From f9ae22c86665590b8caa6b3918738a903592c29b Mon Sep 17 00:00:00 2001 From: Rasoul Date: Tue, 26 Dec 2023 16:19:08 +0330 Subject: [PATCH 01/24] feat: partially add support for amino --- .gitignore | 6 ++ .../akash/audit/v1beta1/audit.amino.ts | 15 +-- .../akash/audit/v1beta2/audit.amino.ts | 15 +-- .../output1/akash/cert/v1beta2/cert.amino.ts | 11 ++- .../akash/deployment/v1beta2/service.amino.ts | 48 +++++----- .../akash/market/v1beta2/service.amino.ts | 26 ++--- .../akash/provider/v1beta1/provider.amino.ts | 27 +++--- .../akash/provider/v1beta2/provider.amino.ts | 27 +++--- .../output1/cosmos/authz/v1beta1/tx.amino.ts | 17 ++-- .../output1/cosmos/bank/v1beta1/tx.amino.ts | 21 +++-- .../output1/cosmos/crisis/v1beta1/tx.amino.ts | 7 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 17 ++-- .../cosmos/evidence/v1beta1/tx.amino.ts | 5 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 11 ++- .../output1/cosmos/gov/v1/tx.amino.ts | 34 +++---- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 24 ++--- .../output1/cosmos/group/v1/tx.amino.ts | 90 +++++++++--------- .../output1/cosmos/nft/v1beta1/tx.amino.ts | 9 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 3 +- .../cosmos/staking/v1beta1/tx.amino.ts | 54 +++++------ .../cosmos/upgrade/v1beta1/tx.amino.ts | 12 +-- .../cosmos/vesting/v1beta1/tx.amino.ts | 28 +++--- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 38 ++++---- .../output1/evmos/erc20/v1/tx.amino.ts | 14 +-- .../output1/evmos/fees/v1/tx.amino.ts | 18 ++-- .../output1/evmos/vesting/v1/tx.amino.ts | 22 ++--- __fixtures__/output1/helpers.ts | 15 ++- .../ibc/applications/transfer/v1/tx.amino.ts | 10 +- .../output1/ibc/core/channel/v1/tx.amino.ts | 94 +++++++++---------- .../output1/ibc/core/client/v1/tx.amino.ts | 27 +++--- .../ibc/core/connection/v1/tx.amino.ts | 40 ++++---- .../gamm/pool-models/balancer/tx/tx.amino.ts | 16 ++-- .../gamm/pool-models/stableswap/tx.amino.ts | 18 ++-- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 54 +++++------ .../output1/osmosis/incentives/tx.amino.ts | 16 ++-- .../output1/osmosis/lockup/tx.amino.ts | 24 ++--- .../output1/osmosis/superfluid/tx.amino.ts | 20 ++-- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 34 +++---- __fixtures__/output2/helpers.ts | 15 ++- .../akash/audit/v1beta1/audit.amino.ts | 15 +-- .../akash/audit/v1beta2/audit.amino.ts | 15 +-- .../akash/cert/v1beta2/cert.amino.ts | 11 ++- .../akash/deployment/v1beta2/service.amino.ts | 47 +++++----- .../akash/market/v1beta2/service.amino.ts | 25 ++--- .../akash/provider/v1beta1/provider.amino.ts | 27 +++--- .../akash/provider/v1beta2/provider.amino.ts | 27 +++--- .../cosmos/authz/v1beta1/tx.amino.ts | 17 ++-- .../cosmos/bank/v1beta1/tx.amino.ts | 21 +++-- .../cosmos/crisis/v1beta1/tx.amino.ts | 7 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 17 ++-- .../cosmos/evidence/v1beta1/tx.amino.ts | 5 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 11 ++- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 33 +++---- .../cosmos/gov/v1beta1/tx.amino.ts | 23 ++--- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 89 +++++++++--------- .../cosmos/nft/v1beta1/tx.amino.ts | 9 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 3 +- .../cosmos/staking/v1beta1/tx.amino.ts | 53 ++++++----- .../cosmos/upgrade/v1beta1/tx.amino.ts | 11 ++- .../cosmos/vesting/v1beta1/tx.amino.ts | 27 +++--- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 37 ++++---- .../outputosmojs/evmos/erc20/v1/tx.amino.ts | 13 +-- .../outputosmojs/evmos/fees/v1/tx.amino.ts | 17 ++-- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 21 +++-- .../ibc/applications/fee/v1/tx.amino.ts | 51 +++++----- .../controller/v1/tx.amino.ts | 13 +-- .../ibc/applications/transfer/v1/tx.amino.ts | 8 +- .../ibc/core/channel/v1/tx.amino.ts | 94 +++++++++---------- .../ibc/core/client/v1/tx.amino.ts | 27 +++--- .../ibc/core/connection/v1/tx.amino.ts | 38 ++++---- .../concentrated-liquidity/tx.amino.ts | 17 ++-- .../gamm/pool-models/balancer/tx/tx.amino.ts | 15 +-- .../gamm/pool-models/stableswap/tx.amino.ts | 17 ++-- .../osmosis/gamm/v1beta1/tx.amino.ts | 53 ++++++----- .../osmosis/incentives/tx.amino.ts | 15 +-- .../outputosmojs/osmosis/lockup/tx.amino.ts | 23 ++--- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 13 +-- .../osmosis/protorev/v1beta1/tx.amino.ts | 29 +++--- .../osmosis/superfluid/tx.amino.ts | 19 ++-- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 33 +++---- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 21 +++-- .../akash/audit/v1beta1/audit.amino.ts | 15 +-- .../akash/audit/v1beta2/audit.amino.ts | 15 +-- .../outputv4/akash/cert/v1beta2/cert.amino.ts | 11 ++- .../akash/deployment/v1beta2/service.amino.ts | 47 +++++----- .../akash/market/v1beta2/service.amino.ts | 25 ++--- .../akash/provider/v1beta1/provider.amino.ts | 27 +++--- .../akash/provider/v1beta2/provider.amino.ts | 27 +++--- .../outputv4/cosmos/authz/v1beta1/tx.amino.ts | 17 ++-- .../outputv4/cosmos/bank/v1beta1/tx.amino.ts | 21 +++-- .../cosmos/crisis/v1beta1/tx.amino.ts | 7 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 17 ++-- .../cosmos/evidence/v1beta1/tx.amino.ts | 5 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 11 ++- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 33 +++---- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 23 ++--- .../outputv4/cosmos/group/v1/tx.amino.ts | 89 +++++++++--------- .../outputv4/cosmos/nft/v1beta1/tx.amino.ts | 9 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 3 +- .../cosmos/staking/v1beta1/tx.amino.ts | 53 ++++++----- .../cosmos/upgrade/v1beta1/tx.amino.ts | 11 ++- .../cosmos/vesting/v1beta1/tx.amino.ts | 27 +++--- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 37 ++++---- .../outputv4/evmos/erc20/v1/tx.amino.ts | 13 +-- .../v-next/outputv4/evmos/fees/v1/tx.amino.ts | 17 ++-- .../outputv4/evmos/vesting/v1/tx.amino.ts | 21 +++-- .../ibc/applications/transfer/v1/tx.amino.ts | 8 +- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 94 +++++++++---------- .../outputv4/ibc/core/client/v1/tx.amino.ts | 27 +++--- .../ibc/core/connection/v1/tx.amino.ts | 38 ++++---- .../gamm/pool-models/balancer/tx/tx.amino.ts | 15 +-- .../gamm/pool-models/stableswap/tx.amino.ts | 17 ++-- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 53 ++++++----- .../outputv4/osmosis/incentives/tx.amino.ts | 15 +-- .../outputv4/osmosis/lockup/tx.amino.ts | 23 ++--- .../outputv4/osmosis/superfluid/tx.amino.ts | 19 ++-- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 33 +++---- packages/ast/.editorconfig | 2 +- .../src/encoding/amino/to-amino-json/index.ts | 4 +- .../src/encoding/amino/to-amino-json/utils.ts | 49 ++++++++-- .../encoding/amino/to-amino-json/utils.d.ts | 3 +- packages/telescope/package.json | 2 +- packages/telescope/src/build.ts | 2 +- packages/telescope/src/helpers/internal.ts | 17 ++-- packages/telescope/src/utils/index.ts | 1 + .../telescope/types/helpers/internal.d.ts | 2 +- packages/telescope/types/utils/index.d.ts | 1 + yarn.lock | 16 ++++ 128 files changed, 1614 insertions(+), 1457 deletions(-) diff --git a/.gitignore b/.gitignore index be08fab726..be5beb5c43 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,9 @@ coverage packages/**/build packages/**/main packages/**/module +/.idea/inspectionProfiles/Project_Default.xml +/.idea/.gitignore +/.idea/misc.xml +/.idea/modules.xml +/.idea/telescope.iml +/.idea/vcs.xml diff --git a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts index b3c5e0e145..20b34cb7ca 100644 --- a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "akash/audit/testonly-sign-provider-attributes"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: omitDefault(owner), + auditor: omitDefault(auditor), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: omitDefault(owner), + auditor: omitDefault(auditor), + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts index de83b12abd..573aa1bbc9 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "mymessage-testonly"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: omitDefault(owner), + auditor: omitDefault(auditor), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: omitDefault(owner), + auditor: omitDefault(auditor), + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts index 97e535cbe2..8087e380cd 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts @@ -1,5 +1,6 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { CertificateID, CertificateIDSDKType, MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export interface MsgCreateCertificateAminoType extends AminoMsg { type: "akash/cert/v1beta2/testonly-create-certificate"; @@ -27,9 +28,9 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner, - cert, - pubkey + owner: omitDefault(owner), + cert: cert, + pubkey: pubkey }; }, fromAmino: ({ @@ -51,8 +52,8 @@ export const AminoConverter = { }: MsgRevokeCertificate): MsgRevokeCertificateAminoType["value"] => { return { id: { - owner: id.owner, - serial: id.serial + owner: omitDefault(id.owner), + serial: omitDefault(id.serial) } }; }, diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index bed5b9394a..fc4dd8975e 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -4,7 +4,7 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType, DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { PlacementRequirements, PlacementRequirementsSDKType, SignedBy, SignedBySDKType, Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { Resource, ResourceSDKType } from "./resource"; import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta2/resourceunits"; @@ -157,19 +157,19 @@ export const AminoConverter = { }: MsgCreateDeployment): MsgCreateDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, groups: groups.map(el0 => ({ - name: el0.name, + name: omitDefault(el0.name), requirements: { signed_by: { all_of: el0.requirements.signedBy.allOf, any_of: el0.requirements.signedBy.anyOf }, attributes: el0.requirements.attributes.map(el1 => ({ - key: el1.key, - value: el1.value + key: omitDefault(el1.key), + value: omitDefault(el1.value) })) }, resources: el0.resources.map(el1 => ({ @@ -179,8 +179,8 @@ export const AminoConverter = { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, memory: { @@ -188,18 +188,18 @@ export const AminoConverter = { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, storage: el1.resources.storage.map(el2 => ({ - name: el2.name, + name: omitDefault(el2.name), quantity: { val: el2.quantity.val }, attributes: el2.attributes.map(el3 => ({ - key: el3.key, - value: el3.value + key: omitDefault(el3.key), + value: omitDefault(el3.value) })) })), endpoints: el1.resources.endpoints.map(el2 => ({ @@ -209,17 +209,17 @@ export const AminoConverter = { }, count: el1.count, price: { - denom: el1.price.denom, - amount: el1.price.amount + denom: omitDefault(el1.price.denom), + amount: omitDefault(el1.price.amount) } })) })), - version, + version: version, deposit: { denom: deposit.denom, amount: Long.fromValue(deposit.amount).toString() }, - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -306,14 +306,14 @@ export const AminoConverter = { }: MsgDepositDeployment): MsgDepositDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() }, - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -342,10 +342,10 @@ export const AminoConverter = { }: MsgUpdateDeployment): MsgUpdateDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, - version + version: version }; }, fromAmino: ({ @@ -368,7 +368,7 @@ export const AminoConverter = { }: MsgCloseDeployment): MsgCloseDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() } }; @@ -391,7 +391,7 @@ export const AminoConverter = { }: MsgCloseGroup): MsgCloseGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } @@ -416,7 +416,7 @@ export const AminoConverter = { }: MsgPauseGroup): MsgPauseGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } @@ -441,7 +441,7 @@ export const AminoConverter = { }: MsgStartGroup): MsgStartGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } diff --git a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts index acfe362680..6d103b9b9a 100644 --- a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts @@ -4,7 +4,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; export interface MsgCreateBidAminoType extends AminoMsg { type: "akash/market/v1beta2/testonly-create-bid"; value: { @@ -84,15 +84,15 @@ export const AminoConverter = { }: MsgCreateBid): MsgCreateBidAminoType["value"] => { return { order: { - owner: order.owner, + owner: omitDefault(order.owner), dseq: order.dseq.toString(), gseq: order.gseq, oseq: order.oseq }, - provider, + provider: omitDefault(provider), price: { - denom: price.denom, - amount: price.amount + denom: omitDefault(price.denom), + amount: omitDefault(price.amount) }, deposit: { denom: deposit.denom, @@ -132,11 +132,11 @@ export const AminoConverter = { }: MsgCloseBid): MsgCloseBidAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -161,11 +161,11 @@ export const AminoConverter = { }: MsgWithdrawLease): MsgWithdrawLeaseAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -190,11 +190,11 @@ export const AminoConverter = { }: MsgCreateLease): MsgCreateLeaseAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -219,11 +219,11 @@ export const AminoConverter = { }: MsgCloseLease): MsgCloseLeaseAminoType["value"] => { return { lease_id: { - owner: leaseId.owner, + owner: omitDefault(leaseId.owner), dseq: leaseId.dseq.toString(), gseq: leaseId.gseq, oseq: leaseId.oseq, - provider: leaseId.provider + provider: omitDefault(leaseId.provider) } }; }, diff --git a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts index 09f69f6e0b..a7497ddc96 100644 --- a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/testonly-create-provider"; @@ -48,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -89,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts index de1a53399d..d2a861a256 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/v1beta2/testonly-create-provider"; @@ -48,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -89,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts index dee011d143..542e0b87da 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { @@ -47,11 +48,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -83,9 +84,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -111,9 +112,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts index 5352659e14..91e06445ec 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgSend"; @@ -41,11 +42,11 @@ export const AminoConverter = { amount }: MsgSend): MsgSendAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -72,17 +73,17 @@ export const AminoConverter = { }: MsgMultiSend): MsgMultiSendAminoType["value"] => { return { inputs: inputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), outputs: outputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; diff --git a/__fixtures__/output1/cosmos/crisis/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/crisis/v1beta1/tx.amino.ts index dfa3c954cc..35ffefde90 100644 --- a/__fixtures__/output1/cosmos/crisis/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/crisis/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; export interface MsgVerifyInvariantAminoType extends AminoMsg { type: "cosmos-sdk/MsgVerifyInvariant"; @@ -17,9 +18,9 @@ export const AminoConverter = { invariantRoute }: MsgVerifyInvariant): MsgVerifyInvariantAminoType["value"] => { return { - sender, - invariant_module_name: invariantModuleName, - invariant_route: invariantRoute + sender: omitDefault(sender), + invariant_module_name: omitDefault(invariantModuleName), + invariant_route: omitDefault(invariantRoute) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts index c7d34e047d..05a4e031f8 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; export interface MsgSetWithdrawAddressAminoType extends AminoMsg { type: "cosmos-sdk/MsgModifyWithdrawAddress"; @@ -39,8 +40,8 @@ export const AminoConverter = { withdrawAddress }: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoType["value"] => { return { - delegator_address: delegatorAddress, - withdraw_address: withdrawAddress + delegator_address: omitDefault(delegatorAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ @@ -60,8 +61,8 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -80,7 +81,7 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoType["value"] => { return { - validator_address: validatorAddress + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -99,10 +100,10 @@ export const AminoConverter = { }: MsgFundCommunityPool): MsgFundCommunityPoolAminoType["value"] => { return { amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts index 8cf0ca70d6..4abb8bc814 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; export interface MsgSubmitEvidenceAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitEvidence"; @@ -19,9 +20,9 @@ export const AminoConverter = { evidence }: MsgSubmitEvidence): MsgSubmitEvidenceAminoType["value"] => { return { - submitter, + submitter: omitDefault(submitter), evidence: { - type_url: evidence.typeUrl, + type_url: omitDefault(evidence.typeUrl), value: evidence.value } }; diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts index c376a3917b..08792b032d 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; export interface MsgGrantAllowanceAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrantAllowance"; @@ -28,10 +29,10 @@ export const AminoConverter = { allowance }: MsgGrantAllowance): MsgGrantAllowanceAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), allowance: { - type_url: allowance.typeUrl, + type_url: omitDefault(allowance.typeUrl), value: allowance.value } }; @@ -58,8 +59,8 @@ export const AminoConverter = { grantee }: MsgRevokeAllowance): MsgRevokeAllowanceAminoType["value"] => { return { - granter, - grantee + granter: omitDefault(granter), + grantee: omitDefault(grantee) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index d97e98504a..ea779a95d7 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/v1/MsgSubmitProposal"; @@ -72,15 +72,15 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer, - metadata + proposer: omitDefault(proposer), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -111,10 +111,10 @@ export const AminoConverter = { }: MsgExecLegacyContent): MsgExecLegacyContentAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, - authority + authority: omitDefault(authority) }; }, fromAmino: ({ @@ -140,9 +140,9 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option, - metadata + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -169,12 +169,12 @@ export const AminoConverter = { }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: omitDefault(el0.weight) })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -203,10 +203,10 @@ export const AminoConverter = { }: MsgDeposit): MsgDepositAminoType["value"] => { return { proposal_id: proposalId.toString(), - depositor, + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index e9ba4f76f0..9041ac6e96 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long, padDecimal } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -58,14 +58,14 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer + proposer: omitDefault(proposer) }; }, fromAmino: ({ @@ -95,8 +95,8 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option + voter: omitDefault(voter), + option: option }; }, fromAmino: ({ @@ -120,10 +120,10 @@ export const AminoConverter = { }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: padDecimal(el0.weight) })) }; }, @@ -151,10 +151,10 @@ export const AminoConverter = { }: MsgDeposit): MsgDepositAminoType["value"] => { return { proposal_id: proposalId.toString(), - depositor, + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index e916efb20d..89d45709b4 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { @@ -166,14 +166,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -201,12 +201,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -236,9 +236,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - new_admin: newAdmin + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -261,9 +261,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -287,11 +287,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - metadata, + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -324,18 +324,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), group_policy_as_admin: groupPolicyAsAdmin, decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -374,9 +374,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -399,10 +399,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -430,9 +430,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -457,14 +457,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -494,7 +494,7 @@ export const AminoConverter = { }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { proposal_id: proposalId.toString(), - address + address: omitDefault(address) }; }, fromAmino: ({ @@ -518,10 +518,10 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -548,7 +548,7 @@ export const AminoConverter = { }: MsgExec): MsgExecAminoType["value"] => { return { proposal_id: proposalId.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -568,7 +568,7 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, + address: omitDefault(address), group_id: groupId.toString() }; }, diff --git a/__fixtures__/output1/cosmos/nft/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/nft/v1beta1/tx.amino.ts index c244a7789d..f43ed3e82e 100644 --- a/__fixtures__/output1/cosmos/nft/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/nft/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgNFTSend"; @@ -19,10 +20,10 @@ export const AminoConverter = { receiver }: MsgSend): MsgSendAminoType["value"] => { return { - class_id: classId, - id, - sender, - receiver + class_id: omitDefault(classId), + id: omitDefault(id), + sender: omitDefault(sender), + receiver: omitDefault(receiver) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts index 9a3e9b11e4..94ba73ca94 100644 --- a/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; @@ -13,7 +14,7 @@ export const AminoConverter = { validatorAddr }: MsgUnjail): MsgUnjailAminoType["value"] => { return { - validator_addr: validatorAddr + validator_addr: omitDefault(validatorAddr) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts index 6591c296d4..edd80d3420 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts @@ -3,8 +3,8 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; +import { omitDefault, padDecimal, Long } from "../../../helpers"; import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; -import { Long } from "../../../helpers"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export interface MsgCreateValidatorAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateValidator"; @@ -94,20 +94,20 @@ export const AminoConverter = { }: MsgCreateValidator): MsgCreateValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: padDecimal(commission.rate), + max_rate: padDecimal(commission.maxRate), + max_change_rate: padDecimal(commission.maxChangeRate) }, - min_self_delegation: minSelfDelegation, - delegator_address: delegatorAddress, - validator_address: validatorAddress, + min_self_delegation: omitDefault(minSelfDelegation), + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), pubkey: decodePubkey(pubkey)!, value: { denom: value.denom, @@ -158,15 +158,15 @@ export const AminoConverter = { }: MsgEditValidator): MsgEditValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, - validator_address: validatorAddress, - commission_rate: commissionRate, - min_self_delegation: minSelfDelegation + validator_address: omitDefault(validatorAddress), + commission_rate: padDecimal(commissionRate), + min_self_delegation: omitDefault(minSelfDelegation) }; }, fromAmino: ({ @@ -197,8 +197,8 @@ export const AminoConverter = { amount }: MsgDelegate): MsgDelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() @@ -229,9 +229,9 @@ export const AminoConverter = { amount }: MsgBeginRedelegate): MsgBeginRedelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_src_address: validatorSrcAddress, - validator_dst_address: validatorDstAddress, + delegator_address: omitDefault(delegatorAddress), + validator_src_address: omitDefault(validatorSrcAddress), + validator_dst_address: omitDefault(validatorDstAddress), amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() @@ -263,8 +263,8 @@ export const AminoConverter = { amount }: MsgUndelegate): MsgUndelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts index 008a9442dc..36eec858e2 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; @@ -37,14 +37,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, height: plan.height.toString(), - info: plan.info, + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -75,7 +75,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index eada26bd87..5b8576ebcc 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -53,14 +53,14 @@ export const AminoConverter = { delayed }: MsgCreateVestingAccount): MsgCreateVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), end_time: endTime.toString(), - delayed + delayed: delayed }; }, fromAmino: ({ @@ -90,11 +90,11 @@ export const AminoConverter = { amount }: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -122,14 +122,14 @@ export const AminoConverter = { vestingPeriods }: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime.toString(), vesting_periods: vestingPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index 94a5bc95fa..f88093b5e4 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -1,8 +1,8 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, Long } from "../../../helpers"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; -import { Long } from "../../../helpers"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; @@ -74,11 +74,11 @@ export const AminoConverter = { instantiatePermission }: MsgStoreCode): MsgStoreCodeAminoType["value"] => { return { - sender, + sender: omitDefault(sender), wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address + address: omitDefault(instantiatePermission.address) } }; }, @@ -108,14 +108,14 @@ export const AminoConverter = { funds }: MsgInstantiateContract): MsgInstantiateContractAminoType["value"] => { return { - sender, - admin, + sender: omitDefault(sender), + admin: omitDefault(admin), code_id: codeId.toString(), - label, + label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -149,12 +149,12 @@ export const AminoConverter = { funds }: MsgExecuteContract): MsgExecuteContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -184,8 +184,8 @@ export const AminoConverter = { msg }: MsgMigrateContract): MsgMigrateContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; @@ -212,9 +212,9 @@ export const AminoConverter = { contract }: MsgUpdateAdmin): MsgUpdateAdminAminoType["value"] => { return { - sender, - new_admin: newAdmin, - contract + sender: omitDefault(sender), + new_admin: omitDefault(newAdmin), + contract: omitDefault(contract) }; }, fromAmino: ({ @@ -236,8 +236,8 @@ export const AminoConverter = { contract }: MsgClearAdmin): MsgClearAdminAminoType["value"] => { return { - sender, - contract + sender: omitDefault(sender), + contract: omitDefault(contract) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts b/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts index caa1bd4fbd..9b58b680fa 100644 --- a/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { Long, omitDefault } from "../../../helpers"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; export interface MsgConvertCoinAminoType extends AminoMsg { type: "/evmos.erc20.v1.MsgConvertCoin"; @@ -35,8 +35,8 @@ export const AminoConverter = { denom: coin.denom, amount: Long.fromValue(coin.amount).toString() }, - receiver, - sender + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ @@ -63,10 +63,10 @@ export const AminoConverter = { sender }: MsgConvertERC20): MsgConvertERC20AminoType["value"] => { return { - contract_address: contractAddress, - amount, - receiver, - sender + contract_address: omitDefault(contractAddress), + amount: omitDefault(amount), + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/evmos/fees/v1/tx.amino.ts b/__fixtures__/output1/evmos/fees/v1/tx.amino.ts index 87695a734f..d40d07e084 100644 --- a/__fixtures__/output1/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/fees/v1/tx.amino.ts @@ -1,5 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; export interface MsgRegisterDevFeeInfoAminoType extends AminoMsg { type: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; @@ -35,9 +35,9 @@ export const AminoConverter = { nonces }: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress, + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress), nonces: nonces.map(el0 => el0.toString()) }; }, @@ -62,8 +62,8 @@ export const AminoConverter = { deployerAddress }: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress) }; }, fromAmino: ({ @@ -84,9 +84,9 @@ export const AminoConverter = { withdrawAddress }: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index 296eeaea6f..03d0a1333e 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -50,24 +50,24 @@ export const AminoConverter = { merge }: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), - merge + merge: merge }; }, fromAmino: ({ @@ -108,9 +108,9 @@ export const AminoConverter = { destAddress }: MsgClawback): MsgClawbackAminoType["value"] => { return { - funder_address: funderAddress, - account_address: accountAddress, - dest_address: destAddress + funder_address: omitDefault(funderAddress), + account_address: omitDefault(accountAddress), + dest_address: omitDefault(destAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/helpers.ts b/__fixtures__/output1/helpers.ts index 53124a848b..023babb171 100644 --- a/__fixtures__/output1/helpers.ts +++ b/__fixtures__/output1/helpers.ts @@ -6,6 +6,7 @@ import * as _m0 from "protobufjs/minimal"; import Long from 'long'; +import { Dec } from "@keplr-wallet/unit"; // @ts-ignore if (_m0.util.Long !== Long) { @@ -65,7 +66,7 @@ export function omitDefault(input: T): T | und } if (Long.isLong(input)) { - return input.isZero() ? undefined : input; + return (input as Long).isZero() ? undefined : input; } throw new Error(`Got unsupported type ${typeof input}`); @@ -140,7 +141,7 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.key !== "undefined") { // String to Uint8Array - // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); // Uint8Array to String options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); @@ -150,7 +151,7 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.offset !== "undefined") { options.params["pagination.offset"] = pagination.offset.toString() - } + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -226,7 +227,7 @@ const timestampFromJSON = (object: any): Timestamp => { nanos: isSet(object.nanos) ? Number(object.nanos) : 0, }; } - + export function fromJsonTimestamp(o: any): Timestamp { if (o instanceof Date) { return toTimestamp(o); @@ -236,7 +237,11 @@ export function fromJsonTimestamp(o: any): Timestamp { return timestampFromJSON(o); } } - + function numberToLong(number: number) { return Long.fromNumber(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts index d0699be66f..67268205b0 100644 --- a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, Long, omitDefault } from "../../../../helpers"; +import { AminoHeight, omitDefault, Long } from "../../../../helpers"; import { MsgTransfer, MsgTransferSDKType } from "./tx"; export interface MsgTransferAminoType extends AminoMsg { type: "cosmos-sdk/MsgTransfer"; @@ -31,14 +31,14 @@ export const AminoConverter = { timeoutTimestamp }: MsgTransfer): MsgTransferAminoType["value"] => { return { - source_port: sourcePort, - source_channel: sourceChannel, + source_port: omitDefault(sourcePort), + source_channel: omitDefault(sourceChannel), token: { denom: token.denom, amount: Long.fromValue(token.amount).toString() }, - sender, - receiver, + sender: omitDefault(sender), + receiver: omitDefault(receiver), timeout_height: timeoutHeight ? { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() diff --git a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts index e45b2d998c..2898278800 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts @@ -166,18 +166,18 @@ export const AminoConverter = { signer }: MsgChannelOpenInit): MsgChannelOpenInitAminoType["value"] => { return { - port_id: portId, + port_id: omitDefault(portId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -213,25 +213,25 @@ export const AminoConverter = { signer }: MsgChannelOpenTry): MsgChannelOpenTryAminoType["value"] => { return { - port_id: portId, - previous_channel_id: previousChannelId, + port_id: omitDefault(portId), + previous_channel_id: omitDefault(previousChannelId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - counterparty_version: counterpartyVersion, + counterparty_version: omitDefault(counterpartyVersion), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -278,16 +278,16 @@ export const AminoConverter = { signer }: MsgChannelOpenAck): MsgChannelOpenAckAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - counterparty_channel_id: counterpartyChannelId, - counterparty_version: counterpartyVersion, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + counterparty_channel_id: omitDefault(counterpartyChannelId), + counterparty_version: omitDefault(counterpartyVersion), proof_try: proofTry, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -323,14 +323,14 @@ export const AminoConverter = { signer }: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -360,9 +360,9 @@ export const AminoConverter = { signer }: MsgChannelCloseInit): MsgChannelCloseInitAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - signer + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -387,14 +387,14 @@ export const AminoConverter = { signer }: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -427,10 +427,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -443,7 +443,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -487,10 +487,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -504,7 +504,7 @@ export const AminoConverter = { revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, next_sequence_recv: nextSequenceRecv.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -551,10 +551,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -569,7 +569,7 @@ export const AminoConverter = { revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, next_sequence_recv: nextSequenceRecv.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -617,10 +617,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -628,13 +628,13 @@ export const AminoConverter = { } : {}, timeout_timestamp: packet.timeoutTimestamp.toString() }, - acknowledgement, + acknowledgement: acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts index 727e135426..da58249ba9 100644 --- a/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../../helpers"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export interface MsgCreateClientAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateClient"; @@ -64,14 +65,14 @@ export const AminoConverter = { }: MsgCreateClient): MsgCreateClientAminoType["value"] => { return { client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -100,12 +101,12 @@ export const AminoConverter = { signer }: MsgUpdateClient): MsgUpdateClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), header: { - type_url: header.typeUrl, + type_url: omitDefault(header.typeUrl), value: header.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -134,18 +135,18 @@ export const AminoConverter = { signer }: MsgUpgradeClient): MsgUpgradeClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, proof_upgrade_client: proofUpgradeClient, proof_upgrade_consensus_state: proofUpgradeConsensusState, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -180,12 +181,12 @@ export const AminoConverter = { signer }: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), misbehaviour: { - type_url: misbehaviour.typeUrl, + type_url: omitDefault(misbehaviour.typeUrl), value: misbehaviour.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index 540541f124..80fc93b1f8 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -2,7 +2,7 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./co import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, Long, omitDefault } from "../../../../helpers"; +import { AminoHeight, omitDefault, Long } from "../../../../helpers"; import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; export interface MsgConnectionOpenInitAminoType extends AminoMsg { @@ -94,20 +94,20 @@ export const AminoConverter = { signer }: MsgConnectionOpenInit): MsgConnectionOpenInitAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, delay_period: delayPeriod.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -152,22 +152,22 @@ export const AminoConverter = { signer }: MsgConnectionOpenTry): MsgConnectionOpenTryAminoType["value"] => { return { - client_id: clientId, - previous_connection_id: previousConnectionId, + client_id: omitDefault(clientId), + previous_connection_id: omitDefault(previousConnectionId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, delay_period: delayPeriod.toString(), counterparty_versions: counterpartyVersions.map(el0 => ({ - identifier: el0.identifier, + identifier: omitDefault(el0.identifier), features: el0.features })), proof_height: proofHeight ? { @@ -181,7 +181,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -247,14 +247,14 @@ export const AminoConverter = { signer }: MsgConnectionOpenAck): MsgConnectionOpenAckAminoType["value"] => { return { - connection_id: connectionId, - counterparty_connection_id: counterpartyConnectionId, + connection_id: omitDefault(connectionId), + counterparty_connection_id: omitDefault(counterpartyConnectionId), version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, proof_height: proofHeight ? { @@ -268,7 +268,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -318,13 +318,13 @@ export const AminoConverter = { signer }: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoType["value"] => { return { - connection_id: connectionId, + connection_id: omitDefault(connectionId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index fd70c527f4..1e4994a9a0 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../../../helpers"; +import { omitDefault, padDecimal, Long } from "../../../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; @@ -58,10 +58,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -70,14 +70,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: Long.fromValue(el0.token.amount).toString() }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: Long.fromValue(el0.token.amount).toString() }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -86,9 +86,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: Long.fromValue(el0.token.amount).toString() }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index ace726116c..5c97b566f1 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,7 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../../helpers"; +import { omitDefault, padDecimal, Long } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -41,18 +41,18 @@ export const AminoConverter = { scalingFactorController }: MsgCreateStableswapPool): MsgCreateStableswapPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee) }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), scaling_factors: scalingFactors.map(el0 => el0.toString()), - future_pool_governor: futurePoolGovernor, - scaling_factor_controller: scalingFactorController + future_pool_governor: omitDefault(futurePoolGovernor), + scaling_factor_controller: omitDefault(scalingFactorController) }; }, fromAmino: ({ @@ -87,7 +87,7 @@ export const AminoConverter = { scalingFactors }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index b3a3f6f1f1..3e316b61f1 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -111,12 +111,12 @@ export const AminoConverter = { tokenInMaxs }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - share_out_amount: shareOutAmount, + share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -146,12 +146,12 @@ export const AminoConverter = { tokenOutMins }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - share_in_amount: shareInAmount, + share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -181,16 +181,16 @@ export const AminoConverter = { tokenOutMinAmount }: MsgSwapExactAmountIn): MsgSwapExactAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_out_denom: el0.tokenOutDenom + token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { denom: tokenIn.denom, amount: Long.fromValue(tokenIn.amount).toString() }, - token_out_min_amount: tokenOutMinAmount + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -222,12 +222,12 @@ export const AminoConverter = { tokenOut }: MsgSwapExactAmountOut): MsgSwapExactAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_in_denom: el0.tokenInDenom + token_in_denom: omitDefault(el0.tokenInDenom) })), - token_in_max_amount: tokenInMaxAmount, + token_in_max_amount: omitDefault(tokenInMaxAmount), token_out: { denom: tokenOut.denom, amount: Long.fromValue(tokenOut.amount).toString() @@ -263,13 +263,13 @@ export const AminoConverter = { shareOutMinAmount }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: Long.fromValue(tokenIn.amount).toString() }, - share_out_min_amount: shareOutMinAmount + share_out_min_amount: omitDefault(shareOutMinAmount) }; }, fromAmino: ({ @@ -299,11 +299,11 @@ export const AminoConverter = { tokenInMaxAmount }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - token_in_denom: tokenInDenom, - share_out_amount: shareOutAmount, - token_in_max_amount: tokenInMaxAmount + token_in_denom: omitDefault(tokenInDenom), + share_out_amount: omitDefault(shareOutAmount), + token_in_max_amount: omitDefault(tokenInMaxAmount) }; }, fromAmino: ({ @@ -331,13 +331,13 @@ export const AminoConverter = { shareInMaxAmount }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: Long.fromValue(tokenOut.amount).toString() }, - share_in_max_amount: shareInMaxAmount + share_in_max_amount: omitDefault(shareInMaxAmount) }; }, fromAmino: ({ @@ -367,11 +367,11 @@ export const AminoConverter = { tokenOutMinAmount }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - token_out_denom: tokenOutDenom, - share_in_amount: shareInAmount, - token_out_min_amount: tokenOutMinAmount + token_out_denom: omitDefault(tokenOutDenom), + share_in_amount: omitDefault(shareInAmount), + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 3e12d2cc96..1b90268c77 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -3,7 +3,7 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../helpers"; +import { omitDefault, Long } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -58,16 +58,16 @@ export const AminoConverter = { }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { is_perpetual: isPerpetual, - owner, + owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, - denom: distributeTo.denom, + denom: omitDefault(distributeTo.denom), duration: (distributeTo.duration * 1_000_000_000).toString(), timestamp: distributeTo.timestamp }, coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), start_time: startTime, num_epochs_paid_over: numEpochsPaidOver.toString() @@ -110,11 +110,11 @@ export const AminoConverter = { rewards }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { - owner, + owner: omitDefault(owner), gauge_id: gaugeId.toString(), rewards: rewards.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index 0bb3390ab8..b27724ac4c 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -3,7 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../helpers"; +import { omitDefault, Long } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -67,11 +67,11 @@ export const AminoConverter = { coins }: MsgLockTokens): MsgLockTokensAminoType["value"] => { return { - owner, + owner: omitDefault(owner), duration: (duration * 1_000_000_000).toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -99,7 +99,7 @@ export const AminoConverter = { owner }: MsgBeginUnlockingAll): MsgBeginUnlockingAllAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ @@ -118,11 +118,11 @@ export const AminoConverter = { coins }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -149,7 +149,7 @@ export const AminoConverter = { duration }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), duration: (duration * 1_000_000_000).toString() }; @@ -177,11 +177,11 @@ export const AminoConverter = { coins }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index 719496a013..dd3bd8d125 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../helpers"; +import { omitDefault, Long } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -52,9 +52,9 @@ export const AminoConverter = { valAddr }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString(), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -76,7 +76,7 @@ export const AminoConverter = { lockId }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString() }; }, @@ -97,7 +97,7 @@ export const AminoConverter = { lockId }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString() }; }, @@ -119,12 +119,12 @@ export const AminoConverter = { valAddr }: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -149,7 +149,7 @@ export const AminoConverter = { poolId }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString() }; }, diff --git a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts index 037e4cfeeb..f807c1c4ef 100644 --- a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -67,8 +67,8 @@ export const AminoConverter = { subdenom }: MsgCreateDenom): MsgCreateDenomAminoType["value"] => { return { - sender, - subdenom + sender: omitDefault(sender), + subdenom: omitDefault(subdenom) }; }, fromAmino: ({ @@ -88,7 +88,7 @@ export const AminoConverter = { amount }: MsgMint): MsgMintAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() @@ -115,7 +115,7 @@ export const AminoConverter = { amount }: MsgBurn): MsgBurnAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() @@ -143,9 +143,9 @@ export const AminoConverter = { newAdmin }: MsgChangeAdmin): MsgChangeAdminAminoType["value"] => { return { - sender, - denom, - new_admin: newAdmin + sender: omitDefault(sender), + denom: omitDefault(denom), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -167,20 +167,20 @@ export const AminoConverter = { metadata }: MsgSetDenomMetadata): MsgSetDenomMetadataAminoType["value"] => { return { - sender, + sender: omitDefault(sender), metadata: { - description: metadata.description, + description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ - denom: el0.denom, + denom: omitDefault(el0.denom), exponent: el0.exponent, aliases: el0.aliases })), - base: metadata.base, - display: metadata.display, - name: metadata.name, - symbol: metadata.symbol, - uri: metadata.uri, - uri_hash: metadata.uriHash + base: omitDefault(metadata.base), + display: omitDefault(metadata.display), + name: omitDefault(metadata.name), + symbol: omitDefault(metadata.symbol), + uri: omitDefault(metadata.uri), + uri_hash: omitDefault(metadata.uriHash) } }; }, diff --git a/__fixtures__/output2/helpers.ts b/__fixtures__/output2/helpers.ts index 674ecc2536..44fef196b0 100644 --- a/__fixtures__/output2/helpers.ts +++ b/__fixtures__/output2/helpers.ts @@ -8,6 +8,7 @@ import * as _m0 from "protobufjs/minimal"; import Long from 'long'; +import { Dec } from "@keplr-wallet/unit"; // @ts-ignore if (_m0.util.Long !== Long) { @@ -67,7 +68,7 @@ export function omitDefault(input: T): T | und } if (Long.isLong(input)) { - return input.isZero() ? undefined : input; + return (input as Long).isZero() ? undefined : input; } throw new Error(`Got unsupported type ${typeof input}`); @@ -142,7 +143,7 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.key !== "undefined") { // String to Uint8Array - // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); // Uint8Array to String options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); @@ -152,7 +153,7 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.offset !== "undefined") { options.params["pagination.offset"] = pagination.offset.toString() - } + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -228,7 +229,7 @@ const timestampFromJSON = (object: any): Timestamp => { nanos: isSet(object.nanos) ? Number(object.nanos) : 0, }; } - + export function fromJsonTimestamp(o: any): Timestamp { if (o instanceof Date) { return toTimestamp(o); @@ -238,7 +239,11 @@ export function fromJsonTimestamp(o: any): Timestamp { return timestampFromJSON(o); } } - + function numberToLong(number: number) { return Long.fromNumber(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts index b3c5e0e145..20b34cb7ca 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "akash/audit/testonly-sign-provider-attributes"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: omitDefault(owner), + auditor: omitDefault(auditor), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: omitDefault(owner), + auditor: omitDefault(auditor), + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts index de83b12abd..573aa1bbc9 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "mymessage-testonly"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: omitDefault(owner), + auditor: omitDefault(auditor), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: omitDefault(owner), + auditor: omitDefault(auditor), + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts index 97e535cbe2..8087e380cd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts @@ -1,5 +1,6 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { CertificateID, CertificateIDSDKType, MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export interface MsgCreateCertificateAminoType extends AminoMsg { type: "akash/cert/v1beta2/testonly-create-certificate"; @@ -27,9 +28,9 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner, - cert, - pubkey + owner: omitDefault(owner), + cert: cert, + pubkey: pubkey }; }, fromAmino: ({ @@ -51,8 +52,8 @@ export const AminoConverter = { }: MsgRevokeCertificate): MsgRevokeCertificateAminoType["value"] => { return { id: { - owner: id.owner, - serial: id.serial + owner: omitDefault(id.owner), + serial: omitDefault(id.serial) } }; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index 29301829da..73fbc73897 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -4,6 +4,7 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType, DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { PlacementRequirements, PlacementRequirementsSDKType, SignedBy, SignedBySDKType, Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { Resource, ResourceSDKType } from "./resource"; import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta2/resourceunits"; @@ -156,19 +157,19 @@ export const AminoConverter = { }: MsgCreateDeployment): MsgCreateDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, groups: groups.map(el0 => ({ - name: el0.name, + name: omitDefault(el0.name), requirements: { signed_by: { all_of: el0.requirements.signedBy.allOf, any_of: el0.requirements.signedBy.anyOf }, attributes: el0.requirements.attributes.map(el1 => ({ - key: el1.key, - value: el1.value + key: omitDefault(el1.key), + value: omitDefault(el1.value) })) }, resources: el0.resources.map(el1 => ({ @@ -178,8 +179,8 @@ export const AminoConverter = { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, memory: { @@ -187,18 +188,18 @@ export const AminoConverter = { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, storage: el1.resources.storage.map(el2 => ({ - name: el2.name, + name: omitDefault(el2.name), quantity: { val: el2.quantity.val }, attributes: el2.attributes.map(el3 => ({ - key: el3.key, - value: el3.value + key: omitDefault(el3.key), + value: omitDefault(el3.value) })) })), endpoints: el1.resources.endpoints.map(el2 => ({ @@ -208,17 +209,17 @@ export const AminoConverter = { }, count: el1.count, price: { - denom: el1.price.denom, - amount: el1.price.amount + denom: omitDefault(el1.price.denom), + amount: omitDefault(el1.price.amount) } })) })), - version, + version: version, deposit: { denom: deposit.denom, amount: deposit.amount }, - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -305,14 +306,14 @@ export const AminoConverter = { }: MsgDepositDeployment): MsgDepositDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, amount: { denom: amount.denom, amount: amount.amount }, - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -341,10 +342,10 @@ export const AminoConverter = { }: MsgUpdateDeployment): MsgUpdateDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, - version + version: version }; }, fromAmino: ({ @@ -367,7 +368,7 @@ export const AminoConverter = { }: MsgCloseDeployment): MsgCloseDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() } }; @@ -390,7 +391,7 @@ export const AminoConverter = { }: MsgCloseGroup): MsgCloseGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } @@ -415,7 +416,7 @@ export const AminoConverter = { }: MsgPauseGroup): MsgPauseGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } @@ -440,7 +441,7 @@ export const AminoConverter = { }: MsgStartGroup): MsgStartGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts index 0e47f2ffe8..31c5984835 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts @@ -4,6 +4,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; export interface MsgCreateBidAminoType extends AminoMsg { type: "akash/market/v1beta2/testonly-create-bid"; value: { @@ -83,15 +84,15 @@ export const AminoConverter = { }: MsgCreateBid): MsgCreateBidAminoType["value"] => { return { order: { - owner: order.owner, + owner: omitDefault(order.owner), dseq: order.dseq.toString(), gseq: order.gseq, oseq: order.oseq }, - provider, + provider: omitDefault(provider), price: { - denom: price.denom, - amount: price.amount + denom: omitDefault(price.denom), + amount: omitDefault(price.amount) }, deposit: { denom: deposit.denom, @@ -131,11 +132,11 @@ export const AminoConverter = { }: MsgCloseBid): MsgCloseBidAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -160,11 +161,11 @@ export const AminoConverter = { }: MsgWithdrawLease): MsgWithdrawLeaseAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -189,11 +190,11 @@ export const AminoConverter = { }: MsgCreateLease): MsgCreateLeaseAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -218,11 +219,11 @@ export const AminoConverter = { }: MsgCloseLease): MsgCloseLeaseAminoType["value"] => { return { lease_id: { - owner: leaseId.owner, + owner: omitDefault(leaseId.owner), dseq: leaseId.dseq.toString(), gseq: leaseId.gseq, oseq: leaseId.oseq, - provider: leaseId.provider + provider: omitDefault(leaseId.provider) } }; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts index 09f69f6e0b..a7497ddc96 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/testonly-create-provider"; @@ -48,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -89,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts index de1a53399d..d2a861a256 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/v1beta2/testonly-create-provider"; @@ -48,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -89,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts index dee011d143..542e0b87da 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { @@ -47,11 +48,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -83,9 +84,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -111,9 +112,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts index 5352659e14..91e06445ec 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgSend"; @@ -41,11 +42,11 @@ export const AminoConverter = { amount }: MsgSend): MsgSendAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -72,17 +73,17 @@ export const AminoConverter = { }: MsgMultiSend): MsgMultiSendAminoType["value"] => { return { inputs: inputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), outputs: outputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.amino.ts index dfa3c954cc..35ffefde90 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; export interface MsgVerifyInvariantAminoType extends AminoMsg { type: "cosmos-sdk/MsgVerifyInvariant"; @@ -17,9 +18,9 @@ export const AminoConverter = { invariantRoute }: MsgVerifyInvariant): MsgVerifyInvariantAminoType["value"] => { return { - sender, - invariant_module_name: invariantModuleName, - invariant_route: invariantRoute + sender: omitDefault(sender), + invariant_module_name: omitDefault(invariantModuleName), + invariant_route: omitDefault(invariantRoute) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts index c7d34e047d..05a4e031f8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; export interface MsgSetWithdrawAddressAminoType extends AminoMsg { type: "cosmos-sdk/MsgModifyWithdrawAddress"; @@ -39,8 +40,8 @@ export const AminoConverter = { withdrawAddress }: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoType["value"] => { return { - delegator_address: delegatorAddress, - withdraw_address: withdrawAddress + delegator_address: omitDefault(delegatorAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ @@ -60,8 +61,8 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -80,7 +81,7 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoType["value"] => { return { - validator_address: validatorAddress + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -99,10 +100,10 @@ export const AminoConverter = { }: MsgFundCommunityPool): MsgFundCommunityPoolAminoType["value"] => { return { amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts index 8cf0ca70d6..4abb8bc814 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; export interface MsgSubmitEvidenceAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitEvidence"; @@ -19,9 +20,9 @@ export const AminoConverter = { evidence }: MsgSubmitEvidence): MsgSubmitEvidenceAminoType["value"] => { return { - submitter, + submitter: omitDefault(submitter), evidence: { - type_url: evidence.typeUrl, + type_url: omitDefault(evidence.typeUrl), value: evidence.value } }; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts index c376a3917b..08792b032d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; export interface MsgGrantAllowanceAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrantAllowance"; @@ -28,10 +29,10 @@ export const AminoConverter = { allowance }: MsgGrantAllowance): MsgGrantAllowanceAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), allowance: { - type_url: allowance.typeUrl, + type_url: omitDefault(allowance.typeUrl), value: allowance.value } }; @@ -58,8 +59,8 @@ export const AminoConverter = { grantee }: MsgRevokeAllowance): MsgRevokeAllowanceAminoType["value"] => { return { - granter, - grantee + granter: omitDefault(granter), + grantee: omitDefault(grantee) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index 7c0115740a..e417d411e7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/v1/MsgSubmitProposal"; @@ -71,15 +72,15 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer, - metadata + proposer: omitDefault(proposer), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -110,10 +111,10 @@ export const AminoConverter = { }: MsgExecLegacyContent): MsgExecLegacyContentAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, - authority + authority: omitDefault(authority) }; }, fromAmino: ({ @@ -139,9 +140,9 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option, - metadata + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -168,12 +169,12 @@ export const AminoConverter = { }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: omitDefault(el0.weight) })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -202,10 +203,10 @@ export const AminoConverter = { }: MsgDeposit): MsgDepositAminoType["value"] => { return { proposal_id: proposalId.toString(), - depositor, + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index fad45eaf42..f7ce81597e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -57,14 +58,14 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer + proposer: omitDefault(proposer) }; }, fromAmino: ({ @@ -94,8 +95,8 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option + voter: omitDefault(voter), + option: option }; }, fromAmino: ({ @@ -119,10 +120,10 @@ export const AminoConverter = { }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: padDecimal(el0.weight) })) }; }, @@ -150,10 +151,10 @@ export const AminoConverter = { }: MsgDeposit): MsgDepositAminoType["value"] => { return { proposal_id: proposalId.toString(), - depositor, + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index e7787dfe21..e6c6b6e10f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { @@ -165,14 +166,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -200,12 +201,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -235,9 +236,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - new_admin: newAdmin + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -260,9 +261,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -286,11 +287,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - metadata, + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -323,18 +324,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), group_policy_as_admin: groupPolicyAsAdmin, decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -373,9 +374,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -398,10 +399,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -429,9 +430,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -456,14 +457,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -493,7 +494,7 @@ export const AminoConverter = { }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { proposal_id: proposalId.toString(), - address + address: omitDefault(address) }; }, fromAmino: ({ @@ -517,10 +518,10 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -547,7 +548,7 @@ export const AminoConverter = { }: MsgExec): MsgExecAminoType["value"] => { return { proposal_id: proposalId.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -567,7 +568,7 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, + address: omitDefault(address), group_id: groupId.toString() }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.amino.ts index c244a7789d..f43ed3e82e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgNFTSend"; @@ -19,10 +20,10 @@ export const AminoConverter = { receiver }: MsgSend): MsgSendAminoType["value"] => { return { - class_id: classId, - id, - sender, - receiver + class_id: omitDefault(classId), + id: omitDefault(id), + sender: omitDefault(sender), + receiver: omitDefault(receiver) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts index 9a3e9b11e4..94ba73ca94 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; @@ -13,7 +14,7 @@ export const AminoConverter = { validatorAddr }: MsgUnjail): MsgUnjailAminoType["value"] => { return { - validator_addr: validatorAddr + validator_addr: omitDefault(validatorAddr) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts index 86e67cabcd..3f3fa4907d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts @@ -3,6 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export interface MsgCreateValidatorAminoType extends AminoMsg { @@ -93,20 +94,20 @@ export const AminoConverter = { }: MsgCreateValidator): MsgCreateValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: padDecimal(commission.rate), + max_rate: padDecimal(commission.maxRate), + max_change_rate: padDecimal(commission.maxChangeRate) }, - min_self_delegation: minSelfDelegation, - delegator_address: delegatorAddress, - validator_address: validatorAddress, + min_self_delegation: omitDefault(minSelfDelegation), + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), pubkey: decodePubkey(pubkey)!, value: { denom: value.denom, @@ -157,15 +158,15 @@ export const AminoConverter = { }: MsgEditValidator): MsgEditValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, - validator_address: validatorAddress, - commission_rate: commissionRate, - min_self_delegation: minSelfDelegation + validator_address: omitDefault(validatorAddress), + commission_rate: padDecimal(commissionRate), + min_self_delegation: omitDefault(minSelfDelegation) }; }, fromAmino: ({ @@ -196,8 +197,8 @@ export const AminoConverter = { amount }: MsgDelegate): MsgDelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount @@ -228,9 +229,9 @@ export const AminoConverter = { amount }: MsgBeginRedelegate): MsgBeginRedelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_src_address: validatorSrcAddress, - validator_dst_address: validatorDstAddress, + delegator_address: omitDefault(delegatorAddress), + validator_src_address: omitDefault(validatorSrcAddress), + validator_dst_address: omitDefault(validatorDstAddress), amount: { denom: amount.denom, amount: amount.amount @@ -262,8 +263,8 @@ export const AminoConverter = { amount }: MsgUndelegate): MsgUndelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts index 1eb1068281..a70e117cfb 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; @@ -36,14 +37,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, height: plan.height.toString(), - info: plan.info, + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -74,7 +75,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index b1829bb2bc..dbe24d82a8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -52,14 +53,14 @@ export const AminoConverter = { delayed }: MsgCreateVestingAccount): MsgCreateVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), end_time: endTime.toString(), - delayed + delayed: delayed }; }, fromAmino: ({ @@ -89,11 +90,11 @@ export const AminoConverter = { amount }: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -121,14 +122,14 @@ export const AminoConverter = { vestingPeriods }: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime.toString(), vesting_periods: vestingPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index db3abbec45..87c0a7e409 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { @@ -73,11 +74,11 @@ export const AminoConverter = { instantiatePermission }: MsgStoreCode): MsgStoreCodeAminoType["value"] => { return { - sender, + sender: omitDefault(sender), wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address + address: omitDefault(instantiatePermission.address) } }; }, @@ -107,14 +108,14 @@ export const AminoConverter = { funds }: MsgInstantiateContract): MsgInstantiateContractAminoType["value"] => { return { - sender, - admin, + sender: omitDefault(sender), + admin: omitDefault(admin), code_id: codeId.toString(), - label, + label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -148,12 +149,12 @@ export const AminoConverter = { funds }: MsgExecuteContract): MsgExecuteContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -183,8 +184,8 @@ export const AminoConverter = { msg }: MsgMigrateContract): MsgMigrateContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; @@ -211,9 +212,9 @@ export const AminoConverter = { contract }: MsgUpdateAdmin): MsgUpdateAdminAminoType["value"] => { return { - sender, - new_admin: newAdmin, - contract + sender: omitDefault(sender), + new_admin: omitDefault(newAdmin), + contract: omitDefault(contract) }; }, fromAmino: ({ @@ -235,8 +236,8 @@ export const AminoConverter = { contract }: MsgClearAdmin): MsgClearAdminAminoType["value"] => { return { - sender, - contract + sender: omitDefault(sender), + contract: omitDefault(contract) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts index 0be2123e86..cad7e1500f 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; export interface MsgConvertCoinAminoType extends AminoMsg { type: "/evmos.erc20.v1.MsgConvertCoin"; @@ -34,8 +35,8 @@ export const AminoConverter = { denom: coin.denom, amount: coin.amount }, - receiver, - sender + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ @@ -62,10 +63,10 @@ export const AminoConverter = { sender }: MsgConvertERC20): MsgConvertERC20AminoType["value"] => { return { - contract_address: contractAddress, - amount, - receiver, - sender + contract_address: omitDefault(contractAddress), + amount: omitDefault(amount), + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts index c226ee6556..a53f2bf860 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; export interface MsgRegisterDevFeeInfoAminoType extends AminoMsg { type: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; @@ -34,9 +35,9 @@ export const AminoConverter = { nonces }: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress, + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress), nonces: nonces.map(el0 => el0.toString()) }; }, @@ -61,8 +62,8 @@ export const AminoConverter = { deployerAddress }: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress) }; }, fromAmino: ({ @@ -83,9 +84,9 @@ export const AminoConverter = { withdrawAddress }: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index a11da2a219..92314cb295 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -49,24 +50,24 @@ export const AminoConverter = { merge }: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), - merge + merge: merge }; }, fromAmino: ({ @@ -107,9 +108,9 @@ export const AminoConverter = { destAddress }: MsgClawback): MsgClawbackAminoType["value"] => { return { - funder_address: funderAddress, - account_address: accountAddress, - dest_address: destAddress + funder_address: omitDefault(funderAddress), + account_address: omitDefault(accountAddress), + dest_address: omitDefault(destAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts index b0688ec501..d29f247ac3 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Fee, FeeSDKType, PacketFee, PacketFeeSDKType } from "./fee"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../../helpers"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { MsgRegisterPayee, MsgRegisterPayeeSDKType, MsgRegisterCounterpartyPayee, MsgRegisterCounterpartyPayeeSDKType, MsgPayPacketFee, MsgPayPacketFeeSDKType, MsgPayPacketFeeAsync, MsgPayPacketFeeAsyncSDKType } from "./tx"; export interface MsgRegisterPayeeAminoType extends AminoMsg { @@ -76,10 +77,10 @@ export const AminoConverter = { payee }: MsgRegisterPayee): MsgRegisterPayeeAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - relayer, - payee + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + relayer: omitDefault(relayer), + payee: omitDefault(payee) }; }, fromAmino: ({ @@ -105,10 +106,10 @@ export const AminoConverter = { counterpartyPayee }: MsgRegisterCounterpartyPayee): MsgRegisterCounterpartyPayeeAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - relayer, - counterparty_payee: counterpartyPayee + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + relayer: omitDefault(relayer), + counterparty_payee: omitDefault(counterpartyPayee) }; }, fromAmino: ({ @@ -137,22 +138,22 @@ export const AminoConverter = { return { fee: { recv_fee: fee.recvFee.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), ack_fee: fee.ackFee.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), timeout_fee: fee.timeoutFee.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }, - source_port_id: sourcePortId, - source_channel_id: sourceChannelId, - signer, - relayers + source_port_id: omitDefault(sourcePortId), + source_channel_id: omitDefault(sourceChannelId), + signer: omitDefault(signer), + relayers: relayers }; }, fromAmino: ({ @@ -193,19 +194,19 @@ export const AminoConverter = { packet_fee: { fee: { recv_fee: packetFee.fee.recvFee.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), ack_fee: packetFee.fee.ackFee.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), timeout_fee: packetFee.fee.timeoutFee.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }, - refund_address: packetFee.refundAddress, + refund_address: omitDefault(packetFee.refundAddress), relayers: packetFee.relayers } }; diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index 41d9968082..8c90707efa 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType, typeFromJSON } from "../../v1/packet"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../../../helpers"; import { MsgRegisterInterchainAccount, MsgRegisterInterchainAccountSDKType, MsgSendTx, MsgSendTxSDKType } from "./tx"; export interface MsgRegisterInterchainAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgRegisterInterchainAccount"; @@ -31,9 +32,9 @@ export const AminoConverter = { version }: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountAminoType["value"] => { return { - owner, - connection_id: connectionId, - version + owner: omitDefault(owner), + connection_id: omitDefault(connectionId), + version: omitDefault(version) }; }, fromAmino: ({ @@ -57,12 +58,12 @@ export const AminoConverter = { relativeTimeout }: MsgSendTx): MsgSendTxAminoType["value"] => { return { - owner, - connection_id: connectionId, + owner: omitDefault(owner), + connection_id: omitDefault(connectionId), packet_data: { type: packetData.type, data: packetData.data, - memo: packetData.memo + memo: omitDefault(packetData.memo) }, relative_timeout: relativeTimeout.toString() }; diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts index a03ccde6de..b6c87f6d09 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts @@ -31,14 +31,14 @@ export const AminoConverter = { timeoutTimestamp }: MsgTransfer): MsgTransferAminoType["value"] => { return { - source_port: sourcePort, - source_channel: sourceChannel, + source_port: omitDefault(sourcePort), + source_channel: omitDefault(sourceChannel), token: { denom: token.denom, amount: token.amount }, - sender, - receiver, + sender: omitDefault(sender), + receiver: omitDefault(receiver), timeout_height: timeoutHeight ? { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts index a2055c9569..43d1082629 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts @@ -166,18 +166,18 @@ export const AminoConverter = { signer }: MsgChannelOpenInit): MsgChannelOpenInitAminoType["value"] => { return { - port_id: portId, + port_id: omitDefault(portId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -213,25 +213,25 @@ export const AminoConverter = { signer }: MsgChannelOpenTry): MsgChannelOpenTryAminoType["value"] => { return { - port_id: portId, - previous_channel_id: previousChannelId, + port_id: omitDefault(portId), + previous_channel_id: omitDefault(previousChannelId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - counterparty_version: counterpartyVersion, + counterparty_version: omitDefault(counterpartyVersion), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -278,16 +278,16 @@ export const AminoConverter = { signer }: MsgChannelOpenAck): MsgChannelOpenAckAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - counterparty_channel_id: counterpartyChannelId, - counterparty_version: counterpartyVersion, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + counterparty_channel_id: omitDefault(counterpartyChannelId), + counterparty_version: omitDefault(counterpartyVersion), proof_try: proofTry, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -323,14 +323,14 @@ export const AminoConverter = { signer }: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -360,9 +360,9 @@ export const AminoConverter = { signer }: MsgChannelCloseInit): MsgChannelCloseInitAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - signer + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -387,14 +387,14 @@ export const AminoConverter = { signer }: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -427,10 +427,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -443,7 +443,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -487,10 +487,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -504,7 +504,7 @@ export const AminoConverter = { revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, next_sequence_recv: nextSequenceRecv.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -551,10 +551,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -569,7 +569,7 @@ export const AminoConverter = { revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, next_sequence_recv: nextSequenceRecv.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -617,10 +617,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -628,13 +628,13 @@ export const AminoConverter = { } : {}, timeout_timestamp: packet.timeoutTimestamp.toString() }, - acknowledgement, + acknowledgement: acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts index 727e135426..da58249ba9 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../../helpers"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export interface MsgCreateClientAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateClient"; @@ -64,14 +65,14 @@ export const AminoConverter = { }: MsgCreateClient): MsgCreateClientAminoType["value"] => { return { client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -100,12 +101,12 @@ export const AminoConverter = { signer }: MsgUpdateClient): MsgUpdateClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), header: { - type_url: header.typeUrl, + type_url: omitDefault(header.typeUrl), value: header.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -134,18 +135,18 @@ export const AminoConverter = { signer }: MsgUpgradeClient): MsgUpgradeClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, proof_upgrade_client: proofUpgradeClient, proof_upgrade_consensus_state: proofUpgradeConsensusState, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -180,12 +181,12 @@ export const AminoConverter = { signer }: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), misbehaviour: { - type_url: misbehaviour.typeUrl, + type_url: omitDefault(misbehaviour.typeUrl), value: misbehaviour.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 53e0a3765c..639aa1ea54 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -94,20 +94,20 @@ export const AminoConverter = { signer }: MsgConnectionOpenInit): MsgConnectionOpenInitAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, delay_period: delayPeriod.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -152,22 +152,22 @@ export const AminoConverter = { signer }: MsgConnectionOpenTry): MsgConnectionOpenTryAminoType["value"] => { return { - client_id: clientId, - previous_connection_id: previousConnectionId, + client_id: omitDefault(clientId), + previous_connection_id: omitDefault(previousConnectionId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, delay_period: delayPeriod.toString(), counterparty_versions: counterpartyVersions.map(el0 => ({ - identifier: el0.identifier, + identifier: omitDefault(el0.identifier), features: el0.features })), proof_height: proofHeight ? { @@ -181,7 +181,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -247,14 +247,14 @@ export const AminoConverter = { signer }: MsgConnectionOpenAck): MsgConnectionOpenAckAminoType["value"] => { return { - connection_id: connectionId, - counterparty_connection_id: counterpartyConnectionId, + connection_id: omitDefault(connectionId), + counterparty_connection_id: omitDefault(counterpartyConnectionId), version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, proof_height: proofHeight ? { @@ -268,7 +268,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -318,13 +318,13 @@ export const AminoConverter = { signer }: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoType["value"] => { return { - connection_id: connectionId, + connection_id: omitDefault(connectionId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index 1632416bcc..2037e1668d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -3,6 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../helpers"; import { MsgCreatePosition, MsgCreatePositionSDKType, MsgWithdrawPosition, MsgWithdrawPositionSDKType, MsgCollectFees, MsgCollectFeesSDKType, MsgCollectIncentives, MsgCollectIncentivesSDKType, MsgFungifyChargedPositions, MsgFungifyChargedPositionsSDKType } from "./tx"; export interface MsgCreatePositionAminoType extends AminoMsg { type: "osmosis/concentratedliquidity/create-position"; @@ -67,7 +68,7 @@ export const AminoConverter = { }: MsgCreatePosition): MsgCreatePositionAminoType["value"] => { return { pool_id: poolId.toString(), - sender, + sender: omitDefault(sender), lower_tick: lowerTick.toString(), upper_tick: upperTick.toString(), token_desired0: { @@ -78,8 +79,8 @@ export const AminoConverter = { denom: tokenDesired1.denom, amount: tokenDesired1.amount }, - token_min_amount0: tokenMinAmount0, - token_min_amount1: tokenMinAmount1 + token_min_amount0: omitDefault(tokenMinAmount0), + token_min_amount1: omitDefault(tokenMinAmount1) }; }, fromAmino: ({ @@ -119,8 +120,8 @@ export const AminoConverter = { }: MsgWithdrawPosition): MsgWithdrawPositionAminoType["value"] => { return { position_id: positionId.toString(), - sender, - liquidity_amount: liquidityAmount + sender: omitDefault(sender), + liquidity_amount: padDecimal(liquidityAmount) }; }, fromAmino: ({ @@ -143,7 +144,7 @@ export const AminoConverter = { }: MsgCollectFees): MsgCollectFeesAminoType["value"] => { return { position_ids: positionIds.map(el0 => el0.toString()), - sender + sender: omitDefault(sender) }; }, fromAmino: ({ @@ -164,7 +165,7 @@ export const AminoConverter = { }: MsgCollectIncentives): MsgCollectIncentivesAminoType["value"] => { return { position_ids: positionIds.map(el0 => el0.toString()), - sender + sender: omitDefault(sender) }; }, fromAmino: ({ @@ -185,7 +186,7 @@ export const AminoConverter = { }: MsgFungifyChargedPositions): MsgFungifyChargedPositionsAminoType["value"] => { return { position_ids: positionIds.map(el0 => el0.toString()), - sender + sender: omitDefault(sender) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index ad8f12c620..90a4da0936 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; @@ -57,10 +58,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -69,14 +70,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -85,9 +86,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 7811c40f43..6d137e53fb 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,6 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -40,18 +41,18 @@ export const AminoConverter = { scalingFactorController }: MsgCreateStableswapPool): MsgCreateStableswapPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee) }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), scaling_factors: scalingFactors.map(el0 => el0.toString()), - future_pool_governor: futurePoolGovernor, - scaling_factor_controller: scalingFactorController + future_pool_governor: omitDefault(futurePoolGovernor), + scaling_factor_controller: omitDefault(scalingFactorController) }; }, fromAmino: ({ @@ -86,7 +87,7 @@ export const AminoConverter = { scalingFactors }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index e82624ab3d..c86c71d74d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -110,12 +111,12 @@ export const AminoConverter = { tokenInMaxs }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - share_out_amount: shareOutAmount, + share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -145,12 +146,12 @@ export const AminoConverter = { tokenOutMins }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - share_in_amount: shareInAmount, + share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -180,16 +181,16 @@ export const AminoConverter = { tokenOutMinAmount }: MsgSwapExactAmountIn): MsgSwapExactAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_out_denom: el0.tokenOutDenom + token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - token_out_min_amount: tokenOutMinAmount + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -221,12 +222,12 @@ export const AminoConverter = { tokenOut }: MsgSwapExactAmountOut): MsgSwapExactAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_in_denom: el0.tokenInDenom + token_in_denom: omitDefault(el0.tokenInDenom) })), - token_in_max_amount: tokenInMaxAmount, + token_in_max_amount: omitDefault(tokenInMaxAmount), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -262,13 +263,13 @@ export const AminoConverter = { shareOutMinAmount }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - share_out_min_amount: shareOutMinAmount + share_out_min_amount: omitDefault(shareOutMinAmount) }; }, fromAmino: ({ @@ -298,11 +299,11 @@ export const AminoConverter = { tokenInMaxAmount }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - token_in_denom: tokenInDenom, - share_out_amount: shareOutAmount, - token_in_max_amount: tokenInMaxAmount + token_in_denom: omitDefault(tokenInDenom), + share_out_amount: omitDefault(shareOutAmount), + token_in_max_amount: omitDefault(tokenInMaxAmount) }; }, fromAmino: ({ @@ -330,13 +331,13 @@ export const AminoConverter = { shareInMaxAmount }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount }, - share_in_max_amount: shareInMaxAmount + share_in_max_amount: omitDefault(shareInMaxAmount) }; }, fromAmino: ({ @@ -366,11 +367,11 @@ export const AminoConverter = { tokenOutMinAmount }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - token_out_denom: tokenOutDenom, - share_in_amount: shareInAmount, - token_out_min_amount: tokenOutMinAmount + token_out_denom: omitDefault(tokenOutDenom), + share_in_amount: omitDefault(shareInAmount), + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index a00674a250..4b6d7884e5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -3,6 +3,7 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -57,16 +58,16 @@ export const AminoConverter = { }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { is_perpetual: isPerpetual, - owner, + owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, - denom: distributeTo.denom, + denom: omitDefault(distributeTo.denom), duration: (distributeTo.duration * 1_000_000_000).toString(), timestamp: distributeTo.timestamp }, coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), start_time: startTime, num_epochs_paid_over: numEpochsPaidOver.toString() @@ -109,11 +110,11 @@ export const AminoConverter = { rewards }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { - owner, + owner: omitDefault(owner), gauge_id: gaugeId.toString(), rewards: rewards.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index 5a645daaa7..afc07e7e40 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -3,6 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -66,11 +67,11 @@ export const AminoConverter = { coins }: MsgLockTokens): MsgLockTokensAminoType["value"] => { return { - owner, + owner: omitDefault(owner), duration: (duration * 1_000_000_000).toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -98,7 +99,7 @@ export const AminoConverter = { owner }: MsgBeginUnlockingAll): MsgBeginUnlockingAllAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ @@ -117,11 +118,11 @@ export const AminoConverter = { coins }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -148,7 +149,7 @@ export const AminoConverter = { duration }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), duration: (duration * 1_000_000_000).toString() }; @@ -176,11 +177,11 @@ export const AminoConverter = { coins }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index deb7cbf04b..2b539a50e4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType } from "./tx"; export interface MsgSwapExactAmountInAminoType extends AminoMsg { type: "osmosis/poolmanager/swap-exact-amount-in"; @@ -43,16 +44,16 @@ export const AminoConverter = { tokenOutMinAmount }: MsgSwapExactAmountIn): MsgSwapExactAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_out_denom: el0.tokenOutDenom + token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - token_out_min_amount: tokenOutMinAmount + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -84,12 +85,12 @@ export const AminoConverter = { tokenOut }: MsgSwapExactAmountOut): MsgSwapExactAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_in_denom: el0.tokenInDenom + token_in_denom: omitDefault(el0.tokenInDenom) })), - token_in_max_amount: tokenInMaxAmount, + token_in_max_amount: omitDefault(tokenInMaxAmount), token_out: { denom: tokenOut.denom, amount: tokenOut.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index a7969d86b0..d55c9bd387 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType, Route, RouteSDKType, Trade, TradeSDKType } from "./protorev"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSetHotRoutes, MsgSetHotRoutesSDKType, MsgSetDeveloperAccount, MsgSetDeveloperAccountSDKType, MsgSetMaxPoolPointsPerTx, MsgSetMaxPoolPointsPerTxSDKType, MsgSetMaxPoolPointsPerBlock, MsgSetMaxPoolPointsPerBlockSDKType, MsgSetPoolWeights, MsgSetPoolWeightsSDKType, MsgSetBaseDenoms, MsgSetBaseDenomsSDKType } from "./tx"; export interface MsgSetHotRoutesAminoType extends AminoMsg { type: "osmosis/MsgSetHotRoutes"; @@ -70,18 +71,18 @@ export const AminoConverter = { hotRoutes }: MsgSetHotRoutes): MsgSetHotRoutesAminoType["value"] => { return { - admin, + admin: omitDefault(admin), hot_routes: hotRoutes.map(el0 => ({ arb_routes: el0.arbRoutes.map(el1 => ({ trades: el1.trades.map(el2 => ({ pool: el2.pool.toString(), - token_in: el2.tokenIn, - token_out: el2.tokenOut + token_in: omitDefault(el2.tokenIn), + token_out: omitDefault(el2.tokenOut) })), - step_size: el1.stepSize + step_size: omitDefault(el1.stepSize) })), - token_in: el0.tokenIn, - token_out: el0.tokenOut + token_in: omitDefault(el0.tokenIn), + token_out: omitDefault(el0.tokenOut) })) }; }, @@ -113,8 +114,8 @@ export const AminoConverter = { developerAccount }: MsgSetDeveloperAccount): MsgSetDeveloperAccountAminoType["value"] => { return { - admin, - developer_account: developerAccount + admin: omitDefault(admin), + developer_account: omitDefault(developerAccount) }; }, fromAmino: ({ @@ -134,7 +135,7 @@ export const AminoConverter = { maxPoolPointsPerTx }: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAminoType["value"] => { return { - admin, + admin: omitDefault(admin), max_pool_points_per_tx: maxPoolPointsPerTx.toString() }; }, @@ -155,7 +156,7 @@ export const AminoConverter = { maxPoolPointsPerBlock }: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAminoType["value"] => { return { - admin, + admin: omitDefault(admin), max_pool_points_per_block: maxPoolPointsPerBlock.toString() }; }, @@ -176,7 +177,7 @@ export const AminoConverter = { poolWeights }: MsgSetPoolWeights): MsgSetPoolWeightsAminoType["value"] => { return { - admin, + admin: omitDefault(admin), pool_weights: { stable_weight: poolWeights.stableWeight.toString(), balancer_weight: poolWeights.balancerWeight.toString(), @@ -205,10 +206,10 @@ export const AminoConverter = { baseDenoms }: MsgSetBaseDenoms): MsgSetBaseDenomsAminoType["value"] => { return { - admin, + admin: omitDefault(admin), base_denoms: baseDenoms.map(el0 => ({ - denom: el0.denom, - step_size: el0.stepSize + denom: omitDefault(el0.denom), + step_size: omitDefault(el0.stepSize) })) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index ab182966bc..286a368446 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -51,9 +52,9 @@ export const AminoConverter = { valAddr }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString(), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -75,7 +76,7 @@ export const AminoConverter = { lockId }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString() }; }, @@ -96,7 +97,7 @@ export const AminoConverter = { lockId }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString() }; }, @@ -118,12 +119,12 @@ export const AminoConverter = { valAddr }: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -148,7 +149,7 @@ export const AminoConverter = { poolId }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString() }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts index 6ac7848d13..817ccf8440 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -66,8 +67,8 @@ export const AminoConverter = { subdenom }: MsgCreateDenom): MsgCreateDenomAminoType["value"] => { return { - sender, - subdenom + sender: omitDefault(sender), + subdenom: omitDefault(subdenom) }; }, fromAmino: ({ @@ -87,7 +88,7 @@ export const AminoConverter = { amount }: MsgMint): MsgMintAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: amount.amount @@ -114,7 +115,7 @@ export const AminoConverter = { amount }: MsgBurn): MsgBurnAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: amount.amount @@ -142,9 +143,9 @@ export const AminoConverter = { newAdmin }: MsgChangeAdmin): MsgChangeAdminAminoType["value"] => { return { - sender, - denom, - new_admin: newAdmin + sender: omitDefault(sender), + denom: omitDefault(denom), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -166,20 +167,20 @@ export const AminoConverter = { metadata }: MsgSetDenomMetadata): MsgSetDenomMetadataAminoType["value"] => { return { - sender, + sender: omitDefault(sender), metadata: { - description: metadata.description, + description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ - denom: el0.denom, + denom: omitDefault(el0.denom), exponent: el0.exponent, aliases: el0.aliases })), - base: metadata.base, - display: metadata.display, - name: metadata.name, - symbol: metadata.symbol, - uri: metadata.uri, - uri_hash: metadata.uriHash + base: omitDefault(metadata.base), + display: omitDefault(metadata.display), + name: omitDefault(metadata.name), + symbol: omitDefault(metadata.symbol), + uri: omitDefault(metadata.uri), + uri_hash: omitDefault(metadata.uriHash) } }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index 4cb0b8802d..a7ecab13d6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { MsgSetValidatorSetPreference, MsgSetValidatorSetPreferenceSDKType, MsgDelegateToValidatorSet, MsgDelegateToValidatorSetSDKType, MsgUndelegateFromValidatorSet, MsgUndelegateFromValidatorSetSDKType, MsgRedelegateValidatorSet, MsgRedelegateValidatorSetSDKType, MsgWithdrawDelegationRewards, MsgWithdrawDelegationRewardsSDKType, MsgDelegateBondedTokens, MsgDelegateBondedTokensSDKType } from "./tx"; export interface MsgSetValidatorSetPreferenceAminoType extends AminoMsg { type: "osmosis/valset-pref/MsgSetValidatorSetPreference"; @@ -64,10 +65,10 @@ export const AminoConverter = { preferences }: MsgSetValidatorSetPreference): MsgSetValidatorSetPreferenceAminoType["value"] => { return { - delegator, + delegator: omitDefault(delegator), preferences: preferences.map(el0 => ({ - val_oper_address: el0.valOperAddress, - weight: el0.weight + val_oper_address: omitDefault(el0.valOperAddress), + weight: padDecimal(el0.weight) })) }; }, @@ -91,7 +92,7 @@ export const AminoConverter = { coin }: MsgDelegateToValidatorSet): MsgDelegateToValidatorSetAminoType["value"] => { return { - delegator, + delegator: omitDefault(delegator), coin: { denom: coin.denom, amount: coin.amount @@ -118,7 +119,7 @@ export const AminoConverter = { coin }: MsgUndelegateFromValidatorSet): MsgUndelegateFromValidatorSetAminoType["value"] => { return { - delegator, + delegator: omitDefault(delegator), coin: { denom: coin.denom, amount: coin.amount @@ -145,10 +146,10 @@ export const AminoConverter = { preferences }: MsgRedelegateValidatorSet): MsgRedelegateValidatorSetAminoType["value"] => { return { - delegator, + delegator: omitDefault(delegator), preferences: preferences.map(el0 => ({ - val_oper_address: el0.valOperAddress, - weight: el0.weight + val_oper_address: omitDefault(el0.valOperAddress), + weight: padDecimal(el0.weight) })) }; }, @@ -171,7 +172,7 @@ export const AminoConverter = { delegator }: MsgWithdrawDelegationRewards): MsgWithdrawDelegationRewardsAminoType["value"] => { return { - delegator + delegator: omitDefault(delegator) }; }, fromAmino: ({ @@ -189,7 +190,7 @@ export const AminoConverter = { lockID }: MsgDelegateBondedTokens): MsgDelegateBondedTokensAminoType["value"] => { return { - delegator, + delegator: omitDefault(delegator), lockID: lockID.toString() }; }, diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts index b3c5e0e145..20b34cb7ca 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "akash/audit/testonly-sign-provider-attributes"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: omitDefault(owner), + auditor: omitDefault(auditor), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: omitDefault(owner), + auditor: omitDefault(auditor), + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts index de83b12abd..573aa1bbc9 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "mymessage-testonly"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: omitDefault(owner), + auditor: omitDefault(auditor), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: omitDefault(owner), + auditor: omitDefault(auditor), + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts index 97e535cbe2..8087e380cd 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts @@ -1,5 +1,6 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { CertificateID, CertificateIDSDKType, MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export interface MsgCreateCertificateAminoType extends AminoMsg { type: "akash/cert/v1beta2/testonly-create-certificate"; @@ -27,9 +28,9 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner, - cert, - pubkey + owner: omitDefault(owner), + cert: cert, + pubkey: pubkey }; }, fromAmino: ({ @@ -51,8 +52,8 @@ export const AminoConverter = { }: MsgRevokeCertificate): MsgRevokeCertificateAminoType["value"] => { return { id: { - owner: id.owner, - serial: id.serial + owner: omitDefault(id.owner), + serial: omitDefault(id.serial) } }; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index 29301829da..73fbc73897 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -4,6 +4,7 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType, DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { PlacementRequirements, PlacementRequirementsSDKType, SignedBy, SignedBySDKType, Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { Resource, ResourceSDKType } from "./resource"; import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta2/resourceunits"; @@ -156,19 +157,19 @@ export const AminoConverter = { }: MsgCreateDeployment): MsgCreateDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, groups: groups.map(el0 => ({ - name: el0.name, + name: omitDefault(el0.name), requirements: { signed_by: { all_of: el0.requirements.signedBy.allOf, any_of: el0.requirements.signedBy.anyOf }, attributes: el0.requirements.attributes.map(el1 => ({ - key: el1.key, - value: el1.value + key: omitDefault(el1.key), + value: omitDefault(el1.value) })) }, resources: el0.resources.map(el1 => ({ @@ -178,8 +179,8 @@ export const AminoConverter = { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, memory: { @@ -187,18 +188,18 @@ export const AminoConverter = { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, storage: el1.resources.storage.map(el2 => ({ - name: el2.name, + name: omitDefault(el2.name), quantity: { val: el2.quantity.val }, attributes: el2.attributes.map(el3 => ({ - key: el3.key, - value: el3.value + key: omitDefault(el3.key), + value: omitDefault(el3.value) })) })), endpoints: el1.resources.endpoints.map(el2 => ({ @@ -208,17 +209,17 @@ export const AminoConverter = { }, count: el1.count, price: { - denom: el1.price.denom, - amount: el1.price.amount + denom: omitDefault(el1.price.denom), + amount: omitDefault(el1.price.amount) } })) })), - version, + version: version, deposit: { denom: deposit.denom, amount: deposit.amount }, - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -305,14 +306,14 @@ export const AminoConverter = { }: MsgDepositDeployment): MsgDepositDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, amount: { denom: amount.denom, amount: amount.amount }, - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -341,10 +342,10 @@ export const AminoConverter = { }: MsgUpdateDeployment): MsgUpdateDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() }, - version + version: version }; }, fromAmino: ({ @@ -367,7 +368,7 @@ export const AminoConverter = { }: MsgCloseDeployment): MsgCloseDeploymentAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString() } }; @@ -390,7 +391,7 @@ export const AminoConverter = { }: MsgCloseGroup): MsgCloseGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } @@ -415,7 +416,7 @@ export const AminoConverter = { }: MsgPauseGroup): MsgPauseGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } @@ -440,7 +441,7 @@ export const AminoConverter = { }: MsgStartGroup): MsgStartGroupAminoType["value"] => { return { id: { - owner: id.owner, + owner: omitDefault(id.owner), dseq: id.dseq.toString(), gseq: id.gseq } diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts index 0e47f2ffe8..31c5984835 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts @@ -4,6 +4,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; export interface MsgCreateBidAminoType extends AminoMsg { type: "akash/market/v1beta2/testonly-create-bid"; value: { @@ -83,15 +84,15 @@ export const AminoConverter = { }: MsgCreateBid): MsgCreateBidAminoType["value"] => { return { order: { - owner: order.owner, + owner: omitDefault(order.owner), dseq: order.dseq.toString(), gseq: order.gseq, oseq: order.oseq }, - provider, + provider: omitDefault(provider), price: { - denom: price.denom, - amount: price.amount + denom: omitDefault(price.denom), + amount: omitDefault(price.amount) }, deposit: { denom: deposit.denom, @@ -131,11 +132,11 @@ export const AminoConverter = { }: MsgCloseBid): MsgCloseBidAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -160,11 +161,11 @@ export const AminoConverter = { }: MsgWithdrawLease): MsgWithdrawLeaseAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -189,11 +190,11 @@ export const AminoConverter = { }: MsgCreateLease): MsgCreateLeaseAminoType["value"] => { return { bid_id: { - owner: bidId.owner, + owner: omitDefault(bidId.owner), dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: bidId.provider + provider: omitDefault(bidId.provider) } }; }, @@ -218,11 +219,11 @@ export const AminoConverter = { }: MsgCloseLease): MsgCloseLeaseAminoType["value"] => { return { lease_id: { - owner: leaseId.owner, + owner: omitDefault(leaseId.owner), dseq: leaseId.dseq.toString(), gseq: leaseId.gseq, oseq: leaseId.oseq, - provider: leaseId.provider + provider: omitDefault(leaseId.provider) } }; }, diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts index 09f69f6e0b..a7497ddc96 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/testonly-create-provider"; @@ -48,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -89,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts index de1a53399d..d2a861a256 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/v1beta2/testonly-create-provider"; @@ -48,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -89,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, - host_uri: hostUri, + owner: omitDefault(owner), + host_uri: omitDefault(hostUri), attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { - email: info.email, - website: info.website + email: omitDefault(info.email), + website: omitDefault(info.website) } }; }, @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts index dee011d143..542e0b87da 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { @@ -47,11 +48,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -83,9 +84,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -111,9 +112,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts index 5352659e14..91e06445ec 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgSend"; @@ -41,11 +42,11 @@ export const AminoConverter = { amount }: MsgSend): MsgSendAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -72,17 +73,17 @@ export const AminoConverter = { }: MsgMultiSend): MsgMultiSendAminoType["value"] => { return { inputs: inputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), outputs: outputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.amino.ts index dfa3c954cc..35ffefde90 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; export interface MsgVerifyInvariantAminoType extends AminoMsg { type: "cosmos-sdk/MsgVerifyInvariant"; @@ -17,9 +18,9 @@ export const AminoConverter = { invariantRoute }: MsgVerifyInvariant): MsgVerifyInvariantAminoType["value"] => { return { - sender, - invariant_module_name: invariantModuleName, - invariant_route: invariantRoute + sender: omitDefault(sender), + invariant_module_name: omitDefault(invariantModuleName), + invariant_route: omitDefault(invariantRoute) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts index c7d34e047d..05a4e031f8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; export interface MsgSetWithdrawAddressAminoType extends AminoMsg { type: "cosmos-sdk/MsgModifyWithdrawAddress"; @@ -39,8 +40,8 @@ export const AminoConverter = { withdrawAddress }: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoType["value"] => { return { - delegator_address: delegatorAddress, - withdraw_address: withdrawAddress + delegator_address: omitDefault(delegatorAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ @@ -60,8 +61,8 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -80,7 +81,7 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoType["value"] => { return { - validator_address: validatorAddress + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -99,10 +100,10 @@ export const AminoConverter = { }: MsgFundCommunityPool): MsgFundCommunityPoolAminoType["value"] => { return { amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts index 8cf0ca70d6..4abb8bc814 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; export interface MsgSubmitEvidenceAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitEvidence"; @@ -19,9 +20,9 @@ export const AminoConverter = { evidence }: MsgSubmitEvidence): MsgSubmitEvidenceAminoType["value"] => { return { - submitter, + submitter: omitDefault(submitter), evidence: { - type_url: evidence.typeUrl, + type_url: omitDefault(evidence.typeUrl), value: evidence.value } }; diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts index c376a3917b..08792b032d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; export interface MsgGrantAllowanceAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrantAllowance"; @@ -28,10 +29,10 @@ export const AminoConverter = { allowance }: MsgGrantAllowance): MsgGrantAllowanceAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), allowance: { - type_url: allowance.typeUrl, + type_url: omitDefault(allowance.typeUrl), value: allowance.value } }; @@ -58,8 +59,8 @@ export const AminoConverter = { grantee }: MsgRevokeAllowance): MsgRevokeAllowanceAminoType["value"] => { return { - granter, - grantee + granter: omitDefault(granter), + grantee: omitDefault(grantee) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index 7c0115740a..e417d411e7 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/v1/MsgSubmitProposal"; @@ -71,15 +72,15 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer, - metadata + proposer: omitDefault(proposer), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -110,10 +111,10 @@ export const AminoConverter = { }: MsgExecLegacyContent): MsgExecLegacyContentAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, - authority + authority: omitDefault(authority) }; }, fromAmino: ({ @@ -139,9 +140,9 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option, - metadata + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -168,12 +169,12 @@ export const AminoConverter = { }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: omitDefault(el0.weight) })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -202,10 +203,10 @@ export const AminoConverter = { }: MsgDeposit): MsgDepositAminoType["value"] => { return { proposal_id: proposalId.toString(), - depositor, + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index fad45eaf42..f7ce81597e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -57,14 +58,14 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer + proposer: omitDefault(proposer) }; }, fromAmino: ({ @@ -94,8 +95,8 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option + voter: omitDefault(voter), + option: option }; }, fromAmino: ({ @@ -119,10 +120,10 @@ export const AminoConverter = { }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: padDecimal(el0.weight) })) }; }, @@ -150,10 +151,10 @@ export const AminoConverter = { }: MsgDeposit): MsgDepositAminoType["value"] => { return { proposal_id: proposalId.toString(), - depositor, + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index e7787dfe21..e6c6b6e10f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { @@ -165,14 +166,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -200,12 +201,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -235,9 +236,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - new_admin: newAdmin + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -260,9 +261,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -286,11 +287,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), group_id: groupId.toString(), - metadata, + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -323,18 +324,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), group_policy_as_admin: groupPolicyAsAdmin, decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -373,9 +374,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -398,10 +399,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -429,9 +430,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -456,14 +457,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -493,7 +494,7 @@ export const AminoConverter = { }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { proposal_id: proposalId.toString(), - address + address: omitDefault(address) }; }, fromAmino: ({ @@ -517,10 +518,10 @@ export const AminoConverter = { }: MsgVote): MsgVoteAminoType["value"] => { return { proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -547,7 +548,7 @@ export const AminoConverter = { }: MsgExec): MsgExecAminoType["value"] => { return { proposal_id: proposalId.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -567,7 +568,7 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, + address: omitDefault(address), group_id: groupId.toString() }; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.amino.ts index c244a7789d..f43ed3e82e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgNFTSend"; @@ -19,10 +20,10 @@ export const AminoConverter = { receiver }: MsgSend): MsgSendAminoType["value"] => { return { - class_id: classId, - id, - sender, - receiver + class_id: omitDefault(classId), + id: omitDefault(id), + sender: omitDefault(sender), + receiver: omitDefault(receiver) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts index 9a3e9b11e4..94ba73ca94 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; @@ -13,7 +14,7 @@ export const AminoConverter = { validatorAddr }: MsgUnjail): MsgUnjailAminoType["value"] => { return { - validator_addr: validatorAddr + validator_addr: omitDefault(validatorAddr) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts index 86e67cabcd..3f3fa4907d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts @@ -3,6 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export interface MsgCreateValidatorAminoType extends AminoMsg { @@ -93,20 +94,20 @@ export const AminoConverter = { }: MsgCreateValidator): MsgCreateValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: padDecimal(commission.rate), + max_rate: padDecimal(commission.maxRate), + max_change_rate: padDecimal(commission.maxChangeRate) }, - min_self_delegation: minSelfDelegation, - delegator_address: delegatorAddress, - validator_address: validatorAddress, + min_self_delegation: omitDefault(minSelfDelegation), + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), pubkey: decodePubkey(pubkey)!, value: { denom: value.denom, @@ -157,15 +158,15 @@ export const AminoConverter = { }: MsgEditValidator): MsgEditValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, - validator_address: validatorAddress, - commission_rate: commissionRate, - min_self_delegation: minSelfDelegation + validator_address: omitDefault(validatorAddress), + commission_rate: padDecimal(commissionRate), + min_self_delegation: omitDefault(minSelfDelegation) }; }, fromAmino: ({ @@ -196,8 +197,8 @@ export const AminoConverter = { amount }: MsgDelegate): MsgDelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount @@ -228,9 +229,9 @@ export const AminoConverter = { amount }: MsgBeginRedelegate): MsgBeginRedelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_src_address: validatorSrcAddress, - validator_dst_address: validatorDstAddress, + delegator_address: omitDefault(delegatorAddress), + validator_src_address: omitDefault(validatorSrcAddress), + validator_dst_address: omitDefault(validatorDstAddress), amount: { denom: amount.denom, amount: amount.amount @@ -262,8 +263,8 @@ export const AminoConverter = { amount }: MsgUndelegate): MsgUndelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts index 1eb1068281..a70e117cfb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; @@ -36,14 +37,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, height: plan.height.toString(), - info: plan.info, + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -74,7 +75,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index b1829bb2bc..dbe24d82a8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -52,14 +53,14 @@ export const AminoConverter = { delayed }: MsgCreateVestingAccount): MsgCreateVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), end_time: endTime.toString(), - delayed + delayed: delayed }; }, fromAmino: ({ @@ -89,11 +90,11 @@ export const AminoConverter = { amount }: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -121,14 +122,14 @@ export const AminoConverter = { vestingPeriods }: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime.toString(), vesting_periods: vestingPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index db3abbec45..87c0a7e409 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { @@ -73,11 +74,11 @@ export const AminoConverter = { instantiatePermission }: MsgStoreCode): MsgStoreCodeAminoType["value"] => { return { - sender, + sender: omitDefault(sender), wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address + address: omitDefault(instantiatePermission.address) } }; }, @@ -107,14 +108,14 @@ export const AminoConverter = { funds }: MsgInstantiateContract): MsgInstantiateContractAminoType["value"] => { return { - sender, - admin, + sender: omitDefault(sender), + admin: omitDefault(admin), code_id: codeId.toString(), - label, + label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -148,12 +149,12 @@ export const AminoConverter = { funds }: MsgExecuteContract): MsgExecuteContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -183,8 +184,8 @@ export const AminoConverter = { msg }: MsgMigrateContract): MsgMigrateContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; @@ -211,9 +212,9 @@ export const AminoConverter = { contract }: MsgUpdateAdmin): MsgUpdateAdminAminoType["value"] => { return { - sender, - new_admin: newAdmin, - contract + sender: omitDefault(sender), + new_admin: omitDefault(newAdmin), + contract: omitDefault(contract) }; }, fromAmino: ({ @@ -235,8 +236,8 @@ export const AminoConverter = { contract }: MsgClearAdmin): MsgClearAdminAminoType["value"] => { return { - sender, - contract + sender: omitDefault(sender), + contract: omitDefault(contract) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts index 0be2123e86..cad7e1500f 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; export interface MsgConvertCoinAminoType extends AminoMsg { type: "/evmos.erc20.v1.MsgConvertCoin"; @@ -34,8 +35,8 @@ export const AminoConverter = { denom: coin.denom, amount: coin.amount }, - receiver, - sender + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ @@ -62,10 +63,10 @@ export const AminoConverter = { sender }: MsgConvertERC20): MsgConvertERC20AminoType["value"] => { return { - contract_address: contractAddress, - amount, - receiver, - sender + contract_address: omitDefault(contractAddress), + amount: omitDefault(amount), + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts index c226ee6556..a53f2bf860 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; export interface MsgRegisterDevFeeInfoAminoType extends AminoMsg { type: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; @@ -34,9 +35,9 @@ export const AminoConverter = { nonces }: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress, + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress), nonces: nonces.map(el0 => el0.toString()) }; }, @@ -61,8 +62,8 @@ export const AminoConverter = { deployerAddress }: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress) }; }, fromAmino: ({ @@ -83,9 +84,9 @@ export const AminoConverter = { withdrawAddress }: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index a11da2a219..92314cb295 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -49,24 +50,24 @@ export const AminoConverter = { merge }: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ length: el0.length.toString(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), - merge + merge: merge }; }, fromAmino: ({ @@ -107,9 +108,9 @@ export const AminoConverter = { destAddress }: MsgClawback): MsgClawbackAminoType["value"] => { return { - funder_address: funderAddress, - account_address: accountAddress, - dest_address: destAddress + funder_address: omitDefault(funderAddress), + account_address: omitDefault(accountAddress), + dest_address: omitDefault(destAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index a03ccde6de..b6c87f6d09 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -31,14 +31,14 @@ export const AminoConverter = { timeoutTimestamp }: MsgTransfer): MsgTransferAminoType["value"] => { return { - source_port: sourcePort, - source_channel: sourceChannel, + source_port: omitDefault(sourcePort), + source_channel: omitDefault(sourceChannel), token: { denom: token.denom, amount: token.amount }, - sender, - receiver, + sender: omitDefault(sender), + receiver: omitDefault(receiver), timeout_height: timeoutHeight ? { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index a2055c9569..43d1082629 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -166,18 +166,18 @@ export const AminoConverter = { signer }: MsgChannelOpenInit): MsgChannelOpenInitAminoType["value"] => { return { - port_id: portId, + port_id: omitDefault(portId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -213,25 +213,25 @@ export const AminoConverter = { signer }: MsgChannelOpenTry): MsgChannelOpenTryAminoType["value"] => { return { - port_id: portId, - previous_channel_id: previousChannelId, + port_id: omitDefault(portId), + previous_channel_id: omitDefault(previousChannelId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - counterparty_version: counterpartyVersion, + counterparty_version: omitDefault(counterpartyVersion), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -278,16 +278,16 @@ export const AminoConverter = { signer }: MsgChannelOpenAck): MsgChannelOpenAckAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - counterparty_channel_id: counterpartyChannelId, - counterparty_version: counterpartyVersion, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + counterparty_channel_id: omitDefault(counterpartyChannelId), + counterparty_version: omitDefault(counterpartyVersion), proof_try: proofTry, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -323,14 +323,14 @@ export const AminoConverter = { signer }: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -360,9 +360,9 @@ export const AminoConverter = { signer }: MsgChannelCloseInit): MsgChannelCloseInitAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - signer + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -387,14 +387,14 @@ export const AminoConverter = { signer }: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -427,10 +427,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -443,7 +443,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -487,10 +487,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -504,7 +504,7 @@ export const AminoConverter = { revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, next_sequence_recv: nextSequenceRecv.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -551,10 +551,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -569,7 +569,7 @@ export const AminoConverter = { revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, next_sequence_recv: nextSequenceRecv.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -617,10 +617,10 @@ export const AminoConverter = { return { packet: { sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), @@ -628,13 +628,13 @@ export const AminoConverter = { } : {}, timeout_timestamp: packet.timeoutTimestamp.toString() }, - acknowledgement, + acknowledgement: acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts index 727e135426..da58249ba9 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../../helpers"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export interface MsgCreateClientAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateClient"; @@ -64,14 +65,14 @@ export const AminoConverter = { }: MsgCreateClient): MsgCreateClientAminoType["value"] => { return { client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -100,12 +101,12 @@ export const AminoConverter = { signer }: MsgUpdateClient): MsgUpdateClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), header: { - type_url: header.typeUrl, + type_url: omitDefault(header.typeUrl), value: header.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -134,18 +135,18 @@ export const AminoConverter = { signer }: MsgUpgradeClient): MsgUpgradeClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, proof_upgrade_client: proofUpgradeClient, proof_upgrade_consensus_state: proofUpgradeConsensusState, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -180,12 +181,12 @@ export const AminoConverter = { signer }: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), misbehaviour: { - type_url: misbehaviour.typeUrl, + type_url: omitDefault(misbehaviour.typeUrl), value: misbehaviour.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 53e0a3765c..639aa1ea54 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -94,20 +94,20 @@ export const AminoConverter = { signer }: MsgConnectionOpenInit): MsgConnectionOpenInitAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, delay_period: delayPeriod.toString(), - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -152,22 +152,22 @@ export const AminoConverter = { signer }: MsgConnectionOpenTry): MsgConnectionOpenTryAminoType["value"] => { return { - client_id: clientId, - previous_connection_id: previousConnectionId, + client_id: omitDefault(clientId), + previous_connection_id: omitDefault(previousConnectionId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, delay_period: delayPeriod.toString(), counterparty_versions: counterpartyVersions.map(el0 => ({ - identifier: el0.identifier, + identifier: omitDefault(el0.identifier), features: el0.features })), proof_height: proofHeight ? { @@ -181,7 +181,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -247,14 +247,14 @@ export const AminoConverter = { signer }: MsgConnectionOpenAck): MsgConnectionOpenAckAminoType["value"] => { return { - connection_id: connectionId, - counterparty_connection_id: counterpartyConnectionId, + connection_id: omitDefault(connectionId), + counterparty_connection_id: omitDefault(counterpartyConnectionId), version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, proof_height: proofHeight ? { @@ -268,7 +268,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -318,13 +318,13 @@ export const AminoConverter = { signer }: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoType["value"] => { return { - connection_id: connectionId, + connection_id: omitDefault(connectionId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index ad8f12c620..90a4da0936 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../../helpers"; import { Timestamp, TimestampSDKType } from "../../../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; @@ -57,10 +58,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -69,14 +70,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -85,9 +86,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 7811c40f43..6d137e53fb 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,6 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -40,18 +41,18 @@ export const AminoConverter = { scalingFactorController }: MsgCreateStableswapPool): MsgCreateStableswapPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee) }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), scaling_factors: scalingFactors.map(el0 => el0.toString()), - future_pool_governor: futurePoolGovernor, - scaling_factor_controller: scalingFactorController + future_pool_governor: omitDefault(futurePoolGovernor), + scaling_factor_controller: omitDefault(scalingFactorController) }; }, fromAmino: ({ @@ -86,7 +87,7 @@ export const AminoConverter = { scalingFactors }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index e82624ab3d..c86c71d74d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -110,12 +111,12 @@ export const AminoConverter = { tokenInMaxs }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - share_out_amount: shareOutAmount, + share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -145,12 +146,12 @@ export const AminoConverter = { tokenOutMins }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - share_in_amount: shareInAmount, + share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -180,16 +181,16 @@ export const AminoConverter = { tokenOutMinAmount }: MsgSwapExactAmountIn): MsgSwapExactAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_out_denom: el0.tokenOutDenom + token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - token_out_min_amount: tokenOutMinAmount + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -221,12 +222,12 @@ export const AminoConverter = { tokenOut }: MsgSwapExactAmountOut): MsgSwapExactAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ pool_id: el0.poolId.toString(), - token_in_denom: el0.tokenInDenom + token_in_denom: omitDefault(el0.tokenInDenom) })), - token_in_max_amount: tokenInMaxAmount, + token_in_max_amount: omitDefault(tokenInMaxAmount), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -262,13 +263,13 @@ export const AminoConverter = { shareOutMinAmount }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - share_out_min_amount: shareOutMinAmount + share_out_min_amount: omitDefault(shareOutMinAmount) }; }, fromAmino: ({ @@ -298,11 +299,11 @@ export const AminoConverter = { tokenInMaxAmount }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - token_in_denom: tokenInDenom, - share_out_amount: shareOutAmount, - token_in_max_amount: tokenInMaxAmount + token_in_denom: omitDefault(tokenInDenom), + share_out_amount: omitDefault(shareOutAmount), + token_in_max_amount: omitDefault(tokenInMaxAmount) }; }, fromAmino: ({ @@ -330,13 +331,13 @@ export const AminoConverter = { shareInMaxAmount }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount }, - share_in_max_amount: shareInMaxAmount + share_in_max_amount: omitDefault(shareInMaxAmount) }; }, fromAmino: ({ @@ -366,11 +367,11 @@ export const AminoConverter = { tokenOutMinAmount }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString(), - token_out_denom: tokenOutDenom, - share_in_amount: shareInAmount, - token_out_min_amount: tokenOutMinAmount + token_out_denom: omitDefault(tokenOutDenom), + share_in_amount: omitDefault(shareInAmount), + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index a00674a250..4b6d7884e5 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -3,6 +3,7 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -57,16 +58,16 @@ export const AminoConverter = { }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { is_perpetual: isPerpetual, - owner, + owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, - denom: distributeTo.denom, + denom: omitDefault(distributeTo.denom), duration: (distributeTo.duration * 1_000_000_000).toString(), timestamp: distributeTo.timestamp }, coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), start_time: startTime, num_epochs_paid_over: numEpochsPaidOver.toString() @@ -109,11 +110,11 @@ export const AminoConverter = { rewards }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { - owner, + owner: omitDefault(owner), gauge_id: gaugeId.toString(), rewards: rewards.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index 5a645daaa7..afc07e7e40 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -3,6 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -66,11 +67,11 @@ export const AminoConverter = { coins }: MsgLockTokens): MsgLockTokensAminoType["value"] => { return { - owner, + owner: omitDefault(owner), duration: (duration * 1_000_000_000).toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -98,7 +99,7 @@ export const AminoConverter = { owner }: MsgBeginUnlockingAll): MsgBeginUnlockingAllAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ @@ -117,11 +118,11 @@ export const AminoConverter = { coins }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -148,7 +149,7 @@ export const AminoConverter = { duration }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), duration: (duration * 1_000_000_000).toString() }; @@ -176,11 +177,11 @@ export const AminoConverter = { coins }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { - owner, + owner: omitDefault(owner), ID: ID.toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index ab182966bc..286a368446 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -51,9 +52,9 @@ export const AminoConverter = { valAddr }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString(), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -75,7 +76,7 @@ export const AminoConverter = { lockId }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString() }; }, @@ -96,7 +97,7 @@ export const AminoConverter = { lockId }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { - sender, + sender: omitDefault(sender), lock_id: lockId.toString() }; }, @@ -118,12 +119,12 @@ export const AminoConverter = { valAddr }: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -148,7 +149,7 @@ export const AminoConverter = { poolId }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_id: poolId.toString() }; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index 6ac7848d13..817ccf8440 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -66,8 +67,8 @@ export const AminoConverter = { subdenom }: MsgCreateDenom): MsgCreateDenomAminoType["value"] => { return { - sender, - subdenom + sender: omitDefault(sender), + subdenom: omitDefault(subdenom) }; }, fromAmino: ({ @@ -87,7 +88,7 @@ export const AminoConverter = { amount }: MsgMint): MsgMintAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: amount.amount @@ -114,7 +115,7 @@ export const AminoConverter = { amount }: MsgBurn): MsgBurnAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: amount.amount @@ -142,9 +143,9 @@ export const AminoConverter = { newAdmin }: MsgChangeAdmin): MsgChangeAdminAminoType["value"] => { return { - sender, - denom, - new_admin: newAdmin + sender: omitDefault(sender), + denom: omitDefault(denom), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -166,20 +167,20 @@ export const AminoConverter = { metadata }: MsgSetDenomMetadata): MsgSetDenomMetadataAminoType["value"] => { return { - sender, + sender: omitDefault(sender), metadata: { - description: metadata.description, + description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ - denom: el0.denom, + denom: omitDefault(el0.denom), exponent: el0.exponent, aliases: el0.aliases })), - base: metadata.base, - display: metadata.display, - name: metadata.name, - symbol: metadata.symbol, - uri: metadata.uri, - uri_hash: metadata.uriHash + base: omitDefault(metadata.base), + display: omitDefault(metadata.display), + name: omitDefault(metadata.name), + symbol: omitDefault(metadata.symbol), + uri: omitDefault(metadata.uri), + uri_hash: omitDefault(metadata.uriHash) } }; }, diff --git a/packages/ast/.editorconfig b/packages/ast/.editorconfig index 4a7ea3036a..779f99a12b 100644 --- a/packages/ast/.editorconfig +++ b/packages/ast/.editorconfig @@ -2,7 +2,7 @@ root = true [*] indent_style = space -indent_size = 2 +indent_size = 4 end_of_line = lf charset = utf-8 trim_trailing_whitespace = true diff --git a/packages/ast/src/encoding/amino/to-amino-json/index.ts b/packages/ast/src/encoding/amino/to-amino-json/index.ts index eb40401a18..f23a997110 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/index.ts @@ -135,7 +135,7 @@ export const toAminoParseField = ({ // scalar types... switch (field.type) { case 'string': - return toAmino.string(args); + return toAmino.string(args, true); case 'int64': case 'sint64': case 'uint64': @@ -224,4 +224,4 @@ export const toAminoJsonMethod = ({ )) ); -}; \ No newline at end of file +}; diff --git a/packages/ast/src/encoding/amino/to-amino-json/utils.ts b/packages/ast/src/encoding/amino/to-amino-json/utils.ts index dfe180b424..082a248e81 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/utils.ts @@ -1,15 +1,15 @@ import * as t from '@babel/types'; -import { BILLION, memberExpressionOrIdentifier, shorthandProperty, TypeLong } from "../../../utils"; +import { BILLION, memberExpressionOrIdentifier, TypeLong } from "../../../utils"; import { protoFieldsToArray } from '../utils'; import { ToAminoParseField, toAminoParseField } from './index' -import { getOneOfs, getFieldOptionality } from '../../proto'; +import { getFieldOptionality, getOneOfs } from '../../proto'; import { ProtoField } from '@cosmology/types'; export const toAmino = { defaultType(args: ToAminoParseField) { - if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { - return shorthandProperty(args.field.name); - } + // if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { + // return shorthandProperty(args.field.name); + // } return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), memberExpressionOrIdentifier(args.scope)) }, @@ -21,11 +21,42 @@ export const toAmino = { ) }, - string(args: ToAminoParseField) { - if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { - return shorthandProperty(args.field.name); + string(args: ToAminoParseField, omitEmpty?: boolean) + { + const isCosmosSDKDec = + (args.field.options?.['(gogoproto.customtype)'] == + 'github.com/cosmos/cosmos-sdk/types.Dec') || + (args.field.options?.['(gogoproto.customtype)'] == + 'cosmossdk.io/math.LegacyDec'); + + if (isCosmosSDKDec) { + args.context.addUtil('padDecimal'); + return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), + t.callExpression( + t.identifier('padDecimal'), + [ + memberExpressionOrIdentifier(args.scope) + ] + ) + ) } - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), memberExpressionOrIdentifier(args.scope)) + + let valueExpr = omitEmpty ? + this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : + memberExpressionOrIdentifier(args.scope); + + return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), valueExpr) + }, + + omitDefaultMemberExpressionOrIdentifier(args: ToAminoParseField, names) + { + args.context.addUtil('omitDefault'); + return t.callExpression( + t.identifier('omitDefault'), + [ + memberExpressionOrIdentifier(names) + ] + ); }, rawBytes(args: ToAminoParseField) { diff --git a/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts b/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts index d6ef416bae..33da9f6f6c 100644 --- a/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts +++ b/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts @@ -3,7 +3,8 @@ import { ToAminoParseField } from './index'; export declare const toAmino: { defaultType(args: ToAminoParseField): t.ObjectProperty; long(args: ToAminoParseField): t.ObjectProperty; - string(args: ToAminoParseField): t.ObjectProperty; + string(args: ToAminoParseField, omitEmpty?: boolean): t.ObjectProperty; + omitDefaultMemberExpressionOrIdentifier(args: ToAminoParseField, names: any): t.CallExpression; rawBytes(args: ToAminoParseField): t.ObjectProperty; wasmByteCode(args: ToAminoParseField): t.ObjectProperty; duration(args: ToAminoParseField): t.ObjectProperty; diff --git a/packages/telescope/package.json b/packages/telescope/package.json index 93832e91c1..3cc22c3d17 100644 --- a/packages/telescope/package.json +++ b/packages/telescope/package.json @@ -104,6 +104,6 @@ "mkdirp": "3.0.0", "parse-package-name": "1.0.0", "rimraf": "5.0.0", - "shelljs": "0.8.5" + "@keplr-wallet/unit": "^0.12.53" } } diff --git a/packages/telescope/src/build.ts b/packages/telescope/src/build.ts index 7d6129e37d..97892e4f6f 100644 --- a/packages/telescope/src/build.ts +++ b/packages/telescope/src/build.ts @@ -229,4 +229,4 @@ export class TelescopeParseContext implements TelescopeParseContext { mutations: getMutations(this.mutations) })); } -} \ No newline at end of file +} diff --git a/packages/telescope/src/helpers/internal.ts b/packages/telescope/src/helpers/internal.ts index 9349e04a7c..abb54701a9 100644 --- a/packages/telescope/src/helpers/internal.ts +++ b/packages/telescope/src/helpers/internal.ts @@ -1,5 +1,6 @@ export const internal = `import * as _m0 from "protobufjs/minimal"; import Long from 'long'; +import { Dec } from "@keplr-wallet/unit"; // @ts-ignore if (_m0.util.Long !== Long) { @@ -59,7 +60,7 @@ export function omitDefault(input: T): T | und } if (Long.isLong(input)) { - return input.isZero() ? undefined : input; + return (input as Long).isZero() ? undefined : input; } throw new Error(\`Got unsupported type \${typeof input}\`); @@ -134,7 +135,7 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.key !== "undefined") { // String to Uint8Array - // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); // Uint8Array to String options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64'); @@ -144,7 +145,7 @@ export const setPaginationParams = (options: Params, pagination?: PageRequest) = } if (typeof pagination?.offset !== "undefined") { options.params["pagination.offset"] = pagination.offset.toString() - } + } if (typeof pagination?.reverse !== "undefined") { options.params['pagination.reverse'] = pagination.reverse; } @@ -220,7 +221,7 @@ const timestampFromJSON = (object: any): Timestamp => { nanos: isSet(object.nanos) ? Number(object.nanos) : 0, }; } - + export function fromJsonTimestamp(o: any): Timestamp { if (o instanceof Date) { return toTimestamp(o); @@ -230,8 +231,12 @@ export function fromJsonTimestamp(o: any): Timestamp { return timestampFromJSON(o); } } - + function numberToLong(number: number) { return Long.fromNumber(number); } -`; \ No newline at end of file + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} +`; diff --git a/packages/telescope/src/utils/index.ts b/packages/telescope/src/utils/index.ts index 8f9253e1a6..547a26eddd 100644 --- a/packages/telescope/src/utils/index.ts +++ b/packages/telescope/src/utils/index.ts @@ -20,6 +20,7 @@ export const UTILS = { bytesFromBase64: '__helpers__', BrowserHeaders: 'browser-headers', Decimal: '@cosmjs/math', + padDecimal: '__helpers__', createProtobufRpcClient: '@cosmjs/stargate', Pubkey: '@cosmjs/amino', decodeBech32Pubkey: '@cosmjs/amino', diff --git a/packages/telescope/types/helpers/internal.d.ts b/packages/telescope/types/helpers/internal.d.ts index a8316767e6..8665027f03 100644 --- a/packages/telescope/types/helpers/internal.d.ts +++ b/packages/telescope/types/helpers/internal.d.ts @@ -1 +1 @@ -export declare const internal = "import * as _m0 from \"protobufjs/minimal\";\nimport Long from 'long';\n\n// @ts-ignore\nif (_m0.util.Long !== Long) {\n _m0.util.Long = (Long as any);\n\n _m0.configure();\n}\n\nexport { Long };\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n};\n\nexport function omitDefault(input: T): T | undefined {\n if (typeof input === \"string\") {\n return input === \"\" ? undefined : input;\n }\n\n if (typeof input === \"number\") {\n return input === 0 ? undefined : input;\n }\n\n if (Long.isLong(input)) {\n return input.isZero() ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n};\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: Long;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n};\n\nexport function fromDuration(duration: Duration): string {\n return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();\n};\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n};\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n};\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: Long;\n limit: Long;\n countTotal: boolean;\n reverse: boolean;\n};\n\nexport interface PageRequestParams {\n \"pagination.key\"?: string;\n \"pagination.offset\"?: string;\n \"pagination.limit\"?: string;\n \"pagination.count_total\"?: boolean;\n \"pagination.reverse\"?: boolean;\n};\n\nexport interface Params {\n params: PageRequestParams;\n};\n\nexport const setPaginationParams = (options: Params, pagination?: PageRequest) => {\n\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== \"undefined\") {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== \"undefined\") {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); \n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');\n }\n if (typeof pagination?.limit !== \"undefined\") {\n options.params[\"pagination.limit\"] = pagination.limit.toString()\n }\n if (typeof pagination?.offset !== \"undefined\") {\n options.params[\"pagination.offset\"] = pagination.offset.toString()\n } \n if (typeof pagination?.reverse !== \"undefined\") {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record>, never>;\n\nexport interface Rpc {\n request(service: string, method: string, data: Uint8Array): Promise;\n};\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: Long;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = date.getTime() % 1000 * 1000000;\n return {\n seconds,\n nanos\n };\n};\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n};\n\nconst fromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromString(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n}\n \nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === \"string\") {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n \nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n"; +export declare const internal = "import * as _m0 from \"protobufjs/minimal\";\nimport Long from 'long';\nimport { Dec } from \"@keplr-wallet/unit\";\n\n// @ts-ignore\nif (_m0.util.Long !== Long) {\n _m0.util.Long = (Long as any);\n\n _m0.configure();\n}\n\nexport { Long };\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n};\n\nexport function omitDefault(input: T): T | undefined {\n if (typeof input === \"string\") {\n return input === \"\" ? undefined : input;\n }\n\n if (typeof input === \"number\") {\n return input === 0 ? undefined : input;\n }\n\n if (Long.isLong(input)) {\n return (input as Long).isZero() ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n};\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: Long;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n};\n\nexport function fromDuration(duration: Duration): string {\n return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();\n};\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n};\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n};\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: Long;\n limit: Long;\n countTotal: boolean;\n reverse: boolean;\n};\n\nexport interface PageRequestParams {\n \"pagination.key\"?: string;\n \"pagination.offset\"?: string;\n \"pagination.limit\"?: string;\n \"pagination.count_total\"?: boolean;\n \"pagination.reverse\"?: boolean;\n};\n\nexport interface Params {\n params: PageRequestParams;\n};\n\nexport const setPaginationParams = (options: Params, pagination?: PageRequest) => {\n\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== \"undefined\") {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== \"undefined\") {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');\n }\n if (typeof pagination?.limit !== \"undefined\") {\n options.params[\"pagination.limit\"] = pagination.limit.toString()\n }\n if (typeof pagination?.offset !== \"undefined\") {\n options.params[\"pagination.offset\"] = pagination.offset.toString()\n }\n if (typeof pagination?.reverse !== \"undefined\") {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record>, never>;\n\nexport interface Rpc {\n request(service: string, method: string, data: Uint8Array): Promise;\n};\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: Long;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = date.getTime() % 1000 * 1000000;\n return {\n seconds,\n nanos\n };\n};\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n};\n\nconst fromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromString(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n}\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === \"string\") {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nexport function padDecimal(decStr: string): string{\n return decStr ? new Dec(decStr).toString() : decStr;\n}\n"; diff --git a/packages/telescope/types/utils/index.d.ts b/packages/telescope/types/utils/index.d.ts index 8aa2d48cc2..768f1beb36 100644 --- a/packages/telescope/types/utils/index.d.ts +++ b/packages/telescope/types/utils/index.d.ts @@ -14,6 +14,7 @@ export declare const UTILS: { bytesFromBase64: string; BrowserHeaders: string; Decimal: string; + padDecimal: string; createProtobufRpcClient: string; Pubkey: string; decodeBech32Pubkey: string; diff --git a/yarn.lock b/yarn.lock index bbf5d017d2..d31c6b80ed 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2044,6 +2044,13 @@ axios "^0.27.2" long "^4.0.0" +"@keplr-wallet/types@0.12.53": + version "0.12.53" + resolved "https://registry.npmjs.org/@keplr-wallet/types/-/types-0.12.53.tgz#6b5c0112c02c4330d6b46c336c658c729428bcb7" + integrity sha512-9YSt3kwzdPGOv/0qGjEx+sv2989FOpvGV1cyBCVLTLdZ6q6SO8XYWivS090BXVln6x8jqSf5IstfnruK0kIKSA== + dependencies: + long "^4.0.0" + "@keplr-wallet/unit@0.11.22": version "0.11.22" resolved "https://registry.npmjs.org/@keplr-wallet/unit/-/unit-0.11.22.tgz" @@ -2062,6 +2069,15 @@ big-integer "^1.6.48" utility-types "^3.10.0" +"@keplr-wallet/unit@^0.12.53": + version "0.12.53" + resolved "https://registry.npmjs.org/@keplr-wallet/unit/-/unit-0.12.53.tgz#a31997b27d24c700cf17f4111fd5379831550386" + integrity sha512-KcBTi7EKpU5j7emIv0Ov9hAIKGDl462gxlG6yyGn1Ar8ySHok/ooDH9mvThPloxHI7kblvVfriV1YQbd9aqurg== + dependencies: + "@keplr-wallet/types" "0.12.53" + big-integer "^1.6.48" + utility-types "^3.10.0" + "@lerna/child-process@7.0.2": version "7.0.2" resolved "https://registry.npmjs.org/@lerna/child-process/-/child-process-7.0.2.tgz" From 1c4296c5eb5cb48b42b6c9ba7523f8faa8a8bcbe Mon Sep 17 00:00:00 2001 From: Rasoul Date: Wed, 27 Dec 2023 11:55:52 +0330 Subject: [PATCH 02/24] feat: add emit default and fix timestamp --- .../output/google/api/expr/v1alpha1/eval.ts | 4 +- __fixtures__/misc/output/helpers.ts | 12 +- __fixtures__/misc/output/misc/eval_request.ts | 6 +- .../akash/audit/v1beta1/audit.amino.ts | 8 +- .../akash/audit/v1beta2/audit.amino.ts | 8 +- .../output1/akash/cert/v1beta2/cert.amino.ts | 7 +- .../akash/deployment/v1beta2/service.amino.ts | 36 ++-- .../akash/market/v1beta2/service.amino.ts | 30 +-- .../akash/provider/v1beta1/provider.amino.ts | 18 +- .../akash/provider/v1beta2/provider.amino.ts | 18 +- .../output1/cosmos/gov/v1/tx.amino.ts | 6 +- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../output1/cosmos/group/v1/tx.amino.ts | 18 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 3 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 2 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 8 +- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../output1/evmos/vesting/v1/tx.amino.ts | 6 +- __fixtures__/output1/helpers.ts | 6 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../output1/ibc/core/channel/v1/tx.amino.ts | 20 +- .../ibc/core/connection/v1/tx.amino.ts | 4 +- .../gamm/pool-models/stableswap/tx.amino.ts | 2 +- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 16 +- .../output1/osmosis/incentives/tx.amino.ts | 6 +- .../output1/osmosis/lockup/tx.amino.ts | 6 +- .../output1/osmosis/superfluid/tx.amino.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 2 +- __fixtures__/output2/helpers.ts | 6 +- .../akash/audit/v1beta1/audit.amino.ts | 8 +- .../akash/audit/v1beta2/audit.amino.ts | 8 +- .../outputosmojs/akash/audit/v1beta2/query.ts | 14 +- .../akash/base/v1beta1/attribute.ts | 6 +- .../akash/base/v1beta1/endpoint.ts | 4 +- .../akash/base/v1beta2/attribute.ts | 6 +- .../akash/base/v1beta2/endpoint.ts | 4 +- .../akash/cert/v1beta2/cert.amino.ts | 7 +- .../akash/deployment/v1beta1/deployment.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 6 +- .../akash/deployment/v1beta2/deployment.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 4 +- .../akash/deployment/v1beta2/groupid.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 36 ++-- .../akash/escrow/v1beta1/query.ts | 20 +- .../akash/escrow/v1beta1/types.ts | 2 +- .../akash/escrow/v1beta2/query.ts | 20 +- .../akash/escrow/v1beta2/types.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 8 +- .../outputosmojs/akash/market/v1beta2/bid.ts | 8 +- .../akash/market/v1beta2/lease.ts | 10 +- .../akash/market/v1beta2/order.ts | 8 +- .../akash/market/v1beta2/service.amino.ts | 30 +-- .../akash/provider/v1beta1/provider.amino.ts | 18 +- .../akash/provider/v1beta2/provider.amino.ts | 18 +- .../akash/provider/v1beta2/query.ts | 4 +- .../outputosmojs/capability/v1/capability.ts | 8 +- .../outputosmojs/capability/v1/genesis.ts | 6 +- .../v-next/outputosmojs/confio/proofs.ts | 24 +-- .../cosmos/app/v1alpha1/config.ts | 4 +- .../cosmos/app/v1alpha1/module.ts | 10 +- .../outputosmojs/cosmos/auth/v1beta1/auth.ts | 20 +- .../outputosmojs/cosmos/auth/v1beta1/query.ts | 10 +- .../cosmos/authz/v1beta1/authz.ts | 12 +- .../cosmos/authz/v1beta1/query.ts | 12 +- .../outputosmojs/cosmos/authz/v1beta1/tx.ts | 14 +- .../outputosmojs/cosmos/bank/v1beta1/bank.ts | 30 +-- .../cosmos/bank/v1beta1/genesis.ts | 4 +- .../outputosmojs/cosmos/bank/v1beta1/query.ts | 18 +- .../outputosmojs/cosmos/bank/v1beta1/tx.ts | 6 +- .../cosmos/base/abci/v1beta1/abci.ts | 48 ++--- .../cosmos/base/node/v1beta1/query.ts | 4 +- .../cosmos/base/query/v1beta1/pagination.ts | 12 +- .../base/reflection/v1beta1/reflection.ts | 4 +- .../base/reflection/v2alpha1/reflection.ts | 32 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 18 +- .../cosmos/base/store/v1beta1/commit_info.ts | 8 +- .../cosmos/base/store/v1beta1/listening.ts | 6 +- .../cosmos/base/tendermint/v1beta1/query.ts | 38 ++-- .../outputosmojs/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 8 +- .../cosmos/capability/v1beta1/genesis.ts | 6 +- .../outputosmojs/cosmos/crisis/v1beta1/tx.ts | 8 +- .../outputosmojs/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../cosmos/crypto/multisig/keys.ts | 4 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 42 ++-- .../cosmos/distribution/v1beta1/genesis.ts | 28 +-- .../cosmos/distribution/v1beta1/query.ts | 24 +-- .../cosmos/distribution/v1beta1/tx.ts | 14 +- .../cosmos/evidence/v1beta1/evidence.ts | 10 +- .../cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 10 +- .../cosmos/feegrant/v1beta1/query.ts | 10 +- .../cosmos/feegrant/v1beta1/tx.ts | 10 +- .../outputosmojs/cosmos/gov/v1/genesis.ts | 4 +- .../v-next/outputosmojs/cosmos/gov/v1/gov.ts | 44 ++--- .../outputosmojs/cosmos/gov/v1/query.ts | 26 +-- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 6 +- .../v-next/outputosmojs/cosmos/gov/v1/tx.ts | 28 +-- .../cosmos/gov/v1beta1/genesis.ts | 4 +- .../outputosmojs/cosmos/gov/v1beta1/gov.ts | 40 ++-- .../outputosmojs/cosmos/gov/v1beta1/query.ts | 26 +-- .../cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../outputosmojs/cosmos/gov/v1beta1/tx.ts | 20 +- .../outputosmojs/cosmos/group/v1/events.ts | 24 +-- .../outputosmojs/cosmos/group/v1/genesis.ts | 8 +- .../outputosmojs/cosmos/group/v1/query.ts | 30 +-- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 18 +- .../v-next/outputosmojs/cosmos/group/v1/tx.ts | 90 ++++----- .../outputosmojs/cosmos/group/v1/types.ts | 78 ++++---- .../outputosmojs/cosmos/ics23/v1/proofs.ts | 24 +-- .../outputosmojs/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputosmojs/cosmos/nft/v1beta1/event.ts | 22 +-- .../cosmos/nft/v1beta1/genesis.ts | 4 +- .../outputosmojs/cosmos/nft/v1beta1/nft.ts | 22 +-- .../outputosmojs/cosmos/nft/v1beta1/query.ts | 28 +-- .../outputosmojs/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputosmojs/cosmos/orm/v1/orm.ts | 16 +- .../cosmos/orm/v1alpha1/schema.ts | 8 +- .../cosmos/params/v1beta1/params.ts | 12 +- .../cosmos/params/v1beta1/query.ts | 8 +- .../cosmos/slashing/v1beta1/genesis.ts | 10 +- .../cosmos/slashing/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/slashing.ts | 16 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 3 +- .../cosmos/staking/v1beta1/authz.ts | 4 +- .../cosmos/staking/v1beta1/genesis.ts | 8 +- .../cosmos/staking/v1beta1/query.ts | 36 ++-- .../cosmos/staking/v1beta1/staking.ts | 90 ++++----- .../outputosmojs/cosmos/staking/v1beta1/tx.ts | 32 ++-- .../cosmos/tx/signing/v1beta1/signing.ts | 6 +- .../outputosmojs/cosmos/tx/v1beta1/service.ts | 10 +- .../outputosmojs/cosmos/tx/v1beta1/tx.ts | 32 ++-- .../cosmos/upgrade/v1beta1/query.ts | 12 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 2 +- .../outputosmojs/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 22 +-- .../cosmos/vesting/v1beta1/tx.amino.ts | 8 +- .../outputosmojs/cosmos/vesting/v1beta1/tx.ts | 20 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../outputosmojs/cosmos_proto/cosmos.ts | 10 +- .../outputosmojs/cosmwasm/wasm/v1/authz.ts | 8 +- .../outputosmojs/cosmwasm/wasm/v1/genesis.ts | 10 +- .../outputosmojs/cosmwasm/wasm/v1/ibc.ts | 10 +- .../outputosmojs/cosmwasm/wasm/v1/proposal.ts | 64 +++---- .../outputosmojs/cosmwasm/wasm/v1/query.ts | 22 +-- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/tx.ts | 36 ++-- .../outputosmojs/cosmwasm/wasm/v1/types.ts | 32 ++-- .../outputosmojs/evmos/claims/v1/claims.ts | 14 +- .../outputosmojs/evmos/claims/v1/genesis.ts | 8 +- .../outputosmojs/evmos/claims/v1/query.ts | 6 +- .../outputosmojs/evmos/epochs/v1/genesis.ts | 14 +- .../outputosmojs/evmos/epochs/v1/query.ts | 6 +- .../outputosmojs/evmos/erc20/v1/erc20.ts | 26 +-- .../outputosmojs/evmos/erc20/v1/genesis.ts | 6 +- .../outputosmojs/evmos/erc20/v1/query.ts | 4 +- .../v-next/outputosmojs/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputosmojs/evmos/fees/v1/fees.ts | 8 +- .../outputosmojs/evmos/fees/v1/genesis.ts | 12 +- .../outputosmojs/evmos/fees/v1/query.ts | 6 +- .../v-next/outputosmojs/evmos/fees/v1/tx.ts | 18 +- .../evmos/incentives/v1/genesis.ts | 10 +- .../evmos/incentives/v1/incentives.ts | 30 +-- .../outputosmojs/evmos/incentives/v1/query.ts | 14 +- .../evmos/inflation/v1/genesis.ts | 14 +- .../evmos/inflation/v1/inflation.ts | 18 +- .../outputosmojs/evmos/inflation/v1/query.ts | 8 +- .../outputosmojs/evmos/recovery/v1/genesis.ts | 4 +- .../outputosmojs/evmos/vesting/v1/query.ts | 4 +- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 6 +- .../outputosmojs/evmos/vesting/v1/tx.ts | 16 +- .../outputosmojs/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputosmojs/google/api/auth.ts | 28 +-- .../v-next/outputosmojs/google/api/backend.ts | 20 +- .../v-next/outputosmojs/google/api/billing.ts | 4 +- .../outputosmojs/google/api/config_change.ts | 12 +- .../outputosmojs/google/api/consumer.ts | 8 +- .../v-next/outputosmojs/google/api/context.ts | 4 +- .../v-next/outputosmojs/google/api/control.ts | 4 +- .../outputosmojs/google/api/distribution.ts | 28 +-- .../outputosmojs/google/api/documentation.ts | 20 +- .../outputosmojs/google/api/endpoint.ts | 8 +- .../v1alpha1/conformance_service.ts | 22 +-- .../google/api/expr/v1alpha1/checked.ts | 34 ++-- .../google/api/expr/v1alpha1/eval.ts | 6 +- .../google/api/expr/v1alpha1/explain.ts | 6 +- .../google/api/expr/v1alpha1/syntax.ts | 54 +++--- .../google/api/expr/v1alpha1/value.ts | 20 +- .../google/api/expr/v1beta1/decl.ts | 14 +- .../google/api/expr/v1beta1/eval.ts | 6 +- .../google/api/expr/v1beta1/expr.ts | 36 ++-- .../google/api/expr/v1beta1/source.ts | 16 +- .../google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputosmojs/google/api/http.ts | 24 +-- .../outputosmojs/google/api/httpbody.ts | 4 +- .../v-next/outputosmojs/google/api/label.ts | 8 +- .../v-next/outputosmojs/google/api/log.ts | 8 +- .../v-next/outputosmojs/google/api/logging.ts | 4 +- .../v-next/outputosmojs/google/api/metric.ts | 26 +-- .../google/api/monitored_resource.ts | 22 +-- .../outputosmojs/google/api/monitoring.ts | 4 +- .../v-next/outputosmojs/google/api/quota.ts | 30 +-- .../outputosmojs/google/api/resource.ts | 16 +- .../v-next/outputosmojs/google/api/routing.ts | 6 +- .../v-next/outputosmojs/google/api/service.ts | 10 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 24 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 32 ++-- .../api/servicecontrol/v1/metric_value.ts | 20 +- .../google/api/servicecontrol/v1/operation.ts | 18 +- .../api/servicecontrol/v1/quota_controller.ts | 28 +-- .../servicecontrol/v1/service_controller.ts | 28 +-- .../servicecontrol/v2/service_controller.ts | 26 +-- .../api/servicemanagement/v1/resources.ts | 42 ++-- .../servicemanagement/v1/servicemanager.ts | 58 +++--- .../google/api/serviceusage/v1/resources.ts | 12 +- .../api/serviceusage/v1/serviceusage.ts | 30 +-- .../api/serviceusage/v1beta1/resources.ts | 70 +++---- .../api/serviceusage/v1beta1/serviceusage.ts | 90 ++++----- .../google/api/system_parameter.ts | 10 +- .../v-next/outputosmojs/google/api/usage.ts | 10 +- .../outputosmojs/google/api/visibility.ts | 6 +- .../google/logging/type/http_request.ts | 30 +-- .../google/logging/v2/log_entry.ts | 44 ++--- .../outputosmojs/google/logging/v2/logging.ts | 46 ++--- .../google/logging/v2/logging_config.ts | 180 +++++++++--------- .../google/logging/v2/logging_metrics.ts | 38 ++-- .../google/longrunning/operations.ts | 28 +-- .../outputosmojs/google/protobuf/any.ts | 2 +- .../outputosmojs/google/protobuf/api.ts | 24 +-- .../google/protobuf/compiler/plugin.ts | 20 +- .../google/protobuf/descriptor.ts | 156 +++++++-------- .../outputosmojs/google/protobuf/duration.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../outputosmojs/google/protobuf/struct.ts | 12 +- .../outputosmojs/google/protobuf/timestamp.ts | 2 +- .../outputosmojs/google/protobuf/type.ts | 34 ++-- .../outputosmojs/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 88 ++++----- .../outputosmojs/google/rpc/error_details.ts | 46 ++--- .../v-next/outputosmojs/google/rpc/status.ts | 6 +- __fixtures__/v-next/outputosmojs/helpers.ts | 12 +- .../ibc/applications/fee/v1/ack.ts | 6 +- .../ibc/applications/fee/v1/fee.ts | 4 +- .../ibc/applications/fee/v1/genesis.ts | 20 +- .../ibc/applications/fee/v1/metadata.ts | 6 +- .../ibc/applications/fee/v1/query.ts | 32 ++-- .../ibc/applications/fee/v1/tx.ts | 24 +-- .../controller/v1/controller.ts | 4 +- .../controller/v1/query.ts | 8 +- .../controller/v1/tx.amino.ts | 2 +- .../interchain_accounts/controller/v1/tx.ts | 20 +- .../interchain_accounts/genesis/v1/genesis.ts | 18 +- .../interchain_accounts/host/v1/host.ts | 4 +- .../interchain_accounts/v1/account.ts | 4 +- .../interchain_accounts/v1/metadata.ts | 14 +- .../interchain_accounts/v1/packet.ts | 6 +- .../ibc/applications/transfer/v1/authz.ts | 6 +- .../ibc/applications/transfer/v1/genesis.ts | 4 +- .../ibc/applications/transfer/v1/query.ts | 4 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../ibc/core/channel/v1/channel.ts | 42 ++-- .../ibc/core/channel/v1/genesis.ts | 10 +- .../outputosmojs/ibc/core/channel/v1/query.ts | 64 +++---- .../ibc/core/channel/v1/tx.amino.ts | 20 +- .../outputosmojs/ibc/core/channel/v1/tx.ts | 54 +++--- .../outputosmojs/ibc/core/client/v1/client.ts | 22 +-- .../ibc/core/client/v1/genesis.ts | 8 +- .../outputosmojs/ibc/core/client/v1/query.ts | 18 +- .../outputosmojs/ibc/core/client/v1/tx.ts | 16 +- .../ibc/core/connection/v1/connection.ts | 26 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../ibc/core/connection/v1/query.ts | 16 +- .../ibc/core/connection/v1/tx.amino.ts | 4 +- .../outputosmojs/ibc/core/connection/v1/tx.ts | 26 +-- .../outputosmojs/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 40 ++-- .../solomachine/v2/solomachine.ts | 40 ++-- .../solomachine/v3/solomachine.ts | 28 +-- .../lightclients/tendermint/v1/tendermint.ts | 16 +- .../osmosis/accum/v1beta1/accum.ts | 6 +- .../osmosis/claim/v1beta1/claim.ts | 4 +- .../osmosis/claim/v1beta1/params.ts | 6 +- .../osmosis/claim/v1beta1/query.ts | 10 +- .../osmosis/concentrated-liquidity/genesis.ts | 10 +- .../incentive_record.ts | 14 +- .../pool-model/query.ts | 34 ++-- .../concentrated-liquidity/pool-model/tx.ts | 16 +- .../osmosis/concentrated-liquidity/pool.ts | 26 +-- .../concentrated-liquidity/position.ts | 16 +- .../concentrated-liquidity/tickInfo.ts | 6 +- .../concentrated-liquidity/tx.amino.ts | 8 +- .../osmosis/concentrated-liquidity/tx.ts | 62 +++--- .../cosmwasmpool/v1beta1/model/pool.ts | 10 +- .../osmosis/cosmwasmpool/v1beta1/model/tx.ts | 8 +- .../downtime-detector/v1beta1/genesis.ts | 8 +- .../downtime-detector/v1beta1/query.ts | 6 +- .../outputosmojs/osmosis/epochs/genesis.ts | 14 +- .../outputosmojs/osmosis/epochs/query.ts | 6 +- .../gamm/pool-models/balancer/balancerPool.ts | 18 +- .../gamm/pool-models/balancer/tx/tx.ts | 8 +- .../pool-models/stableswap/stableswap_pool.ts | 14 +- .../gamm/pool-models/stableswap/tx.amino.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../osmosis/gamm/v1beta1/genesis.ts | 4 +- .../outputosmojs/osmosis/gamm/v1beta1/gov.ts | 10 +- .../osmosis/gamm/v1beta1/query.ts | 54 +++--- .../osmosis/gamm/v1beta1/tx.amino.ts | 16 +- .../outputosmojs/osmosis/gamm/v1beta1/tx.ts | 76 ++++---- .../outputosmojs/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputosmojs/osmosis/incentives/gauge.ts | 12 +- .../osmosis/incentives/genesis.ts | 4 +- .../outputosmojs/osmosis/incentives/params.ts | 4 +- .../outputosmojs/osmosis/incentives/query.ts | 12 +- .../osmosis/incentives/tx.amino.ts | 6 +- .../outputosmojs/osmosis/incentives/tx.ts | 14 +- .../outputosmojs/osmosis/lockup/genesis.ts | 4 +- .../outputosmojs/osmosis/lockup/lock.ts | 20 +- .../outputosmojs/osmosis/lockup/query.ts | 44 ++--- .../outputosmojs/osmosis/lockup/tx.amino.ts | 6 +- .../v-next/outputosmojs/osmosis/lockup/tx.ts | 26 +-- .../osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputosmojs/osmosis/mint/v1beta1/mint.ts | 28 +-- .../osmosis/pool-incentives/v1beta1/gov.ts | 10 +- .../pool-incentives/v1beta1/incentives.ts | 14 +- .../osmosis/pool-incentives/v1beta1/query.ts | 12 +- .../osmosis/poolmanager/v1beta1/genesis.ts | 4 +- .../poolmanager/v1beta1/module_route.ts | 6 +- .../osmosis/poolmanager/v1beta1/query.ts | 40 ++-- .../osmosis/poolmanager/v1beta1/swap_route.ts | 10 +- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 4 +- .../osmosis/poolmanager/v1beta1/tx.ts | 14 +- .../osmosis/protorev/v1beta1/genesis.ts | 14 +- .../osmosis/protorev/v1beta1/gov.ts | 14 +- .../osmosis/protorev/v1beta1/params.ts | 6 +- .../osmosis/protorev/v1beta1/protorev.ts | 26 +-- .../osmosis/protorev/v1beta1/query.ts | 16 +- .../osmosis/protorev/v1beta1/tx.amino.ts | 12 +- .../osmosis/protorev/v1beta1/tx.ts | 20 +- .../osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputosmojs/osmosis/superfluid/params.ts | 4 +- .../outputosmojs/osmosis/superfluid/query.ts | 50 ++--- .../osmosis/superfluid/superfluid.ts | 26 +-- .../osmosis/superfluid/tx.amino.ts | 8 +- .../outputosmojs/osmosis/superfluid/tx.ts | 26 +-- .../osmosis/superfluid/v1beta1/gov.ts | 16 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/query.ts | 6 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 2 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../osmosis/twap/v1beta1/genesis.ts | 4 +- .../osmosis/twap/v1beta1/query.ts | 24 +-- .../osmosis/twap/v1beta1/twap_record.ts | 22 +-- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 4 +- .../osmosis/txfees/v1beta1/gov.ts | 6 +- .../osmosis/txfees/v1beta1/query.ts | 14 +- .../osmosis/valset-pref/v1beta1/query.ts | 4 +- .../osmosis/valset-pref/v1beta1/state.ts | 6 +- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 2 +- .../osmosis/valset-pref/v1beta1/tx.ts | 16 +- .../outputosmojs/tendermint/abci/types.ts | 134 ++++++------- .../outputosmojs/tendermint/crypto/proof.ts | 14 +- .../tendermint/libs/bits/types.ts | 4 +- .../outputosmojs/tendermint/p2p/types.ts | 34 ++-- .../outputosmojs/tendermint/types/evidence.ts | 14 +- .../outputosmojs/tendermint/types/params.ts | 18 +- .../outputosmojs/tendermint/types/types.ts | 44 ++--- .../tendermint/types/validator.ts | 10 +- .../outputosmojs/tendermint/version/types.ts | 10 +- .../outputv2/akash/audit/v1beta2/query.ts | 14 +- .../outputv2/akash/base/v1beta1/attribute.ts | 6 +- .../outputv2/akash/base/v1beta1/endpoint.ts | 4 +- .../outputv2/akash/base/v1beta2/attribute.ts | 6 +- .../outputv2/akash/base/v1beta2/endpoint.ts | 4 +- .../akash/deployment/v1beta1/deployment.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 6 +- .../akash/deployment/v1beta2/deployment.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 4 +- .../akash/deployment/v1beta2/groupid.ts | 2 +- .../outputv2/akash/escrow/v1beta1/query.ts | 20 +- .../outputv2/akash/escrow/v1beta1/types.ts | 2 +- .../outputv2/akash/escrow/v1beta2/query.ts | 20 +- .../outputv2/akash/escrow/v1beta2/types.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 8 +- .../outputv2/akash/market/v1beta2/bid.ts | 8 +- .../outputv2/akash/market/v1beta2/lease.ts | 10 +- .../outputv2/akash/market/v1beta2/order.ts | 8 +- .../outputv2/akash/provider/v1beta2/query.ts | 4 +- __fixtures__/v-next/outputv2/confio/proofs.ts | 24 +-- .../outputv2/cosmos/app/v1alpha1/config.ts | 4 +- .../outputv2/cosmos/app/v1alpha1/module.ts | 10 +- .../outputv2/cosmos/auth/v1beta1/auth.ts | 20 +- .../outputv2/cosmos/auth/v1beta1/query.ts | 10 +- .../outputv2/cosmos/authz/v1beta1/authz.ts | 12 +- .../outputv2/cosmos/authz/v1beta1/query.ts | 12 +- .../outputv2/cosmos/authz/v1beta1/tx.ts | 14 +- .../outputv2/cosmos/bank/v1beta1/bank.ts | 30 +-- .../outputv2/cosmos/bank/v1beta1/genesis.ts | 4 +- .../outputv2/cosmos/bank/v1beta1/query.ts | 18 +- .../v-next/outputv2/cosmos/bank/v1beta1/tx.ts | 6 +- .../outputv2/cosmos/base/abci/v1beta1/abci.ts | 48 ++--- .../cosmos/base/query/v1beta1/pagination.ts | 12 +- .../base/reflection/v1beta1/reflection.ts | 4 +- .../base/reflection/v2alpha1/reflection.ts | 32 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 18 +- .../cosmos/base/store/v1beta1/commit_info.ts | 8 +- .../cosmos/base/store/v1beta1/listening.ts | 6 +- .../cosmos/base/tendermint/v1beta1/query.ts | 38 ++-- .../outputv2/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 8 +- .../cosmos/capability/v1beta1/genesis.ts | 6 +- .../outputv2/cosmos/crisis/v1beta1/tx.ts | 8 +- .../v-next/outputv2/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../outputv2/cosmos/crypto/multisig/keys.ts | 4 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 42 ++-- .../cosmos/distribution/v1beta1/genesis.ts | 28 +-- .../cosmos/distribution/v1beta1/query.ts | 24 +-- .../cosmos/distribution/v1beta1/tx.ts | 14 +- .../cosmos/evidence/v1beta1/evidence.ts | 10 +- .../outputv2/cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 10 +- .../outputv2/cosmos/feegrant/v1beta1/query.ts | 10 +- .../outputv2/cosmos/feegrant/v1beta1/tx.ts | 10 +- .../v-next/outputv2/cosmos/gov/v1/genesis.ts | 4 +- .../v-next/outputv2/cosmos/gov/v1/gov.ts | 44 ++--- .../v-next/outputv2/cosmos/gov/v1/query.ts | 26 +-- .../v-next/outputv2/cosmos/gov/v1/tx.ts | 28 +-- .../outputv2/cosmos/gov/v1beta1/genesis.ts | 4 +- .../v-next/outputv2/cosmos/gov/v1beta1/gov.ts | 40 ++-- .../outputv2/cosmos/gov/v1beta1/query.ts | 26 +-- .../v-next/outputv2/cosmos/gov/v1beta1/tx.ts | 20 +- .../v-next/outputv2/cosmos/group/v1/events.ts | 24 +-- .../outputv2/cosmos/group/v1/genesis.ts | 8 +- .../v-next/outputv2/cosmos/group/v1/query.ts | 30 +-- .../v-next/outputv2/cosmos/group/v1/tx.ts | 90 ++++----- .../v-next/outputv2/cosmos/group/v1/types.ts | 78 ++++---- .../outputv2/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputv2/cosmos/nft/v1beta1/event.ts | 22 +-- .../outputv2/cosmos/nft/v1beta1/genesis.ts | 4 +- .../v-next/outputv2/cosmos/nft/v1beta1/nft.ts | 22 +-- .../outputv2/cosmos/nft/v1beta1/query.ts | 28 +-- .../v-next/outputv2/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputv2/cosmos/orm/v1/orm.ts | 16 +- .../outputv2/cosmos/orm/v1alpha1/schema.ts | 8 +- .../outputv2/cosmos/params/v1beta1/params.ts | 12 +- .../outputv2/cosmos/params/v1beta1/query.ts | 8 +- .../cosmos/slashing/v1beta1/genesis.ts | 10 +- .../outputv2/cosmos/slashing/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/slashing.ts | 16 +- .../outputv2/cosmos/staking/v1beta1/authz.ts | 4 +- .../cosmos/staking/v1beta1/genesis.ts | 8 +- .../outputv2/cosmos/staking/v1beta1/query.ts | 36 ++-- .../cosmos/staking/v1beta1/staking.ts | 90 ++++----- .../outputv2/cosmos/staking/v1beta1/tx.ts | 32 ++-- .../cosmos/tx/signing/v1beta1/signing.ts | 6 +- .../outputv2/cosmos/tx/v1beta1/service.ts | 10 +- .../v-next/outputv2/cosmos/tx/v1beta1/tx.ts | 32 ++-- .../outputv2/cosmos/upgrade/v1beta1/query.ts | 12 +- .../outputv2/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 22 +-- .../outputv2/cosmos/vesting/v1beta1/tx.ts | 20 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../v-next/outputv2/cosmos_proto/cosmos.ts | 10 +- .../outputv2/cosmwasm/wasm/v1/genesis.ts | 10 +- .../v-next/outputv2/cosmwasm/wasm/v1/ibc.ts | 10 +- .../outputv2/cosmwasm/wasm/v1/proposal.ts | 64 +++---- .../v-next/outputv2/cosmwasm/wasm/v1/query.ts | 22 +-- .../v-next/outputv2/cosmwasm/wasm/v1/tx.ts | 36 ++-- .../v-next/outputv2/cosmwasm/wasm/v1/types.ts | 32 ++-- .../v-next/outputv2/evmos/claims/v1/claims.ts | 14 +- .../outputv2/evmos/claims/v1/genesis.ts | 8 +- .../v-next/outputv2/evmos/claims/v1/query.ts | 6 +- .../outputv2/evmos/epochs/v1/genesis.ts | 14 +- .../v-next/outputv2/evmos/epochs/v1/query.ts | 6 +- .../v-next/outputv2/evmos/erc20/v1/erc20.ts | 26 +-- .../v-next/outputv2/evmos/erc20/v1/genesis.ts | 6 +- .../v-next/outputv2/evmos/erc20/v1/query.ts | 4 +- .../v-next/outputv2/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputv2/evmos/fees/v1/fees.ts | 8 +- .../v-next/outputv2/evmos/fees/v1/genesis.ts | 12 +- .../v-next/outputv2/evmos/fees/v1/query.ts | 6 +- .../v-next/outputv2/evmos/fees/v1/tx.ts | 18 +- .../outputv2/evmos/incentives/v1/genesis.ts | 10 +- .../evmos/incentives/v1/incentives.ts | 30 +-- .../outputv2/evmos/incentives/v1/query.ts | 14 +- .../outputv2/evmos/inflation/v1/genesis.ts | 14 +- .../outputv2/evmos/inflation/v1/inflation.ts | 18 +- .../outputv2/evmos/inflation/v1/query.ts | 8 +- .../outputv2/evmos/recovery/v1/genesis.ts | 4 +- .../v-next/outputv2/evmos/vesting/v1/query.ts | 4 +- .../v-next/outputv2/evmos/vesting/v1/tx.ts | 16 +- .../outputv2/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputv2/google/api/auth.ts | 28 +-- .../v-next/outputv2/google/api/backend.ts | 20 +- .../v-next/outputv2/google/api/billing.ts | 4 +- .../outputv2/google/api/config_change.ts | 12 +- .../v-next/outputv2/google/api/consumer.ts | 8 +- .../v-next/outputv2/google/api/context.ts | 4 +- .../v-next/outputv2/google/api/control.ts | 4 +- .../outputv2/google/api/distribution.ts | 28 +-- .../outputv2/google/api/documentation.ts | 20 +- .../v-next/outputv2/google/api/endpoint.ts | 8 +- .../v1alpha1/conformance_service.ts | 22 +-- .../google/api/expr/v1alpha1/checked.ts | 34 ++-- .../outputv2/google/api/expr/v1alpha1/eval.ts | 6 +- .../google/api/expr/v1alpha1/explain.ts | 6 +- .../google/api/expr/v1alpha1/syntax.ts | 54 +++--- .../google/api/expr/v1alpha1/value.ts | 20 +- .../outputv2/google/api/expr/v1beta1/decl.ts | 14 +- .../outputv2/google/api/expr/v1beta1/eval.ts | 6 +- .../outputv2/google/api/expr/v1beta1/expr.ts | 36 ++-- .../google/api/expr/v1beta1/source.ts | 16 +- .../outputv2/google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputv2/google/api/http.ts | 24 +-- .../v-next/outputv2/google/api/httpbody.ts | 4 +- .../v-next/outputv2/google/api/label.ts | 8 +- .../v-next/outputv2/google/api/log.ts | 8 +- .../v-next/outputv2/google/api/logging.ts | 4 +- .../v-next/outputv2/google/api/metric.ts | 26 +-- .../outputv2/google/api/monitored_resource.ts | 22 +-- .../v-next/outputv2/google/api/monitoring.ts | 4 +- .../v-next/outputv2/google/api/quota.ts | 30 +-- .../v-next/outputv2/google/api/resource.ts | 16 +- .../v-next/outputv2/google/api/routing.ts | 6 +- .../v-next/outputv2/google/api/service.ts | 10 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 24 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 32 ++-- .../api/servicecontrol/v1/metric_value.ts | 20 +- .../google/api/servicecontrol/v1/operation.ts | 18 +- .../api/servicecontrol/v1/quota_controller.ts | 28 +-- .../servicecontrol/v1/service_controller.ts | 28 +-- .../servicecontrol/v2/service_controller.ts | 26 +-- .../api/servicemanagement/v1/resources.ts | 42 ++-- .../servicemanagement/v1/servicemanager.ts | 58 +++--- .../google/api/serviceusage/v1/resources.ts | 12 +- .../api/serviceusage/v1/serviceusage.ts | 30 +-- .../api/serviceusage/v1beta1/resources.ts | 70 +++---- .../api/serviceusage/v1beta1/serviceusage.ts | 90 ++++----- .../outputv2/google/api/system_parameter.ts | 10 +- .../v-next/outputv2/google/api/usage.ts | 10 +- .../v-next/outputv2/google/api/visibility.ts | 6 +- .../google/logging/type/http_request.ts | 30 +-- .../outputv2/google/logging/v2/log_entry.ts | 44 ++--- .../outputv2/google/logging/v2/logging.ts | 46 ++--- .../google/logging/v2/logging_config.ts | 180 +++++++++--------- .../google/logging/v2/logging_metrics.ts | 38 ++-- .../outputv2/google/longrunning/operations.ts | 28 +-- .../v-next/outputv2/google/protobuf/api.ts | 24 +-- .../google/protobuf/compiler/plugin.ts | 20 +- .../outputv2/google/protobuf/descriptor.ts | 156 +++++++-------- .../google/protobuf/source_context.ts | 4 +- .../v-next/outputv2/google/protobuf/struct.ts | 12 +- .../v-next/outputv2/google/protobuf/type.ts | 34 ++-- .../outputv2/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 88 ++++----- .../outputv2/google/rpc/error_details.ts | 46 ++--- .../v-next/outputv2/google/rpc/status.ts | 6 +- __fixtures__/v-next/outputv2/helpers.ts | 12 +- .../ibc/applications/transfer/v1/genesis.ts | 4 +- .../ibc/applications/transfer/v1/query.ts | 4 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../outputv2/ibc/core/channel/v1/channel.ts | 42 ++-- .../outputv2/ibc/core/channel/v1/genesis.ts | 10 +- .../outputv2/ibc/core/channel/v1/query.ts | 64 +++---- .../v-next/outputv2/ibc/core/channel/v1/tx.ts | 54 +++--- .../outputv2/ibc/core/client/v1/client.ts | 22 +-- .../outputv2/ibc/core/client/v1/genesis.ts | 8 +- .../outputv2/ibc/core/client/v1/query.ts | 18 +- .../v-next/outputv2/ibc/core/client/v1/tx.ts | 16 +- .../ibc/core/connection/v1/connection.ts | 26 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../outputv2/ibc/core/connection/v1/query.ts | 16 +- .../outputv2/ibc/core/connection/v1/tx.ts | 26 +-- .../v-next/outputv2/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 40 ++-- .../solomachine/v2/solomachine.ts | 40 ++-- .../lightclients/tendermint/v1/tendermint.ts | 16 +- .../outputv2/osmosis/claim/v1beta1/claim.ts | 4 +- .../outputv2/osmosis/claim/v1beta1/params.ts | 6 +- .../outputv2/osmosis/claim/v1beta1/query.ts | 10 +- .../v-next/outputv2/osmosis/epochs/genesis.ts | 14 +- .../v-next/outputv2/osmosis/epochs/query.ts | 6 +- .../gamm/pool-models/balancer/balancerPool.ts | 18 +- .../gamm/pool-models/balancer/tx/tx.ts | 8 +- .../pool-models/stableswap/stableswap_pool.ts | 14 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../outputv2/osmosis/gamm/v1beta1/genesis.ts | 4 +- .../outputv2/osmosis/gamm/v1beta1/query.ts | 54 +++--- .../outputv2/osmosis/gamm/v1beta1/tx.ts | 76 ++++---- .../v-next/outputv2/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputv2/osmosis/incentives/gauge.ts | 12 +- .../outputv2/osmosis/incentives/genesis.ts | 4 +- .../outputv2/osmosis/incentives/params.ts | 4 +- .../outputv2/osmosis/incentives/query.ts | 12 +- .../v-next/outputv2/osmosis/incentives/tx.ts | 14 +- .../v-next/outputv2/osmosis/lockup/genesis.ts | 4 +- .../v-next/outputv2/osmosis/lockup/lock.ts | 20 +- .../v-next/outputv2/osmosis/lockup/query.ts | 44 ++--- .../v-next/outputv2/osmosis/lockup/tx.ts | 26 +-- .../outputv2/osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputv2/osmosis/mint/v1beta1/mint.ts | 28 +-- .../osmosis/pool-incentives/v1beta1/gov.ts | 10 +- .../pool-incentives/v1beta1/incentives.ts | 14 +- .../osmosis/pool-incentives/v1beta1/query.ts | 12 +- .../outputv2/osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputv2/osmosis/superfluid/params.ts | 4 +- .../outputv2/osmosis/superfluid/query.ts | 50 ++--- .../outputv2/osmosis/superfluid/superfluid.ts | 26 +-- .../v-next/outputv2/osmosis/superfluid/tx.ts | 26 +-- .../osmosis/superfluid/v1beta1/gov.ts | 16 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/query.ts | 6 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../outputv2/osmosis/twap/v1beta1/genesis.ts | 4 +- .../outputv2/osmosis/twap/v1beta1/query.ts | 24 +-- .../osmosis/twap/v1beta1/twap_record.ts | 22 +-- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 4 +- .../outputv2/osmosis/txfees/v1beta1/gov.ts | 6 +- .../outputv2/osmosis/txfees/v1beta1/query.ts | 14 +- .../v-next/outputv2/tendermint/abci/types.ts | 134 ++++++------- .../outputv2/tendermint/crypto/proof.ts | 14 +- .../outputv2/tendermint/libs/bits/types.ts | 4 +- .../v-next/outputv2/tendermint/p2p/types.ts | 34 ++-- .../outputv2/tendermint/types/evidence.ts | 14 +- .../outputv2/tendermint/types/params.ts | 18 +- .../v-next/outputv2/tendermint/types/types.ts | 44 ++--- .../outputv2/tendermint/types/validator.ts | 10 +- .../outputv2/tendermint/version/types.ts | 10 +- .../outputv3/akash/audit/v1beta2/query.ts | 14 +- .../outputv3/akash/base/v1beta1/attribute.ts | 6 +- .../outputv3/akash/base/v1beta1/endpoint.ts | 4 +- .../outputv3/akash/base/v1beta2/attribute.ts | 6 +- .../outputv3/akash/base/v1beta2/endpoint.ts | 4 +- .../akash/deployment/v1beta1/deployment.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 6 +- .../akash/deployment/v1beta2/deployment.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 4 +- .../akash/deployment/v1beta2/groupid.ts | 2 +- .../outputv3/akash/escrow/v1beta1/query.ts | 20 +- .../outputv3/akash/escrow/v1beta1/types.ts | 2 +- .../outputv3/akash/escrow/v1beta2/query.ts | 20 +- .../outputv3/akash/escrow/v1beta2/types.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 8 +- .../outputv3/akash/market/v1beta2/bid.ts | 8 +- .../outputv3/akash/market/v1beta2/lease.ts | 10 +- .../outputv3/akash/market/v1beta2/order.ts | 8 +- .../outputv3/akash/provider/v1beta2/query.ts | 4 +- __fixtures__/v-next/outputv3/confio/proofs.ts | 24 +-- .../outputv3/cosmos/app/v1alpha1/config.ts | 4 +- .../outputv3/cosmos/app/v1alpha1/module.ts | 10 +- .../outputv3/cosmos/auth/v1beta1/auth.ts | 20 +- .../outputv3/cosmos/auth/v1beta1/query.ts | 10 +- .../outputv3/cosmos/authz/v1beta1/authz.ts | 12 +- .../outputv3/cosmos/authz/v1beta1/query.ts | 12 +- .../outputv3/cosmos/authz/v1beta1/tx.ts | 14 +- .../outputv3/cosmos/bank/v1beta1/bank.ts | 30 +-- .../outputv3/cosmos/bank/v1beta1/genesis.ts | 4 +- .../outputv3/cosmos/bank/v1beta1/query.ts | 18 +- .../v-next/outputv3/cosmos/bank/v1beta1/tx.ts | 6 +- .../outputv3/cosmos/base/abci/v1beta1/abci.ts | 48 ++--- .../cosmos/base/query/v1beta1/pagination.ts | 12 +- .../base/reflection/v1beta1/reflection.ts | 4 +- .../base/reflection/v2alpha1/reflection.ts | 32 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 18 +- .../cosmos/base/store/v1beta1/commit_info.ts | 8 +- .../cosmos/base/store/v1beta1/listening.ts | 6 +- .../cosmos/base/tendermint/v1beta1/query.ts | 38 ++-- .../outputv3/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 8 +- .../cosmos/capability/v1beta1/genesis.ts | 6 +- .../outputv3/cosmos/crisis/v1beta1/tx.ts | 8 +- .../v-next/outputv3/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../outputv3/cosmos/crypto/multisig/keys.ts | 4 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 42 ++-- .../cosmos/distribution/v1beta1/genesis.ts | 28 +-- .../cosmos/distribution/v1beta1/query.ts | 24 +-- .../cosmos/distribution/v1beta1/tx.ts | 14 +- .../cosmos/evidence/v1beta1/evidence.ts | 10 +- .../outputv3/cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 10 +- .../outputv3/cosmos/feegrant/v1beta1/query.ts | 10 +- .../outputv3/cosmos/feegrant/v1beta1/tx.ts | 10 +- .../v-next/outputv3/cosmos/gov/v1/genesis.ts | 4 +- .../v-next/outputv3/cosmos/gov/v1/gov.ts | 44 ++--- .../v-next/outputv3/cosmos/gov/v1/query.ts | 26 +-- .../v-next/outputv3/cosmos/gov/v1/tx.ts | 28 +-- .../outputv3/cosmos/gov/v1beta1/genesis.ts | 4 +- .../v-next/outputv3/cosmos/gov/v1beta1/gov.ts | 40 ++-- .../outputv3/cosmos/gov/v1beta1/query.ts | 26 +-- .../v-next/outputv3/cosmos/gov/v1beta1/tx.ts | 20 +- .../v-next/outputv3/cosmos/group/v1/events.ts | 24 +-- .../outputv3/cosmos/group/v1/genesis.ts | 8 +- .../v-next/outputv3/cosmos/group/v1/query.ts | 30 +-- .../v-next/outputv3/cosmos/group/v1/tx.ts | 90 ++++----- .../v-next/outputv3/cosmos/group/v1/types.ts | 78 ++++---- .../outputv3/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputv3/cosmos/nft/v1beta1/event.ts | 22 +-- .../outputv3/cosmos/nft/v1beta1/genesis.ts | 4 +- .../v-next/outputv3/cosmos/nft/v1beta1/nft.ts | 22 +-- .../outputv3/cosmos/nft/v1beta1/query.ts | 28 +-- .../v-next/outputv3/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputv3/cosmos/orm/v1/orm.ts | 16 +- .../outputv3/cosmos/orm/v1alpha1/schema.ts | 8 +- .../outputv3/cosmos/params/v1beta1/params.ts | 12 +- .../outputv3/cosmos/params/v1beta1/query.ts | 8 +- .../cosmos/slashing/v1beta1/genesis.ts | 10 +- .../outputv3/cosmos/slashing/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/slashing.ts | 16 +- .../outputv3/cosmos/staking/v1beta1/authz.ts | 4 +- .../cosmos/staking/v1beta1/genesis.ts | 8 +- .../outputv3/cosmos/staking/v1beta1/query.ts | 36 ++-- .../cosmos/staking/v1beta1/staking.ts | 90 ++++----- .../outputv3/cosmos/staking/v1beta1/tx.ts | 32 ++-- .../cosmos/tx/signing/v1beta1/signing.ts | 6 +- .../outputv3/cosmos/tx/v1beta1/service.ts | 10 +- .../v-next/outputv3/cosmos/tx/v1beta1/tx.ts | 32 ++-- .../outputv3/cosmos/upgrade/v1beta1/query.ts | 12 +- .../outputv3/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 22 +-- .../outputv3/cosmos/vesting/v1beta1/tx.ts | 20 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../v-next/outputv3/cosmos_proto/cosmos.ts | 10 +- .../outputv3/cosmwasm/wasm/v1/genesis.ts | 10 +- .../v-next/outputv3/cosmwasm/wasm/v1/ibc.ts | 10 +- .../outputv3/cosmwasm/wasm/v1/proposal.ts | 64 +++---- .../v-next/outputv3/cosmwasm/wasm/v1/query.ts | 22 +-- .../v-next/outputv3/cosmwasm/wasm/v1/tx.ts | 36 ++-- .../v-next/outputv3/cosmwasm/wasm/v1/types.ts | 32 ++-- .../v-next/outputv3/evmos/claims/v1/claims.ts | 14 +- .../outputv3/evmos/claims/v1/genesis.ts | 8 +- .../v-next/outputv3/evmos/claims/v1/query.ts | 6 +- .../outputv3/evmos/epochs/v1/genesis.ts | 14 +- .../v-next/outputv3/evmos/epochs/v1/query.ts | 6 +- .../v-next/outputv3/evmos/erc20/v1/erc20.ts | 26 +-- .../v-next/outputv3/evmos/erc20/v1/genesis.ts | 6 +- .../v-next/outputv3/evmos/erc20/v1/query.ts | 4 +- .../v-next/outputv3/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputv3/evmos/fees/v1/fees.ts | 8 +- .../v-next/outputv3/evmos/fees/v1/genesis.ts | 12 +- .../v-next/outputv3/evmos/fees/v1/query.ts | 6 +- .../v-next/outputv3/evmos/fees/v1/tx.ts | 18 +- .../outputv3/evmos/incentives/v1/genesis.ts | 10 +- .../evmos/incentives/v1/incentives.ts | 30 +-- .../outputv3/evmos/incentives/v1/query.ts | 14 +- .../outputv3/evmos/inflation/v1/genesis.ts | 14 +- .../outputv3/evmos/inflation/v1/inflation.ts | 18 +- .../outputv3/evmos/inflation/v1/query.ts | 8 +- .../outputv3/evmos/recovery/v1/genesis.ts | 4 +- .../v-next/outputv3/evmos/vesting/v1/query.ts | 4 +- .../v-next/outputv3/evmos/vesting/v1/tx.ts | 16 +- .../outputv3/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputv3/google/api/auth.ts | 28 +-- .../v-next/outputv3/google/api/backend.ts | 20 +- .../v-next/outputv3/google/api/billing.ts | 4 +- .../outputv3/google/api/config_change.ts | 12 +- .../v-next/outputv3/google/api/consumer.ts | 8 +- .../v-next/outputv3/google/api/context.ts | 4 +- .../v-next/outputv3/google/api/control.ts | 4 +- .../outputv3/google/api/distribution.ts | 28 +-- .../outputv3/google/api/documentation.ts | 20 +- .../v-next/outputv3/google/api/endpoint.ts | 8 +- .../v1alpha1/conformance_service.ts | 22 +-- .../google/api/expr/v1alpha1/checked.ts | 34 ++-- .../outputv3/google/api/expr/v1alpha1/eval.ts | 6 +- .../google/api/expr/v1alpha1/explain.ts | 6 +- .../google/api/expr/v1alpha1/syntax.ts | 54 +++--- .../google/api/expr/v1alpha1/value.ts | 20 +- .../outputv3/google/api/expr/v1beta1/decl.ts | 14 +- .../outputv3/google/api/expr/v1beta1/eval.ts | 6 +- .../outputv3/google/api/expr/v1beta1/expr.ts | 36 ++-- .../google/api/expr/v1beta1/source.ts | 16 +- .../outputv3/google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputv3/google/api/http.ts | 24 +-- .../v-next/outputv3/google/api/httpbody.ts | 4 +- .../v-next/outputv3/google/api/label.ts | 8 +- .../v-next/outputv3/google/api/log.ts | 8 +- .../v-next/outputv3/google/api/logging.ts | 4 +- .../v-next/outputv3/google/api/metric.ts | 26 +-- .../outputv3/google/api/monitored_resource.ts | 22 +-- .../v-next/outputv3/google/api/monitoring.ts | 4 +- .../v-next/outputv3/google/api/quota.ts | 30 +-- .../v-next/outputv3/google/api/resource.ts | 16 +- .../v-next/outputv3/google/api/routing.ts | 6 +- .../v-next/outputv3/google/api/service.ts | 10 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 24 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 32 ++-- .../api/servicecontrol/v1/metric_value.ts | 20 +- .../google/api/servicecontrol/v1/operation.ts | 18 +- .../api/servicecontrol/v1/quota_controller.ts | 28 +-- .../servicecontrol/v1/service_controller.ts | 28 +-- .../servicecontrol/v2/service_controller.ts | 26 +-- .../api/servicemanagement/v1/resources.ts | 42 ++-- .../servicemanagement/v1/servicemanager.ts | 58 +++--- .../google/api/serviceusage/v1/resources.ts | 12 +- .../api/serviceusage/v1/serviceusage.ts | 30 +-- .../api/serviceusage/v1beta1/resources.ts | 70 +++---- .../api/serviceusage/v1beta1/serviceusage.ts | 90 ++++----- .../outputv3/google/api/system_parameter.ts | 10 +- .../v-next/outputv3/google/api/usage.ts | 10 +- .../v-next/outputv3/google/api/visibility.ts | 6 +- .../google/logging/type/http_request.ts | 30 +-- .../outputv3/google/logging/v2/log_entry.ts | 44 ++--- .../outputv3/google/logging/v2/logging.ts | 46 ++--- .../google/logging/v2/logging_config.ts | 180 +++++++++--------- .../google/logging/v2/logging_metrics.ts | 38 ++-- .../outputv3/google/longrunning/operations.ts | 28 +-- .../v-next/outputv3/google/protobuf/any.ts | 2 +- .../v-next/outputv3/google/protobuf/api.ts | 24 +-- .../google/protobuf/compiler/plugin.ts | 20 +- .../outputv3/google/protobuf/descriptor.ts | 156 +++++++-------- .../outputv3/google/protobuf/duration.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../v-next/outputv3/google/protobuf/struct.ts | 12 +- .../outputv3/google/protobuf/timestamp.ts | 2 +- .../v-next/outputv3/google/protobuf/type.ts | 34 ++-- .../outputv3/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 88 ++++----- .../outputv3/google/rpc/error_details.ts | 46 ++--- .../v-next/outputv3/google/rpc/status.ts | 6 +- __fixtures__/v-next/outputv3/helpers.ts | 12 +- .../ibc/applications/transfer/v1/genesis.ts | 4 +- .../ibc/applications/transfer/v1/query.ts | 4 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../outputv3/ibc/core/channel/v1/channel.ts | 42 ++-- .../outputv3/ibc/core/channel/v1/genesis.ts | 10 +- .../outputv3/ibc/core/channel/v1/query.ts | 64 +++---- .../v-next/outputv3/ibc/core/channel/v1/tx.ts | 54 +++--- .../outputv3/ibc/core/client/v1/client.ts | 22 +-- .../outputv3/ibc/core/client/v1/genesis.ts | 8 +- .../outputv3/ibc/core/client/v1/query.ts | 18 +- .../v-next/outputv3/ibc/core/client/v1/tx.ts | 16 +- .../ibc/core/connection/v1/connection.ts | 26 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../outputv3/ibc/core/connection/v1/query.ts | 16 +- .../outputv3/ibc/core/connection/v1/tx.ts | 26 +-- .../v-next/outputv3/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 40 ++-- .../solomachine/v2/solomachine.ts | 40 ++-- .../lightclients/tendermint/v1/tendermint.ts | 16 +- .../outputv3/osmosis/claim/v1beta1/claim.ts | 4 +- .../outputv3/osmosis/claim/v1beta1/params.ts | 6 +- .../outputv3/osmosis/claim/v1beta1/query.ts | 10 +- .../v-next/outputv3/osmosis/epochs/genesis.ts | 14 +- .../v-next/outputv3/osmosis/epochs/query.ts | 6 +- .../gamm/pool-models/balancer/balancerPool.ts | 18 +- .../gamm/pool-models/balancer/tx/tx.ts | 8 +- .../pool-models/stableswap/stableswap_pool.ts | 14 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../outputv3/osmosis/gamm/v1beta1/genesis.ts | 4 +- .../outputv3/osmosis/gamm/v1beta1/query.ts | 54 +++--- .../outputv3/osmosis/gamm/v1beta1/tx.ts | 76 ++++---- .../v-next/outputv3/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputv3/osmosis/incentives/gauge.ts | 12 +- .../outputv3/osmosis/incentives/genesis.ts | 4 +- .../outputv3/osmosis/incentives/params.ts | 4 +- .../outputv3/osmosis/incentives/query.ts | 12 +- .../v-next/outputv3/osmosis/incentives/tx.ts | 14 +- .../v-next/outputv3/osmosis/lockup/genesis.ts | 4 +- .../v-next/outputv3/osmosis/lockup/lock.ts | 20 +- .../v-next/outputv3/osmosis/lockup/query.ts | 44 ++--- .../v-next/outputv3/osmosis/lockup/tx.ts | 26 +-- .../outputv3/osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputv3/osmosis/mint/v1beta1/mint.ts | 28 +-- .../osmosis/pool-incentives/v1beta1/gov.ts | 10 +- .../pool-incentives/v1beta1/incentives.ts | 14 +- .../osmosis/pool-incentives/v1beta1/query.ts | 12 +- .../outputv3/osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputv3/osmosis/superfluid/params.ts | 4 +- .../outputv3/osmosis/superfluid/query.ts | 50 ++--- .../outputv3/osmosis/superfluid/superfluid.ts | 26 +-- .../v-next/outputv3/osmosis/superfluid/tx.ts | 26 +-- .../osmosis/superfluid/v1beta1/gov.ts | 16 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/query.ts | 6 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../outputv3/osmosis/twap/v1beta1/genesis.ts | 4 +- .../outputv3/osmosis/twap/v1beta1/query.ts | 24 +-- .../osmosis/twap/v1beta1/twap_record.ts | 22 +-- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 4 +- .../outputv3/osmosis/txfees/v1beta1/gov.ts | 6 +- .../outputv3/osmosis/txfees/v1beta1/query.ts | 14 +- .../v-next/outputv3/tendermint/abci/types.ts | 134 ++++++------- .../outputv3/tendermint/crypto/proof.ts | 14 +- .../outputv3/tendermint/libs/bits/types.ts | 4 +- .../v-next/outputv3/tendermint/p2p/types.ts | 34 ++-- .../outputv3/tendermint/types/evidence.ts | 14 +- .../outputv3/tendermint/types/params.ts | 18 +- .../v-next/outputv3/tendermint/types/types.ts | 44 ++--- .../outputv3/tendermint/types/validator.ts | 10 +- .../outputv3/tendermint/version/types.ts | 10 +- .../akash/audit/v1beta1/audit.amino.ts | 8 +- .../akash/audit/v1beta2/audit.amino.ts | 8 +- .../outputv4/akash/audit/v1beta2/query.ts | 14 +- .../outputv4/akash/base/v1beta1/attribute.ts | 6 +- .../outputv4/akash/base/v1beta1/endpoint.ts | 4 +- .../outputv4/akash/base/v1beta2/attribute.ts | 6 +- .../outputv4/akash/base/v1beta2/endpoint.ts | 4 +- .../outputv4/akash/cert/v1beta2/cert.amino.ts | 7 +- .../akash/deployment/v1beta1/deployment.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 6 +- .../akash/deployment/v1beta2/deployment.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 4 +- .../akash/deployment/v1beta2/groupid.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 36 ++-- .../outputv4/akash/escrow/v1beta1/query.ts | 20 +- .../outputv4/akash/escrow/v1beta1/types.ts | 2 +- .../outputv4/akash/escrow/v1beta2/query.ts | 20 +- .../outputv4/akash/escrow/v1beta2/types.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 8 +- .../outputv4/akash/market/v1beta2/bid.ts | 8 +- .../outputv4/akash/market/v1beta2/lease.ts | 10 +- .../outputv4/akash/market/v1beta2/order.ts | 8 +- .../akash/market/v1beta2/service.amino.ts | 30 +-- .../akash/provider/v1beta1/provider.amino.ts | 18 +- .../akash/provider/v1beta2/provider.amino.ts | 18 +- .../outputv4/akash/provider/v1beta2/query.ts | 4 +- __fixtures__/v-next/outputv4/confio/proofs.ts | 24 +-- .../outputv4/cosmos/app/v1alpha1/config.ts | 4 +- .../outputv4/cosmos/app/v1alpha1/module.ts | 10 +- .../outputv4/cosmos/auth/v1beta1/auth.ts | 20 +- .../outputv4/cosmos/auth/v1beta1/query.ts | 10 +- .../outputv4/cosmos/authz/v1beta1/authz.ts | 12 +- .../outputv4/cosmos/authz/v1beta1/query.ts | 12 +- .../outputv4/cosmos/authz/v1beta1/tx.ts | 14 +- .../outputv4/cosmos/bank/v1beta1/bank.ts | 30 +-- .../outputv4/cosmos/bank/v1beta1/genesis.ts | 4 +- .../outputv4/cosmos/bank/v1beta1/query.ts | 18 +- .../v-next/outputv4/cosmos/bank/v1beta1/tx.ts | 6 +- .../outputv4/cosmos/base/abci/v1beta1/abci.ts | 48 ++--- .../cosmos/base/query/v1beta1/pagination.ts | 12 +- .../base/reflection/v1beta1/reflection.ts | 4 +- .../base/reflection/v2alpha1/reflection.ts | 32 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 18 +- .../cosmos/base/store/v1beta1/commit_info.ts | 8 +- .../cosmos/base/store/v1beta1/listening.ts | 6 +- .../cosmos/base/tendermint/v1beta1/query.ts | 38 ++-- .../outputv4/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 8 +- .../cosmos/capability/v1beta1/genesis.ts | 6 +- .../outputv4/cosmos/crisis/v1beta1/tx.ts | 8 +- .../v-next/outputv4/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../outputv4/cosmos/crypto/multisig/keys.ts | 4 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 42 ++-- .../cosmos/distribution/v1beta1/genesis.ts | 28 +-- .../cosmos/distribution/v1beta1/query.ts | 24 +-- .../cosmos/distribution/v1beta1/tx.ts | 14 +- .../cosmos/evidence/v1beta1/evidence.ts | 10 +- .../outputv4/cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 10 +- .../outputv4/cosmos/feegrant/v1beta1/query.ts | 10 +- .../outputv4/cosmos/feegrant/v1beta1/tx.ts | 10 +- .../v-next/outputv4/cosmos/gov/v1/genesis.ts | 4 +- .../v-next/outputv4/cosmos/gov/v1/gov.ts | 44 ++--- .../v-next/outputv4/cosmos/gov/v1/query.ts | 26 +-- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 6 +- .../v-next/outputv4/cosmos/gov/v1/tx.ts | 28 +-- .../outputv4/cosmos/gov/v1beta1/genesis.ts | 4 +- .../v-next/outputv4/cosmos/gov/v1beta1/gov.ts | 40 ++-- .../outputv4/cosmos/gov/v1beta1/query.ts | 26 +-- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../v-next/outputv4/cosmos/gov/v1beta1/tx.ts | 20 +- .../v-next/outputv4/cosmos/group/v1/events.ts | 24 +-- .../outputv4/cosmos/group/v1/genesis.ts | 8 +- .../v-next/outputv4/cosmos/group/v1/query.ts | 30 +-- .../outputv4/cosmos/group/v1/tx.amino.ts | 18 +- .../v-next/outputv4/cosmos/group/v1/tx.ts | 90 ++++----- .../v-next/outputv4/cosmos/group/v1/types.ts | 78 ++++---- .../outputv4/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputv4/cosmos/nft/v1beta1/event.ts | 22 +-- .../outputv4/cosmos/nft/v1beta1/genesis.ts | 4 +- .../v-next/outputv4/cosmos/nft/v1beta1/nft.ts | 22 +-- .../outputv4/cosmos/nft/v1beta1/query.ts | 28 +-- .../v-next/outputv4/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputv4/cosmos/orm/v1/orm.ts | 16 +- .../outputv4/cosmos/orm/v1alpha1/schema.ts | 8 +- .../outputv4/cosmos/params/v1beta1/params.ts | 12 +- .../outputv4/cosmos/params/v1beta1/query.ts | 8 +- .../cosmos/slashing/v1beta1/genesis.ts | 10 +- .../outputv4/cosmos/slashing/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/slashing.ts | 16 +- .../cosmos/slashing/v1beta1/tx.amino.ts | 3 +- .../outputv4/cosmos/staking/v1beta1/authz.ts | 4 +- .../cosmos/staking/v1beta1/genesis.ts | 8 +- .../outputv4/cosmos/staking/v1beta1/query.ts | 36 ++-- .../cosmos/staking/v1beta1/staking.ts | 90 ++++----- .../outputv4/cosmos/staking/v1beta1/tx.ts | 32 ++-- .../cosmos/tx/signing/v1beta1/signing.ts | 6 +- .../outputv4/cosmos/tx/v1beta1/service.ts | 10 +- .../v-next/outputv4/cosmos/tx/v1beta1/tx.ts | 32 ++-- .../outputv4/cosmos/upgrade/v1beta1/query.ts | 12 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 2 +- .../outputv4/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 22 +-- .../cosmos/vesting/v1beta1/tx.amino.ts | 8 +- .../outputv4/cosmos/vesting/v1beta1/tx.ts | 20 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../v-next/outputv4/cosmos_proto/cosmos.ts | 10 +- .../outputv4/cosmwasm/wasm/v1/genesis.ts | 10 +- .../v-next/outputv4/cosmwasm/wasm/v1/ibc.ts | 10 +- .../outputv4/cosmwasm/wasm/v1/proposal.ts | 64 +++---- .../v-next/outputv4/cosmwasm/wasm/v1/query.ts | 22 +-- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../v-next/outputv4/cosmwasm/wasm/v1/tx.ts | 36 ++-- .../v-next/outputv4/cosmwasm/wasm/v1/types.ts | 32 ++-- .../v-next/outputv4/evmos/claims/v1/claims.ts | 14 +- .../outputv4/evmos/claims/v1/genesis.ts | 8 +- .../v-next/outputv4/evmos/claims/v1/query.ts | 6 +- .../outputv4/evmos/epochs/v1/genesis.ts | 14 +- .../v-next/outputv4/evmos/epochs/v1/query.ts | 6 +- .../v-next/outputv4/evmos/erc20/v1/erc20.ts | 26 +-- .../v-next/outputv4/evmos/erc20/v1/genesis.ts | 6 +- .../v-next/outputv4/evmos/erc20/v1/query.ts | 4 +- .../v-next/outputv4/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputv4/evmos/fees/v1/fees.ts | 8 +- .../v-next/outputv4/evmos/fees/v1/genesis.ts | 12 +- .../v-next/outputv4/evmos/fees/v1/query.ts | 6 +- .../v-next/outputv4/evmos/fees/v1/tx.ts | 18 +- .../outputv4/evmos/incentives/v1/genesis.ts | 10 +- .../evmos/incentives/v1/incentives.ts | 30 +-- .../outputv4/evmos/incentives/v1/query.ts | 14 +- .../outputv4/evmos/inflation/v1/genesis.ts | 14 +- .../outputv4/evmos/inflation/v1/inflation.ts | 18 +- .../outputv4/evmos/inflation/v1/query.ts | 8 +- .../outputv4/evmos/recovery/v1/genesis.ts | 4 +- .../v-next/outputv4/evmos/vesting/v1/query.ts | 4 +- .../outputv4/evmos/vesting/v1/tx.amino.ts | 6 +- .../v-next/outputv4/evmos/vesting/v1/tx.ts | 16 +- .../outputv4/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputv4/google/api/auth.ts | 28 +-- .../v-next/outputv4/google/api/backend.ts | 20 +- .../v-next/outputv4/google/api/billing.ts | 4 +- .../outputv4/google/api/config_change.ts | 12 +- .../v-next/outputv4/google/api/consumer.ts | 8 +- .../v-next/outputv4/google/api/context.ts | 4 +- .../v-next/outputv4/google/api/control.ts | 4 +- .../outputv4/google/api/distribution.ts | 28 +-- .../outputv4/google/api/documentation.ts | 20 +- .../v-next/outputv4/google/api/endpoint.ts | 8 +- .../v1alpha1/conformance_service.ts | 22 +-- .../google/api/expr/v1alpha1/checked.ts | 34 ++-- .../outputv4/google/api/expr/v1alpha1/eval.ts | 6 +- .../google/api/expr/v1alpha1/explain.ts | 6 +- .../google/api/expr/v1alpha1/syntax.ts | 54 +++--- .../google/api/expr/v1alpha1/value.ts | 20 +- .../outputv4/google/api/expr/v1beta1/decl.ts | 14 +- .../outputv4/google/api/expr/v1beta1/eval.ts | 6 +- .../outputv4/google/api/expr/v1beta1/expr.ts | 36 ++-- .../google/api/expr/v1beta1/source.ts | 16 +- .../outputv4/google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputv4/google/api/http.ts | 24 +-- .../v-next/outputv4/google/api/httpbody.ts | 4 +- .../v-next/outputv4/google/api/label.ts | 8 +- .../v-next/outputv4/google/api/log.ts | 8 +- .../v-next/outputv4/google/api/logging.ts | 4 +- .../v-next/outputv4/google/api/metric.ts | 26 +-- .../outputv4/google/api/monitored_resource.ts | 22 +-- .../v-next/outputv4/google/api/monitoring.ts | 4 +- .../v-next/outputv4/google/api/quota.ts | 30 +-- .../v-next/outputv4/google/api/resource.ts | 16 +- .../v-next/outputv4/google/api/routing.ts | 6 +- .../v-next/outputv4/google/api/service.ts | 10 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 24 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 32 ++-- .../api/servicecontrol/v1/metric_value.ts | 20 +- .../google/api/servicecontrol/v1/operation.ts | 18 +- .../api/servicecontrol/v1/quota_controller.ts | 28 +-- .../servicecontrol/v1/service_controller.ts | 28 +-- .../servicecontrol/v2/service_controller.ts | 26 +-- .../api/servicemanagement/v1/resources.ts | 42 ++-- .../servicemanagement/v1/servicemanager.ts | 58 +++--- .../google/api/serviceusage/v1/resources.ts | 12 +- .../api/serviceusage/v1/serviceusage.ts | 30 +-- .../api/serviceusage/v1beta1/resources.ts | 70 +++---- .../api/serviceusage/v1beta1/serviceusage.ts | 90 ++++----- .../outputv4/google/api/system_parameter.ts | 10 +- .../v-next/outputv4/google/api/usage.ts | 10 +- .../v-next/outputv4/google/api/visibility.ts | 6 +- .../google/logging/type/http_request.ts | 30 +-- .../outputv4/google/logging/v2/log_entry.ts | 44 ++--- .../outputv4/google/logging/v2/logging.ts | 46 ++--- .../google/logging/v2/logging_config.ts | 180 +++++++++--------- .../google/logging/v2/logging_metrics.ts | 38 ++-- .../outputv4/google/longrunning/operations.ts | 28 +-- .../v-next/outputv4/google/protobuf/any.ts | 2 +- .../v-next/outputv4/google/protobuf/api.ts | 24 +-- .../google/protobuf/compiler/plugin.ts | 20 +- .../outputv4/google/protobuf/descriptor.ts | 156 +++++++-------- .../outputv4/google/protobuf/duration.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../v-next/outputv4/google/protobuf/struct.ts | 12 +- .../outputv4/google/protobuf/timestamp.ts | 2 +- .../v-next/outputv4/google/protobuf/type.ts | 34 ++-- .../outputv4/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 88 ++++----- .../outputv4/google/rpc/error_details.ts | 46 ++--- .../v-next/outputv4/google/rpc/status.ts | 6 +- __fixtures__/v-next/outputv4/helpers.ts | 12 +- .../ibc/applications/transfer/v1/genesis.ts | 4 +- .../ibc/applications/transfer/v1/query.ts | 4 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../outputv4/ibc/core/channel/v1/channel.ts | 42 ++-- .../outputv4/ibc/core/channel/v1/genesis.ts | 10 +- .../outputv4/ibc/core/channel/v1/query.ts | 64 +++---- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 20 +- .../v-next/outputv4/ibc/core/channel/v1/tx.ts | 54 +++--- .../outputv4/ibc/core/client/v1/client.ts | 22 +-- .../outputv4/ibc/core/client/v1/genesis.ts | 8 +- .../outputv4/ibc/core/client/v1/query.ts | 18 +- .../v-next/outputv4/ibc/core/client/v1/tx.ts | 16 +- .../ibc/core/connection/v1/connection.ts | 26 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../outputv4/ibc/core/connection/v1/query.ts | 16 +- .../ibc/core/connection/v1/tx.amino.ts | 4 +- .../outputv4/ibc/core/connection/v1/tx.ts | 26 +-- .../v-next/outputv4/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 40 ++-- .../solomachine/v2/solomachine.ts | 40 ++-- .../lightclients/tendermint/v1/tendermint.ts | 16 +- .../outputv4/osmosis/claim/v1beta1/claim.ts | 4 +- .../outputv4/osmosis/claim/v1beta1/params.ts | 6 +- .../outputv4/osmosis/claim/v1beta1/query.ts | 10 +- .../v-next/outputv4/osmosis/epochs/genesis.ts | 14 +- .../v-next/outputv4/osmosis/epochs/query.ts | 6 +- .../gamm/pool-models/balancer/balancerPool.ts | 18 +- .../gamm/pool-models/balancer/tx/tx.ts | 8 +- .../pool-models/stableswap/stableswap_pool.ts | 14 +- .../gamm/pool-models/stableswap/tx.amino.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../outputv4/osmosis/gamm/v1beta1/genesis.ts | 4 +- .../outputv4/osmosis/gamm/v1beta1/query.ts | 54 +++--- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 16 +- .../outputv4/osmosis/gamm/v1beta1/tx.ts | 76 ++++---- .../v-next/outputv4/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputv4/osmosis/incentives/gauge.ts | 12 +- .../outputv4/osmosis/incentives/genesis.ts | 4 +- .../outputv4/osmosis/incentives/params.ts | 4 +- .../outputv4/osmosis/incentives/query.ts | 12 +- .../outputv4/osmosis/incentives/tx.amino.ts | 6 +- .../v-next/outputv4/osmosis/incentives/tx.ts | 14 +- .../v-next/outputv4/osmosis/lockup/genesis.ts | 4 +- .../v-next/outputv4/osmosis/lockup/lock.ts | 20 +- .../v-next/outputv4/osmosis/lockup/query.ts | 44 ++--- .../outputv4/osmosis/lockup/tx.amino.ts | 6 +- .../v-next/outputv4/osmosis/lockup/tx.ts | 26 +-- .../outputv4/osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputv4/osmosis/mint/v1beta1/mint.ts | 28 +-- .../osmosis/pool-incentives/v1beta1/gov.ts | 10 +- .../pool-incentives/v1beta1/incentives.ts | 14 +- .../osmosis/pool-incentives/v1beta1/query.ts | 12 +- .../outputv4/osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputv4/osmosis/superfluid/params.ts | 4 +- .../outputv4/osmosis/superfluid/query.ts | 50 ++--- .../outputv4/osmosis/superfluid/superfluid.ts | 26 +-- .../outputv4/osmosis/superfluid/tx.amino.ts | 8 +- .../v-next/outputv4/osmosis/superfluid/tx.ts | 26 +-- .../osmosis/superfluid/v1beta1/gov.ts | 16 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/query.ts | 6 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 2 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../outputv4/osmosis/twap/v1beta1/genesis.ts | 4 +- .../outputv4/osmosis/twap/v1beta1/query.ts | 24 +-- .../osmosis/twap/v1beta1/twap_record.ts | 22 +-- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 4 +- .../outputv4/osmosis/txfees/v1beta1/gov.ts | 6 +- .../outputv4/osmosis/txfees/v1beta1/query.ts | 14 +- .../v-next/outputv4/tendermint/abci/types.ts | 134 ++++++------- .../outputv4/tendermint/crypto/proof.ts | 14 +- .../outputv4/tendermint/libs/bits/types.ts | 4 +- .../v-next/outputv4/tendermint/p2p/types.ts | 34 ++-- .../outputv4/tendermint/types/evidence.ts | 14 +- .../outputv4/tendermint/types/params.ts | 18 +- .../v-next/outputv4/tendermint/types/types.ts | 44 ++--- .../outputv4/tendermint/types/validator.ts | 10 +- .../outputv4/tendermint/version/types.ts | 10 +- .../__snapshots__/encode.test.ts.snap | 4 +- .../__snapshots__/object.spec.ts.snap | 108 +++++------ .../authz.timestamp.test.ts.snap | 12 +- .../__snapshots__/cosmwasm.test.ts.snap | 30 +-- .../__snapshots__/lockup.test.ts.snap | 16 +- .../__snapshots__/tendermint.test.ts.snap | 52 ++--- .../amino-converter.spec.ts.snap | 136 ++++++------- .../__snapshots__/nested-enums.test.ts.snap | 4 +- .../super-nested-enums.test.ts.snap | 6 +- .../__tests__/__snapshots__/vote.test.ts.snap | 28 +-- .../src/encoding/amino/to-amino-json/index.ts | 10 +- .../src/encoding/amino/to-amino-json/utils.ts | 20 +- .../interfaces-amino.test.ts.snap | 24 +-- .../__snapshots__/contracts.test.ts.snap | 4 +- .../src/encoding/proto/from-amino/utils.ts | 4 +- .../ast/src/encoding/proto/to-amino/index.ts | 34 ++-- .../ast/src/encoding/proto/to-amino/utils.ts | 169 ++++++++++------ .../encoding/amino/to-amino-json/utils.d.ts | 4 +- .../types/encoding/proto/to-amino/utils.d.ts | 37 ++-- packages/telescope/src/helpers/internal.ts | 6 +- .../src/helpers/internalForBigInt.ts | 12 +- .../telescope/types/helpers/internal.d.ts | 2 +- .../types/helpers/internalForBigInt.d.ts | 2 +- 1239 files changed, 11812 insertions(+), 11678 deletions(-) diff --git a/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts index 9ca7f8bfa8..8ae2c993ff 100644 --- a/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { /** The ids of the expressions with unknown values. */ @@ -204,7 +204,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output/helpers.ts b/__fixtures__/misc/output/helpers.ts index f92d2b935a..b18c95df6c 100644 --- a/__fixtures__/misc/output/helpers.ts +++ b/__fixtures__/misc/output/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -255,3 +261,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output/misc/eval_request.ts b/__fixtures__/misc/output/misc/eval_request.ts index 56bc046529..cc860420e9 100644 --- a/__fixtures__/misc/output/misc/eval_request.ts +++ b/__fixtures__/misc/output/misc/eval_request.ts @@ -1,6 +1,6 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject } from "../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../helpers"; export const protobufPackage = "misc"; export interface EvalRequest_BindingsEntry { key: string; @@ -162,7 +162,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -256,7 +256,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts index 20b34cb7ca..533d7261bf 100644 --- a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts @@ -31,8 +31,8 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) @@ -62,8 +62,8 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, keys: keys }; }, diff --git a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts index 573aa1bbc9..e6f7269391 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts @@ -31,8 +31,8 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) @@ -62,8 +62,8 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, keys: keys }; }, diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts index 8087e380cd..3d90abcb1e 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts @@ -1,6 +1,5 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { CertificateID, CertificateIDSDKType, MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export interface MsgCreateCertificateAminoType extends AminoMsg { type: "akash/cert/v1beta2/testonly-create-certificate"; @@ -28,7 +27,7 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner: omitDefault(owner), + owner: owner, cert: cert, pubkey: pubkey }; @@ -52,8 +51,8 @@ export const AminoConverter = { }: MsgRevokeCertificate): MsgRevokeCertificateAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - serial: omitDefault(id.serial) + owner: id.owner, + serial: id.serial } }; }, diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index fc4dd8975e..f4bd20ab61 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -157,11 +157,11 @@ export const AminoConverter = { }: MsgCreateDeployment): MsgCreateDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, groups: groups.map(el0 => ({ - name: omitDefault(el0.name), + name: el0.name, requirements: { signed_by: { all_of: el0.requirements.signedBy.allOf, @@ -193,7 +193,7 @@ export const AminoConverter = { })) }, storage: el1.resources.storage.map(el2 => ({ - name: omitDefault(el2.name), + name: el2.name, quantity: { val: el2.quantity.val }, @@ -219,7 +219,7 @@ export const AminoConverter = { denom: deposit.denom, amount: Long.fromValue(deposit.amount).toString() }, - depositor: omitDefault(depositor) + depositor: depositor }; }, fromAmino: ({ @@ -306,14 +306,14 @@ export const AminoConverter = { }: MsgDepositDeployment): MsgDepositDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, amount: { denom: amount.denom, amount: Long.fromValue(amount.amount).toString() }, - depositor: omitDefault(depositor) + depositor: depositor }; }, fromAmino: ({ @@ -342,8 +342,8 @@ export const AminoConverter = { }: MsgUpdateDeployment): MsgUpdateDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, version: version }; @@ -368,8 +368,8 @@ export const AminoConverter = { }: MsgCloseDeployment): MsgCloseDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() } }; }, @@ -391,8 +391,8 @@ export const AminoConverter = { }: MsgCloseGroup): MsgCloseGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -416,8 +416,8 @@ export const AminoConverter = { }: MsgPauseGroup): MsgPauseGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -441,8 +441,8 @@ export const AminoConverter = { }: MsgStartGroup): MsgStartGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; diff --git a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts index 6d103b9b9a..eb9e615abf 100644 --- a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts @@ -84,12 +84,12 @@ export const AminoConverter = { }: MsgCreateBid): MsgCreateBidAminoType["value"] => { return { order: { - owner: omitDefault(order.owner), - dseq: order.dseq.toString(), + owner: order.owner, + dseq: order.dseq?.toString?.(), gseq: order.gseq, oseq: order.oseq }, - provider: omitDefault(provider), + provider: provider, price: { denom: omitDefault(price.denom), amount: omitDefault(price.amount) @@ -132,11 +132,11 @@ export const AminoConverter = { }: MsgCloseBid): MsgCloseBidAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -161,11 +161,11 @@ export const AminoConverter = { }: MsgWithdrawLease): MsgWithdrawLeaseAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -190,11 +190,11 @@ export const AminoConverter = { }: MsgCreateLease): MsgCreateLeaseAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -219,11 +219,11 @@ export const AminoConverter = { }: MsgCloseLease): MsgCloseLeaseAminoType["value"] => { return { lease_id: { - owner: omitDefault(leaseId.owner), - dseq: leaseId.dseq.toString(), + owner: leaseId.owner, + dseq: leaseId.dseq?.toString?.(), gseq: leaseId.gseq, oseq: leaseId.oseq, - provider: omitDefault(leaseId.provider) + provider: leaseId.provider } }; }, diff --git a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts index a7497ddc96..831b4eea3c 100644 --- a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts @@ -49,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -90,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -128,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner: omitDefault(owner) + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts index d2a861a256..d90c974036 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts @@ -49,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -90,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -128,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner: omitDefault(owner) + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index ea779a95d7..53691f39c9 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -139,7 +139,7 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), option: option, metadata: omitDefault(metadata) @@ -168,7 +168,7 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, @@ -202,7 +202,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), depositor: omitDefault(depositor), amount: amount.map(el0 => ({ denom: omitDefault(el0.denom), diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index 9041ac6e96..e6a1cde8ff 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -94,7 +94,7 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), voter: omitDefault(voter), option: option }; @@ -119,7 +119,7 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, @@ -150,7 +150,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), depositor: omitDefault(depositor), amount: amount.map(el0 => ({ denom: omitDefault(el0.denom), diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index 89d45709b4..c5c284d47d 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -202,7 +202,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ address: omitDefault(el0.address), weight: omitDefault(el0.weight), @@ -237,7 +237,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), new_admin: omitDefault(newAdmin) }; }, @@ -262,7 +262,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), metadata: omitDefault(metadata) }; }, @@ -288,7 +288,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), metadata: omitDefault(metadata), decision_policy: { type_url: omitDefault(decisionPolicy.typeUrl), @@ -333,7 +333,7 @@ export const AminoConverter = { })), group_metadata: omitDefault(groupMetadata), group_policy_metadata: omitDefault(groupPolicyMetadata), - group_policy_as_admin: groupPolicyAsAdmin, + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value @@ -493,7 +493,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), address: omitDefault(address) }; }, @@ -517,7 +517,7 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), voter: omitDefault(voter), option: option, metadata: omitDefault(metadata), @@ -547,7 +547,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), signer: omitDefault(signer) }; }, @@ -569,7 +569,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address: omitDefault(address), - group_id: groupId.toString() + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts index 94ba73ca94..9a3e9b11e4 100644 --- a/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,5 +1,4 @@ import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; @@ -14,7 +13,7 @@ export const AminoConverter = { validatorAddr }: MsgUnjail): MsgUnjailAminoType["value"] => { return { - validator_addr: omitDefault(validatorAddr) + validator_addr: validatorAddr }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts index 36eec858e2..7e586548f5 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts @@ -41,7 +41,7 @@ export const AminoConverter = { plan: { name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), + height: omitDefault(plan.height)?.toString?.(), info: omitDefault(plan.info), upgraded_client_state: { type_url: omitDefault(plan.upgradedClientState.typeUrl), diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index 5b8576ebcc..889a5b5ded 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -59,8 +59,8 @@ export const AminoConverter = { denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) })), - end_time: endTime.toString(), - delayed: delayed + end_time: omitDefault(endTime)?.toString?.(), + delayed: omitDefault(delayed) }; }, fromAmino: ({ @@ -124,9 +124,9 @@ export const AminoConverter = { return { from_address: omitDefault(fromAddress), to_address: omitDefault(toAddress), - start_time: startTime.toString(), + start_time: omitDefault(startTime)?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index f88093b5e4..276bc6855b 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), admin: omitDefault(admin), - code_id: codeId.toString(), + code_id: omitDefault(codeId)?.toString?.(), label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +186,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), contract: omitDefault(contract), - code_id: codeId.toString(), + code_id: omitDefault(codeId)?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index 03d0a1333e..d17edcacbc 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -54,20 +54,20 @@ export const AminoConverter = { to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) })) })), - merge: merge + merge: omitDefault(merge) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/helpers.ts b/__fixtures__/output1/helpers.ts index 023babb171..719141976d 100644 --- a/__fixtures__/output1/helpers.ts +++ b/__fixtures__/output1/helpers.ts @@ -56,7 +56,7 @@ export interface AminoHeight { readonly revision_height?: string; }; -export function omitDefault(input: T): T | undefined { +export function omitDefault(input: T): T | undefined { if (typeof input === "string") { return input === "" ? undefined : input; } @@ -65,6 +65,10 @@ export function omitDefault(input: T): T | und return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (Long.isLong(input)) { return (input as Long).isZero() ? undefined : input; } diff --git a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts index 67268205b0..b1fd375e8f 100644 --- a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp.toString() + timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts index 2898278800..442611c6e7 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), signer: omitDefault(signer) }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), signer: omitDefault(signer) }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -626,7 +626,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, acknowledgement: acknowledgement, proof_acked: proofAcked, diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index 80fc93b1f8..65ba7ea8bd 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: omitDefault(version.identifier), features: version.features }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), signer: omitDefault(signer) }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: omitDefault(el0.identifier), features: el0.features diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 5c97b566f1..5d2e5f0eb3 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -88,7 +88,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index 3e316b61f1..5eac4ac14f 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -112,7 +112,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ denom: omitDefault(el0.denom), @@ -147,7 +147,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ denom: omitDefault(el0.denom), @@ -183,7 +183,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { @@ -224,7 +224,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_in_denom: omitDefault(el0.tokenInDenom) })), token_in_max_amount: omitDefault(tokenInMaxAmount), @@ -264,7 +264,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_in: { denom: tokenIn.denom, amount: Long.fromValue(tokenIn.amount).toString() @@ -300,7 +300,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_in_denom: omitDefault(tokenInDenom), share_out_amount: omitDefault(shareOutAmount), token_in_max_amount: omitDefault(tokenInMaxAmount) @@ -332,7 +332,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_out: { denom: tokenOut.denom, amount: Long.fromValue(tokenOut.amount).toString() @@ -368,7 +368,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_out_denom: omitDefault(tokenOutDenom), share_in_amount: omitDefault(shareInAmount), token_out_min_amount: omitDefault(tokenOutMinAmount) diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 1b90268c77..048fcf4aed 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -57,7 +57,7 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: isPerpetual, + is_perpetual: omitDefault(isPerpetual), owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, @@ -70,7 +70,7 @@ export const AminoConverter = { amount: omitDefault(el0.amount) })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver.toString() + num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() }; }, fromAmino: ({ @@ -111,7 +111,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner: omitDefault(owner), - gauge_id: gaugeId.toString(), + gauge_id: omitDefault(gaugeId)?.toString?.(), rewards: rewards.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index b27724ac4c..da28c4becb 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +178,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index dd3bd8d125..1e716851ae 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -53,7 +53,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString(), + lock_id: omitDefault(lockId)?.toString?.(), val_addr: omitDefault(valAddr) }; }, @@ -77,7 +77,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString() + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -98,7 +98,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString() + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString() + pool_id: omitDefault(poolId)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts index f807c1c4ef..c548ae85a1 100644 --- a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -172,7 +172,7 @@ export const AminoConverter = { description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ denom: omitDefault(el0.denom), - exponent: el0.exponent, + exponent: omitDefault(el0.exponent), aliases: el0.aliases })), base: omitDefault(metadata.base), diff --git a/__fixtures__/output2/helpers.ts b/__fixtures__/output2/helpers.ts index 44fef196b0..22c801fd98 100644 --- a/__fixtures__/output2/helpers.ts +++ b/__fixtures__/output2/helpers.ts @@ -58,7 +58,7 @@ export interface AminoHeight { readonly revision_height?: string; }; -export function omitDefault(input: T): T | undefined { +export function omitDefault(input: T): T | undefined { if (typeof input === "string") { return input === "" ? undefined : input; } @@ -67,6 +67,10 @@ export function omitDefault(input: T): T | und return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (Long.isLong(input)) { return (input as Long).isZero() ? undefined : input; } diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts index 20b34cb7ca..533d7261bf 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts @@ -31,8 +31,8 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) @@ -62,8 +62,8 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, keys: keys }; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts index 573aa1bbc9..e6f7269391 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts @@ -31,8 +31,8 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) @@ -62,8 +62,8 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, keys: keys }; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts index aae0bd9c0f..43ac6dbb6e 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -261,8 +261,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -460,7 +460,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -567,8 +567,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -674,7 +674,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = omitDefault(message.auditor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts index a349616423..5fe0a6d75f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -126,8 +126,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts index e702df91b2..376ab8d9e2 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -110,7 +110,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts index 6489fb4faa..7348c25670 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -126,8 +126,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts index f845c6b557..76a0a59ac4 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -133,7 +133,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); obj.sequence_number = message.sequenceNumber; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts index 8087e380cd..3d90abcb1e 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts @@ -1,6 +1,5 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { CertificateID, CertificateIDSDKType, MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export interface MsgCreateCertificateAminoType extends AminoMsg { type: "akash/cert/v1beta2/testonly-create-certificate"; @@ -28,7 +27,7 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner: omitDefault(owner), + owner: owner, cert: cert, pubkey: pubkey }; @@ -52,8 +51,8 @@ export const AminoConverter = { }: MsgRevokeCertificate): MsgRevokeCertificateAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - serial: omitDefault(id.serial) + owner: id.owner, + serial: id.serial } }; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts index b70314be62..1125fda6d3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts @@ -3,7 +3,7 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, Exact, Rpc } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, Exact, omitDefault, Rpc } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -994,7 +994,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1131,7 +1131,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -1252,7 +1252,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts index 06b94bd054..7a2b3ece12 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsSDKType } from "../../base/ import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, Exact } from "../../../helpers"; +import { isSet, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -733,7 +733,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, @@ -1005,7 +1005,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts index fcce7b400a..5e4f17b7a4 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -160,7 +160,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -297,7 +297,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -418,7 +418,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts index f77e978b35..94a0ed4086 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -184,7 +184,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts index 3325bf03a1..951a64fb3d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts @@ -109,7 +109,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index 73fbc73897..0e6cf7a88d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -157,11 +157,11 @@ export const AminoConverter = { }: MsgCreateDeployment): MsgCreateDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, groups: groups.map(el0 => ({ - name: omitDefault(el0.name), + name: el0.name, requirements: { signed_by: { all_of: el0.requirements.signedBy.allOf, @@ -193,7 +193,7 @@ export const AminoConverter = { })) }, storage: el1.resources.storage.map(el2 => ({ - name: omitDefault(el2.name), + name: el2.name, quantity: { val: el2.quantity.val }, @@ -219,7 +219,7 @@ export const AminoConverter = { denom: deposit.denom, amount: deposit.amount }, - depositor: omitDefault(depositor) + depositor: depositor }; }, fromAmino: ({ @@ -306,14 +306,14 @@ export const AminoConverter = { }: MsgDepositDeployment): MsgDepositDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, amount: { denom: amount.denom, amount: amount.amount }, - depositor: omitDefault(depositor) + depositor: depositor }; }, fromAmino: ({ @@ -342,8 +342,8 @@ export const AminoConverter = { }: MsgUpdateDeployment): MsgUpdateDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, version: version }; @@ -368,8 +368,8 @@ export const AminoConverter = { }: MsgCloseDeployment): MsgCloseDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() } }; }, @@ -391,8 +391,8 @@ export const AminoConverter = { }: MsgCloseGroup): MsgCloseGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -416,8 +416,8 @@ export const AminoConverter = { }: MsgPauseGroup): MsgPauseGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -441,8 +441,8 @@ export const AminoConverter = { }: MsgStartGroup): MsgStartGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts index b3a4918936..4b1ab6f4da 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -180,10 +180,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -465,11 +465,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts index 25ae285477..998505522f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts @@ -401,7 +401,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts index cebbe4c96b..80dea169c3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -180,10 +180,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -465,11 +465,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts index 87aaaafa1f..4f02550359 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts @@ -442,7 +442,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; obj.depositor = message.depositor; obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts index 6dc992047c..4d84e0faa2 100644 --- a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, padDecimal } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -118,9 +118,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor; - obj.initial_inflation = message.initialInflation; - obj.variance = message.variance; + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); + obj.initial_inflation = padDecimal(message.initialInflation); + obj.variance = padDecimal(message.variance); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts index 0de9bc7457..d2e3943d1d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -639,7 +639,7 @@ export const BidID = { toAmino(message: BidID): BidIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -779,7 +779,7 @@ export const Bid = { obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -942,7 +942,7 @@ export const BidFilters = { toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts index 691a6c9aae..9dd43901f1 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -261,7 +261,7 @@ export const LeaseID = { toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -415,8 +415,8 @@ export const Lease = { obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); + obj.closed_on = omitDefault(message.closedOn); return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -579,7 +579,7 @@ export const LeaseFilters = { toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts index 1b8c7729d2..0cc3c5ff9d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -204,7 +204,7 @@ export const OrderID = { toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; return obj; @@ -343,7 +343,7 @@ export const Order = { obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; obj.state = message.state; obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -492,7 +492,7 @@ export const OrderFilters = { toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.state = message.state; diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts index 31c5984835..e8401755fa 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts @@ -84,12 +84,12 @@ export const AminoConverter = { }: MsgCreateBid): MsgCreateBidAminoType["value"] => { return { order: { - owner: omitDefault(order.owner), - dseq: order.dseq.toString(), + owner: order.owner, + dseq: order.dseq?.toString?.(), gseq: order.gseq, oseq: order.oseq }, - provider: omitDefault(provider), + provider: provider, price: { denom: omitDefault(price.denom), amount: omitDefault(price.amount) @@ -132,11 +132,11 @@ export const AminoConverter = { }: MsgCloseBid): MsgCloseBidAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -161,11 +161,11 @@ export const AminoConverter = { }: MsgWithdrawLease): MsgWithdrawLeaseAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -190,11 +190,11 @@ export const AminoConverter = { }: MsgCreateLease): MsgCreateLeaseAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -219,11 +219,11 @@ export const AminoConverter = { }: MsgCloseLease): MsgCloseLeaseAminoType["value"] => { return { lease_id: { - owner: omitDefault(leaseId.owner), - dseq: leaseId.dseq.toString(), + owner: leaseId.owner, + dseq: leaseId.dseq?.toString?.(), gseq: leaseId.gseq, oseq: leaseId.oseq, - provider: omitDefault(leaseId.provider) + provider: leaseId.provider } }; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts index a7497ddc96..831b4eea3c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts @@ -49,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -90,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -128,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner: omitDefault(owner) + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts index d2a861a256..d90c974036 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts @@ -49,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -90,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -128,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner: omitDefault(owner) + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts index ad5b8ed815..e1552672b5 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -315,7 +315,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts b/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts index de44f896ab..0c0b9ee1d4 100644 --- a/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts +++ b/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "capability.v1"; /** * Capability defines an implementation of an object capability. The index @@ -112,7 +112,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -212,8 +212,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = omitDefault(message.module); + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { diff --git a/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts index f5c04637cd..01d4a4402f 100644 --- a/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "capability.v1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -110,7 +110,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -219,7 +219,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/confio/proofs.ts b/__fixtures__/v-next/outputosmojs/confio/proofs.ts index aaf20156aa..9194066d7e 100644 --- a/__fixtures__/v-next/outputosmojs/confio/proofs.ts +++ b/__fixtures__/v-next/outputosmojs/confio/proofs.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "ics23"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ @@ -987,10 +987,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = message.hash; - obj.prehash_key = message.prehashKey; - obj.prehash_value = message.prehashValue; - obj.length = message.length; + obj.hash = omitDefault(message.hash); + obj.prehash_key = omitDefault(message.prehashKey); + obj.prehash_value = omitDefault(message.prehashValue); + obj.length = omitDefault(message.length); obj.prefix = message.prefix; return obj; }, @@ -1105,7 +1105,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); obj.prefix = message.prefix; obj.suffix = message.suffix; return obj; @@ -1237,8 +1237,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = omitDefault(message.maxDepth); + obj.min_depth = omitDefault(message.minDepth); return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1416,11 +1416,11 @@ export const InnerSpec = { } else { obj.child_order = []; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = omitDefault(message.childSize); + obj.min_prefix_length = omitDefault(message.minPrefixLength); + obj.max_prefix_length = omitDefault(message.maxPrefixLength); obj.empty_child = message.emptyChild; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts index 66d5472589..57e92f1cb6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -238,7 +238,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts index 76b4830a64..32ddad25bb 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -212,7 +212,7 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = message.goImport; + obj.go_import = omitDefault(message.goImport); if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { @@ -328,8 +328,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = message.name; - obj.revision = message.revision; + obj.name = omitDefault(message.name); + obj.revision = omitDefault(message.revision); return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -421,7 +421,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = message.module; + obj.module = omitDefault(message.module); return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts index 5ee167e06f..b5f80765a7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -161,10 +161,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -293,7 +293,7 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { @@ -446,11 +446,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = omitDefault(message.maxMemoCharacters); + obj.tx_sig_limit = omitDefault(message.txSigLimit); + obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); + obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); + obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts index 9bbadac797..3da89afd16 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -406,7 +406,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -1002,7 +1002,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = message.bech32Prefix; + obj.bech32_prefix = omitDefault(message.bech32Prefix); return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1186,7 +1186,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1278,7 +1278,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts index 7e93265c39..b1d3e1ae6d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -135,7 +135,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = omitDefault(message.msg); return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -236,7 +236,7 @@ export const Grant = { fromAmino(object: GrantAmino): Grant { return { authorization: object?.authorization ? Any.fromAmino(object.authorization) : undefined, - expiration: object?.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: Grant): GrantAmino { @@ -371,13 +371,13 @@ export const GrantAuthorization = { granter: object.granter, grantee: object.grantee, authorization: object?.authorization ? Any.fromAmino(object.authorization) : undefined, - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; obj.expiration = message.expiration; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts index 622e9d6f69..1305d4aad9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -186,9 +186,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -414,7 +414,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -640,7 +640,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts index 74fe88a855..870c8f59b9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -173,8 +173,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -393,7 +393,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -590,9 +590,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts index 2f078e4a6f..cdfd23f812 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -243,7 +243,7 @@ export const Params = { } else { obj.send_enabled = []; } - obj.default_send_enabled = message.defaultSendEnabled; + obj.default_send_enabled = omitDefault(message.defaultSendEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -349,8 +349,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = message.denom; - obj.enabled = message.enabled; + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -464,7 +464,7 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -583,7 +583,7 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -820,8 +820,8 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = message.denom; - obj.exponent = message.exponent; + obj.denom = omitDefault(message.denom); + obj.exponent = omitDefault(message.exponent); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { @@ -1024,18 +1024,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { obj.denom_units = []; } - obj.base = message.base; - obj.display = message.display; - obj.name = message.name; - obj.symbol = message.symbol; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.base = omitDefault(message.base); + obj.display = omitDefault(message.display); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts index 5b0c7a0dd1..9db2b1c2fc 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -304,7 +304,7 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts index e51b06a1a4..e94fab87e7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -345,8 +345,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = omitDefault(message.address); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -544,7 +544,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -770,7 +770,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1193,7 +1193,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1752,7 +1752,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -1950,7 +1950,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2057,7 +2057,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts index 626cb6f8a0..f7c982ed0c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -136,8 +136,8 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts index db9800e7b6..566fe399d7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventSDKType } from "../../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.abci.v1beta1"; /** * TxResponse defines a structure containing relevant tx data and metadata. The @@ -493,22 +493,22 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.height = omitDefault(message.height); + obj.txhash = omitDefault(message.txhash); + obj.codespace = omitDefault(message.codespace); + obj.code = omitDefault(message.code); + obj.data = omitDefault(message.data); + obj.raw_log = omitDefault(message.rawLog); if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { obj.logs = []; } - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = omitDefault(message.timestamp); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -642,7 +642,7 @@ export const ABCIMessageLog = { toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { @@ -761,7 +761,7 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -872,8 +872,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -979,8 +979,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1131,7 +1131,7 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -1354,7 +1354,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = omitDefault(message.msgType); obj.data = message.data; return obj; }, @@ -1656,11 +1656,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = omitDefault(message.totalCount); + obj.count = omitDefault(message.count); + obj.page_number = omitDefault(message.pageNumber); + obj.page_total = omitDefault(message.pageTotal); + obj.limit = omitDefault(message.limit); if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts index fe49bcf90e..34c7facef3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.node.v1beta1"; /** ConfigRequest defines the request structure for the Config gRPC query. */ export interface ConfigRequest {} @@ -152,7 +152,7 @@ export const ConfigResponse = { }, toAmino(message: ConfigResponse): ConfigResponseAmino { const obj: any = {}; - obj.minimum_gas_price = message.minimumGasPrice; + obj.minimum_gas_price = omitDefault(message.minimumGasPrice); return obj; }, fromAminoMsg(object: ConfigResponseAminoMsg): ConfigResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts index 11b58fe55d..f3c354b26b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.query.v1beta1"; /** * PageRequest is to be embedded in gRPC request messages for efficient @@ -217,10 +217,10 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.offset = omitDefault(message.offset); + obj.limit = omitDefault(message.limit); + obj.count_total = omitDefault(message.countTotal); + obj.reverse = omitDefault(message.reverse); return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { @@ -327,7 +327,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = omitDefault(message.total); return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts index 66110987ca..811fd1553c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -286,7 +286,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = message.interfaceName; + obj.interface_name = omitDefault(message.interfaceName); return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts index d5128377df..06cbb22910 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -564,7 +564,7 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { @@ -793,9 +793,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -887,7 +887,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1127,7 +1127,7 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { @@ -1243,8 +1243,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.type_url = message.typeUrl; + obj.fullname = omitDefault(message.fullname); + obj.type_url = omitDefault(message.typeUrl); return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1358,7 +1358,7 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { @@ -1455,7 +1455,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1547,7 +1547,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = message.msgTypeUrl; + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -2763,8 +2763,8 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.is_module = message.isModule; + obj.fullname = omitDefault(message.fullname); + obj.is_module = omitDefault(message.isModule); if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { @@ -2875,8 +2875,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.full_query_path = message.fullQueryPath; + obj.name = omitDefault(message.name); + obj.full_query_path = omitDefault(message.fullQueryPath); return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts index dbdac054ba..183d74925a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; /** Snapshot contains Tendermint state sync snapshot info. */ export interface Snapshot { @@ -227,9 +227,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -594,7 +594,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -730,8 +730,8 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.version = omitDefault(message.version); + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -837,8 +837,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = omitDefault(message.name); + obj.format = omitDefault(message.format); return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts index 8bb9ef7e26..b4561275d2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -138,7 +138,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -249,7 +249,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, @@ -356,7 +356,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); obj.hash = message.hash; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts index 83243b1038..a0a9bb4bc2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) @@ -138,8 +138,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = omitDefault(message.storeKey); + obj.delete = omitDefault(message.delete); obj.key = message.key; obj.value = message.value; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts index d0b78b7fe4..37c04cec3d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -243,7 +243,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -372,7 +372,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -598,7 +598,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -738,10 +738,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -833,7 +833,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1283,7 +1283,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = omitDefault(message.syncing); return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1660,18 +1660,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = omitDefault(message.name); + obj.app_name = omitDefault(message.appName); + obj.version = omitDefault(message.version); + obj.git_commit = omitDefault(message.gitCommit); + obj.build_tags = omitDefault(message.buildTags); + obj.go_version = omitDefault(message.goVersion); if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { obj.build_deps = []; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1791,9 +1791,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = omitDefault(message.path); + obj.version = omitDefault(message.version); + obj.sum = omitDefault(message.sum); return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts index 747f676202..7bccf4abe0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -138,8 +138,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -245,8 +245,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -338,7 +338,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = omitDefault(message.int); return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -430,7 +430,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = omitDefault(message.dec); return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts index a9cb19310c..8c391acfff 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -112,7 +112,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -218,8 +218,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = omitDefault(message.module); + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts index 6648e70766..00b1ce782f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -110,7 +110,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -225,7 +225,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts index 871b9206ce..c23e9172bd 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -112,9 +112,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = message.sender; - obj.invariant_module_name = message.invariantModuleName; - obj.invariant_route = message.invariantRoute; + obj.sender = omitDefault(message.sender); + obj.invariant_module_name = omitDefault(message.invariantModuleName); + obj.invariant_route = omitDefault(message.invariantRoute); return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts index c6d9592114..429cc44993 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -148,11 +148,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = message.purpose; - obj.coin_type = message.coinType; - obj.account = message.account; - obj.change = message.change; - obj.address_index = message.addressIndex; + obj.purpose = omitDefault(message.purpose); + obj.coin_type = omitDefault(message.coinType); + obj.account = omitDefault(message.account); + obj.change = omitDefault(message.change); + obj.address_index = omitDefault(message.addressIndex); return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts index ba458bad16..fb54d5ac44 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -196,7 +196,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -308,7 +308,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = omitDefault(message.privKeyType); return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts index 9ae38ac7ad..6fe4d220c8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -109,7 +109,7 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts index c68d342239..793172420e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { bytesFromBase64, base64FromBytes, DeepPartial, isSet } from "../../../../helpers"; +import { bytesFromBase64, base64FromBytes, DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. @@ -222,7 +222,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = omitDefault(message.extraBitsStored); obj.elems = message.elems; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts index 583b79b3d0..bcc67e131d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -330,10 +330,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax; - obj.base_proposer_reward = message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward; - obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + obj.community_tax = padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -452,7 +452,7 @@ export const ValidatorHistoricalRewards = { } else { obj.cumulative_reward_ratio = []; } - obj.reference_count = message.referenceCount; + obj.reference_count = omitDefault(message.referenceCount); return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -571,7 +571,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = []; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -885,8 +885,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; - obj.fraction = message.fraction; + obj.validator_period = omitDefault(message.validatorPeriod); + obj.fraction = padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1236,9 +1236,9 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1363,9 +1363,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; - obj.stake = message.stake; - obj.height = message.height ? message.height.toString() : undefined; + obj.previous_period = omitDefault(message.previousPeriod); + obj.stake = padDecimal(message.stake); + obj.height = message.height; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1479,7 +1479,7 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -1632,11 +1632,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; - obj.amount = message.amount; - obj.deposit = message.deposit; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); + obj.amount = omitDefault(message.amount); + obj.deposit = omitDefault(message.deposit); return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts index 3ee2ea1d03..1a43710e1b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, Params, ParamsSDKType, FeePool, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -236,8 +236,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -351,7 +351,7 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -462,7 +462,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -583,8 +583,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.period = omitDefault(message.period); obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -691,7 +691,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -812,8 +812,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -948,9 +948,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.height = omitDefault(message.height); + obj.period = omitDefault(message.period); obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1232,7 +1232,7 @@ export const GenesisState = { } else { obj.delegator_withdraw_infos = []; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = omitDefault(message.previousProposer); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts index 29658328f3..af14e31658 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -500,7 +500,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -684,7 +684,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -910,9 +910,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.starting_height = omitDefault(message.startingHeight); + obj.ending_height = omitDefault(message.endingHeight); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1138,8 +1138,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1335,7 +1335,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1558,7 +1558,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1754,7 +1754,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -1846,7 +1846,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts index aa8e5d29d1..c33d8a6fe8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -169,8 +169,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -348,8 +348,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -545,7 +545,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -768,7 +768,7 @@ export const MsgFundCommunityPool = { } else { obj.amount = []; } - obj.depositor = message.depositor; + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts index db91fd6601..f80d6774df 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * Equivocation implements the Evidence interface and defines evidence of double @@ -124,17 +124,17 @@ export const Equivocation = { fromAmino(object: EquivocationAmino): Equivocation { return { height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, power: BigInt(object.power), consensusAddress: object.consensus_address }; }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.power = omitDefault(message.power); + obj.consensus_address = omitDefault(message.consensusAddress); return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts index 2001e1e82c..6bbd6cf87d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -108,7 +108,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = omitDefault(message.submitter); obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts index 5405d422e0..d024685548 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -175,7 +175,7 @@ export const BasicAllowance = { fromAmino(object: BasicAllowanceAmino): BasicAllowance { return { spendLimit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromAmino(e)) : [], - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: BasicAllowance): BasicAllowanceAmino { @@ -344,7 +344,7 @@ export const PeriodicAllowance = { period: object?.period ? Duration.fromAmino(object.period) : undefined, periodSpendLimit: Array.isArray(object?.period_spend_limit) ? object.period_spend_limit.map((e: any) => Coin.fromAmino(e)) : [], periodCanSpend: Array.isArray(object?.period_can_spend) ? object.period_can_spend.map((e: any) => Coin.fromAmino(e)) : [], - periodReset: object.period_reset + periodReset: object?.period_reset ? Timestamp.fromAmino(object.period_reset) : undefined }; }, toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { @@ -600,8 +600,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts index 63fb155894..b6b7b0eef0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -151,8 +151,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -350,7 +350,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -576,7 +576,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts index cbc5e4a82a..39441bba0a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -138,8 +138,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, @@ -318,8 +318,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts index db60786f57..0384235c77 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -204,7 +204,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts index 18a54a18be..a1d31b0123 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -358,8 +358,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -487,8 +487,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -717,23 +717,23 @@ export const Proposal = { messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [], status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time, + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined, metadata: object.metadata }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -744,7 +744,7 @@ export const Proposal = { } obj.voting_start_time = message.votingStartTime; obj.voting_end_time = message.votingEndTime; - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -878,10 +878,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1023,14 +1023,14 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1361,9 +1361,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = omitDefault(message.quorum); + obj.threshold = omitDefault(message.threshold); + obj.veto_threshold = omitDefault(message.vetoThreshold); return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts index 24c48650f5..73d4b57104 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -256,7 +256,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -482,9 +482,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -710,8 +710,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -909,7 +909,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1121,7 +1121,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1349,8 +1349,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1548,7 +1548,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1760,7 +1760,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index e417d411e7..3ee8d1dcaa 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -139,7 +139,7 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), option: option, metadata: omitDefault(metadata) @@ -168,7 +168,7 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, @@ -202,7 +202,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), depositor: omitDefault(depositor), amount: amount.map(el0 => ({ denom: omitDefault(el0.denom), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts index 77998587b2..5f3cce8229 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -242,8 +242,8 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = omitDefault(message.proposer); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -335,7 +335,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -442,7 +442,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -648,10 +648,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -865,14 +865,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1072,8 +1072,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts index 6462d5deab..c5cea1ecbe 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -204,7 +204,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts index 3b2d050f68..0059c428a1 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts @@ -4,7 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -387,8 +387,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -494,8 +494,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -623,8 +623,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -832,18 +832,18 @@ export const Proposal = { content: object?.content ? Any.fromAmino(object.content) : undefined, status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -987,10 +987,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = omitDefault(message.yes); + obj.abstain = omitDefault(message.abstain); + obj.no = omitDefault(message.no); + obj.no_with_veto = omitDefault(message.noWithVeto); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1132,9 +1132,9 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts index c397400869..140381963c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -256,7 +256,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -482,9 +482,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -710,8 +710,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -909,7 +909,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1121,7 +1121,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1349,8 +1349,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1548,7 +1548,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1760,7 +1760,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index f7ce81597e..8614717a58 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -94,7 +94,7 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), voter: omitDefault(voter), option: option }; @@ -119,7 +119,7 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, @@ -150,7 +150,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), depositor: omitDefault(depositor), amount: amount.map(el0 => ({ denom: omitDefault(el0.denom), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts index 643e413157..a7478acd22 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -203,7 +203,7 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; + obj.proposer = omitDefault(message.proposer); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -295,7 +295,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -415,9 +415,9 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -617,8 +617,8 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { @@ -823,8 +823,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts index 535b779956..73b113bc67 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts @@ -1,6 +1,6 @@ import { ProposalExecutorResult, ProposalExecutorResultSDKType, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** EventCreateGroup is an event emitted when a group is created. */ export interface EventCreateGroup { @@ -156,7 +156,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -248,7 +248,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -340,7 +340,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -432,7 +432,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -524,7 +524,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -616,7 +616,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -708,7 +708,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -814,8 +814,8 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = message.result; + obj.proposal_id = omitDefault(message.proposalId); + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -921,8 +921,8 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.group_id = omitDefault(message.groupId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts index 1ba992182d..97de86deb4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoSDKType, GroupMember, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -246,7 +246,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = omitDefault(message.groupSeq); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -257,13 +257,13 @@ export const GenesisState = { } else { obj.group_members = []; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = omitDefault(message.groupPolicySeq); if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = []; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = omitDefault(message.proposalSeq); if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts index 36fc4f2b1e..8732a79db7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -355,7 +355,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -539,7 +539,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -737,7 +737,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -963,7 +963,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1189,7 +1189,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1415,7 +1415,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1627,7 +1627,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -1825,7 +1825,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2051,8 +2051,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2250,7 +2250,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2476,7 +2476,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = omitDefault(message.voter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2702,7 +2702,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2914,7 +2914,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index e6c6b6e10f..fb944f6918 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -202,7 +202,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ address: omitDefault(el0.address), weight: omitDefault(el0.weight), @@ -237,7 +237,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), new_admin: omitDefault(newAdmin) }; }, @@ -262,7 +262,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), metadata: omitDefault(metadata) }; }, @@ -288,7 +288,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), metadata: omitDefault(metadata), decision_policy: { type_url: omitDefault(decisionPolicy.typeUrl), @@ -333,7 +333,7 @@ export const AminoConverter = { })), group_metadata: omitDefault(groupMetadata), group_policy_metadata: omitDefault(groupPolicyMetadata), - group_policy_as_admin: groupPolicyAsAdmin, + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value @@ -493,7 +493,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), address: omitDefault(address) }; }, @@ -517,7 +517,7 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), voter: omitDefault(voter), option: option, metadata: omitDefault(metadata), @@ -547,7 +547,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), signer: omitDefault(signer) }; }, @@ -569,7 +569,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address: omitDefault(address), - group_id: groupId.toString() + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts index b5fa9c55c5..1aea0b5b77 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts @@ -1,7 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -465,13 +465,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -563,7 +563,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -691,8 +691,8 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -889,9 +889,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1083,9 +1083,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1291,9 +1291,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1386,7 +1386,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1506,9 +1506,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -1678,15 +1678,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = omitDefault(message.groupMetadata); + obj.group_policy_metadata = omitDefault(message.groupPolicyMetadata); + obj.group_policy_as_admin = omitDefault(message.groupPolicyAsAdmin); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1793,8 +1793,8 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_id = omitDefault(message.groupId); + obj.group_policy_address = omitDefault(message.groupPolicyAddress); return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -1986,8 +1986,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -2180,9 +2180,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2418,19 +2418,19 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.exec = message.exec; + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2522,7 +2522,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2628,8 +2628,8 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.proposal_id = omitDefault(message.proposalId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -2849,11 +2849,11 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; - obj.exec = message.exec; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3031,8 +3031,8 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.proposal_id = omitDefault(message.proposalId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3210,8 +3210,8 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts index c61d72a5ab..5a8b4e1af0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -586,14 +586,14 @@ export const Member = { address: object.address, weight: object.weight, metadata: object.metadata, - addedAt: object.added_at + addedAt: object?.added_at ? Timestamp.fromAmino(object.added_at) : undefined }; }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = omitDefault(message.address); + obj.weight = omitDefault(message.weight); + obj.metadata = omitDefault(message.metadata); obj.added_at = message.addedAt; return obj; }, @@ -804,7 +804,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -911,7 +911,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = omitDefault(message.percentage); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1176,16 +1176,16 @@ export const GroupInfo = { metadata: object.metadata, version: BigInt(object.version), totalWeight: object.total_weight, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.id = omitDefault(message.id); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); + obj.total_weight = omitDefault(message.totalWeight); obj.created_at = message.createdAt; return obj; }, @@ -1292,7 +1292,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1464,16 +1464,16 @@ export const GroupPolicyInfo = { metadata: object.metadata, version: BigInt(object.version), decisionPolicy: object?.decision_policy ? Any.fromAmino(object.decision_policy) : undefined, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt; return obj; @@ -1738,35 +1738,35 @@ export const Proposal = { address: object.address, metadata: object.metadata, proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => e) : [], - submitTime: object.submit_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, groupVersion: BigInt(object.group_version), groupPolicyVersion: BigInt(object.group_policy_version), status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - votingPeriodEnd: object.voting_period_end, + votingPeriodEnd: object?.voting_period_end ? Timestamp.fromAmino(object.voting_period_end) : undefined, executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.id = omitDefault(message.id); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } obj.submit_time = message.submitTime; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = message.status; - obj.result = message.result; + obj.group_version = omitDefault(message.groupVersion); + obj.group_policy_version = omitDefault(message.groupPolicyVersion); + obj.status = omitDefault(message.status); + obj.result = omitDefault(message.result); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd; - obj.executor_result = message.executorResult; + obj.executor_result = omitDefault(message.executorResult); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1905,10 +1905,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2051,15 +2051,15 @@ export const Vote = { voter: object.voter, option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object.metadata, - submitTime: object.submit_time + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined }; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); obj.submit_time = message.submitTime; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts b/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts index 720e512e95..8db9fe5e13 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.ics23.v1"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ @@ -1011,10 +1011,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = message.hash; - obj.prehash_key = message.prehashKey; - obj.prehash_value = message.prehashValue; - obj.length = message.length; + obj.hash = omitDefault(message.hash); + obj.prehash_key = omitDefault(message.prehashKey); + obj.prehash_value = omitDefault(message.prehashValue); + obj.length = omitDefault(message.length); obj.prefix = message.prefix; return obj; }, @@ -1135,7 +1135,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); obj.prefix = message.prefix; obj.suffix = message.suffix; return obj; @@ -1273,8 +1273,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = omitDefault(message.maxDepth); + obj.min_depth = omitDefault(message.minDepth); return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1458,11 +1458,11 @@ export const InnerSpec = { } else { obj.child_order = []; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = omitDefault(message.childSize); + obj.min_prefix_length = omitDefault(message.minPrefixLength); + obj.max_prefix_length = omitDefault(message.maxPrefixLength); obj.empty_child = message.emptyChild; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts index 6611caa320..5e6fe0ff5e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -119,8 +119,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation; - obj.annual_provisions = message.annualProvisions; + obj.inflation = padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -282,12 +282,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange; - obj.inflation_max = message.inflationMax; - obj.inflation_min = message.inflationMin; - obj.goal_bonded = message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.mint_denom = omitDefault(message.mintDenom); + obj.inflation_rate_change = padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded); + obj.blocks_per_year = omitDefault(message.blocksPerYear); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts index ac79db83f9..b22ef4e871 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -148,10 +148,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -271,9 +271,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -393,9 +393,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts index 5a4f9e3de3..d5e81af99f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -245,7 +245,7 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts index b56ead1c7f..13c2139d68 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -201,12 +201,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.description = omitDefault(message.description); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -355,10 +355,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts index 72a2d046a5..336a0070b7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -211,8 +211,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -304,7 +304,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -410,8 +410,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -503,7 +503,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -595,7 +595,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -687,7 +687,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -807,8 +807,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1034,8 +1034,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1219,7 +1219,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts index 89ae370971..40240e0fd9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -132,10 +132,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts index 21b6949094..6d43bbb1a3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -218,7 +218,7 @@ export const TableDescriptor = { } else { obj.index = []; } - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -324,8 +324,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.auto_increment = message.autoIncrement; + obj.fields = omitDefault(message.fields); + obj.auto_increment = omitDefault(message.autoIncrement); return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -445,9 +445,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.id = message.id; - obj.unique = message.unique; + obj.fields = omitDefault(message.fields); + obj.id = omitDefault(message.id); + obj.unique = omitDefault(message.unique); return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -539,7 +539,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts index e17265d000..78b166f614 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -339,9 +339,9 @@ export const ModuleSchemaDescriptor_FileEntry = { }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = message.storageType; + obj.id = omitDefault(message.id); + obj.proto_file_name = omitDefault(message.protoFileName); + obj.storage_type = omitDefault(message.storageType); return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts index a4fd3e6f26..b6b5aafa70 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -134,8 +134,8 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { @@ -260,9 +260,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; - obj.value = message.value; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts index 03946a3569..d46893a7c5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -144,8 +144,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -527,7 +527,7 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = message.subspace; + obj.subspace = omitDefault(message.subspace); if (message.keys) { obj.keys = message.keys.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts index 6d3347c5e7..ea51926134 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -292,7 +292,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -407,7 +407,7 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { @@ -518,8 +518,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.index = omitDefault(message.index); + obj.missed = omitDefault(message.missed); return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts index f9fa71e31b..89787a6342 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -307,7 +307,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = message.consAddress; + obj.cons_address = omitDefault(message.consAddress); return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts index fcc91d0a38..2ff1d9409f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -188,19 +188,19 @@ export const ValidatorSigningInfo = { address: object.address, startHeight: BigInt(object.start_height), indexOffset: BigInt(object.index_offset), - jailedUntil: object.jailed_until, + jailedUntil: object?.jailed_until ? Timestamp.fromAmino(object.jailed_until) : undefined, tombstoned: object.tombstoned, missedBlocksCounter: BigInt(object.missed_blocks_counter) }; }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.address = omitDefault(message.address); + obj.start_height = omitDefault(message.startHeight); + obj.index_offset = omitDefault(message.indexOffset); obj.jailed_until = message.jailedUntil; - obj.tombstoned = message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.tombstoned = omitDefault(message.tombstoned); + obj.missed_blocks_counter = omitDefault(message.missedBlocksCounter); return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -348,7 +348,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = omitDefault(message.signedBlocksWindow); obj.min_signed_per_window = message.minSignedPerWindow; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts index 94ba73ca94..9a3e9b11e4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,5 +1,4 @@ import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; @@ -14,7 +13,7 @@ export const AminoConverter = { validatorAddr }: MsgUnjail): MsgUnjailAminoType["value"] => { return { - validator_addr: omitDefault(validatorAddr) + validator_addr: validatorAddr }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts index 7c253d7423..e4b228683e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -206,7 +206,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = message.authorizationType; + obj.authorization_type = omitDefault(message.authorizationType); return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts index c6702ae78d..dd4e4b56c3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -281,7 +281,7 @@ export const GenesisState = { } else { obj.redelegations = []; } - obj.exported = message.exported; + obj.exported = omitDefault(message.exported); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -387,8 +387,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.address = omitDefault(message.address); + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts index 6164486c09..2e21aacd7a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -487,7 +487,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -699,7 +699,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -897,7 +897,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1123,7 +1123,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1349,8 +1349,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1548,8 +1548,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -1747,7 +1747,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1973,7 +1973,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2227,9 +2227,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.src_validator_addr = omitDefault(message.srcValidatorAddr); + obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2455,7 +2455,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2681,8 +2681,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -2866,7 +2866,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts index 770b7ff5a7..21e1ef4b59 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -661,9 +661,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -764,7 +764,7 @@ export const Commission = { fromAmino(object: CommissionAmino): Commission { return { commissionRates: object?.commission_rates ? CommissionRates.fromAmino(object.commission_rates) : undefined, - updateTime: object.update_time + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: Commission): CommissionAmino { @@ -918,11 +918,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = omitDefault(message.moniker); + obj.identity = omitDefault(message.identity); + obj.website = omitDefault(message.website); + obj.security_contact = omitDefault(message.securityContact); + obj.details = omitDefault(message.details); return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1147,24 +1147,24 @@ export const Validator = { delegatorShares: object.delegator_shares, description: object?.description ? Description.fromAmino(object.description) : undefined, unbondingHeight: BigInt(object.unbonding_height), - unbondingTime: object.unbonding_time, + unbondingTime: object?.unbonding_time ? Timestamp.fromAmino(object.unbonding_time) : undefined, commission: object?.commission ? Commission.fromAmino(object.commission) : undefined, minSelfDelegation: object.min_self_delegation }; }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = omitDefault(message.operatorAddress); obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = message.status; - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = omitDefault(message.jailed); + obj.status = omitDefault(message.status); + obj.tokens = omitDefault(message.tokens); + obj.delegator_shares = padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = omitDefault(message.unbondingHeight); obj.unbonding_time = message.unbondingTime; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1374,8 +1374,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1599,9 +1599,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -1825,9 +1825,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.shares = padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -1955,8 +1955,8 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { @@ -2088,17 +2088,17 @@ export const UnbondingDelegationEntry = { fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, balance: object.balance }; }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = omitDefault(message.initialBalance); + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2225,17 +2225,17 @@ export const RedelegationEntry = { fromAmino(object: RedelegationEntryAmino): RedelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, sharesDst: object.shares_dst }; }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = omitDefault(message.initialBalance); + obj.shares_dst = padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2377,9 +2377,9 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { @@ -2547,11 +2547,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = omitDefault(message.maxValidators); + obj.max_entries = omitDefault(message.maxEntries); + obj.historical_entries = omitDefault(message.historicalEntries); + obj.bond_denom = omitDefault(message.bondDenom); + obj.min_commission_rate = padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2765,7 +2765,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts index a8c55b5258..43e9748b7c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -284,9 +284,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -495,9 +495,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = omitDefault(message.validatorAddress); + obj.commission_rate = padDecimal(message.commissionRate); + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -689,8 +689,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -897,9 +897,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -987,7 +987,7 @@ export const MsgBeginRedelegateResponse = { }, fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { @@ -1112,8 +1112,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1201,7 +1201,7 @@ export const MsgUndelegateResponse = { }, fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts index e78d240a1f..3bea420c60 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts @@ -1,7 +1,7 @@ import { CompactBitArray, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -361,7 +361,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { @@ -574,7 +574,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.signature = message.signature; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts index 089e715655..3be8ff0d2a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts @@ -4,7 +4,7 @@ import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultS import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../tendermint/types/block"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -404,7 +404,7 @@ export const GetTxsEventRequest = { obj.events = []; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = message.orderBy; + obj.order_by = omitDefault(message.orderBy); return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -657,7 +657,7 @@ export const BroadcastTxRequest = { toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1055,7 +1055,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1268,7 +1268,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts index 93818d5cf3..62b87d3d9c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../ import { CompactBitArray, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -767,8 +767,8 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.auth_info_bytes = message.authInfoBytes; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -932,9 +932,9 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1112,8 +1112,8 @@ export const TxBody = { } else { obj.messages = []; } - obj.memo = message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.memo = omitDefault(message.memo); + obj.timeout_height = omitDefault(message.timeoutHeight); if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1379,7 +1379,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1578,7 +1578,7 @@ export const ModeInfo_Single = { }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -1844,9 +1844,9 @@ export const Fee = { } else { obj.amount = []; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.gas_limit = omitDefault(message.gasLimit); + obj.payer = omitDefault(message.payer); + obj.granter = omitDefault(message.granter); return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -1965,7 +1965,7 @@ export const Tip = { } else { obj.amount = []; } - obj.tipper = message.tipper; + obj.tipper = omitDefault(message.tipper); return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2099,9 +2099,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.sig = message.sig; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts index e6d26d2c5c..9655b88727 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -395,7 +395,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -487,7 +487,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -579,7 +579,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = omitDefault(message.lastHeight); return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -763,7 +763,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = message.moduleName; + obj.module_name = omitDefault(message.moduleName); return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -1031,7 +1031,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts index a70e117cfb..92dc39510b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts @@ -41,7 +41,7 @@ export const AminoConverter = { plan: { name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), + height: omitDefault(plan.height)?.toString?.(), info: omitDefault(plan.info), upgraded_client_state: { type_url: omitDefault(plan.upgradedClientState.typeUrl), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts index c4208170e0..b632719a9f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -144,7 +144,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -309,7 +309,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts index 9e71338b93..9436a6cba2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -231,7 +231,7 @@ export const Plan = { fromAmino(object: PlanAmino): Plan { return { name: object.name, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, height: BigInt(object.height), info: object.info, upgradedClientState: object?.upgraded_client_state ? Any.fromAmino(object.upgraded_client_state) : undefined @@ -239,10 +239,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.time = message.time; - obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.height = omitDefault(message.height); + obj.info = omitDefault(message.info); obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -363,8 +363,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -471,8 +471,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -578,8 +578,8 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.name = omitDefault(message.name); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index dbe24d82a8..e840986a6c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -59,8 +59,8 @@ export const AminoConverter = { denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) })), - end_time: endTime.toString(), - delayed: delayed + end_time: omitDefault(endTime)?.toString?.(), + delayed: omitDefault(delayed) }; }, fromAmino: ({ @@ -124,9 +124,9 @@ export const AminoConverter = { return { from_address: omitDefault(fromAddress), to_address: omitDefault(toAddress), - start_time: startTime.toString(), + start_time: omitDefault(startTime)?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts index 6b3512e4aa..7bce200489 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -212,15 +212,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.amount = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; - obj.delayed = message.delayed; + obj.end_time = omitDefault(message.endTime); + obj.delayed = omitDefault(message.delayed); return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -420,8 +420,8 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -640,9 +640,9 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts index d7eaac7e1b..106434b2a8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -268,7 +268,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = omitDefault(message.endTime); return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -375,7 +375,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -581,7 +581,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = omitDefault(message.length); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -715,7 +715,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts index c802974c9c..e24aa6744b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial } from "../helpers"; +import { isSet, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -190,8 +190,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -322,8 +322,8 @@ export const ScalarDescriptor = { }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); if (message.fieldType) { obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts index fb1c397a42..7201e6906b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** * ContractExecutionAuthorization defines authorization for wasm execute. @@ -460,7 +460,7 @@ export const ContractGrant = { }, toAmino(message: ContractGrant): ContractGrantAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); obj.limit = message.limit ? Any.toAmino(message.limit) : undefined; obj.filter = message.filter ? Any.toAmino(message.filter) : undefined; return obj; @@ -554,7 +554,7 @@ export const MaxCallsLimit = { }, toAmino(message: MaxCallsLimit): MaxCallsLimitAmino { const obj: any = {}; - obj.remaining = message.remaining ? message.remaining.toString() : undefined; + obj.remaining = omitDefault(message.remaining); return obj; }, fromAminoMsg(object: MaxCallsLimitAminoMsg): MaxCallsLimit { @@ -772,7 +772,7 @@ export const CombinedLimit = { }, toAmino(message: CombinedLimit): CombinedLimitAmino { const obj: any = {}; - obj.calls_remaining = message.callsRemaining ? message.callsRemaining.toString() : undefined; + obj.calls_remaining = omitDefault(message.callsRemaining); if (message.amounts) { obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts index 5e69794dee..bec96638b7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts @@ -1,7 +1,7 @@ import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType } from "./tx"; import { Params, ParamsSDKType, CodeInfo, CodeInfoSDKType, ContractInfo, ContractInfoSDKType, Model, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -505,10 +505,10 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes; - obj.pinned = message.pinned; + obj.pinned = omitDefault(message.pinned); return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -636,7 +636,7 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); @@ -749,7 +749,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts index 105112803a..3ad2036369 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -145,9 +145,9 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.channel = omitDefault(message.channel); + obj.timeout_height = omitDefault(message.timeoutHeight); + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); obj.data = message.data; return obj; }, @@ -240,7 +240,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = omitDefault(message.channel); return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts index d7ee78345e..409a617d25 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -334,9 +334,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -536,12 +536,12 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -695,10 +695,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -833,9 +833,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1006,10 +1006,10 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1149,10 +1149,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1272,9 +1272,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1411,8 +1411,8 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { @@ -1554,8 +1554,8 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts index 60062c05f5..c1638b775c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** @@ -359,7 +359,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -465,7 +465,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -572,7 +572,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -798,7 +798,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1024,7 +1024,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1250,7 +1250,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData; return obj; }, @@ -1449,7 +1449,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1634,7 +1634,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { @@ -1754,8 +1754,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId; + obj.creator = omitDefault(message.creator); obj.data_hash = message.dataHash; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index 87c0a7e409..476501027c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), admin: omitDefault(admin), - code_id: codeId.toString(), + code_id: omitDefault(codeId)?.toString?.(), label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +186,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), contract: omitDefault(contract), - code_id: codeId.toString(), + code_id: omitDefault(codeId)?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts index a6225a4362..bd9291364b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgStoreCode submit Wasm code to the system */ @@ -260,7 +260,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -354,7 +354,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -524,10 +524,10 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.sender = omitDefault(message.sender); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -639,7 +639,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.data = message.data; return obj; }, @@ -782,8 +782,8 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1015,9 +1015,9 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1230,9 +1230,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1410,8 +1410,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts index cbf707b4d0..c1b3d05e42 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ @@ -293,7 +293,7 @@ export const AccessTypeParam = { }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -399,8 +399,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = message.permission; - obj.address = message.address; + obj.permission = omitDefault(message.permission); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -521,8 +521,8 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.instantiate_default_permission = omitDefault(message.instantiateDefaultPermission); + obj.max_wasm_code_size = omitDefault(message.maxWasmCodeSize); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -643,7 +643,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -820,12 +820,12 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.code_id = omitDefault(message.codeId); + obj.creator = omitDefault(message.creator); + obj.admin = omitDefault(message.admin); + obj.label = omitDefault(message.label); obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = omitDefault(message.ibcPortId); obj.extension = message.extension ? Any.toAmino(message.extension) : undefined; return obj; }, @@ -960,8 +960,8 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.operation = omitDefault(message.operation); + obj.code_id = omitDefault(message.codeId); obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1069,8 +1069,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); + obj.tx_index = omitDefault(message.txIndex); return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts index 3854732c9e..ca49dbe7a4 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -205,9 +205,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = message.action; - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = omitDefault(message.action); + obj.completed = omitDefault(message.completed); + obj.claimable_amount = omitDefault(message.claimableAmount); return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -338,8 +338,8 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = omitDefault(message.address); + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { @@ -461,7 +461,7 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts index b41d1f279d..b381dd0a7f 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts @@ -2,7 +2,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressSDKType } from "./claims"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -316,7 +316,7 @@ export const Params = { fromAmino(object: ParamsAmino): Params { return { enableClaims: object.enable_claims, - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimsDenom: object.claims_denom, @@ -326,11 +326,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = omitDefault(message.enableClaims); obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = omitDefault(message.claimsDenom); if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts index 30e290a2f4..52bde33f98 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -691,7 +691,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -799,7 +799,7 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts index 3d5963e85c..4f069d7a2c 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -170,23 +170,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts index 4469e08520..af1bc27b8f 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination: PageRequest; @@ -295,7 +295,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -381,7 +381,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts index fb222047d1..b07d3f3193 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts @@ -1,6 +1,6 @@ import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -242,10 +242,10 @@ export const TokenPair = { }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = message.contractOwner; + obj.erc20_address = omitDefault(message.erc20Address); + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); + obj.contract_owner = omitDefault(message.contractOwner); return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -359,8 +359,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -475,9 +475,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.erc20address = omitDefault(message.erc20address); return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -591,9 +591,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts index 827ed639cc..b1aa770bc1 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -224,8 +224,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = message.enableErc20; - obj.enable_evm_hook = message.enableEvmHook; + obj.enable_erc20 = omitDefault(message.enableErc20); + obj.enable_evm_hook = omitDefault(message.enableEvmHook); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts index e9dc1d28c8..296b3d49bf 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { TokenPair, TokenPairSDKType } from "./erc20"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -346,7 +346,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = message.token; + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts index 589a1a9219..55a8ee4f10 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -148,8 +148,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -343,10 +343,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = omitDefault(message.contractAddress); + obj.amount = omitDefault(message.amount); + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts index 29394204e6..e63354c975 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -120,9 +120,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts index 98a304e97a..22757d927a 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -281,11 +281,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = message.enableFees; - obj.developer_shares = message.developerShares; - obj.validator_shares = message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; - obj.min_gas_price = message.minGasPrice; + obj.enable_fees = omitDefault(message.enableFees); + obj.developer_shares = padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); + obj.min_gas_price = padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts index 78ed82eb07..aeea760238 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -384,7 +384,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -722,7 +722,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = omitDefault(message.deployerAddress); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts index be56e0a897..f138abb59c 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -209,9 +209,9 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { @@ -382,8 +382,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -563,9 +563,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts index bd6e8c593b..d33f13e023 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -285,10 +285,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = message.enableIncentives; - obj.allocation_limit = message.allocationLimit; - obj.incentives_epoch_identifier = message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler; + obj.enable_incentives = omitDefault(message.enableIncentives); + obj.allocation_limit = padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); + obj.reward_scaler = padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts index 1dbb692fa1..490926a8df 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -206,21 +206,21 @@ export const Incentive = { contract: object.contract, allocations: Array.isArray(object?.allocations) ? object.allocations.map((e: any) => DecCoin.fromAmino(e)) : [], epochs: object.epochs, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, totalGas: BigInt(object.total_gas) }; }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); obj.start_time = message.startTime; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = omitDefault(message.totalGas); return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -334,9 +334,9 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); + obj.cumulative_gas = omitDefault(message.cumulativeGas); return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { @@ -486,15 +486,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -608,9 +608,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts index fd9e6ad0f5..a16b2f7b45 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -470,7 +470,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -656,7 +656,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -870,8 +870,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -957,7 +957,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = omitDefault(message.gasMeter); return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1242,7 +1242,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts index aefac9f788..03372295e6 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -165,10 +165,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.period = omitDefault(message.period); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.epochs_per_period = omitDefault(message.epochsPerPeriod); + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -296,10 +296,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = omitDefault(message.mintDenom); obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = omitDefault(message.enableInflation); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts index 843ea1bf5f..b63e2f6da6 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -170,9 +170,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards; - obj.usage_incentives = message.usageIncentives; - obj.community_pool = message.communityPool; + obj.staking_rewards = padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -314,11 +314,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a; - obj.r = message.r; - obj.c = message.c; - obj.bonding_target = message.bondingTarget; - obj.max_variance = message.maxVariance; + obj.a = padDecimal(message.a); + obj.r = padDecimal(message.r); + obj.c = padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts index 159dc1f1bd..42fdc121f6 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -263,7 +263,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -567,7 +567,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -871,7 +871,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate; + obj.inflation_rate = padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts index f4aae79a45..ce276d33ab 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -190,7 +190,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = omitDefault(message.enableRecovery); obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts index 1babe85b3e..116b99f215 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -99,7 +99,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index 92314cb295..85cb68563a 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -54,20 +54,20 @@ export const AminoConverter = { to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) })) })), - merge: merge + merge: omitDefault(merge) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts index 666c941d8d..654117b0e2 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -220,7 +220,7 @@ export const MsgCreateClawbackVestingAccount = { return { fromAddress: object.from_address, toAddress: object.to_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [], merge: object.merge @@ -228,8 +228,8 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); @@ -241,7 +241,7 @@ export const MsgCreateClawbackVestingAccount = { } else { obj.vesting_periods = []; } - obj.merge = message.merge; + obj.merge = omitDefault(message.merge); return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -421,9 +421,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = omitDefault(message.funderAddress); + obj.account_address = omitDefault(message.accountAddress); + obj.dest_address = omitDefault(message.destAddress); return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts index 8c09524940..f2c9a0ed47 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts @@ -1,7 +1,7 @@ import { BaseVestingAccount, BaseVestingAccountSDKType, Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -169,7 +169,7 @@ export const ClawbackVestingAccount = { return { baseVestingAccount: object?.base_vesting_account ? BaseVestingAccount.fromAmino(object.base_vesting_account) : undefined, funderAddress: object.funder_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [] }; @@ -177,7 +177,7 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = omitDefault(message.funderAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/google/api/auth.ts b/__fixtures__/v-next/outputosmojs/google/api/auth.ts index 5f29c5d813..fb32f92772 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/auth.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -560,9 +560,9 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = omitDefault(message.allowWithoutCredential); if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { @@ -681,9 +681,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = omitDefault(message.header); + obj.query = omitDefault(message.query); + obj.value_prefix = omitDefault(message.valuePrefix); return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -847,11 +847,11 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = omitDefault(message.id); + obj.issuer = omitDefault(message.issuer); + obj.jwks_uri = omitDefault(message.jwksUri); + obj.audiences = omitDefault(message.audiences); + obj.authorization_url = omitDefault(message.authorizationUrl); if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { @@ -942,7 +942,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = omitDefault(message.canonicalScopes); return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1042,8 +1042,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = omitDefault(message.providerId); + obj.audiences = omitDefault(message.audiences); return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputosmojs/google/api/backend.ts b/__fixtures__/v-next/outputosmojs/google/api/backend.ts index d338bed164..31fb2077aa 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/backend.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/backend.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -480,15 +480,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = message.pathTranslation; - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = omitDefault(message.selector); + obj.address = omitDefault(message.address); + obj.deadline = omitDefault(message.deadline); + obj.min_deadline = omitDefault(message.minDeadline); + obj.operation_deadline = omitDefault(message.operationDeadline); + obj.path_translation = omitDefault(message.pathTranslation); + obj.jwt_audience = omitDefault(message.jwtAudience); + obj.disable_auth = omitDefault(message.disableAuth); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputosmojs/google/api/billing.ts b/__fixtures__/v-next/outputosmojs/google/api/billing.ts index 27347f04dd..9c841d19cf 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/billing.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -292,7 +292,7 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/config_change.ts b/__fixtures__/v-next/outputosmojs/google/api/config_change.ts index 96400d8390..a07880516d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/config_change.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/config_change.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -264,10 +264,10 @@ export const ConfigChange = { }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = message.changeType; + obj.element = omitDefault(message.element); + obj.old_value = omitDefault(message.oldValue); + obj.new_value = omitDefault(message.newValue); + obj.change_type = omitDefault(message.changeType); if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { @@ -358,7 +358,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputosmojs/google/api/consumer.ts b/__fixtures__/v-next/outputosmojs/google/api/consumer.ts index f44ff01000..ad9033ff50 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/consumer.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/consumer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -329,9 +329,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputosmojs/google/api/context.ts b/__fixtures__/v-next/outputosmojs/google/api/context.ts index 845e6385ca..ca42a21971 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/context.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -378,7 +378,7 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.requested) { obj.requested = message.requested.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/control.ts b/__fixtures__/v-next/outputosmojs/google/api/control.ts index 7113f80159..6d73e1fa4c 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/control.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -88,7 +88,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = message.environment; + obj.environment = omitDefault(message.environment); return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputosmojs/google/api/distribution.ts b/__fixtures__/v-next/outputosmojs/google/api/distribution.ts index 74f1a529cf..42567cc5e6 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/distribution.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../protobuf/timestamp"; import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -479,9 +479,9 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { @@ -593,8 +593,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = omitDefault(message.min); + obj.max = omitDefault(message.max); return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -824,9 +824,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -940,9 +940,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1165,13 +1165,13 @@ export const Distribution_Exemplar = { fromAmino(object: Distribution_ExemplarAmino): Distribution_Exemplar { return { value: object.value, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, attachments: Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); obj.timestamp = message.timestamp; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/google/api/documentation.ts b/__fixtures__/v-next/outputosmojs/google/api/documentation.ts index 83abb83efd..9fc5f6b171 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/documentation.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -383,7 +383,7 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = message.summary; + obj.summary = omitDefault(message.summary); if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { @@ -394,9 +394,9 @@ export const Documentation = { } else { obj.rules = []; } - obj.documentation_root_url = message.documentationRootUrl; - obj.service_root_url = message.serviceRootUrl; - obj.overview = message.overview; + obj.documentation_root_url = omitDefault(message.documentationRootUrl); + obj.service_root_url = omitDefault(message.serviceRootUrl); + obj.overview = omitDefault(message.overview); return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -510,9 +510,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.description = message.description; - obj.deprecation_description = message.deprecationDescription; + obj.selector = omitDefault(message.selector); + obj.description = omitDefault(message.description); + obj.deprecation_description = omitDefault(message.deprecationDescription); return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -634,8 +634,8 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = message.name; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.content = omitDefault(message.content); if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts b/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts index 324c6217f5..96a901256e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -193,14 +193,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { obj.aliases = []; } - obj.target = message.target; - obj.allow_cors = message.allowCors; + obj.target = omitDefault(message.target); + obj.allow_cors = omitDefault(message.allowCors); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts index 38ec79acc4..368d215d9b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -3,7 +3,7 @@ import { Decl, DeclSDKType, CheckedExpr, CheckedExprSDKType } from "../../v1alph import { ExprValue, ExprValueSDKType } from "../../v1alpha1/eval"; import { Status, StatusSDKType } from "../../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../../helpers"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -309,10 +309,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = omitDefault(message.celSource); + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.source_location = omitDefault(message.sourceLocation); + obj.disable_macros = omitDefault(message.disableMacros); return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -567,8 +567,8 @@ export const CheckRequest = { } else { obj.type_env = []; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = omitDefault(message.container); + obj.no_std_env = omitDefault(message.noStdEnv); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -780,7 +780,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -954,7 +954,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1181,9 +1181,9 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts index c24d5ae88a..e7051bf412 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts @@ -2,7 +2,7 @@ import { SourceInfo, SourceInfoSDKType, Expr, ExprSDKType, Constant, ConstantSDK import { Empty, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -603,7 +603,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -697,7 +697,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, @@ -933,7 +933,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = omitDefault(message.exprVersion); obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1189,15 +1189,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = message.null; - obj.primitive = message.primitive; - obj.wrapper = message.wrapper; - obj.well_known = message.wellKnown; + obj.null = omitDefault(message.null); + obj.primitive = omitDefault(message.primitive); + obj.wrapper = omitDefault(message.wrapper); + obj.well_known = omitDefault(message.wellKnown); obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = omitDefault(message.messageType); + obj.type_param = omitDefault(message.typeParam); obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1608,7 +1608,7 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -1727,7 +1727,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -1845,7 +1845,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2115,7 +2115,7 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = omitDefault(message.overloadId); if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -2127,8 +2127,8 @@ export const Decl_FunctionDecl_Overload = { obj.type_params = []; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = omitDefault(message.isInstanceFunction); + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2250,7 +2250,7 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts index c356c814d5..d9403e850b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -337,8 +337,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = omitDefault(message.expr); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts index a1349e6432..c7696fc5fe 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -251,8 +251,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.value_index = message.valueIndex; + obj.id = omitDefault(message.id); + obj.value_index = omitDefault(message.valueIndex); return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts index f2f5e770bf..4ae71f6e4b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts @@ -2,7 +2,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -746,7 +746,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -839,7 +839,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -954,8 +954,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1078,7 +1078,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1289,7 +1289,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = omitDefault(message.messageName); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1422,8 +1422,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1595,9 +1595,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1794,17 +1794,17 @@ export const Constant = { stringValue: object?.string_value, bytesValue: object?.bytes_value, durationValue: object?.duration_value ? Duration.fromAmino(object.duration_value) : undefined, - timestampValue: object?.timestamp_value + timestampValue: object?.timestamp_value ? Timestamp.fromAmino(object.timestamp_value) : undefined }; }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue; @@ -1906,8 +1906,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2000,7 +2000,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, @@ -2240,8 +2240,8 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -2386,10 +2386,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts index c3d9e73961..ab8022a18e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts @@ -1,7 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -348,18 +348,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -459,8 +459,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts index e3e282f415..dda9e114cf 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -201,9 +201,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.doc = omitDefault(message.doc); obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -327,8 +327,8 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = omitDefault(message.id); + obj.type = omitDefault(message.type); if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { @@ -562,7 +562,7 @@ export const FunctionDecl = { obj.args = []; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = omitDefault(message.receiverFunction); return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts index ea77000e7a..4e1163c523 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -347,7 +347,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -745,7 +745,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts index b824d62037..d5fb8875cb 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts @@ -1,7 +1,7 @@ import { SourceInfo, SourceInfoSDKType } from "./source"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -463,7 +463,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = omitDefault(message.syntaxVersion); return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -647,7 +647,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -740,7 +740,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -855,8 +855,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -979,7 +979,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1190,7 +1190,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1323,8 +1323,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1496,9 +1496,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1672,12 +1672,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts index abed1015e8..24e69ff91d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -147,8 +147,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -316,7 +316,7 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -455,10 +455,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts index b65bb04227..0012295f85 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts @@ -1,7 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -348,18 +348,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -459,8 +459,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputosmojs/google/api/http.ts b/__fixtures__/v-next/outputosmojs/google/api/http.ts index fa3c90307c..9156b1534c 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/http.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -744,7 +744,7 @@ export const Http = { } else { obj.rules = []; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -964,15 +964,15 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = omitDefault(message.selector); + obj.get = omitDefault(message.get); + obj.put = omitDefault(message.put); + obj.post = omitDefault(message.post); + obj.delete = omitDefault(message.delete); + obj.patch = omitDefault(message.patch); obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = omitDefault(message.body); + obj.response_body = omitDefault(message.responseBody); if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { @@ -1077,8 +1077,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = omitDefault(message.kind); + obj.path = omitDefault(message.path); return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts b/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts index 8874270de0..69cf47c4a8 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -211,7 +211,7 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = omitDefault(message.contentType); obj.data = message.data; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/google/api/label.ts b/__fixtures__/v-next/outputosmojs/google/api/label.ts index 08bd5635df..52a308026f 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/label.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/label.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -152,9 +152,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = message.valueType; - obj.description = message.description; + obj.key = omitDefault(message.key); + obj.value_type = omitDefault(message.valueType); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/google/api/log.ts b/__fixtures__/v-next/outputosmojs/google/api/log.ts index cd875e3736..28f857ea37 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/log.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -170,14 +170,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.description = message.description; - obj.display_name = message.displayName; + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/google/api/logging.ts b/__fixtures__/v-next/outputosmojs/google/api/logging.ts index 320c560163..beb4fba318 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/logging.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -323,7 +323,7 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.logs) { obj.logs = message.logs.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/metric.ts b/__fixtures__/v-next/outputosmojs/google/api/metric.ts index 4bf279c987..dda7d086cf 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/metric.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/metric.ts @@ -2,7 +2,7 @@ import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON import { Duration, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -605,20 +605,20 @@ export const MetricDescriptor = { }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.metric_kind = message.metricKind; - obj.value_type = message.valueType; - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = omitDefault(message.metricKind); + obj.value_type = omitDefault(message.valueType); + obj.unit = omitDefault(message.unit); + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { @@ -737,7 +737,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -838,8 +838,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -976,7 +976,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts b/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts index d98ce6eb5a..0c70f0b2e3 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts @@ -2,7 +2,7 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Struct, StructSDKType } from "../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -324,16 +324,16 @@ export const MonitoredResourceDescriptor = { }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.display_name = omitDefault(message.displayName); + obj.description = omitDefault(message.description); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -432,8 +432,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -570,7 +570,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -675,8 +675,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts b/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts index 97d82c1c36..c1b87e8038 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -371,7 +371,7 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/quota.ts b/__fixtures__/v-next/outputosmojs/google/api/quota.ts index 1f31bd3d53..02811a4906 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/quota.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, isObject } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -486,8 +486,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -624,7 +624,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -729,8 +729,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -979,21 +979,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; - obj.duration = message.duration; - obj.metric = message.metric; - obj.unit = message.unit; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.default_limit = omitDefault(message.defaultLimit); + obj.max_limit = omitDefault(message.maxLimit); + obj.free_tier = omitDefault(message.freeTier); + obj.duration = omitDefault(message.duration); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputosmojs/google/api/resource.ts b/__fixtures__/v-next/outputosmojs/google/api/resource.ts index a17b701020..9a6e91c16e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/resource.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/resource.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -512,16 +512,16 @@ export const ResourceDescriptor = { }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { obj.pattern = []; } - obj.name_field = message.nameField; - obj.history = message.history; - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = omitDefault(message.nameField); + obj.history = omitDefault(message.history); + obj.plural = omitDefault(message.plural); + obj.singular = omitDefault(message.singular); if (message.style) { obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); } else { @@ -626,8 +626,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = omitDefault(message.type); + obj.child_type = omitDefault(message.childType); return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputosmojs/google/api/routing.ts b/__fixtures__/v-next/outputosmojs/google/api/routing.ts index ecd714d53b..e22a2f7483 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/routing.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -983,8 +983,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = message.field; - obj.path_template = message.pathTemplate; + obj.field = omitDefault(message.field); + obj.path_template = omitDefault(message.pathTemplate); return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputosmojs/google/api/service.ts b/__fixtures__/v-next/outputosmojs/google/api/service.ts index b80c3792db..d6eb16b952 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/service.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersSDKType } from "./system_parameter"; import { SourceInfo, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -654,10 +654,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; - obj.producer_project_id = message.producerProjectId; - obj.id = message.id; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.id = omitDefault(message.id); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts index 53fa7d0921..b1a4476b31 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,6 @@ import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -334,9 +334,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.detail = omitDefault(message.detail); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts index a4ee4cbada..89c26144c8 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -376,11 +376,11 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.minimum = message.minimum; - obj.maximum = message.maximum; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.minimum = omitDefault(message.minimum); + obj.maximum = omitDefault(message.maximum); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { @@ -507,9 +507,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -623,9 +623,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts index 3d1d7f00ed..34248aedad 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -364,21 +364,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts index e09eb4480e..6cb2705928 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts @@ -4,7 +4,7 @@ import { HttpRequest, HttpRequestSDKType } from "./http_request"; import { Any, AnySDKType } from "../../../protobuf/any"; import { Struct, StructSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; @@ -241,8 +241,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -499,7 +499,7 @@ export const LogEntry = { fromAmino(object: LogEntryAmino): LogEntry { return { name: object.name, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, trace: object.trace, @@ -519,12 +519,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timestamp = message.timestamp; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = omitDefault(message.trace); + obj.insert_id = omitDefault(message.insertId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -532,7 +532,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -663,10 +663,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -780,9 +780,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts index b66671ac62..33db5254bf 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { Distribution, DistributionSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; @@ -160,8 +160,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -371,8 +371,8 @@ export const MetricValue = { acc[key] = String(value); return acc; }, {}) : {}, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, boolValue: object?.bool_value, int64Value: object?.int64_value ? BigInt(object.int64_value) : undefined, doubleValue: object?.double_value, @@ -390,10 +390,10 @@ export const MetricValue = { } obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -502,7 +502,7 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts index f0be1cccba..24659e9054 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts @@ -3,7 +3,7 @@ import { MetricValueSet, MetricValueSetSDKType } from "./metric_value"; import { LogEntry, LogEntrySDKType } from "./log_entry"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -231,8 +231,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -489,8 +489,8 @@ export const Operation = { operationId: object.operation_id, operationName: object.operation_name, consumerId: object.consumer_id, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -505,9 +505,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.operation_name = omitDefault(message.operationName); + obj.consumer_id = omitDefault(message.consumerId); obj.start_time = message.startTime; obj.end_time = message.endTime; obj.labels = {}; @@ -526,7 +526,7 @@ export const Operation = { } else { obj.log_entries = []; } - obj.importance = message.importance; + obj.importance = omitDefault(message.importance); if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts index 8ccf5b15ba..55e24dea89 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts @@ -1,7 +1,7 @@ import { MetricValueSet, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -425,9 +425,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -526,8 +526,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -728,9 +728,9 @@ export const QuotaOperation = { }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.method_name = omitDefault(message.methodName); + obj.consumer_id = omitDefault(message.consumerId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -742,7 +742,7 @@ export const QuotaOperation = { } else { obj.quota_metrics = []; } - obj.quota_mode = message.quotaMode; + obj.quota_mode = omitDefault(message.quotaMode); return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -886,7 +886,7 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { @@ -897,7 +897,7 @@ export const AllocateQuotaResponse = { } else { obj.quota_metrics = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1025,9 +1025,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.description = message.description; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts index d4c036b22a..9ed7a5f41d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts @@ -2,7 +2,7 @@ import { Operation, OperationSDKType } from "./operation"; import { CheckError, CheckErrorSDKType } from "./check_error"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -359,9 +359,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -511,14 +511,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { obj.check_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -746,9 +746,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.project_number = omitDefault(message.projectNumber); + obj.type = omitDefault(message.type); + obj.consumer_number = omitDefault(message.consumerNumber); return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { @@ -870,13 +870,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { obj.operations = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1003,8 +1003,8 @@ export const ReportResponse = { } else { obj.report_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1104,7 +1104,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts index 1ea813abfe..e302198bd8 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -271,15 +271,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { obj.resources = []; } - obj.flags = message.flags; + obj.flags = omitDefault(message.flags); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -421,11 +421,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.permission = omitDefault(message.permission); + obj.container = omitDefault(message.container); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -524,8 +524,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -790,8 +790,8 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts index 915f918ae9..ad9239e65b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { ConfigChange, ConfigChangeSDKType } from "../../config_change"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -630,8 +630,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = omitDefault(message.serviceName); + obj.producer_project_id = omitDefault(message.producerProjectId); return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -770,7 +770,7 @@ export const OperationMetadata = { resourceNames: Array.isArray(object?.resource_names) ? object.resource_names.map((e: any) => e) : [], steps: Array.isArray(object?.steps) ? object.steps.map((e: any) => OperationMetadata_Step.fromAmino(e)) : [], progressPercentage: object.progress_percentage, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: OperationMetadata): OperationMetadataAmino { @@ -785,7 +785,7 @@ export const OperationMetadata = { } else { obj.steps = []; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = omitDefault(message.progressPercentage); obj.start_time = message.startTime; return obj; }, @@ -886,8 +886,8 @@ export const OperationMetadata_Step = { }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = message.status; + obj.description = omitDefault(message.description); + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1001,9 +1001,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = message.kind; - obj.message = message.message; + obj.location = omitDefault(message.location); + obj.kind = omitDefault(message.kind); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1111,7 +1111,7 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { @@ -1230,9 +1230,9 @@ export const ConfigFile = { }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = omitDefault(message.filePath); obj.file_contents = message.fileContents; - obj.file_type = message.fileType; + obj.file_type = omitDefault(message.fileType); return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1318,7 +1318,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1576,7 +1576,7 @@ export const Rollout = { fromAmino(object: RolloutAmino): Rollout { return { rolloutId: object.rollout_id, - createTime: object.create_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, createdBy: object.created_by, status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: object?.traffic_percent_strategy ? Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy) : undefined, @@ -1586,13 +1586,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = omitDefault(message.rolloutId); obj.create_time = message.createTime; - obj.created_by = message.createdBy; - obj.status = message.status; + obj.created_by = omitDefault(message.createdBy); + obj.status = omitDefault(message.status); obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1691,8 +1691,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts index 610b269559..f7d40a46ae 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts @@ -2,7 +2,7 @@ import { ManagedService, ManagedServiceSDKType, ConfigSource, ConfigSourceSDKTyp import { Service, ServiceSDKType } from "../../service"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -478,10 +478,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.consumer_id = omitDefault(message.consumerId); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -594,7 +594,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -680,7 +680,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -852,7 +852,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -938,7 +938,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1138,9 +1138,9 @@ export const GetServiceConfigRequest = { }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = message.view; + obj.service_name = omitDefault(message.serviceName); + obj.config_id = omitDefault(message.configId); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1254,9 +1254,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1369,7 +1369,7 @@ export const ListServiceConfigsResponse = { } else { obj.service_configs = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1469,7 +1469,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1584,9 +1584,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = omitDefault(message.validateOnly); return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -1772,7 +1772,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -1901,10 +1901,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2017,7 +2017,7 @@ export const ListServiceRolloutsResponse = { } else { obj.rollouts = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2117,8 +2117,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = omitDefault(message.serviceName); + obj.rollout_id = omitDefault(message.rolloutId); return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2363,8 +2363,8 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = omitDefault(message.serviceName); + obj.id = omitDefault(message.id); if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts index f4e7d84ce6..ba9d584b59 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -267,10 +267,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -506,8 +506,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts index f24c314b88..86f60b2c3b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts @@ -1,6 +1,6 @@ import { Service, ServiceSDKType } from "./resources"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -364,7 +364,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -564,9 +564,9 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = message.checkIfServiceHasUsage; + obj.name = omitDefault(message.name); + obj.disable_dependent_services = omitDefault(message.disableDependentServices); + obj.check_if_service_has_usage = omitDefault(message.checkIfServiceHasUsage); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -738,7 +738,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -866,10 +866,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -982,7 +982,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1090,7 +1090,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -1320,8 +1320,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = omitDefault(message.serviceId); + obj.error_message = omitDefault(message.errorMessage); return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1429,7 +1429,7 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.names) { obj.names = message.names.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts index 9151c989f4..eb82ef3af2 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -721,10 +721,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -960,8 +960,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { @@ -1251,9 +1251,9 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.display_name = omitDefault(message.displayName); if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { @@ -1264,7 +1264,7 @@ export const ConsumerQuotaMetric = { } else { obj.descendant_consumer_quota_limits = []; } - obj.unit = message.unit; + obj.unit = omitDefault(message.unit); return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1428,11 +1428,11 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.is_precise = omitDefault(message.isPrecise); + obj.allows_admin_overrides = omitDefault(message.allowsAdminOverrides); if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { @@ -1536,8 +1536,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -1730,8 +1730,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = omitDefault(message.effectiveLimit); + obj.default_limit = omitDefault(message.defaultLimit); obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -1839,8 +1839,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2033,17 +2033,17 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.override_value = omitDefault(message.overrideValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.admin_override_ancestor = omitDefault(message.adminOverrideAncestor); return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2240,8 +2240,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2434,17 +2434,17 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.policy_value = omitDefault(message.policyValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2544,8 +2544,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = omitDefault(message.email); + obj.unique_id = omitDefault(message.uniqueId); return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts index 8a74fe6b90..a63b098dda 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,7 +1,7 @@ import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideSDKType, QuotaSafetyCheck, QuotaSafetyCheckSDKType, OverrideInlineSource, OverrideInlineSourceSDKType, Service, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentitySDKType, quotaViewFromJSON, quotaViewToJSON, quotaSafetyCheckFromJSON, quotaSafetyCheckToJSON } from "./resources"; import { FieldMask, FieldMaskSDKType } from "../../../protobuf/field_mask"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -823,7 +823,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -909,7 +909,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -995,7 +995,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1123,10 +1123,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1239,7 +1239,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1347,7 +1347,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -1480,10 +1480,10 @@ export const ListConsumerQuotaMetricsRequest = { }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = message.view; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -1596,7 +1596,7 @@ export const ListConsumerQuotaMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -1696,8 +1696,8 @@ export const GetConsumerQuotaMetricRequest = { }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -1797,8 +1797,8 @@ export const GetConsumerQuotaLimitRequest = { }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -1943,9 +1943,9 @@ export const CreateAdminOverrideRequest = { }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -2109,9 +2109,9 @@ export const UpdateAdminOverrideRequest = { }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -2248,8 +2248,8 @@ export const DeleteAdminOverrideRequest = { }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -2368,9 +2368,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -2483,7 +2483,7 @@ export const ListAdminOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -2726,9 +2726,9 @@ export const ImportAdminOverridesRequest = { }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3042,9 +3042,9 @@ export const CreateConsumerOverrideRequest = { }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3208,9 +3208,9 @@ export const UpdateConsumerOverrideRequest = { }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -3347,8 +3347,8 @@ export const DeleteConsumerOverrideRequest = { }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3467,9 +3467,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -3582,7 +3582,7 @@ export const ListConsumerOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -3825,9 +3825,9 @@ export const ImportConsumerOverridesRequest = { }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -4444,7 +4444,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -4545,7 +4545,7 @@ export const GetServiceIdentityResponse = { toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts b/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts index 2e4357b210..a7fabbd112 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -299,7 +299,7 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { @@ -418,9 +418,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = message.name; - obj.http_header = message.httpHeader; - obj.url_query_parameter = message.urlQueryParameter; + obj.name = omitDefault(message.name); + obj.http_header = omitDefault(message.httpHeader); + obj.url_query_parameter = omitDefault(message.urlQueryParameter); return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputosmojs/google/api/usage.ts b/__fixtures__/v-next/outputosmojs/google/api/usage.ts index f506786eda..c963ccbfe2 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/usage.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -240,7 +240,7 @@ export const Usage = { } else { obj.rules = []; } - obj.producer_notification_channel = message.producerNotificationChannel; + obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -354,9 +354,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.allow_unregistered_calls = message.allowUnregisteredCalls; - obj.skip_service_control = message.skipServiceControl; + obj.selector = omitDefault(message.selector); + obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); + obj.skip_service_control = omitDefault(message.skipServiceControl); return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputosmojs/google/api/visibility.ts b/__fixtures__/v-next/outputosmojs/google/api/visibility.ts index 47680155c8..9acefb0ff9 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/visibility.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -277,8 +277,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.restriction = message.restriction; + obj.selector = omitDefault(message.selector); + obj.restriction = omitDefault(message.restriction); return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts b/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts index b82c744f97..ec4c961f27 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -366,21 +366,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts index 785223e144..da2997e94f 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts @@ -5,7 +5,7 @@ import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../type/log_severity"; import { HttpRequest, HttpRequestSDKType } from "../type/http_request"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; @@ -361,8 +361,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -688,8 +688,8 @@ export const LogEntry = { protoPayload: object?.proto_payload ? Any.fromAmino(object.proto_payload) : undefined, textPayload: object?.text_payload, jsonPayload: object?.json_payload ? Struct.fromAmino(object.json_payload) : undefined, - timestamp: object.timestamp, - receiveTimestamp: object.receive_timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, + receiveTimestamp: object?.receive_timestamp ? Timestamp.fromAmino(object.receive_timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: object.insert_id, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, @@ -709,15 +709,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp; obj.receive_timestamp = message.receiveTimestamp; - obj.severity = message.severity; - obj.insert_id = message.insertId; + obj.severity = omitDefault(message.severity); + obj.insert_id = omitDefault(message.insertId); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -726,9 +726,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = omitDefault(message.trace); + obj.span_id = omitDefault(message.spanId); + obj.trace_sampled = omitDefault(message.traceSampled); obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -858,10 +858,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -975,9 +975,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1091,9 +1091,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = omitDefault(message.uid); + obj.index = omitDefault(message.index); + obj.total_splits = omitDefault(message.totalSplits); return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts index f89275065f..2ce65228e4 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts @@ -3,7 +3,7 @@ import { LogEntry, LogEntrySDKType } from "./log_entry"; import { Duration, DurationSDKType } from "../../protobuf/duration"; import { Status, StatusSDKType } from "../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -550,7 +550,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -649,8 +649,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -851,7 +851,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -864,8 +864,8 @@ export const WriteLogEntriesRequest = { } else { obj.entries = []; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = omitDefault(message.partialSuccess); + obj.dry_run = omitDefault(message.dryRun); return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1030,7 +1030,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1314,10 +1314,10 @@ export const ListLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = omitDefault(message.filter); + obj.order_by = omitDefault(message.orderBy); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1430,7 +1430,7 @@ export const ListLogEntriesResponse = { } else { obj.entries = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1530,8 +1530,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -1644,7 +1644,7 @@ export const ListMonitoredResourceDescriptorsResponse = { } else { obj.resource_descriptors = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -1780,9 +1780,9 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { @@ -1900,7 +1900,7 @@ export const ListLogsResponse = { } else { obj.log_names = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2027,7 +2027,7 @@ export const TailLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2253,8 +2253,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.suppressed_count = message.suppressedCount; + obj.reason = omitDefault(message.reason); + obj.suppressed_count = omitDefault(message.suppressedCount); return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts index 33fdd9b5eb..71e1606755 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts @@ -1,7 +1,7 @@ import { FieldMask, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -1761,8 +1761,8 @@ export const LogBucket = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, retentionDays: object.retention_days, locked: object.locked, lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : -1, @@ -1772,13 +1772,13 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = message.lifecycleState; + obj.retention_days = omitDefault(message.retentionDays); + obj.locked = omitDefault(message.locked); + obj.lifecycle_state = omitDefault(message.lifecycleState); if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { @@ -1919,18 +1919,18 @@ export const LogView = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, filter: object.filter }; }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -2172,25 +2172,25 @@ export const LogSink = { writerIdentity: object.writer_identity, includeChildren: object.include_children, bigqueryOptions: object?.bigquery_options ? BigQueryOptions.fromAmino(object.bigquery_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.destination = omitDefault(message.destination); + obj.filter = omitDefault(message.filter); + obj.description = omitDefault(message.description); + obj.disabled = omitDefault(message.disabled); if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { obj.exclusions = []; } - obj.output_version_format = message.outputVersionFormat; - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = omitDefault(message.outputVersionFormat); + obj.writer_identity = omitDefault(message.writerIdentity); + obj.include_children = omitDefault(message.includeChildren); obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; @@ -2293,8 +2293,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = omitDefault(message.usePartitionedTables); + obj.uses_timestamp_column_partitioning = omitDefault(message.usesTimestampColumnPartitioning); return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -2408,9 +2408,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -2523,7 +2523,7 @@ export const ListBucketsResponse = { } else { obj.buckets = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -2637,8 +2637,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = omitDefault(message.parent); + obj.bucket_id = omitDefault(message.bucketId); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -2753,7 +2753,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -2841,7 +2841,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -2927,7 +2927,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -3013,7 +3013,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -3127,9 +3127,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -3242,7 +3242,7 @@ export const ListViewsResponse = { } else { obj.views = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -3356,8 +3356,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = omitDefault(message.parent); + obj.view_id = omitDefault(message.viewId); obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -3472,7 +3472,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3560,7 +3560,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -3646,7 +3646,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -3760,9 +3760,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -3875,7 +3875,7 @@ export const ListSinksResponse = { } else { obj.sinks = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -3961,7 +3961,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -4075,9 +4075,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -4205,9 +4205,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -4294,7 +4294,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -4444,16 +4444,16 @@ export const LogExclusion = { description: object.description, filter: object.filter, disabled: object.disabled, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.create_time = message.createTime; obj.update_time = message.updateTime; return obj; @@ -4569,9 +4569,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -4684,7 +4684,7 @@ export const ListExclusionsResponse = { } else { obj.exclusions = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -4770,7 +4770,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -4870,7 +4870,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -4985,7 +4985,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5073,7 +5073,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -5159,7 +5159,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -5273,7 +5273,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5389,9 +5389,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.service_account_id = omitDefault(message.serviceAccountId); return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -5477,7 +5477,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -5591,7 +5591,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5735,11 +5735,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.kms_service_account_id = omitDefault(message.kmsServiceAccountId); + obj.storage_location = omitDefault(message.storageLocation); + obj.disable_default_sink = omitDefault(message.disableDefaultSink); return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -5853,9 +5853,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.destination = omitDefault(message.destination); return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -6014,8 +6014,8 @@ export const CopyLogEntriesMetadata = { }, fromAmino(object: CopyLogEntriesMetadataAmino): CopyLogEntriesMetadata { return { - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: object.cancellation_requested, request: object?.request ? CopyLogEntriesRequest.fromAmino(object.request) : undefined, @@ -6027,11 +6027,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.state = message.state; - obj.cancellation_requested = message.cancellationRequested; + obj.state = omitDefault(message.state); + obj.cancellation_requested = omitDefault(message.cancellationRequested); obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = omitDefault(message.progress); + obj.writer_identity = omitDefault(message.writerIdentity); return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { @@ -6117,7 +6117,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = omitDefault(message.logEntriesCopiedCount); return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts index 7eb7b4c9a8..efbfb5ed57 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts @@ -2,7 +2,7 @@ import { MetricDescriptor, MetricDescriptorSDKType } from "../../api/metric"; import { Distribution_BucketOptions } from "../../api/distribution"; import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -398,8 +398,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -655,19 +655,19 @@ export const LogMetric = { return acc; }, {}) : {}, bucketOptions: object?.bucket_options ? Distribution_BucketOptions.fromAmino(object.bucket_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = omitDefault(message.valueExtractor); obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -677,7 +677,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -791,9 +791,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -906,7 +906,7 @@ export const ListLogMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -992,7 +992,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1092,7 +1092,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1193,7 +1193,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1280,7 +1280,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts b/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts index 4e9c9d3655..43154a20a2 100644 --- a/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { Any, AnySDKType } from "../protobuf/any"; import { Status, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -302,9 +302,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = message.done; + obj.done = omitDefault(message.done); obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -392,7 +392,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -520,10 +520,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -636,7 +636,7 @@ export const ListOperationsResponse = { } else { obj.operations = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -722,7 +722,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -808,7 +808,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -908,7 +908,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1009,8 +1009,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = omitDefault(message.responseType); + obj.metadata_type = omitDefault(message.metadataType); return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts index 1e0dcc6334..2eb0b5c2ec 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts index 7bda351887..e6315232a3 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts @@ -1,7 +1,7 @@ import { Option, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJSON } from "./type"; import { SourceContext, SourceContextSDKType } from "./source_context"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -451,7 +451,7 @@ export const Api = { }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { @@ -462,14 +462,14 @@ export const Api = { } else { obj.options = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { obj.mixins = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -647,17 +647,17 @@ export const Method = { }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = omitDefault(message.name); + obj.request_type_url = omitDefault(message.requestTypeUrl); + obj.request_streaming = omitDefault(message.requestStreaming); + obj.response_type_url = omitDefault(message.responseTypeUrl); + obj.response_streaming = omitDefault(message.responseStreaming); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -757,8 +757,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = omitDefault(message.name); + obj.root = omitDefault(message.root); return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts index 9344d3dc75..dfb4b6145b 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -251,10 +251,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = message.major; - obj.minor = message.minor; - obj.patch = message.patch; - obj.suffix = message.suffix; + obj.major = omitDefault(message.major); + obj.minor = omitDefault(message.minor); + obj.patch = omitDefault(message.patch); + obj.suffix = omitDefault(message.suffix); return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -403,7 +403,7 @@ export const CodeGeneratorRequest = { } else { obj.file_to_generate = []; } - obj.parameter = message.parameter; + obj.parameter = omitDefault(message.parameter); if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { @@ -517,7 +517,7 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { @@ -636,9 +636,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = message.name; - obj.insertion_point = message.insertionPoint; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.insertion_point = omitDefault(message.insertionPoint); + obj.content = omitDefault(message.content); return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts index e5cc5b4079..276e47fb40 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -1671,8 +1671,8 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = omitDefault(message.name); + obj.package = omitDefault(message.package); if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { @@ -1710,7 +1710,7 @@ export const FileDescriptorProto = { } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -1986,7 +1986,7 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { @@ -2141,8 +2141,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2243,8 +2243,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2554,15 +2554,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = message.label; - obj.type = message.type; - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.label = omitDefault(message.label); + obj.type = omitDefault(message.type); + obj.type_name = omitDefault(message.typeName); + obj.extendee = omitDefault(message.extendee); + obj.default_value = omitDefault(message.defaultValue); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.json_name = omitDefault(message.jsonName); obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2663,7 +2663,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -2830,7 +2830,7 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { @@ -2946,8 +2946,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3061,8 +3061,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3185,7 +3185,7 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { @@ -3347,12 +3347,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = omitDefault(message.name); + obj.input_type = omitDefault(message.inputType); + obj.output_type = omitDefault(message.outputType); obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = omitDefault(message.clientStreaming); + obj.server_streaming = omitDefault(message.serverStreaming); return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3726,26 +3726,26 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = message.optimizeFor; - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = omitDefault(message.javaPackage); + obj.java_outer_classname = omitDefault(message.javaOuterClassname); + obj.java_multiple_files = omitDefault(message.javaMultipleFiles); + obj.java_generate_equals_and_hash = omitDefault(message.javaGenerateEqualsAndHash); + obj.java_string_check_utf8 = omitDefault(message.javaStringCheckUtf8); + obj.optimize_for = omitDefault(message.optimizeFor); + obj.go_package = omitDefault(message.goPackage); + obj.cc_generic_services = omitDefault(message.ccGenericServices); + obj.java_generic_services = omitDefault(message.javaGenericServices); + obj.py_generic_services = omitDefault(message.pyGenericServices); + obj.php_generic_services = omitDefault(message.phpGenericServices); + obj.deprecated = omitDefault(message.deprecated); + obj.cc_enable_arenas = omitDefault(message.ccEnableArenas); + obj.objc_class_prefix = omitDefault(message.objcClassPrefix); + obj.csharp_namespace = omitDefault(message.csharpNamespace); + obj.swift_prefix = omitDefault(message.swiftPrefix); + obj.php_class_prefix = omitDefault(message.phpClassPrefix); + obj.php_namespace = omitDefault(message.phpNamespace); + obj.php_metadata_namespace = omitDefault(message.phpMetadataNamespace); + obj.ruby_package = omitDefault(message.rubyPackage); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -3900,10 +3900,10 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = omitDefault(message.messageSetWireFormat); + obj.no_standard_descriptor_accessor = omitDefault(message.noStandardDescriptorAccessor); + obj.deprecated = omitDefault(message.deprecated); + obj.map_entry = omitDefault(message.mapEntry); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4086,12 +4086,12 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = message.ctype; - obj.packed = message.packed; - obj.jstype = message.jstype; - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = omitDefault(message.ctype); + obj.packed = omitDefault(message.packed); + obj.jstype = omitDefault(message.jstype); + obj.lazy = omitDefault(message.lazy); + obj.deprecated = omitDefault(message.deprecated); + obj.weak = omitDefault(message.weak); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4316,8 +4316,8 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = omitDefault(message.allowAlias); + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4430,7 +4430,7 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4543,7 +4543,7 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4670,8 +4670,8 @@ export const MethodOptions = { }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = message.idempotencyLevel; + obj.deprecated = omitDefault(message.deprecated); + obj.idempotency_level = omitDefault(message.idempotencyLevel); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4859,12 +4859,12 @@ export const UninterpretedOption = { } else { obj.name = []; } - obj.identifier_value = message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.identifier_value = omitDefault(message.identifierValue); + obj.positive_int_value = omitDefault(message.positiveIntValue); + obj.negative_int_value = omitDefault(message.negativeIntValue); + obj.double_value = omitDefault(message.doubleValue); obj.string_value = message.stringValue; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = omitDefault(message.aggregateValue); return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -4964,8 +4964,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = omitDefault(message.namePart); + obj.is_extension = omitDefault(message.isExtension); return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5257,8 +5257,8 @@ export const SourceCodeInfo_Location = { } else { obj.span = []; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = omitDefault(message.leadingComments); + obj.trailing_comments = omitDefault(message.trailingComments); if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { @@ -5511,9 +5511,9 @@ export const GeneratedCodeInfo_Annotation = { } else { obj.path = []; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = omitDefault(message.sourceFile); + obj.begin = omitDefault(message.begin); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts index 1137adafdf..ba106f7aee 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts index 327c390b9c..5f9df5828d 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -86,7 +86,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = message.fileName; + obj.file_name = omitDefault(message.fileName); return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts index 7a99396c23..67b9b2fe51 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -207,7 +207,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -492,10 +492,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = omitDefault(message.nullValue); + obj.number_value = omitDefault(message.numberValue); + obj.string_value = omitDefault(message.stringValue); + obj.bool_value = omitDefault(message.boolValue); obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts index 124eee4aaa..aaa8802807 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, fromJsonTimestamp, omitDefault, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts index f32cfa56cd..44a05dc6d1 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts @@ -1,7 +1,7 @@ import { SourceContext, SourceContextSDKType } from "./source_context"; import { Any, AnySDKType } from "./any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -529,7 +529,7 @@ export const Type = { }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { @@ -546,7 +546,7 @@ export const Type = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -766,20 +766,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = message.kind; - obj.cardinality = message.cardinality; - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = omitDefault(message.kind); + obj.cardinality = omitDefault(message.cardinality); + obj.number = omitDefault(message.number); + obj.name = omitDefault(message.name); + obj.type_url = omitDefault(message.typeUrl); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.packed = omitDefault(message.packed); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = omitDefault(message.jsonName); + obj.default_value = omitDefault(message.defaultValue); return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -937,7 +937,7 @@ export const Enum = { }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { @@ -949,7 +949,7 @@ export const Enum = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1071,8 +1071,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { @@ -1177,7 +1177,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts index 2516a198f8..0f97819450 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -221,7 +221,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -307,7 +307,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -393,7 +393,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -479,7 +479,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -565,7 +565,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -651,7 +651,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -737,7 +737,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -823,7 +823,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts index db7af00452..c287e91be2 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { Duration, DurationSDKType } from "../../protobuf/duration"; import { Any, AnySDKType } from "../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "google.rpc.context"; /** * This message defines the standard attribute vocabulary for Google APIs. @@ -812,8 +812,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -992,16 +992,16 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.ip = omitDefault(message.ip); + obj.port = omitDefault(message.port); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = omitDefault(message.principal); + obj.region_code = omitDefault(message.regionCode); return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1129,10 +1129,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = omitDefault(message.service); + obj.operation = omitDefault(message.operation); + obj.protocol = omitDefault(message.protocol); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1290,13 +1290,13 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = omitDefault(message.principal); if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { obj.audiences = []; } - obj.presenter = message.presenter; + obj.presenter = omitDefault(message.presenter); obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); @@ -1401,8 +1401,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -1670,7 +1670,7 @@ export const AttributeContext_Request = { host: object.host, scheme: object.scheme, query: object.query, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, size: BigInt(object.size), protocol: object.protocol, reason: object.reason, @@ -1679,22 +1679,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = omitDefault(message.id); + obj.method = omitDefault(message.method); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = omitDefault(message.path); + obj.host = omitDefault(message.host); + obj.scheme = omitDefault(message.scheme); + obj.query = omitDefault(message.query); obj.time = message.time; - obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.size = omitDefault(message.size); + obj.protocol = omitDefault(message.protocol); + obj.reason = omitDefault(message.reason); obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -1794,8 +1794,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -1968,14 +1968,14 @@ export const AttributeContext_Response = { acc[key] = String(value); return acc; }, {}) : {}, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, backendLatency: object?.backend_latency ? Duration.fromAmino(object.backend_latency) : undefined }; }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = omitDefault(message.code); + obj.size = omitDefault(message.size); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { @@ -2082,8 +2082,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2176,8 +2176,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2488,37 +2488,37 @@ export const AttributeContext_Resource = { return acc; }, {}) : {}, displayName: object.display_name, - createTime: object.create_time, - updateTime: object.update_time, - deleteTime: object.delete_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, + deleteTime: object?.delete_time ? Timestamp.fromAmino(object.delete_time) : undefined, etag: object.etag, location: object.location }; }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = omitDefault(message.service); + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = omitDefault(message.uid); obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); obj.create_time = message.createTime; obj.update_time = message.updateTime; obj.delete_time = message.deleteTime; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = omitDefault(message.etag); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts b/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts index 5357966fe2..982a8a20f0 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -585,7 +585,7 @@ export const DebugInfo = { } else { obj.stack_entries = []; } - obj.detail = message.detail; + obj.detail = omitDefault(message.detail); return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -783,8 +783,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = message.subject; - obj.description = message.description; + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -883,8 +883,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1035,8 +1035,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.domain = message.domain; + obj.reason = omitDefault(message.reason); + obj.domain = omitDefault(message.domain); obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1254,9 +1254,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = message.type; - obj.subject = message.subject; - obj.description = message.description; + obj.type = omitDefault(message.type); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1454,8 +1454,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = message.field; - obj.description = message.description; + obj.field = omitDefault(message.field); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1555,8 +1555,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = message.requestId; - obj.serving_data = message.servingData; + obj.request_id = omitDefault(message.requestId); + obj.serving_data = omitDefault(message.servingData); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1684,10 +1684,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = message.resourceType; - obj.resource_name = message.resourceName; - obj.owner = message.owner; - obj.description = message.description; + obj.resource_type = omitDefault(message.resourceType); + obj.resource_name = omitDefault(message.resourceName); + obj.owner = omitDefault(message.owner); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -1885,8 +1885,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = message.description; - obj.url = message.url; + obj.description = omitDefault(message.description); + obj.url = omitDefault(message.url); return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -1986,8 +1986,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = message.locale; - obj.message = message.message; + obj.locale = omitDefault(message.locale); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/status.ts b/__fixtures__/v-next/outputosmojs/google/rpc/status.ts index 716e35fbaf..9a03fd78e5 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/status.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -143,8 +143,8 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = message.code; - obj.message = message.message; + obj.code = omitDefault(message.code); + obj.message = omitDefault(message.message); if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/helpers.ts b/__fixtures__/v-next/outputosmojs/helpers.ts index f92d2b935a..b18c95df6c 100644 --- a/__fixtures__/v-next/outputosmojs/helpers.ts +++ b/__fixtures__/v-next/outputosmojs/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -255,3 +261,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts index e8c2cd3145..c5b54d41cc 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** IncentivizedAcknowledgement is the acknowledgement format to be used by applications wrapped in the fee middleware */ export interface IncentivizedAcknowledgement { @@ -112,8 +112,8 @@ export const IncentivizedAcknowledgement = { toAmino(message: IncentivizedAcknowledgement): IncentivizedAcknowledgementAmino { const obj: any = {}; obj.app_acknowledgement = message.appAcknowledgement; - obj.forward_relayer_address = message.forwardRelayerAddress; - obj.underlying_app_success = message.underlyingAppSuccess; + obj.forward_relayer_address = omitDefault(message.forwardRelayerAddress); + obj.underlying_app_success = omitDefault(message.underlyingAppSuccess); return obj; }, fromAminoMsg(object: IncentivizedAcknowledgementAminoMsg): IncentivizedAcknowledgement { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts index c085bdb1fe..e0a215bc1f 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** Fee defines the ICS29 receive, acknowledgement and timeout fees */ export interface Fee { @@ -312,7 +312,7 @@ export const PacketFee = { toAmino(message: PacketFee): PacketFeeAmino { const obj: any = {}; obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; - obj.refund_address = message.refundAddress; + obj.refund_address = omitDefault(message.refundAddress); if (message.relayers) { obj.relayers = message.relayers.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts index 5b4364fe76..6a59eec139 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedPacketFees, IdentifiedPacketFeesSDKType } from "./fee"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** GenesisState defines the ICS29 fee middleware genesis state */ export interface GenesisState { @@ -373,8 +373,8 @@ export const FeeEnabledChannel = { }, toAmino(message: FeeEnabledChannel): FeeEnabledChannelAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: FeeEnabledChannelAminoMsg): FeeEnabledChannel { @@ -494,9 +494,9 @@ export const RegisteredPayee = { }, toAmino(message: RegisteredPayee): RegisteredPayeeAmino { const obj: any = {}; - obj.channel_id = message.channelId; - obj.relayer = message.relayer; - obj.payee = message.payee; + obj.channel_id = omitDefault(message.channelId); + obj.relayer = omitDefault(message.relayer); + obj.payee = omitDefault(message.payee); return obj; }, fromAminoMsg(object: RegisteredPayeeAminoMsg): RegisteredPayee { @@ -616,9 +616,9 @@ export const RegisteredCounterpartyPayee = { }, toAmino(message: RegisteredCounterpartyPayee): RegisteredCounterpartyPayeeAmino { const obj: any = {}; - obj.channel_id = message.channelId; - obj.relayer = message.relayer; - obj.counterparty_payee = message.counterpartyPayee; + obj.channel_id = omitDefault(message.channelId); + obj.relayer = omitDefault(message.relayer); + obj.counterparty_payee = omitDefault(message.counterpartyPayee); return obj; }, fromAminoMsg(object: RegisteredCounterpartyPayeeAminoMsg): RegisteredCounterpartyPayee { @@ -710,7 +710,7 @@ export const ForwardRelayerAddress = { }, toAmino(message: ForwardRelayerAddress): ForwardRelayerAddressAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: ForwardRelayerAddressAminoMsg): ForwardRelayerAddress { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts index 34b23fb5a4..004ff249c4 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** * Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring @@ -100,8 +100,8 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.fee_version = message.feeVersion; - obj.app_version = message.appVersion; + obj.fee_version = omitDefault(message.feeVersion); + obj.app_version = omitDefault(message.appVersion); return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts index d7bc00dc04..cb7a4a266f 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts @@ -3,7 +3,7 @@ import { IdentifiedPacketFees, IdentifiedPacketFeesSDKType } from "./fee"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { FeeEnabledChannel, FeeEnabledChannelSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc */ export interface QueryIncentivizedPacketsRequest { @@ -289,7 +289,7 @@ export const QueryIncentivizedPacketsRequest = { toAmino(message: QueryIncentivizedPacketsRequest): QueryIncentivizedPacketsRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = omitDefault(message.queryHeight); return obj; }, fromAminoMsg(object: QueryIncentivizedPacketsRequestAminoMsg): QueryIncentivizedPacketsRequest { @@ -500,7 +500,7 @@ export const QueryIncentivizedPacketRequest = { }, toAmino(message: QueryIncentivizedPacketRequest): QueryIncentivizedPacketRequestAmino { const obj: any = {}; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = omitDefault(message.queryHeight); return obj; }, fromAminoMsg(object: QueryIncentivizedPacketRequestAminoMsg): QueryIncentivizedPacketRequest { @@ -727,9 +727,9 @@ export const QueryIncentivizedPacketsForChannelRequest = { toAmino(message: QueryIncentivizedPacketsForChannelRequest): QueryIncentivizedPacketsForChannelRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.query_height = omitDefault(message.queryHeight); return obj; }, fromAminoMsg(object: QueryIncentivizedPacketsForChannelRequestAminoMsg): QueryIncentivizedPacketsForChannelRequest { @@ -1482,8 +1482,8 @@ export const QueryPayeeRequest = { }, toAmino(message: QueryPayeeRequest): QueryPayeeRequestAmino { const obj: any = {}; - obj.channel_id = message.channelId; - obj.relayer = message.relayer; + obj.channel_id = omitDefault(message.channelId); + obj.relayer = omitDefault(message.relayer); return obj; }, fromAminoMsg(object: QueryPayeeRequestAminoMsg): QueryPayeeRequest { @@ -1575,7 +1575,7 @@ export const QueryPayeeResponse = { }, toAmino(message: QueryPayeeResponse): QueryPayeeResponseAmino { const obj: any = {}; - obj.payee_address = message.payeeAddress; + obj.payee_address = omitDefault(message.payeeAddress); return obj; }, fromAminoMsg(object: QueryPayeeResponseAminoMsg): QueryPayeeResponse { @@ -1681,8 +1681,8 @@ export const QueryCounterpartyPayeeRequest = { }, toAmino(message: QueryCounterpartyPayeeRequest): QueryCounterpartyPayeeRequestAmino { const obj: any = {}; - obj.channel_id = message.channelId; - obj.relayer = message.relayer; + obj.channel_id = omitDefault(message.channelId); + obj.relayer = omitDefault(message.relayer); return obj; }, fromAminoMsg(object: QueryCounterpartyPayeeRequestAminoMsg): QueryCounterpartyPayeeRequest { @@ -1774,7 +1774,7 @@ export const QueryCounterpartyPayeeResponse = { }, toAmino(message: QueryCounterpartyPayeeResponse): QueryCounterpartyPayeeResponseAmino { const obj: any = {}; - obj.counterparty_payee = message.counterpartyPayee; + obj.counterparty_payee = omitDefault(message.counterpartyPayee); return obj; }, fromAminoMsg(object: QueryCounterpartyPayeeResponseAminoMsg): QueryCounterpartyPayeeResponse { @@ -1881,7 +1881,7 @@ export const QueryFeeEnabledChannelsRequest = { toAmino(message: QueryFeeEnabledChannelsRequest): QueryFeeEnabledChannelsRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = omitDefault(message.queryHeight); return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelsRequestAminoMsg): QueryFeeEnabledChannelsRequest { @@ -2106,8 +2106,8 @@ export const QueryFeeEnabledChannelRequest = { }, toAmino(message: QueryFeeEnabledChannelRequest): QueryFeeEnabledChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelRequestAminoMsg): QueryFeeEnabledChannelRequest { @@ -2199,7 +2199,7 @@ export const QueryFeeEnabledChannelResponse = { }, toAmino(message: QueryFeeEnabledChannelResponse): QueryFeeEnabledChannelResponseAmino { const obj: any = {}; - obj.fee_enabled = message.feeEnabled; + obj.fee_enabled = omitDefault(message.feeEnabled); return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelResponseAminoMsg): QueryFeeEnabledChannelResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts index 0dc31a3770..14ce2e1a00 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts @@ -1,6 +1,6 @@ import { Fee, FeeSDKType, PacketFee, PacketFeeSDKType } from "./fee"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** MsgRegisterPayee defines the request type for the RegisterPayee rpc */ export interface MsgRegisterPayee { @@ -207,10 +207,10 @@ export const MsgRegisterPayee = { }, toAmino(message: MsgRegisterPayee): MsgRegisterPayeeAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.relayer = message.relayer; - obj.payee = message.payee; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.relayer = omitDefault(message.relayer); + obj.payee = omitDefault(message.payee); return obj; }, fromAminoMsg(object: MsgRegisterPayeeAminoMsg): MsgRegisterPayee { @@ -416,10 +416,10 @@ export const MsgRegisterCounterpartyPayee = { }, toAmino(message: MsgRegisterCounterpartyPayee): MsgRegisterCounterpartyPayeeAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.relayer = message.relayer; - obj.counterparty_payee = message.counterpartyPayee; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.relayer = omitDefault(message.relayer); + obj.counterparty_payee = omitDefault(message.counterpartyPayee); return obj; }, fromAminoMsg(object: MsgRegisterCounterpartyPayeeAminoMsg): MsgRegisterCounterpartyPayee { @@ -648,9 +648,9 @@ export const MsgPayPacketFee = { toAmino(message: MsgPayPacketFee): MsgPayPacketFeeAmino { const obj: any = {}; obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; - obj.source_port_id = message.sourcePortId; - obj.source_channel_id = message.sourceChannelId; - obj.signer = message.signer; + obj.source_port_id = omitDefault(message.sourcePortId); + obj.source_channel_id = omitDefault(message.sourceChannelId); + obj.signer = omitDefault(message.signer); if (message.relayers) { obj.relayers = message.relayers.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts index 257b7fd417..5f3ca2d0cb 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; /** * Params defines the set of on-chain interchain accounts parameters. @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.controller_enabled = message.controllerEnabled; + obj.controller_enabled = omitDefault(message.controllerEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts index 59832c3e00..be05e809d3 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType } from "./controller"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; /** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ export interface QueryInterchainAccountRequest { @@ -114,8 +114,8 @@ export const QueryInterchainAccountRequest = { }, toAmino(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestAmino { const obj: any = {}; - obj.owner = message.owner; - obj.connection_id = message.connectionId; + obj.owner = omitDefault(message.owner); + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryInterchainAccountRequestAminoMsg): QueryInterchainAccountRequest { @@ -207,7 +207,7 @@ export const QueryInterchainAccountResponse = { }, toAmino(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryInterchainAccountResponseAminoMsg): QueryInterchainAccountResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index 8c90707efa..ce6d02019a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -65,7 +65,7 @@ export const AminoConverter = { data: packetData.data, memo: omitDefault(packetData.memo) }, - relative_timeout: relativeTimeout.toString() + relative_timeout: omitDefault(relativeTimeout)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts index 9adea502af..dcfe1c1334 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts @@ -1,6 +1,6 @@ import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType } from "../../v1/packet"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; /** MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount */ export interface MsgRegisterInterchainAccount { @@ -145,9 +145,9 @@ export const MsgRegisterInterchainAccount = { }, toAmino(message: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountAmino { const obj: any = {}; - obj.owner = message.owner; - obj.connection_id = message.connectionId; - obj.version = message.version; + obj.owner = omitDefault(message.owner); + obj.connection_id = omitDefault(message.connectionId); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: MsgRegisterInterchainAccountAminoMsg): MsgRegisterInterchainAccount { @@ -253,8 +253,8 @@ export const MsgRegisterInterchainAccountResponse = { }, toAmino(message: MsgRegisterInterchainAccountResponse): MsgRegisterInterchainAccountResponseAmino { const obj: any = {}; - obj.channel_id = message.channelId; - obj.port_id = message.portId; + obj.channel_id = omitDefault(message.channelId); + obj.port_id = omitDefault(message.portId); return obj; }, fromAminoMsg(object: MsgRegisterInterchainAccountResponseAminoMsg): MsgRegisterInterchainAccountResponse { @@ -388,10 +388,10 @@ export const MsgSendTx = { }, toAmino(message: MsgSendTx): MsgSendTxAmino { const obj: any = {}; - obj.owner = message.owner; - obj.connection_id = message.connectionId; + obj.owner = omitDefault(message.owner); + obj.connection_id = omitDefault(message.connectionId); obj.packet_data = message.packetData ? InterchainAccountPacketData.toAmino(message.packetData) : undefined; - obj.relative_timeout = message.relativeTimeout ? message.relativeTimeout.toString() : undefined; + obj.relative_timeout = omitDefault(message.relativeTimeout); return obj; }, fromAminoMsg(object: MsgSendTxAminoMsg): MsgSendTx { @@ -483,7 +483,7 @@ export const MsgSendTxResponse = { }, toAmino(message: MsgSendTxResponse): MsgSendTxResponseAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: MsgSendTxResponseAminoMsg): MsgSendTxResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts index 1e3049d403..cd9abdaab9 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts @@ -3,7 +3,7 @@ import { ParamsSDKType as Params1SDKType } from "../../controller/v1/controller" import { Params as Params2 } from "../../host/v1/host"; import { ParamsSDKType as Params2SDKType } from "../../host/v1/host"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.genesis.v1"; /** GenesisState defines the interchain accounts genesis state */ export interface GenesisState { @@ -490,7 +490,7 @@ export const HostGenesisState = { } else { obj.interchain_accounts = []; } - obj.port = message.port; + obj.port = omitDefault(message.port); obj.params = message.params ? Params2.toAmino(message.params) : undefined; return obj; }, @@ -625,10 +625,10 @@ export const ActiveChannel = { }, toAmino(message: ActiveChannel): ActiveChannelAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.is_middleware_enabled = message.isMiddlewareEnabled; + obj.connection_id = omitDefault(message.connectionId); + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.is_middleware_enabled = omitDefault(message.isMiddlewareEnabled); return obj; }, fromAminoMsg(object: ActiveChannelAminoMsg): ActiveChannel { @@ -748,9 +748,9 @@ export const RegisteredInterchainAccount = { }, toAmino(message: RegisteredInterchainAccount): RegisteredInterchainAccountAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.port_id = message.portId; - obj.account_address = message.accountAddress; + obj.connection_id = omitDefault(message.connectionId); + obj.port_id = omitDefault(message.portId); + obj.account_address = omitDefault(message.accountAddress); return obj; }, fromAminoMsg(object: RegisteredInterchainAccountAminoMsg): RegisteredInterchainAccount { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts index 167574597c..7100a4b269 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.host.v1"; /** * Params defines the set of on-chain interchain accounts parameters. @@ -108,7 +108,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.host_enabled = message.hostEnabled; + obj.host_enabled = omitDefault(message.hostEnabled); if (message.allowMessages) { obj.allow_messages = message.allowMessages.map(e => e); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts index 689f3af7b5..4f58cdf507 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts @@ -1,6 +1,6 @@ import { BaseAccount, BaseAccountSDKType } from "../../../../cosmos/auth/v1beta1/auth"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.v1"; /** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ export interface InterchainAccount { @@ -94,7 +94,7 @@ export const InterchainAccount = { toAmino(message: InterchainAccount): InterchainAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.account_owner = message.accountOwner; + obj.account_owner = omitDefault(message.accountOwner); return obj; }, fromAminoMsg(object: InterchainAccountAminoMsg): InterchainAccount { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts index c6d4a3c50b..fe24057b68 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.v1"; /** * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring @@ -171,12 +171,12 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.version = message.version; - obj.controller_connection_id = message.controllerConnectionId; - obj.host_connection_id = message.hostConnectionId; - obj.address = message.address; - obj.encoding = message.encoding; - obj.tx_type = message.txType; + obj.version = omitDefault(message.version); + obj.controller_connection_id = omitDefault(message.controllerConnectionId); + obj.host_connection_id = omitDefault(message.hostConnectionId); + obj.address = omitDefault(message.address); + obj.encoding = omitDefault(message.encoding); + obj.tx_type = omitDefault(message.txType); return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts index 7cc7ae4d62..6130898d52 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.v1"; /** * Type defines a classification of message issued from a controller chain to its associated interchain accounts @@ -154,9 +154,9 @@ export const InterchainAccountPacketData = { }, toAmino(message: InterchainAccountPacketData): InterchainAccountPacketDataAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.data = message.data; - obj.memo = message.memo; + obj.memo = omitDefault(message.memo); return obj; }, fromAminoMsg(object: InterchainAccountPacketDataAminoMsg): InterchainAccountPacketData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts index 580f517ec0..5d301d5633 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** Allocation defines the spend limit for a particular port and channel */ export interface Allocation { @@ -160,8 +160,8 @@ export const Allocation = { }, toAmino(message: Allocation): AllocationAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts index ab8128a210..5bcfbfb388 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -117,7 +117,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts index 0d9ea1ef07..b6d13027fb 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -146,7 +146,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts index 4405b9dd80..739bb11487 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -131,8 +131,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = message.path; - obj.base_denom = message.baseDenom; + obj.path = omitDefault(message.path); + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -238,8 +238,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = message.sendEnabled; - obj.receive_enabled = message.receiveEnabled; + obj.send_enabled = omitDefault(message.sendEnabled); + obj.receive_enabled = omitDefault(message.receiveEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts index b6c87f6d09..3f350560f0 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp.toString() + timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts index e924a974bb..8570221c05 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -199,13 +199,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts index a8205324cb..b691673bd7 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -136,10 +136,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts index 1460a5ee2b..73dd2da22a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts @@ -1,6 +1,6 @@ import { Height, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: @@ -409,15 +409,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -601,17 +601,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = omitDefault(message.version); + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -717,8 +717,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -908,14 +908,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.sequence = omitDefault(message.sequence); + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); + obj.destination_port = omitDefault(message.destinationPort); + obj.destination_channel = omitDefault(message.destinationChannel); obj.data = message.data; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1049,9 +1049,9 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); obj.data = message.data; return obj; }, @@ -1159,7 +1159,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts index 47350db256..038755d9ca 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -299,7 +299,7 @@ export const GenesisState = { } else { obj.ack_sequences = []; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = omitDefault(message.nextChannelSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -419,9 +419,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts index 28eb88f2e6..118039d2f6 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts @@ -3,7 +3,7 @@ import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, P import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** QueryChannelRequest is the request type for the Query/Channel RPC method */ export interface QueryChannelRequest { @@ -605,8 +605,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1060,7 +1060,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = omitDefault(message.connection); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1301,8 +1301,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -1558,10 +1558,10 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -1696,7 +1696,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -1818,9 +1818,9 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2062,8 +2062,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2318,9 +2318,9 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2440,7 +2440,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = omitDefault(message.received); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2562,9 +2562,9 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -2837,8 +2837,8 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); @@ -3115,8 +3115,8 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { @@ -3386,8 +3386,8 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { @@ -3626,8 +3626,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { @@ -3747,7 +3747,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = omitDefault(message.nextSequenceReceive); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts index 43d1082629..70454ca48a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), signer: omitDefault(signer) }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), signer: omitDefault(signer) }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -626,7 +626,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, acknowledgement: acknowledgement, proof_acked: proofAcked, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts index 7b939c3757..503f23e8ac 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts @@ -1,7 +1,7 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It @@ -350,9 +350,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -600,13 +600,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = omitDefault(message.portId); + obj.previous_channel_id = omitDefault(message.previousChannelId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -854,13 +854,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.counterparty_channel_id = omitDefault(message.counterpartyChannelId); + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_try = message.proofTry; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1080,11 +1080,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1276,9 +1276,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1498,11 +1498,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1711,7 +1711,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -1934,8 +1934,8 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2173,8 +2173,8 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived; obj.proof_close = message.proofClose; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2398,7 +2398,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement; obj.proof_acked = message.proofAcked; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts index 28d1f1fafe..7fa03f1809 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -240,7 +240,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -462,7 +462,7 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { @@ -601,10 +601,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.subject_client_id = omitDefault(message.subjectClientId); + obj.substitute_client_id = omitDefault(message.substituteClientId); return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -738,8 +738,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -847,8 +847,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts index dea423845c..c9fcfa8f0d 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -236,8 +236,8 @@ export const GenesisState = { obj.clients_metadata = []; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.create_localhost = omitDefault(message.createLocalhost); + obj.next_client_sequence = omitDefault(message.nextClientSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -458,7 +458,7 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts index 0116a70527..a64af52e78 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -332,7 +332,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -799,10 +799,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.client_id = omitDefault(message.clientId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); + obj.latest_height = omitDefault(message.latestHeight); return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1030,7 +1030,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1242,7 +1242,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1334,7 +1334,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts index 778dc3273c..25c358af85 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** MsgCreateClient defines a message to create an IBC client */ export interface MsgCreateClient { @@ -214,7 +214,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -406,9 +406,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -642,12 +642,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -839,9 +839,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts index 9d5bf42a2e..450c9fbb50 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts @@ -1,6 +1,6 @@ import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * State defines if a connection is in one of the following states: @@ -331,15 +331,15 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -509,16 +509,16 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = omitDefault(message.id); + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -638,8 +638,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = omitDefault(message.clientId); + obj.connection_id = omitDefault(message.connectionId); obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -858,7 +858,7 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.paths) { obj.paths = message.paths.map(e => e); } else { @@ -977,7 +977,7 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); if (message.features) { obj.features = message.features.map(e => e); } else { @@ -1074,7 +1074,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = omitDefault(message.maxExpectedTimePerBlock); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts index e5a2b41a7f..e4ded0ea58 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -152,7 +152,7 @@ export const GenesisState = { } else { obj.client_connection_paths = []; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts index 91d10e192b..273486cec6 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts @@ -3,7 +3,7 @@ import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedCo import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -260,7 +260,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -700,7 +700,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -926,7 +926,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1168,9 +1168,9 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.connection_id = omitDefault(message.connectionId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { @@ -1305,7 +1305,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 639aa1ea54..0684a87c34 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: omitDefault(version.identifier), features: version.features }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), signer: omitDefault(signer) }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: omitDefault(el0.identifier), features: el0.features diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts index fe156dbf80..516aae34cf 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts @@ -2,7 +2,7 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./co import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to @@ -282,11 +282,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.delay_period = omitDefault(message.delayPeriod); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -612,11 +612,11 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = omitDefault(message.clientId); + obj.previous_connection_id = omitDefault(message.previousConnectionId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { @@ -627,7 +627,7 @@ export const MsgConnectionOpenTry = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -917,8 +917,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = omitDefault(message.connectionId); + obj.counterparty_connection_id = omitDefault(message.counterpartyConnectionId); obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -926,7 +926,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1132,10 +1132,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts index 53c767187f..b5c89b1c15 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts @@ -1,6 +1,6 @@ import { Order, OrderSDKType, Counterparty, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.port.v1"; /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ export interface QueryAppVersionRequest { @@ -158,11 +158,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = message.ordering; + obj.port_id = omitDefault(message.portId); + obj.connection_id = omitDefault(message.connectionId); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = omitDefault(message.proposedVersion); return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -268,8 +268,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = omitDefault(message.portId); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts index bd0e53506a..283e561587 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -101,7 +101,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts index 6c396137a3..ff01c7c60e 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; /** * DataType defines the type of solo machine proof being created. This is done @@ -481,10 +481,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.frozen_sequence = omitDefault(message.frozenSequence); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -605,8 +605,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -754,11 +754,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -892,8 +892,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1030,9 +1030,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1139,7 +1139,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1287,10 +1287,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1398,7 +1398,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2239,7 +2239,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts index 1eedd41a86..6f7c9495fb 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; /** * DataType defines the type of solo machine proof being created. This is done @@ -481,10 +481,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.sequence = omitDefault(message.sequence); + obj.is_frozen = omitDefault(message.isFrozen); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -605,8 +605,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -754,11 +754,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -892,8 +892,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1030,9 +1030,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1139,7 +1139,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1287,10 +1287,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1398,7 +1398,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2239,7 +2239,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts index 3f6b03459d..06d27ba5cd 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v3"; /** * ClientState defines a solo machine client that tracks the current consensus @@ -244,8 +244,8 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.sequence = omitDefault(message.sequence); + obj.is_frozen = omitDefault(message.isFrozen); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; return obj; }, @@ -367,8 +367,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -502,10 +502,10 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -625,7 +625,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -764,7 +764,7 @@ export const SignatureAndData = { obj.signature = message.signature; obj.path = message.path; obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -871,7 +871,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1019,9 +1019,9 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); obj.path = message.path; obj.data = message.data; return obj; @@ -1130,7 +1130,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts index f3a9d54eca..2204389b8a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts @@ -6,7 +6,7 @@ import { MerkleRoot, MerkleRootSDKType } from "../../../core/commitment/v1/commi import { SignedHeader, SignedHeaderSDKType } from "../../../../tendermint/types/types"; import { ValidatorSet, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; /** * ClientState from Tendermint tracks the current validator set, latest height, @@ -382,7 +382,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -399,8 +399,8 @@ export const ClientState = { } else { obj.upgrade_path = []; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); + obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -513,7 +513,7 @@ export const ConsensusState = { }, fromAmino(object: ConsensusStateAmino): ConsensusState { return { - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, root: object?.root ? MerkleRoot.fromAmino(object.root) : undefined, nextValidatorsHash: object.next_validators_hash }; @@ -642,7 +642,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; @@ -887,8 +887,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = omitDefault(message.numerator); + obj.denominator = omitDefault(message.denominator); return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts b/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts index a1f71289a3..782b7ba768 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.accum.v1beta1"; export interface AccumulatorContent { accumValue: DecCoin[]; @@ -119,7 +119,7 @@ export const AccumulatorContent = { } else { obj.accum_value = []; } - obj.total_shares = message.totalShares; + obj.total_shares = padDecimal(message.totalShares); return obj; }, fromAminoMsg(object: AccumulatorContentAminoMsg): AccumulatorContent { @@ -341,7 +341,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.num_shares = message.numShares; + obj.num_shares = padDecimal(message.numShares); if (message.initAccumValue) { obj.init_accum_value = message.initAccumValue.map(e => e ? DecCoin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts index 24273c32df..19a505db28 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -183,7 +183,7 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts index ddfe413db7..3f441dc22a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** Params defines the claim module's parameters. */ export interface Params { @@ -119,7 +119,7 @@ export const Params = { }, fromAmino(object: ParamsAmino): Params { return { - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimDenom: object.claim_denom @@ -130,7 +130,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = omitDefault(message.claimDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts index e0866ec947..0a765c04dc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType, actionFromJSON, import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryModuleAccountBalanceRequest {} @@ -475,7 +475,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -673,8 +673,8 @@ export const QueryClaimableForActionRequest = { }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = message.action; + obj.address = omitDefault(message.address); + obj.action = omitDefault(message.action); return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -870,7 +870,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts index 43173c0c52..a5016dd19a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts @@ -5,7 +5,7 @@ import { Params, ParamsSDKType } from "./params"; import { Position, PositionSDKType } from "./position"; import { AccumulatorContent, AccumulatorContentSDKType } from "../accum/v1beta1/accum"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** * FullTick contains tick index and pool id along with other tick model @@ -173,8 +173,8 @@ export const FullTick = { }, toAmino(message: FullTick): FullTickAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.tick_index = message.tickIndex ? message.tickIndex.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.tick_index = omitDefault(message.tickIndex); obj.info = message.info ? TickInfo.toAmino(message.info) : undefined; return obj; }, @@ -524,7 +524,7 @@ export const GenesisState = { } else { obj.positions = []; } - obj.next_position_id = message.nextPositionId ? message.nextPositionId.toString() : undefined; + obj.next_position_id = omitDefault(message.nextPositionId); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -630,7 +630,7 @@ export const AccumObject = { }, toAmino(message: AccumObject): AccumObjectAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.accum_content = message.accumContent ? AccumulatorContent.toAmino(message.accumContent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts index f0ffb41b79..02eb3a557b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** @@ -189,9 +189,9 @@ export const IncentiveRecord = { }, toAmino(message: IncentiveRecord): IncentiveRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.incentive_denom = message.incentiveDenom; - obj.incentive_creator_addr = message.incentiveCreatorAddr; + obj.pool_id = omitDefault(message.poolId); + obj.incentive_denom = omitDefault(message.incentiveDenom); + obj.incentive_creator_addr = omitDefault(message.incentiveCreatorAddr); obj.incentive_record_body = message.incentiveRecordBody ? IncentiveRecordBody.toAmino(message.incentiveRecordBody) : undefined; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -308,13 +308,13 @@ export const IncentiveRecordBody = { return { remainingAmount: object.remaining_amount, emissionRate: object.emission_rate, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: IncentiveRecordBody): IncentiveRecordBodyAmino { const obj: any = {}; - obj.remaining_amount = message.remainingAmount; - obj.emission_rate = message.emissionRate; + obj.remaining_amount = padDecimal(message.remainingAmount); + obj.emission_rate = padDecimal(message.emissionRate); obj.start_time = message.startTime; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts index 052cdb7dc0..6010f1701d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "../params"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** =============================== UserPositions */ @@ -216,8 +216,8 @@ export const QueryUserPositionsRequest = { }, toAmino(message: QueryUserPositionsRequest): QueryUserPositionsRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.address = omitDefault(message.address); + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryUserPositionsRequestAminoMsg): QueryUserPositionsRequest { @@ -413,7 +413,7 @@ export const QueryPositionByIdRequest = { }, toAmino(message: QueryPositionByIdRequest): QueryPositionByIdRequestAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = omitDefault(message.positionId); return obj; }, fromAminoMsg(object: QueryPositionByIdRequestAminoMsg): QueryPositionByIdRequest { @@ -986,8 +986,8 @@ export const TickLiquidityNet = { }, toAmino(message: TickLiquidityNet): TickLiquidityNetAmino { const obj: any = {}; - obj.liquidity_net = message.liquidityNet; - obj.tick_index = message.tickIndex; + obj.liquidity_net = padDecimal(message.liquidityNet); + obj.tick_index = omitDefault(message.tickIndex); return obj; }, fromAminoMsg(object: TickLiquidityNetAminoMsg): TickLiquidityNet { @@ -1107,9 +1107,9 @@ export const LiquidityDepthWithRange = { }, toAmino(message: LiquidityDepthWithRange): LiquidityDepthWithRangeAmino { const obj: any = {}; - obj.liquidity_amount = message.liquidityAmount; - obj.lower_tick = message.lowerTick; - obj.upper_tick = message.upperTick; + obj.liquidity_amount = padDecimal(message.liquidityAmount); + obj.lower_tick = omitDefault(message.lowerTick); + obj.upper_tick = omitDefault(message.upperTick); return obj; }, fromAminoMsg(object: LiquidityDepthWithRangeAminoMsg): LiquidityDepthWithRange { @@ -1243,10 +1243,10 @@ export const QueryLiquidityNetInDirectionRequest = { }, toAmino(message: QueryLiquidityNetInDirectionRequest): QueryLiquidityNetInDirectionRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; - obj.start_tick = message.startTick; - obj.bound_tick = message.boundTick; + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); + obj.start_tick = omitDefault(message.startTick); + obj.bound_tick = omitDefault(message.boundTick); return obj; }, fromAminoMsg(object: QueryLiquidityNetInDirectionRequestAminoMsg): QueryLiquidityNetInDirectionRequest { @@ -1379,8 +1379,8 @@ export const QueryLiquidityNetInDirectionResponse = { } else { obj.liquidity_depths = []; } - obj.current_tick = message.currentTick ? message.currentTick.toString() : undefined; - obj.current_liquidity = message.currentLiquidity; + obj.current_tick = omitDefault(message.currentTick); + obj.current_liquidity = padDecimal(message.currentLiquidity); return obj; }, fromAminoMsg(object: QueryLiquidityNetInDirectionResponseAminoMsg): QueryLiquidityNetInDirectionResponse { @@ -1472,7 +1472,7 @@ export const QueryTotalLiquidityForRangeRequest = { }, toAmino(message: QueryTotalLiquidityForRangeRequest): QueryTotalLiquidityForRangeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalLiquidityForRangeRequestAminoMsg): QueryTotalLiquidityForRangeRequest { @@ -1668,7 +1668,7 @@ export const QueryClaimableFeesRequest = { }, toAmino(message: QueryClaimableFeesRequest): QueryClaimableFeesRequestAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = omitDefault(message.positionId); return obj; }, fromAminoMsg(object: QueryClaimableFeesRequestAminoMsg): QueryClaimableFeesRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts index 515d82f13d..c9eef1eaed 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** ===================== MsgCreateConcentratedPool */ export interface MsgCreateConcentratedPool { @@ -165,12 +165,12 @@ export const MsgCreateConcentratedPool = { }, toAmino(message: MsgCreateConcentratedPool): MsgCreateConcentratedPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom0 = message.denom0; - obj.denom1 = message.denom1; - obj.tick_spacing = message.tickSpacing ? message.tickSpacing.toString() : undefined; - obj.exponent_at_price_one = message.exponentAtPriceOne; - obj.swap_fee = message.swapFee; + obj.sender = omitDefault(message.sender); + obj.denom0 = omitDefault(message.denom0); + obj.denom1 = omitDefault(message.denom1); + obj.tick_spacing = omitDefault(message.tickSpacing); + obj.exponent_at_price_one = omitDefault(message.exponentAtPriceOne); + obj.swap_fee = padDecimal(message.swapFee); return obj; }, fromAminoMsg(object: MsgCreateConcentratedPoolAminoMsg): MsgCreateConcentratedPool { @@ -262,7 +262,7 @@ export const MsgCreateConcentratedPoolResponse = { }, toAmino(message: MsgCreateConcentratedPoolResponse): MsgCreateConcentratedPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateConcentratedPoolResponseAminoMsg): MsgCreateConcentratedPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts index c4938532e0..1cf41d6e06 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; export interface Pool { /** pool's address holding all liquidity tokens. */ @@ -259,22 +259,22 @@ export const Pool = { tickSpacing: BigInt(object.tick_spacing), exponentAtPriceOne: object.exponent_at_price_one, swapFee: object.swap_fee, - lastLiquidityUpdate: object.last_liquidity_update + lastLiquidityUpdate: object?.last_liquidity_update ? Timestamp.fromAmino(object.last_liquidity_update) : undefined }; }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.incentives_address = message.incentivesAddress; - obj.id = message.id ? message.id.toString() : undefined; - obj.current_tick_liquidity = message.currentTickLiquidity; - obj.token0 = message.token0; - obj.token1 = message.token1; - obj.current_sqrt_price = message.currentSqrtPrice; - obj.current_tick = message.currentTick; - obj.tick_spacing = message.tickSpacing ? message.tickSpacing.toString() : undefined; - obj.exponent_at_price_one = message.exponentAtPriceOne; - obj.swap_fee = message.swapFee; + obj.address = omitDefault(message.address); + obj.incentives_address = omitDefault(message.incentivesAddress); + obj.id = omitDefault(message.id); + obj.current_tick_liquidity = padDecimal(message.currentTickLiquidity); + obj.token0 = omitDefault(message.token0); + obj.token1 = omitDefault(message.token1); + obj.current_sqrt_price = padDecimal(message.currentSqrtPrice); + obj.current_tick = omitDefault(message.currentTick); + obj.tick_spacing = omitDefault(message.tickSpacing); + obj.exponent_at_price_one = omitDefault(message.exponentAtPriceOne); + obj.swap_fee = padDecimal(message.swapFee); obj.last_liquidity_update = message.lastLiquidityUpdate; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts index 1b52e7baee..32f780f7a5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** @@ -185,19 +185,19 @@ export const Position = { poolId: BigInt(object.pool_id), lowerTick: BigInt(object.lower_tick), upperTick: BigInt(object.upper_tick), - joinTime: object.join_time, + joinTime: object?.join_time ? Timestamp.fromAmino(object.join_time) : undefined, liquidity: object.liquidity }; }, toAmino(message: Position): PositionAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; - obj.address = message.address; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.lower_tick = message.lowerTick ? message.lowerTick.toString() : undefined; - obj.upper_tick = message.upperTick ? message.upperTick.toString() : undefined; + obj.position_id = omitDefault(message.positionId); + obj.address = omitDefault(message.address); + obj.pool_id = omitDefault(message.poolId); + obj.lower_tick = omitDefault(message.lowerTick); + obj.upper_tick = omitDefault(message.upperTick); obj.join_time = message.joinTime; - obj.liquidity = message.liquidity; + obj.liquidity = padDecimal(message.liquidity); return obj; }, fromAminoMsg(object: PositionAminoMsg): Position { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts index 680d94e5c7..d6c0b84a65 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; export interface TickInfo { liquidityGross: string; @@ -146,8 +146,8 @@ export const TickInfo = { }, toAmino(message: TickInfo): TickInfoAmino { const obj: any = {}; - obj.liquidity_gross = message.liquidityGross; - obj.liquidity_net = message.liquidityNet; + obj.liquidity_gross = padDecimal(message.liquidityGross); + obj.liquidity_net = padDecimal(message.liquidityNet); if (message.feeGrowthOutside) { obj.fee_growth_outside = message.feeGrowthOutside.map(e => e ? DecCoin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index 2037e1668d..ef32c9b57f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -67,10 +67,10 @@ export const AminoConverter = { tokenMinAmount1 }: MsgCreatePosition): MsgCreatePositionAminoType["value"] => { return { - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), sender: omitDefault(sender), - lower_tick: lowerTick.toString(), - upper_tick: upperTick.toString(), + lower_tick: omitDefault(lowerTick)?.toString?.(), + upper_tick: omitDefault(upperTick)?.toString?.(), token_desired0: { denom: tokenDesired0.denom, amount: tokenDesired0.amount @@ -119,7 +119,7 @@ export const AminoConverter = { liquidityAmount }: MsgWithdrawPosition): MsgWithdrawPositionAminoType["value"] => { return { - position_id: positionId.toString(), + position_id: omitDefault(positionId)?.toString?.(), sender: omitDefault(sender), liquidity_amount: padDecimal(liquidityAmount) }; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts index a458344a65..fb313c5578 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** ===================== MsgCreatePosition */ @@ -308,14 +308,14 @@ export const MsgCreatePosition = { }, toAmino(message: MsgCreatePosition): MsgCreatePositionAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.sender = message.sender; - obj.lower_tick = message.lowerTick ? message.lowerTick.toString() : undefined; - obj.upper_tick = message.upperTick ? message.upperTick.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.sender = omitDefault(message.sender); + obj.lower_tick = omitDefault(message.lowerTick); + obj.upper_tick = omitDefault(message.upperTick); obj.token_desired0 = message.tokenDesired0 ? Coin.toAmino(message.tokenDesired0) : undefined; obj.token_desired1 = message.tokenDesired1 ? Coin.toAmino(message.tokenDesired1) : undefined; - obj.token_min_amount0 = message.tokenMinAmount0; - obj.token_min_amount1 = message.tokenMinAmount1; + obj.token_min_amount0 = omitDefault(message.tokenMinAmount0); + obj.token_min_amount1 = omitDefault(message.tokenMinAmount1); return obj; }, fromAminoMsg(object: MsgCreatePositionAminoMsg): MsgCreatePosition { @@ -457,17 +457,17 @@ export const MsgCreatePositionResponse = { positionId: BigInt(object.position_id), amount0: object.amount0, amount1: object.amount1, - joinTime: object.join_time, + joinTime: object?.join_time ? Timestamp.fromAmino(object.join_time) : undefined, liquidityCreated: object.liquidity_created }; }, toAmino(message: MsgCreatePositionResponse): MsgCreatePositionResponseAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; - obj.amount0 = message.amount0; - obj.amount1 = message.amount1; + obj.position_id = omitDefault(message.positionId); + obj.amount0 = omitDefault(message.amount0); + obj.amount1 = omitDefault(message.amount1); obj.join_time = message.joinTime; - obj.liquidity_created = message.liquidityCreated; + obj.liquidity_created = padDecimal(message.liquidityCreated); return obj; }, fromAminoMsg(object: MsgCreatePositionResponseAminoMsg): MsgCreatePositionResponse { @@ -587,9 +587,9 @@ export const MsgWithdrawPosition = { }, toAmino(message: MsgWithdrawPosition): MsgWithdrawPositionAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; - obj.sender = message.sender; - obj.liquidity_amount = message.liquidityAmount; + obj.position_id = omitDefault(message.positionId); + obj.sender = omitDefault(message.sender); + obj.liquidity_amount = padDecimal(message.liquidityAmount); return obj; }, fromAminoMsg(object: MsgWithdrawPositionAminoMsg): MsgWithdrawPosition { @@ -695,8 +695,8 @@ export const MsgWithdrawPositionResponse = { }, toAmino(message: MsgWithdrawPositionResponse): MsgWithdrawPositionResponseAmino { const obj: any = {}; - obj.amount0 = message.amount0; - obj.amount1 = message.amount1; + obj.amount0 = omitDefault(message.amount0); + obj.amount1 = omitDefault(message.amount1); return obj; }, fromAminoMsg(object: MsgWithdrawPositionResponseAminoMsg): MsgWithdrawPositionResponse { @@ -824,7 +824,7 @@ export const MsgCollectFees = { } else { obj.position_ids = []; } - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgCollectFeesAminoMsg): MsgCollectFees { @@ -1056,7 +1056,7 @@ export const MsgCollectIncentives = { } else { obj.position_ids = []; } - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgCollectIncentivesAminoMsg): MsgCollectIncentives { @@ -1330,17 +1330,17 @@ export const MsgCreateIncentive = { incentiveDenom: object.incentive_denom, incentiveAmount: object.incentive_amount, emissionRate: object.emission_rate, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, minUptime: object?.min_uptime ? Duration.fromAmino(object.min_uptime) : undefined }; }, toAmino(message: MsgCreateIncentive): MsgCreateIncentiveAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.sender = message.sender; - obj.incentive_denom = message.incentiveDenom; - obj.incentive_amount = message.incentiveAmount; - obj.emission_rate = message.emissionRate; + obj.pool_id = omitDefault(message.poolId); + obj.sender = omitDefault(message.sender); + obj.incentive_denom = omitDefault(message.incentiveDenom); + obj.incentive_amount = omitDefault(message.incentiveAmount); + obj.emission_rate = padDecimal(message.emissionRate); obj.start_time = message.startTime; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -1484,15 +1484,15 @@ export const MsgCreateIncentiveResponse = { incentiveDenom: object.incentive_denom, incentiveAmount: object.incentive_amount, emissionRate: object.emission_rate, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, minUptime: object?.min_uptime ? Duration.fromAmino(object.min_uptime) : undefined }; }, toAmino(message: MsgCreateIncentiveResponse): MsgCreateIncentiveResponseAmino { const obj: any = {}; - obj.incentive_denom = message.incentiveDenom; - obj.incentive_amount = message.incentiveAmount; - obj.emission_rate = message.emissionRate; + obj.incentive_denom = omitDefault(message.incentiveDenom); + obj.incentive_amount = padDecimal(message.incentiveAmount); + obj.emission_rate = padDecimal(message.emissionRate); obj.start_time = message.startTime; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -1622,7 +1622,7 @@ export const MsgFungifyChargedPositions = { } else { obj.position_ids = []; } - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgFungifyChargedPositionsAminoMsg): MsgFungifyChargedPositions { @@ -1714,7 +1714,7 @@ export const MsgFungifyChargedPositionsResponse = { }, toAmino(message: MsgFungifyChargedPositionsResponse): MsgFungifyChargedPositionsResponseAmino { const obj: any = {}; - obj.new_position_id = message.newPositionId ? message.newPositionId.toString() : undefined; + obj.new_position_id = omitDefault(message.newPositionId); return obj; }, fromAminoMsg(object: MsgFungifyChargedPositionsResponseAminoMsg): MsgFungifyChargedPositionsResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts index 849f603c42..39e5faa210 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.cosmwasmpool.v1beta1"; export interface CosmWasmPool { poolAddress: string; @@ -122,10 +122,10 @@ export const CosmWasmPool = { }, toAmino(message: CosmWasmPool): CosmWasmPoolAmino { const obj: any = {}; - obj.pool_address = message.poolAddress; - obj.contract_address = message.contractAddress; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.pool_address = omitDefault(message.poolAddress); + obj.contract_address = omitDefault(message.contractAddress); + obj.pool_id = omitDefault(message.poolId); + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: CosmWasmPoolAminoMsg): CosmWasmPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts index 6c28271f01..590ca9556d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.cosmwasmpool.v1beta1"; /** ===================== MsgCreateCosmwasmPool */ export interface MsgCreateCosmWasmPool { @@ -116,9 +116,9 @@ export const MsgCreateCosmWasmPool = { }, toAmino(message: MsgCreateCosmWasmPool): MsgCreateCosmWasmPoolAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.instantiate_msg = message.instantiateMsg; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgCreateCosmWasmPoolAminoMsg): MsgCreateCosmWasmPool { @@ -210,7 +210,7 @@ export const MsgCreateCosmWasmPoolResponse = { }, toAmino(message: MsgCreateCosmWasmPoolResponse): MsgCreateCosmWasmPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateCosmWasmPoolResponseAminoMsg): MsgCreateCosmWasmPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts index e6e1176073..1b7172db04 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Downtime, DowntimeSDKType, downtimeFromJSON, downtimeToJSON } from "./downtime_duration"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.downtimedetector.v1beta1"; export interface GenesisDowntimeEntry { duration: Downtime; @@ -97,12 +97,12 @@ export const GenesisDowntimeEntry = { fromAmino(object: GenesisDowntimeEntryAmino): GenesisDowntimeEntry { return { duration: isSet(object.duration) ? downtimeFromJSON(object.duration) : -1, - lastDowntime: object.last_downtime + lastDowntime: object?.last_downtime ? Timestamp.fromAmino(object.last_downtime) : undefined }; }, toAmino(message: GenesisDowntimeEntry): GenesisDowntimeEntryAmino { const obj: any = {}; - obj.duration = message.duration; + obj.duration = omitDefault(message.duration); obj.last_downtime = message.lastDowntime; return obj; }, @@ -212,7 +212,7 @@ export const GenesisState = { fromAmino(object: GenesisStateAmino): GenesisState { return { downtimes: Array.isArray(object?.downtimes) ? object.downtimes.map((e: any) => GenesisDowntimeEntry.fromAmino(e)) : [], - lastBlockTime: object.last_block_time + lastBlockTime: object?.last_block_time ? Timestamp.fromAmino(object.last_block_time) : undefined }; }, toAmino(message: GenesisState): GenesisStateAmino { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts index ab52244475..2953b1b936 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Downtime, DowntimeSDKType, downtimeFromJSON, downtimeToJSON } from "./downtime_duration"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.downtimedetector.v1beta1"; /** * Query for has it been at least $RECOVERY_DURATION units of time, @@ -106,7 +106,7 @@ export const RecoveredSinceDowntimeOfLengthRequest = { }, toAmino(message: RecoveredSinceDowntimeOfLengthRequest): RecoveredSinceDowntimeOfLengthRequestAmino { const obj: any = {}; - obj.downtime = message.downtime; + obj.downtime = omitDefault(message.downtime); obj.recovery = message.recovery ? Duration.toAmino(message.recovery) : undefined; return obj; }, @@ -199,7 +199,7 @@ export const RecoveredSinceDowntimeOfLengthResponse = { }, toAmino(message: RecoveredSinceDowntimeOfLengthResponse): RecoveredSinceDowntimeOfLengthResponseAmino { const obj: any = {}; - obj.succesfully_recovered = message.succesfullyRecovered; + obj.succesfully_recovered = omitDefault(message.succesfullyRecovered); return obj; }, fromAminoMsg(object: RecoveredSinceDowntimeOfLengthResponseAminoMsg): RecoveredSinceDowntimeOfLengthResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts index afd78e5bb6..972e37e70b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * EpochInfo is a struct that describes the data going into @@ -223,23 +223,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts index 269394c401..3a880057b2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestSDKType {} @@ -265,7 +265,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -357,7 +357,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts index 7e33865601..3789a243d2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timesta import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -261,7 +261,7 @@ export const SmoothWeightChangeParams = { }, fromAmino(object: SmoothWeightChangeParamsAmino): SmoothWeightChangeParams { return { - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, initialPoolWeights: Array.isArray(object?.initial_pool_weights) ? object.initial_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [], targetPoolWeights: Array.isArray(object?.target_pool_weights) ? object.target_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [] @@ -400,8 +400,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -509,7 +509,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -693,17 +693,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts index cd33076caf..c6d0c0f28a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -141,14 +141,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -240,7 +240,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index af7ea81f30..a6512dd275 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -140,8 +140,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -356,10 +356,10 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -371,7 +371,7 @@ export const Pool = { } else { obj.scaling_factors = []; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 6d137e53fb..65a3763636 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -88,7 +88,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts index 6573a4ddf9..c1e3566484 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -211,7 +211,7 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -223,8 +223,8 @@ export const MsgCreateStableswapPool = { } else { obj.scaling_factors = []; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -316,7 +316,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -453,8 +453,8 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts index 4ca509a447..56ef957957 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -236,7 +236,7 @@ export const GenesisState = { } else { obj.pools = []; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = omitDefault(message.nextPoolNumber); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts index 096db289d8..fb78b345d1 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ReplaceMigrationRecordsProposal is a gov Content type for updating the @@ -132,8 +132,8 @@ export const ReplaceMigrationRecordsProposal = { }, toAmino(message: ReplaceMigrationRecordsProposal): ReplaceMigrationRecordsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: ReplaceMigrationRecordsProposalAminoMsg): ReplaceMigrationRecordsProposal { @@ -239,8 +239,8 @@ export const UpdateMigrationRecordsProposal = { }, toAmino(message: UpdateMigrationRecordsProposal): UpdateMigrationRecordsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: UpdateMigrationRecordsProposalAminoMsg): UpdateMigrationRecordsProposal { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts index 3f74418960..3bfe352d82 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -328,7 +328,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -795,7 +795,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = omitDefault(message.numPools); return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -887,7 +887,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -979,7 +979,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1093,7 +1093,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1212,7 +1212,7 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1323,8 +1323,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1520,7 +1520,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1704,7 +1704,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -1900,7 +1900,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2106,7 +2106,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2230,7 +2230,7 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { } else { obj.tokens_out = []; } - obj.shares_out = message.sharesOut; + obj.shares_out = omitDefault(message.sharesOut); return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2350,9 +2350,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2485,7 +2485,7 @@ export const QueryPoolsWithFilterRequest = { } else { obj.min_liquidity = []; } - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2697,7 +2697,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -2839,9 +2839,9 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { @@ -2938,7 +2938,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3080,14 +3080,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_out = message.tokenOut; + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3179,7 +3179,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index c86c71d74d..fb977802b3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -112,7 +112,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ denom: omitDefault(el0.denom), @@ -147,7 +147,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ denom: omitDefault(el0.denom), @@ -183,7 +183,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { @@ -224,7 +224,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_in_denom: omitDefault(el0.tokenInDenom) })), token_in_max_amount: omitDefault(tokenInMaxAmount), @@ -264,7 +264,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -300,7 +300,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_in_denom: omitDefault(tokenInDenom), share_out_amount: omitDefault(shareOutAmount), token_in_max_amount: omitDefault(tokenInMaxAmount) @@ -332,7 +332,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -368,7 +368,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_out_denom: omitDefault(tokenOutDenom), share_in_amount: omitDefault(shareInAmount), token_out_min_amount: omitDefault(tokenOutMinAmount) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts index 35da20d6e8..5a7303f0c3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -313,9 +313,9 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -434,7 +434,7 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -581,9 +581,9 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -798,8 +798,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -941,14 +941,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { obj.routes = []; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1040,7 +1040,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1146,8 +1146,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1289,13 +1289,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1388,7 +1388,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1522,10 +1522,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1617,7 +1617,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1765,11 +1765,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -1861,7 +1861,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2009,11 +2009,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.share_in_amount = omitDefault(message.shareInAmount); + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2105,7 +2105,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2239,10 +2239,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2334,7 +2334,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts index 7cb9257ec3..ffff618c98 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -129,9 +129,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -223,7 +223,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts index 99b7344136..ab54d3f515 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -76,7 +76,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts index 6fa94369f7..870e9391ec 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * Gauge is an object that stores and distributes yields to recipients who @@ -241,7 +241,7 @@ export const Gauge = { isPerpetual: object.is_perpetual, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over), filledEpochs: BigInt(object.filled_epochs), distributedCoins: Array.isArray(object?.distributed_coins) ? object.distributed_coins.map((e: any) => Coin.fromAmino(e)) : [] @@ -249,8 +249,8 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.id = omitDefault(message.id); + obj.is_perpetual = omitDefault(message.isPerpetual); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -258,8 +258,8 @@ export const Gauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); + obj.filled_epochs = omitDefault(message.filledEpochs); if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts index b238899782..726aa3fd03 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -170,7 +170,7 @@ export const GenesisState = { } else { obj.lockable_durations = []; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = omitDefault(message.lastGaugeId); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts index 712954aff2..2849ccc9ce 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -80,7 +80,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = message.distrEpochIdentifier; + obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts index c0fcbffb40..c84c2d1aa0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestSDKType {} @@ -397,7 +397,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1017,7 +1017,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1454,7 +1454,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1711,13 +1711,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { obj.lock_ids = []; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = omitDefault(message.endEpoch); return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index 4b6d7884e5..14e12ad639 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -57,7 +57,7 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: isPerpetual, + is_perpetual: omitDefault(isPerpetual), owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, @@ -70,7 +70,7 @@ export const AminoConverter = { amount: omitDefault(el0.amount) })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver.toString() + num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() }; }, fromAmino: ({ @@ -111,7 +111,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner: omitDefault(owner), - gauge_id: gaugeId.toString(), + gauge_id: omitDefault(gaugeId)?.toString?.(), rewards: rewards.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts index ac0e9de950..bf6e7b4b8a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts @@ -2,7 +2,7 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** MsgCreateGauge creates a gague to distribute rewards to users */ export interface MsgCreateGauge { @@ -198,14 +198,14 @@ export const MsgCreateGauge = { owner: object.owner, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over) }; }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = omitDefault(message.isPerpetual); + obj.owner = omitDefault(message.owner); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -213,7 +213,7 @@ export const MsgCreateGauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -413,8 +413,8 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.gauge_id = omitDefault(message.gaugeId); if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts index e9294ca846..c412df0f94 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -125,7 +125,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = omitDefault(message.lastLockId); if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts index ac4a26d23c..dcc3f76328 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** * LockQueryType defines the type of the lock query that can @@ -285,14 +285,14 @@ export const PeriodLock = { ID: BigInt(object.ID), owner: object.owner, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [] }; }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.ID = omitDefault(message.ID); + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime; if (message.coins) { @@ -428,13 +428,13 @@ export const QueryCondition = { lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : -1, denom: object.denom, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = message.lockQueryType; - obj.denom = message.denom; + obj.lock_query_type = omitDefault(message.lockQueryType); + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp; return obj; @@ -564,14 +564,14 @@ export const SyntheticLock = { return { underlyingLockId: BigInt(object.underlying_lock_id), synthDenom: object.synth_denom, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined }; }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.underlying_lock_id = omitDefault(message.underlyingLockId); + obj.synth_denom = omitDefault(message.synthDenom); obj.end_time = message.endTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts index 7756a903d1..218cbbe519 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts @@ -4,7 +4,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { Params, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface ModuleBalanceRequest {} export interface ModuleBalanceRequestSDKType {} @@ -639,7 +639,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -835,7 +835,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1031,7 +1031,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1236,12 +1236,12 @@ export const AccountLockedPastTimeRequest = { fromAmino(object: AccountLockedPastTimeRequestAmino): AccountLockedPastTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1447,12 +1447,12 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { fromAmino(object: AccountLockedPastTimeNotUnlockingOnlyRequestAmino): AccountLockedPastTimeNotUnlockingOnlyRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1658,12 +1658,12 @@ export const AccountUnlockedBeforeTimeRequest = { fromAmino(object: AccountUnlockedBeforeTimeRequestAmino): AccountUnlockedBeforeTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1882,15 +1882,15 @@ export const AccountLockedPastTimeDenomRequest = { fromAmino(object: AccountLockedPastTimeDenomRequestAmino): AccountLockedPastTimeDenomRequest { return { owner: object.owner, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, denom: object.denom }; }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2100,7 +2100,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2193,7 +2193,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2285,7 +2285,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2469,7 +2469,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { @@ -2679,7 +2679,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2890,7 +2890,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3101,7 +3101,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3326,9 +3326,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index afc07e7e40..9545e07ec2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +178,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts index 69a9fc1966..ac4506f75e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -205,7 +205,7 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -303,7 +303,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -395,7 +395,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -627,8 +627,8 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -725,7 +725,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -845,8 +845,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -939,7 +939,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1067,8 +1067,8 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1165,7 +1165,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts index 41d0eab8b0..4d8733816d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -117,7 +117,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts index df061dc4ea..1f9cadfe46 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -182,7 +182,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -288,8 +288,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = omitDefault(message.address); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -423,10 +423,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -624,18 +624,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.mint_denom = omitDefault(message.mintDenom); + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); + obj.reduction_factor = padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { obj.weighted_developer_rewards_receivers = []; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts index f2efb65c85..bf5b0ffefe 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -161,8 +161,8 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -295,8 +295,8 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts index 5071971c38..5b6a7e0015 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -119,7 +119,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = omitDefault(message.mintedDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -337,7 +337,7 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -448,8 +448,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.gauge_id = omitDefault(message.gaugeId); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -569,8 +569,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts index 798b5c1585..29db39d313 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; import { Gauge, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -143,7 +143,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -367,9 +367,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -1065,9 +1065,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts index d59100e7c0..c8afe62b80 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { ModuleRoute, ModuleRouteSDKType } from "./module_route"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** Params holds parameters for the poolmanager module */ export interface Params { @@ -233,7 +233,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.next_pool_id = message.nextPoolId ? message.nextPoolId.toString() : undefined; + obj.next_pool_id = omitDefault(message.nextPoolId); obj.params = message.params ? Params.toAmino(message.params) : undefined; if (message.poolRoutes) { obj.pool_routes = message.poolRoutes.map(e => e ? ModuleRoute.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts index a0c8b317e6..4750ca8e49 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** PoolType is an enumeration of all supported pool types. */ export enum PoolType { @@ -160,8 +160,8 @@ export const ModuleRoute = { }, toAmino(message: ModuleRoute): ModuleRouteAmino { const obj: any = {}; - obj.pool_type = message.poolType; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_type = omitDefault(message.poolType); + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: ModuleRouteAminoMsg): ModuleRoute { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts index 4a0dd502e4..fa1f4fbb47 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts @@ -2,7 +2,7 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAm import { Params, ParamsSDKType } from "./genesis"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** =============================== Params */ export interface ParamsRequest {} @@ -408,8 +408,8 @@ export const EstimateSwapExactAmountInRequest = { }, toAmino(message: EstimateSwapExactAmountInRequest): EstimateSwapExactAmountInRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { @@ -534,9 +534,9 @@ export const EstimateSinglePoolSwapExactAmountInRequest = { }, toAmino(message: EstimateSinglePoolSwapExactAmountInRequest): EstimateSinglePoolSwapExactAmountInRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; - obj.token_out_denom = message.tokenOutDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); + obj.token_out_denom = omitDefault(message.tokenOutDenom); return obj; }, fromAminoMsg(object: EstimateSinglePoolSwapExactAmountInRequestAminoMsg): EstimateSinglePoolSwapExactAmountInRequest { @@ -628,7 +628,7 @@ export const EstimateSwapExactAmountInResponse = { }, toAmino(message: EstimateSwapExactAmountInResponse): EstimateSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: EstimateSwapExactAmountInResponseAminoMsg): EstimateSwapExactAmountInResponse { @@ -756,13 +756,13 @@ export const EstimateSwapExactAmountOutRequest = { }, toAmino(message: EstimateSwapExactAmountOutRequest): EstimateSwapExactAmountOutRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_out = message.tokenOut; + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: EstimateSwapExactAmountOutRequestAminoMsg): EstimateSwapExactAmountOutRequest { @@ -882,9 +882,9 @@ export const EstimateSinglePoolSwapExactAmountOutRequest = { }, toAmino(message: EstimateSinglePoolSwapExactAmountOutRequest): EstimateSinglePoolSwapExactAmountOutRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.token_out = message.tokenOut; + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: EstimateSinglePoolSwapExactAmountOutRequestAminoMsg): EstimateSinglePoolSwapExactAmountOutRequest { @@ -976,7 +976,7 @@ export const EstimateSwapExactAmountOutResponse = { }, toAmino(message: EstimateSwapExactAmountOutResponse): EstimateSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: EstimateSwapExactAmountOutResponseAminoMsg): EstimateSwapExactAmountOutResponse { @@ -1140,7 +1140,7 @@ export const NumPoolsResponse = { }, toAmino(message: NumPoolsResponse): NumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = omitDefault(message.numPools); return obj; }, fromAminoMsg(object: NumPoolsResponseAminoMsg): NumPoolsResponse { @@ -1232,7 +1232,7 @@ export const PoolRequest = { }, toAmino(message: PoolRequest): PoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: PoolRequestAminoMsg): PoolRequest { @@ -1416,7 +1416,7 @@ export const AllPoolsRequest = { }, toAmino(message: AllPoolsRequest): AllPoolsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: AllPoolsRequestAminoMsg): AllPoolsRequest { @@ -1640,9 +1640,9 @@ export const SpotPriceRequest = { }, toAmino(message: SpotPriceRequest): SpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: SpotPriceRequestAminoMsg): SpotPriceRequest { @@ -1734,7 +1734,7 @@ export const SpotPriceResponse = { }, toAmino(message: SpotPriceResponse): SpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: SpotPriceResponseAminoMsg): SpotPriceResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts index b1bab266fc..bd301404be 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; export interface SwapAmountInRoute { poolId: bigint; @@ -98,8 +98,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -205,8 +205,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index 2b539a50e4..e613fa39db 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { @@ -87,7 +87,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_in_denom: omitDefault(el0.tokenInDenom) })), token_in_max_amount: omitDefault(tokenInMaxAmount), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts index a4fd24f1ab..d529697f95 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** ===================== MsgSwapExactAmountIn */ export interface MsgSwapExactAmountIn { @@ -160,14 +160,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { obj.routes = []; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -259,7 +259,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -401,13 +401,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -500,7 +500,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts index 54994ff714..903359300b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, BaseDenom, BaseDenomSDKType, PoolWeights, PoolWeightsSDKType } from "./protorev"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** GenesisState defines the protorev module's genesis state. */ export interface GenesisState { @@ -298,17 +298,17 @@ export const GenesisState = { obj.base_denoms = []; } obj.pool_weights = message.poolWeights ? PoolWeights.toAmino(message.poolWeights) : undefined; - obj.days_since_module_genesis = message.daysSinceModuleGenesis ? message.daysSinceModuleGenesis.toString() : undefined; + obj.days_since_module_genesis = omitDefault(message.daysSinceModuleGenesis); if (message.developerFees) { obj.developer_fees = message.developerFees.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.developer_fees = []; } - obj.latest_block_height = message.latestBlockHeight ? message.latestBlockHeight.toString() : undefined; - obj.developer_address = message.developerAddress; - obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; - obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; - obj.point_count_for_block = message.pointCountForBlock ? message.pointCountForBlock.toString() : undefined; + obj.latest_block_height = omitDefault(message.latestBlockHeight); + obj.developer_address = omitDefault(message.developerAddress); + obj.max_pool_points_per_block = omitDefault(message.maxPoolPointsPerBlock); + obj.max_pool_points_per_tx = omitDefault(message.maxPoolPointsPerTx); + obj.point_count_for_block = omitDefault(message.pointCountForBlock); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts index 8a11872048..2d84f925fa 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** * SetProtoRevEnabledProposal is a gov Content type to update whether the @@ -134,9 +134,9 @@ export const SetProtoRevEnabledProposal = { }, toAmino(message: SetProtoRevEnabledProposal): SetProtoRevEnabledProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.enabled = message.enabled; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.enabled = omitDefault(message.enabled); return obj; }, fromAminoMsg(object: SetProtoRevEnabledProposalAminoMsg): SetProtoRevEnabledProposal { @@ -256,9 +256,9 @@ export const SetProtoRevAdminAccountProposal = { }, toAmino(message: SetProtoRevAdminAccountProposal): SetProtoRevAdminAccountProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.account = message.account; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.account = omitDefault(message.account); return obj; }, fromAminoMsg(object: SetProtoRevAdminAccountProposalAminoMsg): SetProtoRevAdminAccountProposal { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts index d456d5515b..7f051e382b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** Params defines the parameters for the module. */ export interface Params { @@ -94,8 +94,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enabled = message.enabled; - obj.admin = message.admin; + obj.enabled = omitDefault(message.enabled); + obj.admin = omitDefault(message.admin); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts index 70ce6676e8..fb370ceb80 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** TokenPairArbRoutes tracks all of the hot routes for a given pair of tokens */ export interface TokenPairArbRoutes { @@ -232,8 +232,8 @@ export const TokenPairArbRoutes = { } else { obj.arb_routes = []; } - obj.token_in = message.tokenIn; - obj.token_out = message.tokenOut; + obj.token_in = omitDefault(message.tokenIn); + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: TokenPairArbRoutesAminoMsg): TokenPairArbRoutes { @@ -352,7 +352,7 @@ export const Route = { } else { obj.trades = []; } - obj.step_size = message.stepSize; + obj.step_size = omitDefault(message.stepSize); return obj; }, fromAminoMsg(object: RouteAminoMsg): Route { @@ -472,9 +472,9 @@ export const Trade = { }, toAmino(message: Trade): TradeAmino { const obj: any = {}; - obj.pool = message.pool ? message.pool.toString() : undefined; - obj.token_in = message.tokenIn; - obj.token_out = message.tokenOut; + obj.pool = omitDefault(message.pool); + obj.token_in = omitDefault(message.tokenIn); + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: TradeAminoMsg): Trade { @@ -624,7 +624,7 @@ export const RouteStatistics = { } else { obj.profits = []; } - obj.number_of_trades = message.numberOfTrades; + obj.number_of_trades = omitDefault(message.numberOfTrades); if (message.route) { obj.route = message.route.map(e => e.toString()); } else { @@ -749,9 +749,9 @@ export const PoolWeights = { }, toAmino(message: PoolWeights): PoolWeightsAmino { const obj: any = {}; - obj.stable_weight = message.stableWeight ? message.stableWeight.toString() : undefined; - obj.balancer_weight = message.balancerWeight ? message.balancerWeight.toString() : undefined; - obj.concentrated_weight = message.concentratedWeight ? message.concentratedWeight.toString() : undefined; + obj.stable_weight = omitDefault(message.stableWeight); + obj.balancer_weight = omitDefault(message.balancerWeight); + obj.concentrated_weight = omitDefault(message.concentratedWeight); return obj; }, fromAminoMsg(object: PoolWeightsAminoMsg): PoolWeights { @@ -857,8 +857,8 @@ export const BaseDenom = { }, toAmino(message: BaseDenom): BaseDenomAmino { const obj: any = {}; - obj.denom = message.denom; - obj.step_size = message.stepSize; + obj.denom = omitDefault(message.denom); + obj.step_size = omitDefault(message.stepSize); return obj; }, fromAminoMsg(object: BaseDenomAminoMsg): BaseDenom { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts index 6765e096b2..6fcc873e68 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { RouteStatistics, RouteStatisticsSDKType, TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -670,7 +670,7 @@ export const QueryGetProtoRevNumberOfTradesResponse = { }, toAmino(message: QueryGetProtoRevNumberOfTradesResponse): QueryGetProtoRevNumberOfTradesResponseAmino { const obj: any = {}; - obj.number_of_trades = message.numberOfTrades; + obj.number_of_trades = omitDefault(message.numberOfTrades); return obj; }, fromAminoMsg(object: QueryGetProtoRevNumberOfTradesResponseAminoMsg): QueryGetProtoRevNumberOfTradesResponse { @@ -762,7 +762,7 @@ export const QueryGetProtoRevProfitsByDenomRequest = { }, toAmino(message: QueryGetProtoRevProfitsByDenomRequest): QueryGetProtoRevProfitsByDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryGetProtoRevProfitsByDenomRequestAminoMsg): QueryGetProtoRevProfitsByDenomRequest { @@ -1751,7 +1751,7 @@ export const QueryGetProtoRevAdminAccountResponse = { }, toAmino(message: QueryGetProtoRevAdminAccountResponse): QueryGetProtoRevAdminAccountResponseAmino { const obj: any = {}; - obj.admin_account = message.adminAccount; + obj.admin_account = omitDefault(message.adminAccount); return obj; }, fromAminoMsg(object: QueryGetProtoRevAdminAccountResponseAminoMsg): QueryGetProtoRevAdminAccountResponse { @@ -1915,7 +1915,7 @@ export const QueryGetProtoRevDeveloperAccountResponse = { }, toAmino(message: QueryGetProtoRevDeveloperAccountResponse): QueryGetProtoRevDeveloperAccountResponseAmino { const obj: any = {}; - obj.developer_account = message.developerAccount; + obj.developer_account = omitDefault(message.developerAccount); return obj; }, fromAminoMsg(object: QueryGetProtoRevDeveloperAccountResponseAminoMsg): QueryGetProtoRevDeveloperAccountResponse { @@ -2243,7 +2243,7 @@ export const QueryGetProtoRevMaxPoolPointsPerBlockResponse = { }, toAmino(message: QueryGetProtoRevMaxPoolPointsPerBlockResponse): QueryGetProtoRevMaxPoolPointsPerBlockResponseAmino { const obj: any = {}; - obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; + obj.max_pool_points_per_block = omitDefault(message.maxPoolPointsPerBlock); return obj; }, fromAminoMsg(object: QueryGetProtoRevMaxPoolPointsPerBlockResponseAminoMsg): QueryGetProtoRevMaxPoolPointsPerBlockResponse { @@ -2407,7 +2407,7 @@ export const QueryGetProtoRevMaxPoolPointsPerTxResponse = { }, toAmino(message: QueryGetProtoRevMaxPoolPointsPerTxResponse): QueryGetProtoRevMaxPoolPointsPerTxResponseAmino { const obj: any = {}; - obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; + obj.max_pool_points_per_tx = omitDefault(message.maxPoolPointsPerTx); return obj; }, fromAminoMsg(object: QueryGetProtoRevMaxPoolPointsPerTxResponseAminoMsg): QueryGetProtoRevMaxPoolPointsPerTxResponse { @@ -2747,7 +2747,7 @@ export const QueryGetProtoRevEnabledResponse = { }, toAmino(message: QueryGetProtoRevEnabledResponse): QueryGetProtoRevEnabledResponseAmino { const obj: any = {}; - obj.enabled = message.enabled; + obj.enabled = omitDefault(message.enabled); return obj; }, fromAminoMsg(object: QueryGetProtoRevEnabledResponseAminoMsg): QueryGetProtoRevEnabledResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index d55c9bd387..7098e81fbd 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -75,7 +75,7 @@ export const AminoConverter = { hot_routes: hotRoutes.map(el0 => ({ arb_routes: el0.arbRoutes.map(el1 => ({ trades: el1.trades.map(el2 => ({ - pool: el2.pool.toString(), + pool: omitDefault(el2.pool)?.toString?.(), token_in: omitDefault(el2.tokenIn), token_out: omitDefault(el2.tokenOut) })), @@ -136,7 +136,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAminoType["value"] => { return { admin: omitDefault(admin), - max_pool_points_per_tx: maxPoolPointsPerTx.toString() + max_pool_points_per_tx: omitDefault(maxPoolPointsPerTx)?.toString?.() }; }, fromAmino: ({ @@ -157,7 +157,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAminoType["value"] => { return { admin: omitDefault(admin), - max_pool_points_per_block: maxPoolPointsPerBlock.toString() + max_pool_points_per_block: omitDefault(maxPoolPointsPerBlock)?.toString?.() }; }, fromAmino: ({ @@ -179,9 +179,9 @@ export const AminoConverter = { return { admin: omitDefault(admin), pool_weights: { - stable_weight: poolWeights.stableWeight.toString(), - balancer_weight: poolWeights.balancerWeight.toString(), - concentrated_weight: poolWeights.concentratedWeight.toString() + stable_weight: omitDefault(poolWeights.stableWeight)?.toString?.(), + balancer_weight: omitDefault(poolWeights.balancerWeight)?.toString?.(), + concentrated_weight: omitDefault(poolWeights.concentratedWeight)?.toString?.() } }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts index 4dfd62deb7..ff1a28d777 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** MsgSetHotRoutes defines the Msg/SetHotRoutes request type. */ export interface MsgSetHotRoutes { @@ -223,7 +223,7 @@ export const MsgSetHotRoutes = { }, toAmino(message: MsgSetHotRoutes): MsgSetHotRoutesAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.hotRoutes) { obj.hot_routes = message.hotRoutes.map(e => e ? TokenPairArbRoutes.toAmino(e) : undefined); } else { @@ -406,8 +406,8 @@ export const MsgSetDeveloperAccount = { }, toAmino(message: MsgSetDeveloperAccount): MsgSetDeveloperAccountAmino { const obj: any = {}; - obj.admin = message.admin; - obj.developer_account = message.developerAccount; + obj.admin = omitDefault(message.admin); + obj.developer_account = omitDefault(message.developerAccount); return obj; }, fromAminoMsg(object: MsgSetDeveloperAccountAminoMsg): MsgSetDeveloperAccount { @@ -585,7 +585,7 @@ export const MsgSetPoolWeights = { }, toAmino(message: MsgSetPoolWeights): MsgSetPoolWeightsAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pool_weights = message.poolWeights ? PoolWeights.toAmino(message.poolWeights) : undefined; return obj; }, @@ -764,8 +764,8 @@ export const MsgSetMaxPoolPointsPerTx = { }, toAmino(message: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAmino { const obj: any = {}; - obj.admin = message.admin; - obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; + obj.admin = omitDefault(message.admin); + obj.max_pool_points_per_tx = omitDefault(message.maxPoolPointsPerTx); return obj; }, fromAminoMsg(object: MsgSetMaxPoolPointsPerTxAminoMsg): MsgSetMaxPoolPointsPerTx { @@ -943,8 +943,8 @@ export const MsgSetMaxPoolPointsPerBlock = { }, toAmino(message: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAmino { const obj: any = {}; - obj.admin = message.admin; - obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; + obj.admin = omitDefault(message.admin); + obj.max_pool_points_per_block = omitDefault(message.maxPoolPointsPerBlock); return obj; }, fromAminoMsg(object: MsgSetMaxPoolPointsPerBlockAminoMsg): MsgSetMaxPoolPointsPerBlock { @@ -1130,7 +1130,7 @@ export const MsgSetBaseDenoms = { }, toAmino(message: MsgSetBaseDenoms): MsgSetBaseDenomsAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.baseDenoms) { obj.base_denoms = message.baseDenoms.map(e => e ? BaseDenom.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts index 1af6320913..96df101996 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.store.v1beta1"; export interface Node { children: Child[]; @@ -207,7 +207,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index; - obj.accumulation = message.accumulation; + obj.accumulation = omitDefault(message.accumulation); return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts index f570e5d46d..40a69a473a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor; + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts index da64331229..0a2b9a2f49 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts @@ -5,7 +5,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface QueryParamsRequest {} export interface QueryParamsRequestSDKType {} @@ -451,7 +451,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -543,7 +543,7 @@ export const AssetTypeResponse = { }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = message.assetType; + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -811,7 +811,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1037,10 +1037,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1343,7 +1343,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { @@ -1527,7 +1527,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1751,9 +1751,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = omitDefault(message.valAddr); + obj.amount_sfsd = omitDefault(message.amountSfsd); + obj.osmo_equivalent = omitDefault(message.osmoEquivalent); return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -1917,7 +1917,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = omitDefault(message.totalDelegations); return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2037,9 +2037,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2235,7 +2235,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2487,8 +2487,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2752,8 +2752,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -2963,8 +2963,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3160,7 +3160,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts index 13d1c0fe76..ac841fb685 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -228,8 +228,8 @@ export const SuperfluidAsset = { }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = message.assetType; + obj.denom = omitDefault(message.denom); + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -349,9 +349,9 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -471,9 +471,9 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.epoch_number = omitDefault(message.epochNumber); + obj.denom = omitDefault(message.denom); + obj.multiplier = padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -607,8 +607,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -716,8 +716,8 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.lock_id = omitDefault(message.lockId); + obj.intermediary_account = omitDefault(message.intermediaryAccount); return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index 286a368446..06225ca5cd 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -53,7 +53,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString(), + lock_id: omitDefault(lockId)?.toString?.(), val_addr: omitDefault(valAddr) }; }, @@ -77,7 +77,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString() + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -98,7 +98,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString() + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString() + pool_id: omitDefault(poolId)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts index 15c4066b0a..e9e5c95b20 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -189,9 +189,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.val_addr = message.valAddr; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -369,8 +369,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -548,8 +548,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -749,13 +749,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.coins = []; } - obj.val_addr = message.valAddr; + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -847,7 +847,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -953,8 +953,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts index 111653cb58..51212758ec 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -161,8 +161,8 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { @@ -295,8 +295,8 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { @@ -452,14 +452,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { obj.ids = []; } - obj.is_overwrite = message.isOverwrite; + obj.is_overwrite = omitDefault(message.isOverwrite); return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index f0562d1e5f..da4e721d4c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -85,7 +85,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts index 960bab7c74..23b609c232 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -232,7 +232,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts index 73afbc9c01..e96e79fa47 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -303,7 +303,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -487,7 +487,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts index 817ccf8440..8f2a82e542 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -172,7 +172,7 @@ export const AminoConverter = { description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ denom: omitDefault(el0.denom), - exponent: el0.exponent, + exponent: omitDefault(el0.exponent), aliases: el0.aliases })), base: omitDefault(metadata.base), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts index cc25cfa05d..5f5ca60673 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -219,8 +219,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = omitDefault(message.sender); + obj.subdenom = omitDefault(message.subdenom); return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -312,7 +312,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = omitDefault(message.newTokenDenom); return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -418,7 +418,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -597,7 +597,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -790,9 +790,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = omitDefault(message.sender); + obj.denom = omitDefault(message.denom); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -970,7 +970,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts index ce3e641a12..a4ddea9bd0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -106,7 +106,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts index a736b7d685..949a7a4e77 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -167,15 +167,15 @@ export const ArithmeticTwapRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time, - endTime: object?.end_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined }; }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; obj.end_time = message.endTime; return obj; @@ -269,7 +269,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -398,14 +398,14 @@ export const ArithmeticTwapToNowRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; return obj; }, @@ -498,7 +498,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts index 8515e15cf7..aaad1535ee 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -244,25 +244,25 @@ export const TwapRecord = { asset0Denom: object.asset0_denom, asset1Denom: object.asset1_denom, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, p0LastSpotPrice: object.p0_last_spot_price, p1LastSpotPrice: object.p1_last_spot_price, p0ArithmeticTwapAccumulator: object.p0_arithmetic_twap_accumulator, p1ArithmeticTwapAccumulator: object.p1_arithmetic_twap_accumulator, - lastErrorTime: object.last_error_time + lastErrorTime: object?.last_error_time ? Timestamp.fromAmino(object.last_error_time) : undefined }; }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.asset0_denom = omitDefault(message.asset0Denom); + obj.asset1_denom = omitDefault(message.asset1Denom); + obj.height = message.height; obj.time = message.time; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts index 966f0cd38c..1d45907002 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -102,8 +102,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts index e8d01a8750..99280e35fc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -101,7 +101,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = message.basedenom; + obj.basedenom = omitDefault(message.basedenom); if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts index a0bc7509fc..262e93907a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -121,8 +121,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts index a722c03266..50c144ff08 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -304,7 +304,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -410,8 +410,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; - obj.spot_price = message.spotPrice; + obj.poolID = omitDefault(message.poolID); + obj.spot_price = padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -503,7 +503,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -595,7 +595,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -759,7 +759,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = message.baseDenom; + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts index 74c86dd98e..2b547996bf 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; /** Request type for UserValidatorPreferences. */ export interface UserValidatorPreferencesRequest { @@ -86,7 +86,7 @@ export const UserValidatorPreferencesRequest = { }, toAmino(message: UserValidatorPreferencesRequest): UserValidatorPreferencesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: UserValidatorPreferencesRequestAminoMsg): UserValidatorPreferencesRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts index 859649aa26..54ddcc65e7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; /** * ValidatorPreference defines the message structure for @@ -129,8 +129,8 @@ export const ValidatorPreference = { }, toAmino(message: ValidatorPreference): ValidatorPreferenceAmino { const obj: any = {}; - obj.val_oper_address = message.valOperAddress; - obj.weight = message.weight; + obj.val_oper_address = omitDefault(message.valOperAddress); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: ValidatorPreferenceAminoMsg): ValidatorPreference { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index a7ecab13d6..9a7d7c2a41 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -191,7 +191,7 @@ export const AminoConverter = { }: MsgDelegateBondedTokens): MsgDelegateBondedTokensAminoType["value"] => { return { delegator: omitDefault(delegator), - lockID: lockID.toString() + lockID: omitDefault(lockID)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts index 83b226b46a..8be877a8b6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; /** MsgCreateValidatorSetPreference is a list that holds validator-set. */ export interface MsgSetValidatorSetPreference { @@ -200,7 +200,7 @@ export const MsgSetValidatorSetPreference = { }, toAmino(message: MsgSetValidatorSetPreference): MsgSetValidatorSetPreferenceAmino { const obj: any = {}; - obj.delegator = message.delegator; + obj.delegator = omitDefault(message.delegator); if (message.preferences) { obj.preferences = message.preferences.map(e => e ? ValidatorPreference.toAmino(e) : undefined); } else { @@ -383,7 +383,7 @@ export const MsgDelegateToValidatorSet = { }, toAmino(message: MsgDelegateToValidatorSet): MsgDelegateToValidatorSetAmino { const obj: any = {}; - obj.delegator = message.delegator; + obj.delegator = omitDefault(message.delegator); obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; return obj; }, @@ -562,7 +562,7 @@ export const MsgUndelegateFromValidatorSet = { }, toAmino(message: MsgUndelegateFromValidatorSet): MsgUndelegateFromValidatorSetAmino { const obj: any = {}; - obj.delegator = message.delegator; + obj.delegator = omitDefault(message.delegator); obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; return obj; }, @@ -749,7 +749,7 @@ export const MsgRedelegateValidatorSet = { }, toAmino(message: MsgRedelegateValidatorSet): MsgRedelegateValidatorSetAmino { const obj: any = {}; - obj.delegator = message.delegator; + obj.delegator = omitDefault(message.delegator); if (message.preferences) { obj.preferences = message.preferences.map(e => e ? ValidatorPreference.toAmino(e) : undefined); } else { @@ -918,7 +918,7 @@ export const MsgWithdrawDelegationRewards = { }, toAmino(message: MsgWithdrawDelegationRewards): MsgWithdrawDelegationRewardsAmino { const obj: any = {}; - obj.delegator = message.delegator; + obj.delegator = omitDefault(message.delegator); return obj; }, fromAminoMsg(object: MsgWithdrawDelegationRewardsAminoMsg): MsgWithdrawDelegationRewards { @@ -1096,8 +1096,8 @@ export const MsgDelegateBondedTokens = { }, toAmino(message: MsgDelegateBondedTokens): MsgDelegateBondedTokensAmino { const obj: any = {}; - obj.delegator = message.delegator; - obj.lockID = message.lockID ? message.lockID.toString() : undefined; + obj.delegator = omitDefault(message.delegator); + obj.lockID = omitDefault(message.lockID); return obj; }, fromAminoMsg(object: MsgDelegateBondedTokensAminoMsg): MsgDelegateBondedTokens { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts index 8fba9784f1..6439aaa002 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts @@ -4,7 +4,7 @@ import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.abci"; export enum CheckTxType { NEW = 0, @@ -1104,7 +1104,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1284,9 +1284,9 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.version = omitDefault(message.version); + obj.block_version = omitDefault(message.blockVersion); + obj.p2p_version = omitDefault(message.p2pVersion); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1386,8 +1386,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -1541,7 +1541,7 @@ export const RequestInitChain = { }, fromAmino(object: RequestInitChainAmino): RequestInitChain { return { - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, chainId: object.chain_id, consensusParams: object?.consensus_params ? ConsensusParams.fromAmino(object.consensus_params) : undefined, validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromAmino(e)) : [], @@ -1552,7 +1552,7 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); @@ -1560,7 +1560,7 @@ export const RequestInitChain = { obj.validators = []; } obj.app_state_bytes = message.appStateBytes; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = omitDefault(message.initialHeight); return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -1689,9 +1689,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data; - obj.path = message.path; - obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.path = omitDefault(message.path); + obj.height = omitDefault(message.height); + obj.prove = omitDefault(message.prove); return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -1935,7 +1935,7 @@ export const RequestCheckTx = { toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx; - obj.type = message.type; + obj.type = omitDefault(message.type); return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2107,7 +2107,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -2454,9 +2454,9 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunk = omitDefault(message.chunk); return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -2570,9 +2570,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.chunk = message.chunk; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -2969,7 +2969,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3055,7 +3055,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3263,10 +3263,10 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.data = omitDefault(message.data); + obj.version = omitDefault(message.version); + obj.app_version = omitDefault(message.appVersion); + obj.last_block_height = omitDefault(message.lastBlockHeight); obj.last_block_app_hash = message.lastBlockAppHash; return obj; }, @@ -3381,9 +3381,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -3709,15 +3709,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.index = omitDefault(message.index); obj.key = message.key; obj.value = message.value; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.height = omitDefault(message.height); + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4007,18 +4007,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4210,18 +4210,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4462,7 +4462,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = omitDefault(message.retainHeight); return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -4646,7 +4646,7 @@ export const ResponseOfferSnapshot = { }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -4871,7 +4871,7 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { @@ -5112,8 +5112,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -5221,7 +5221,7 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = omitDefault(message.round); if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { @@ -5334,7 +5334,7 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { @@ -5455,7 +5455,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.index = message.index; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -5583,8 +5583,8 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.height = omitDefault(message.height); + obj.index = omitDefault(message.index); obj.tx = message.tx; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -5687,7 +5687,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -5788,7 +5788,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -5889,7 +5889,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = omitDefault(message.signedLastBlock); return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6025,17 +6025,17 @@ export const Evidence = { type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: object?.validator ? Validator.fromAmino(object.validator) : undefined, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, totalVotingPower: BigInt(object.total_voting_power) }; }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6177,9 +6177,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata; return obj; diff --git a/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts index b3983460da..72a83d73e4 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.crypto"; export interface Proof { total: bigint; @@ -178,8 +178,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = omitDefault(message.total); + obj.index = omitDefault(message.index); obj.leaf_hash = message.leafHash; if (message.aunts) { obj.aunts = message.aunts.map(e => e); @@ -400,9 +400,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = omitDefault(message.key); + obj.input = omitDefault(message.input); + obj.output = omitDefault(message.output); return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -516,7 +516,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.key = message.key; obj.data = message.data; return obj; diff --git a/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts index 93831d7fef..9101064149 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -107,7 +107,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = omitDefault(message.bits); if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts index 61197cc17c..5d14915e71 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.p2p"; export interface ProtocolVersion { p2p: bigint; @@ -157,9 +157,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = omitDefault(message.p2p); + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { @@ -344,12 +344,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = omitDefault(message.nodeId); + obj.listen_addr = omitDefault(message.listenAddr); + obj.network = omitDefault(message.network); + obj.version = omitDefault(message.version); obj.channels = message.channels; - obj.moniker = message.moniker; + obj.moniker = omitDefault(message.moniker); obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -450,8 +450,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = omitDefault(message.txIndex); + obj.rpc_address = omitDefault(message.rpcAddress); return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -568,12 +568,12 @@ export const PeerInfo = { return { id: object.id, addressInfo: Array.isArray(object?.address_info) ? object.address_info.map((e: any) => PeerAddressInfo.fromAmino(e)) : [], - lastConnected: object.last_connected + lastConnected: object?.last_connected ? Timestamp.fromAmino(object.last_connected) : undefined }; }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { @@ -700,17 +700,17 @@ export const PeerAddressInfo = { fromAmino(object: PeerAddressInfoAmino): PeerAddressInfo { return { address: object.address, - lastDialSuccess: object.last_dial_success, - lastDialFailure: object.last_dial_failure, + lastDialSuccess: object?.last_dial_success ? Timestamp.fromAmino(object.last_dial_success) : undefined, + lastDialFailure: object?.last_dial_failure ? Timestamp.fromAmino(object.last_dial_failure) : undefined, dialFailures: object.dial_failures }; }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.last_dial_success = message.lastDialSuccess; obj.last_dial_failure = message.lastDialFailure; - obj.dial_failures = message.dialFailures; + obj.dial_failures = omitDefault(message.dialFailures); return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts index 2d5c8deeda..be3bb23cbe 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts @@ -2,7 +2,7 @@ import { Vote, VoteSDKType, LightBlock, LightBlockSDKType } from "./types"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Validator, ValidatorSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; @@ -269,15 +269,15 @@ export const DuplicateVoteEvidence = { voteB: object?.vote_b ? Vote.fromAmino(object.vote_b) : undefined, totalVotingPower: BigInt(object.total_voting_power), validatorPower: BigInt(object.validator_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.validator_power = omitDefault(message.validatorPower); obj.timestamp = message.timestamp; return obj; }, @@ -423,19 +423,19 @@ export const LightClientAttackEvidence = { commonHeight: BigInt(object.common_height), byzantineValidators: Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Validator.fromAmino(e)) : [], totalVotingPower: BigInt(object.total_voting_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = omitDefault(message.commonHeight); if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = []; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); obj.timestamp = message.timestamp; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts index 6cc570365f..ce75a28e4c 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -344,9 +344,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); + obj.time_iota_ms = omitDefault(message.timeIotaMs); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -460,9 +460,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -646,7 +646,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = omitDefault(message.appVersion); return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -746,8 +746,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = omitDefault(message.blockMaxBytes); + obj.block_max_gas = omitDefault(message.blockMaxGas); return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts index 7ffc9ad27f..e3597b949b 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts @@ -3,7 +3,7 @@ import { Consensus, ConsensusSDKType } from "../version/types"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { ValidatorSet, ValidatorSetSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -377,7 +377,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = omitDefault(message.total); obj.hash = message.hash; return obj; }, @@ -492,7 +492,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.bytes = message.bytes; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -848,7 +848,7 @@ export const Header = { version: object?.version ? Consensus.fromAmino(object.version) : undefined, chainId: object.chain_id, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, lastBlockId: object?.last_block_id ? BlockID.fromAmino(object.last_block_id) : undefined, lastCommitHash: object.last_commit_hash, dataHash: object.data_hash, @@ -864,8 +864,8 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.height = omitDefault(message.height); obj.time = message.time; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash; @@ -1150,7 +1150,7 @@ export const Vote = { height: BigInt(object.height), round: object.round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, validatorAddress: object.validator_address, validatorIndex: object.validator_index, signature: object.signature @@ -1158,13 +1158,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.validator_address = message.validatorAddress; - obj.validator_index = message.validatorIndex; + obj.validator_index = omitDefault(message.validatorIndex); obj.signature = message.signature; return obj; }, @@ -1301,8 +1301,8 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); @@ -1430,13 +1430,13 @@ export const CommitSig = { return { blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : -1, validatorAddress: object.validator_address, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = message.blockIdFlag; + obj.block_id_flag = omitDefault(message.blockIdFlag); obj.validator_address = message.validatorAddress; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -1603,16 +1603,16 @@ export const Proposal = { round: object.round, polRound: object.pol_round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); + obj.pol_round = omitDefault(message.polRound); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -1946,9 +1946,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = omitDefault(message.blockSize); obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = omitDefault(message.numTxs); return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts index da06a25a41..f3d77bddbe 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -141,7 +141,7 @@ export const ValidatorSet = { obj.validators = []; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -271,8 +271,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -373,7 +373,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts index f71ce87cf5..f700251c5a 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -118,8 +118,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; - obj.software = message.software; + obj.protocol = omitDefault(message.protocol); + obj.software = omitDefault(message.software); return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -219,8 +219,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts index 464ff93dfe..db25d04767 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -322,8 +322,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -502,7 +502,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -597,8 +597,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -694,7 +694,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = omitDefault(message.auditor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts index 0ac064e272..d5372b0b1a 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -168,8 +168,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts index 8f01b44978..5c12f81802 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -118,7 +118,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts index d659b8c3a2..2f1a92f3ee 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -168,8 +168,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts index 84c40f7c7d..ce6fa21203 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -141,7 +141,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); obj.sequence_number = message.sequenceNumber; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts index d9a132b717..3d1516763d 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts @@ -3,7 +3,7 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./group"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -1057,7 +1057,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1184,7 +1184,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -1294,7 +1294,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts index db543e0f2d..4f5224f8fc 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirement import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -801,7 +801,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, @@ -1054,7 +1054,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts index 04dafb7e03..7bd11ffa47 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -199,7 +199,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -326,7 +326,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -436,7 +436,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts index e7af877ac0..546168571a 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -198,7 +198,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts index fa0766e6dc..ebaf29d633 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts @@ -118,7 +118,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts index 9dab0d0044..72135d5ca9 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -232,10 +232,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -493,11 +493,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts index 82f70526f6..583f346072 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts @@ -443,7 +443,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts index 899ec3ab0a..2fe3a4821c 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -232,10 +232,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -493,11 +493,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts index f402ec4856..5d7b67e7ba 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts @@ -495,7 +495,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; obj.depositor = message.depositor; obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts index e84c8105eb..c103ff8007 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -134,9 +134,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor; - obj.initial_inflation = message.initialInflation; - obj.variance = message.variance; + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); + obj.initial_inflation = padDecimal(message.initialInflation); + obj.variance = padDecimal(message.variance); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts index 958cd6f747..aff68fd9ee 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDAmino, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -698,7 +698,7 @@ export const BidID = { toAmino(message: BidID): BidIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -830,7 +830,7 @@ export const Bid = { obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -979,7 +979,7 @@ export const BidFilters = { toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts index f7ae60dc62..d5f9e29353 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDAmino, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -370,7 +370,7 @@ export const LeaseID = { toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -517,8 +517,8 @@ export const Lease = { obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); + obj.closed_on = omitDefault(message.closedOn); return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -667,7 +667,7 @@ export const LeaseFilters = { toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts index 4fb8ab7620..7738d42f0d 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -245,7 +245,7 @@ export const OrderID = { toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; return obj; @@ -376,7 +376,7 @@ export const Order = { obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; obj.state = message.state; obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -512,7 +512,7 @@ export const OrderFilters = { toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.state = message.state; diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts index d6707bd716..acdfbdbf68 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -340,7 +340,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputv2/confio/proofs.ts b/__fixtures__/v-next/outputv2/confio/proofs.ts index f4fe2a52a0..40132e0083 100644 --- a/__fixtures__/v-next/outputv2/confio/proofs.ts +++ b/__fixtures__/v-next/outputv2/confio/proofs.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "ics23"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ @@ -1249,10 +1249,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = message.hash; - obj.prehash_key = message.prehashKey; - obj.prehash_value = message.prehashValue; - obj.length = message.length; + obj.hash = omitDefault(message.hash); + obj.prehash_key = omitDefault(message.prehashKey); + obj.prehash_value = omitDefault(message.prehashValue); + obj.length = omitDefault(message.length); obj.prefix = message.prefix; return obj; }, @@ -1360,7 +1360,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); obj.prefix = message.prefix; obj.suffix = message.suffix; return obj; @@ -1488,8 +1488,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = omitDefault(message.maxDepth); + obj.min_depth = omitDefault(message.minDepth); return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1657,11 +1657,11 @@ export const InnerSpec = { } else { obj.child_order = []; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = omitDefault(message.childSize); + obj.min_prefix_length = omitDefault(message.minPrefixLength); + obj.max_prefix_length = omitDefault(message.maxPrefixLength); obj.empty_child = message.emptyChild; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts index cc559aa7f4..85fe532404 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -281,7 +281,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts index a25f885557..18e1d4ebff 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -312,7 +312,7 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = message.goImport; + obj.go_import = omitDefault(message.goImport); if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { @@ -423,8 +423,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = message.name; - obj.revision = message.revision; + obj.name = omitDefault(message.name); + obj.revision = omitDefault(message.revision); return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -512,7 +512,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = message.module; + obj.module = omitDefault(message.module); return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts index dc476fc476..3c56607c19 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -214,10 +214,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -343,7 +343,7 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { @@ -498,11 +498,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = omitDefault(message.maxMemoCharacters); + obj.tx_sig_limit = omitDefault(message.txSigLimit); + obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); + obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); + obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts index 8a0ff7e146..ea2494acf7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -583,7 +583,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -1164,7 +1164,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = message.bech32Prefix; + obj.bech32_prefix = omitDefault(message.bech32Prefix); return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1340,7 +1340,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1428,7 +1428,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts index 025fd20019..f8cb7c75cc 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts @@ -9,7 +9,7 @@ import { DepositDeploymentAuthorizationSDKType as DepositDeploymentAuthorization import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType } from "../../bank/v1beta1/authz"; import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKType } from "../../staking/v1beta1/authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -216,7 +216,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = omitDefault(message.msg); return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -314,7 +314,7 @@ export const Grant = { fromAmino(object: GrantAmino): Grant { return { authorization: object?.authorization ? Authorization_FromAmino(object.authorization) : undefined, - expiration: object?.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: Grant): GrantAmino { @@ -444,13 +444,13 @@ export const GrantAuthorization = { granter: object.granter, grantee: object.grantee, authorization: object?.authorization ? Authorization_FromAmino(object.authorization) : undefined, - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; obj.expiration = message.expiration; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts index c999fb50b4..8068bd9820 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -271,9 +271,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -493,7 +493,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -713,7 +713,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts index 65680ced69..f13a65bb08 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -265,8 +265,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -476,7 +476,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Sdk_MsgauthzAuthorization_ToAmino((e as Any)) : undefined); } else { @@ -666,9 +666,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts index c481d30eb2..3859b64e57 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -388,7 +388,7 @@ export const Params = { } else { obj.send_enabled = []; } - obj.default_send_enabled = message.defaultSendEnabled; + obj.default_send_enabled = omitDefault(message.defaultSendEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -489,8 +489,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = message.denom; - obj.enabled = message.enabled; + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -599,7 +599,7 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -713,7 +713,7 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -941,8 +941,8 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = message.denom; - obj.exponent = message.exponent; + obj.denom = omitDefault(message.denom); + obj.exponent = omitDefault(message.exponent); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { @@ -1134,18 +1134,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { obj.denom_units = []; } - obj.base = message.base; - obj.display = message.display; - obj.name = message.name; - obj.symbol = message.symbol; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.base = omitDefault(message.base); + obj.display = omitDefault(message.display); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts index d04997686d..60f7d12574 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -334,7 +334,7 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts index 8fdb321255..bc02e33f2a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -639,8 +639,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = omitDefault(message.address); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -833,7 +833,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1053,7 +1053,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1464,7 +1464,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -2009,7 +2009,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -2202,7 +2202,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2306,7 +2306,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts index 7d68969327..ba4ee7d059 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -177,8 +177,8 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts index a00f392d68..d29a59908f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts @@ -1,7 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.abci.v1beta1"; /** * TxResponse defines a structure containing relevant tx data and metadata. The @@ -715,22 +715,22 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.height = omitDefault(message.height); + obj.txhash = omitDefault(message.txhash); + obj.codespace = omitDefault(message.codespace); + obj.code = omitDefault(message.code); + obj.data = omitDefault(message.data); + obj.raw_log = omitDefault(message.rawLog); if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { obj.logs = []; } - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = omitDefault(message.timestamp); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -858,7 +858,7 @@ export const ABCIMessageLog = { toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { @@ -972,7 +972,7 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -1078,8 +1078,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1184,8 +1184,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1329,7 +1329,7 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -1546,7 +1546,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = omitDefault(message.msgType); obj.data = message.data; return obj; }, @@ -1844,11 +1844,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = omitDefault(message.totalCount); + obj.count = omitDefault(message.count); + obj.page_number = omitDefault(message.pageNumber); + obj.page_total = omitDefault(message.pageTotal); + obj.limit = omitDefault(message.limit); if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts index df0bcd01b3..6cc467f7aa 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.query.v1beta1"; /** * PageRequest is to be embedded in gRPC request messages for efficient @@ -292,10 +292,10 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.offset = omitDefault(message.offset); + obj.limit = omitDefault(message.limit); + obj.count_total = omitDefault(message.countTotal); + obj.reverse = omitDefault(message.reverse); return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { @@ -399,7 +399,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = omitDefault(message.total); return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts index e39c0bf892..5fdb17b85b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -331,7 +331,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = message.interfaceName; + obj.interface_name = omitDefault(message.interfaceName); return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts index 1338c7017f..5d80b9fb0f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -955,7 +955,7 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { @@ -1174,9 +1174,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1264,7 +1264,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1494,7 +1494,7 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { @@ -1605,8 +1605,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.type_url = message.typeUrl; + obj.fullname = omitDefault(message.fullname); + obj.type_url = omitDefault(message.typeUrl); return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1715,7 +1715,7 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { @@ -1808,7 +1808,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1896,7 +1896,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = message.msgTypeUrl; + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -3084,8 +3084,8 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.is_module = message.isModule; + obj.fullname = omitDefault(message.fullname); + obj.is_module = omitDefault(message.isModule); if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { @@ -3191,8 +3191,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.full_query_path = message.fullQueryPath; + obj.name = omitDefault(message.name); + obj.full_query_path = omitDefault(message.fullQueryPath); return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts index a1ca4b0ca6..2d2ad2d436 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; /** Snapshot contains Tendermint state sync snapshot info. */ export interface Snapshot { @@ -348,9 +348,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -710,7 +710,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -841,8 +841,8 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.version = omitDefault(message.version); + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -943,8 +943,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = omitDefault(message.name); + obj.format = omitDefault(message.format); return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts index 16dbf3a415..f927113d27 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -183,7 +183,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -291,7 +291,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, @@ -395,7 +395,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); obj.hash = message.hash; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts index 13e21425eb..b8bef1b5e5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) @@ -154,8 +154,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = omitDefault(message.storeKey); + obj.delete = omitDefault(message.delete); obj.key = message.key; obj.value = message.value; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts index 6f61c540e3..1a0b38fa7c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../../tendermint/ty import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoAmino, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -444,7 +444,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -571,7 +571,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -793,7 +793,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -932,10 +932,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1025,7 +1025,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1467,7 +1467,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = omitDefault(message.syncing); return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1831,18 +1831,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = omitDefault(message.name); + obj.app_name = omitDefault(message.appName); + obj.version = omitDefault(message.version); + obj.git_commit = omitDefault(message.gitCommit); + obj.build_tags = omitDefault(message.buildTags); + obj.go_version = omitDefault(message.goVersion); if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { obj.build_deps = []; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1956,9 +1956,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = omitDefault(message.path); + obj.version = omitDefault(message.version); + obj.sum = omitDefault(message.sum); return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts index e5cec5299d..75789f66fe 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -193,8 +193,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -295,8 +295,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -384,7 +384,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = omitDefault(message.int); return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -472,7 +472,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = omitDefault(message.dec); return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts index 6a8b8a8f51..e817b5b070 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -156,7 +156,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -257,8 +257,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = omitDefault(message.module); + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts index ef43a86d5b..a059c5bd54 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersAmino, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -142,7 +142,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -254,7 +254,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts index 192224e402..ae821065ce 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -130,9 +130,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = message.sender; - obj.invariant_module_name = message.invariantModuleName; - obj.invariant_route = message.invariantRoute; + obj.sender = omitDefault(message.sender); + obj.invariant_module_name = omitDefault(message.invariantModuleName); + obj.invariant_route = omitDefault(message.invariantRoute); return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts index 8656f13028..efe0d7b8d1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -164,11 +164,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = message.purpose; - obj.coin_type = message.coinType; - obj.account = message.account; - obj.change = message.change; - obj.address_index = message.addressIndex; + obj.purpose = omitDefault(message.purpose); + obj.coin_type = omitDefault(message.coinType); + obj.account = omitDefault(message.account); + obj.change = omitDefault(message.change); + obj.address_index = omitDefault(message.addressIndex); return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts index 23c0d499df..87915488fe 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -268,7 +268,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -377,7 +377,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = omitDefault(message.privKeyType); return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts index 1b76f2f7a4..2f84ebc98a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -121,7 +121,7 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts index f07ed5aa6a..038862ac9b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { bytesFromBase64, base64FromBytes, DeepPartial, isSet } from "../../../../helpers"; +import { bytesFromBase64, base64FromBytes, DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. @@ -247,7 +247,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = omitDefault(message.extraBitsStored); obj.elems = message.elems; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts index 0eb4b85630..76cd3146d5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -528,10 +528,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax; - obj.base_proposer_reward = message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward; - obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + obj.community_tax = padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -645,7 +645,7 @@ export const ValidatorHistoricalRewards = { } else { obj.cumulative_reward_ratio = []; } - obj.reference_count = message.referenceCount; + obj.reference_count = omitDefault(message.referenceCount); return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -761,7 +761,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = []; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -1064,8 +1064,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; - obj.fraction = message.fraction; + obj.validator_period = omitDefault(message.validatorPeriod); + obj.fraction = padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1400,9 +1400,9 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1525,9 +1525,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; - obj.stake = message.stake; - obj.height = message.height ? message.height.toString() : undefined; + obj.previous_period = omitDefault(message.previousPeriod); + obj.stake = padDecimal(message.stake); + obj.height = message.height; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1636,7 +1636,7 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -1781,11 +1781,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; - obj.amount = message.amount; - obj.deposit = message.deposit; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); + obj.amount = omitDefault(message.amount); + obj.deposit = omitDefault(message.deposit); return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts index 1e509d6a57..b754112b50 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsAmino, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsAmino, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoAmino, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, Params, ParamsAmino, ParamsSDKType, FeePool, FeePoolAmino, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -385,8 +385,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -495,7 +495,7 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -603,7 +603,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -722,8 +722,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.period = omitDefault(message.period); obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -827,7 +827,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -944,8 +944,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -1079,9 +1079,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.height = omitDefault(message.height); + obj.period = omitDefault(message.period); obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1354,7 +1354,7 @@ export const GenesisState = { } else { obj.delegator_withdraw_infos = []; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = omitDefault(message.previousProposer); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts index a930724db1..93fbc7cbe2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Params, ParamsAmino, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsAmino, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardAmino, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -780,7 +780,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -958,7 +958,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1181,9 +1181,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.starting_height = omitDefault(message.startingHeight); + obj.ending_height = omitDefault(message.endingHeight); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1401,8 +1401,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1590,7 +1590,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1804,7 +1804,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1992,7 +1992,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -2080,7 +2080,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts index f76a7eed91..e8544df278 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -271,8 +271,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -444,8 +444,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -633,7 +633,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -847,7 +847,7 @@ export const MsgFundCommunityPool = { } else { obj.amount = []; } - obj.depositor = message.depositor; + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts index 4613d801ed..123289b883 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts @@ -1,6 +1,6 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * Equivocation implements the Evidence interface and defines evidence of double @@ -139,17 +139,17 @@ export const Equivocation = { fromAmino(object: EquivocationAmino): Equivocation { return { height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, power: BigInt(object.power), consensusAddress: object.consensus_address }; }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.power = omitDefault(message.power); + obj.consensus_address = omitDefault(message.consensusAddress); return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts index 6b28f25a17..fe2cb4db81 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -137,7 +137,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = omitDefault(message.submitter); obj.evidence = message.evidence ? Evidence_ToAmino((message.evidence as Any)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts index f11b97b1aa..0ab07e059f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts @@ -3,7 +3,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -271,7 +271,7 @@ export const BasicAllowance = { fromAmino(object: BasicAllowanceAmino): BasicAllowance { return { spendLimit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromAmino(e)) : [], - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: BasicAllowance): BasicAllowanceAmino { @@ -437,7 +437,7 @@ export const PeriodicAllowance = { period: object?.period ? Duration.fromAmino(object.period) : undefined, periodSpendLimit: Array.isArray(object?.period_spend_limit) ? object.period_spend_limit.map((e: any) => Coin.fromAmino(e)) : [], periodCanSpend: Array.isArray(object?.period_can_spend) ? object.period_can_spend.map((e: any) => Coin.fromAmino(e)) : [], - periodReset: object.period_reset + periodReset: object?.period_reset ? Timestamp.fromAmino(object.period_reset) : undefined }; }, toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { @@ -687,8 +687,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts index 8c173b84fd..c27cc0e05d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -232,8 +232,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -426,7 +426,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -646,7 +646,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts index 7e8481c36f..d084f8058a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -193,8 +193,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, @@ -367,8 +367,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts index b336b1dc20..eb58a67458 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -227,7 +227,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts index ac72394938..48e718e4f9 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -500,8 +500,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -625,8 +625,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -846,23 +846,23 @@ export const Proposal = { messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [], status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time, + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined, metadata: object.metadata }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -873,7 +873,7 @@ export const Proposal = { } obj.voting_start_time = message.votingStartTime; obj.voting_end_time = message.votingEndTime; - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -1000,10 +1000,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1140,14 +1140,14 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1467,9 +1467,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = omitDefault(message.quorum); + obj.threshold = omitDefault(message.threshold); + obj.veto_threshold = omitDefault(message.vetoThreshold); return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts index 72279be97f..6cf6b2ed1d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -489,7 +489,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -708,9 +708,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -930,8 +930,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1126,7 +1126,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1331,7 +1331,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1556,8 +1556,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1752,7 +1752,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1959,7 +1959,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts index 1a0ffdf42b..45313771d7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts @@ -8,7 +8,7 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, R import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -380,8 +380,8 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = omitDefault(message.proposer); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -471,7 +471,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -575,7 +575,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -775,10 +775,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -986,14 +986,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1188,8 +1188,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts index ec230e57fb..6c7e3134bc 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -227,7 +227,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts index 119818f2ac..13275868a0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts @@ -9,7 +9,7 @@ import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSu import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -563,8 +563,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -666,8 +666,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -791,8 +791,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -994,18 +994,18 @@ export const Proposal = { content: object?.content ? ProposalContentI_FromAmino(object.content) : undefined, status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -1142,10 +1142,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = omitDefault(message.yes); + obj.abstain = omitDefault(message.abstain); + obj.no = omitDefault(message.no); + obj.no_with_veto = omitDefault(message.noWithVeto); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1282,9 +1282,9 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts index 36a02ca698..4b10e57510 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -489,7 +489,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -708,9 +708,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -930,8 +930,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1126,7 +1126,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1331,7 +1331,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1556,8 +1556,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1752,7 +1752,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1959,7 +1959,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts index 064e5fd09a..bc293959c5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts @@ -7,7 +7,7 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, R import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -316,7 +316,7 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; + obj.proposer = omitDefault(message.proposer); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -406,7 +406,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -522,9 +522,9 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -719,8 +719,8 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { @@ -920,8 +920,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts index 1a6921e3b8..d47356dc8d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts @@ -1,6 +1,6 @@ import { ProposalExecutorResult, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** EventCreateGroup is an event emitted when a group is created. */ export interface EventCreateGroup { @@ -275,7 +275,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -365,7 +365,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -453,7 +453,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -541,7 +541,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -631,7 +631,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -721,7 +721,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -811,7 +811,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -914,8 +914,8 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = message.result; + obj.proposal_id = omitDefault(message.proposalId); + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -1018,8 +1018,8 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.group_id = omitDefault(message.groupId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts index da5fe5a841..7024c6e20e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -277,7 +277,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = omitDefault(message.groupSeq); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -288,13 +288,13 @@ export const GenesisState = { } else { obj.group_members = []; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = omitDefault(message.groupPolicySeq); if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = []; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = omitDefault(message.proposalSeq); if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts index 2016fec933..7d5b1c2eea 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -725,7 +725,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -903,7 +903,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -1098,7 +1098,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1318,7 +1318,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1540,7 +1540,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1760,7 +1760,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1967,7 +1967,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2160,7 +2160,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2380,8 +2380,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2576,7 +2576,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2796,7 +2796,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = omitDefault(message.voter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3016,7 +3016,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3223,7 +3223,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts index 9e51f17133..c293696ee0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts @@ -1,7 +1,7 @@ import { Member, MemberAmino, MemberSDKType, VoteOption, ThresholdDecisionPolicy, ThresholdDecisionPolicyProtoMsg, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicyProtoMsg, PercentageDecisionPolicySDKType, voteOptionFromJSON, voteOptionToJSON } from "./types"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -884,13 +884,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -980,7 +980,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -1104,8 +1104,8 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1297,9 +1297,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1486,9 +1486,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1690,9 +1690,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -1781,7 +1781,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1895,9 +1895,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -2060,15 +2060,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = omitDefault(message.groupMetadata); + obj.group_policy_metadata = omitDefault(message.groupPolicyMetadata); + obj.group_policy_as_admin = omitDefault(message.groupPolicyAsAdmin); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -2172,8 +2172,8 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_id = omitDefault(message.groupId); + obj.group_policy_address = omitDefault(message.groupPolicyAddress); return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2360,8 +2360,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -2547,9 +2547,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2776,19 +2776,19 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.exec = message.exec; + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2878,7 +2878,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2981,8 +2981,8 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.proposal_id = omitDefault(message.proposalId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -3195,11 +3195,11 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; - obj.exec = message.exec; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3373,8 +3373,8 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.proposal_id = omitDefault(message.proposalId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3548,8 +3548,8 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts index cd57676fce..fcd2318465 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts @@ -2,7 +2,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -858,14 +858,14 @@ export const Member = { address: object.address, weight: object.weight, metadata: object.metadata, - addedAt: object.added_at + addedAt: object?.added_at ? Timestamp.fromAmino(object.added_at) : undefined }; }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = omitDefault(message.address); + obj.weight = omitDefault(message.weight); + obj.metadata = omitDefault(message.metadata); obj.added_at = message.addedAt; return obj; }, @@ -1070,7 +1070,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1175,7 +1175,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = omitDefault(message.percentage); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1434,16 +1434,16 @@ export const GroupInfo = { metadata: object.metadata, version: BigInt(object.version), totalWeight: object.total_weight, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.id = omitDefault(message.id); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); + obj.total_weight = omitDefault(message.totalWeight); obj.created_at = message.createdAt; return obj; }, @@ -1549,7 +1549,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1717,16 +1717,16 @@ export const GroupPolicyInfo = { metadata: object.metadata, version: BigInt(object.version), decisionPolicy: object?.decision_policy ? DecisionPolicy_FromAmino(object.decision_policy) : undefined, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; obj.created_at = message.createdAt; return obj; @@ -1983,35 +1983,35 @@ export const Proposal = { address: object.address, metadata: object.metadata, proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => e) : [], - submitTime: object.submit_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, groupVersion: BigInt(object.group_version), groupPolicyVersion: BigInt(object.group_policy_version), status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - votingPeriodEnd: object.voting_period_end, + votingPeriodEnd: object?.voting_period_end ? Timestamp.fromAmino(object.voting_period_end) : undefined, executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.id = omitDefault(message.id); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } obj.submit_time = message.submitTime; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = message.status; - obj.result = message.result; + obj.group_version = omitDefault(message.groupVersion); + obj.group_policy_version = omitDefault(message.groupPolicyVersion); + obj.status = omitDefault(message.status); + obj.result = omitDefault(message.result); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd; - obj.executor_result = message.executorResult; + obj.executor_result = omitDefault(message.executorResult); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -2143,10 +2143,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2283,15 +2283,15 @@ export const Vote = { voter: object.voter, option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object.metadata, - submitTime: object.submit_time + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined }; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); obj.submit_time = message.submitTime; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts index 4ae7e90b3a..0f4729255d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -152,8 +152,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation; - obj.annual_provisions = message.annualProvisions; + obj.inflation = padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -308,12 +308,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange; - obj.inflation_max = message.inflationMax; - obj.inflation_min = message.inflationMin; - obj.goal_bonded = message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.mint_denom = omitDefault(message.mintDenom); + obj.inflation_rate_change = padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded); + obj.blocks_per_year = omitDefault(message.blocksPerYear); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts index 20fe0a6317..669a6a2b57 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -184,10 +184,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -301,9 +301,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -417,9 +417,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts index 5451bd5017..bec132d99b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -264,7 +264,7 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts index f6dc921577..852e27ca98 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -239,12 +239,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.description = omitDefault(message.description); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -387,10 +387,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts index 0430458e59..85a4255913 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTAmino, NFTSDKType, Class, ClassAmino, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -382,8 +382,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -473,7 +473,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -574,8 +574,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -663,7 +663,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -751,7 +751,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -841,7 +841,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -957,8 +957,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1176,8 +1176,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1355,7 +1355,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts index 1d2a04b9da..9310859864 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -154,10 +154,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts index 53af4499b0..d6d5d0c813 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -333,7 +333,7 @@ export const TableDescriptor = { } else { obj.index = []; } - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -434,8 +434,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.auto_increment = message.autoIncrement; + obj.fields = omitDefault(message.fields); + obj.auto_increment = omitDefault(message.autoIncrement); return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -549,9 +549,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.id = message.id; - obj.unique = message.unique; + obj.fields = omitDefault(message.fields); + obj.id = omitDefault(message.id); + obj.unique = omitDefault(message.unique); return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -639,7 +639,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts index 7e32a637b5..d23acf713e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -374,9 +374,9 @@ export const ModuleSchemaDescriptor_FileEntry = { }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = message.storageType; + obj.id = omitDefault(message.id); + obj.proto_file_name = omitDefault(message.protoFileName); + obj.storage_type = omitDefault(message.storageType); return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts index f9e2ec45e2..94bea85d9c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -159,8 +159,8 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { @@ -279,9 +279,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; - obj.value = message.value; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts index 45c327fea9..be175e6c85 100644 --- a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -211,8 +211,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -582,7 +582,7 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = message.subspace; + obj.subspace = omitDefault(message.subspace); if (message.keys) { obj.keys = message.keys.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts index 73a2c86042..ace824b09d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -356,7 +356,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -466,7 +466,7 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { @@ -574,8 +574,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.index = omitDefault(message.index); + obj.missed = omitDefault(message.missed); return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts index 7c8c5ff2a6..4c761eba01 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -386,7 +386,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = message.consAddress; + obj.cons_address = omitDefault(message.consAddress); return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts index 597086b4a8..81a7fa5b29 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -236,19 +236,19 @@ export const ValidatorSigningInfo = { address: object.address, startHeight: BigInt(object.start_height), indexOffset: BigInt(object.index_offset), - jailedUntil: object.jailed_until, + jailedUntil: object?.jailed_until ? Timestamp.fromAmino(object.jailed_until) : undefined, tombstoned: object.tombstoned, missedBlocksCounter: BigInt(object.missed_blocks_counter) }; }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.address = omitDefault(message.address); + obj.start_height = omitDefault(message.startHeight); + obj.index_offset = omitDefault(message.indexOffset); obj.jailed_until = message.jailedUntil; - obj.tombstoned = message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.tombstoned = omitDefault(message.tombstoned); + obj.missed_blocks_counter = omitDefault(message.missedBlocksCounter); return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -392,7 +392,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = omitDefault(message.signedBlocksWindow); obj.min_signed_per_window = message.minSignedPerWindow; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign; diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts index 2d9bd049b3..845bc638db 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -250,7 +250,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = message.authorizationType; + obj.authorization_type = omitDefault(message.authorizationType); return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts index d96977ed5d..661dd082a0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -319,7 +319,7 @@ export const GenesisState = { } else { obj.redelegations = []; } - obj.exported = message.exported; + obj.exported = omitDefault(message.exported); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -422,8 +422,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.address = omitDefault(message.address); + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts index ed5c817d6d..ff0a10a75b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -930,7 +930,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1135,7 +1135,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1328,7 +1328,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1548,7 +1548,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1766,8 +1766,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1958,8 +1958,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -2152,7 +2152,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2372,7 +2372,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2618,9 +2618,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.src_validator_addr = omitDefault(message.srcValidatorAddr); + obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2840,7 +2840,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3058,8 +3058,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -3239,7 +3239,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts index e1d477f550..5fa6ca4335 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -1034,9 +1034,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1134,7 +1134,7 @@ export const Commission = { fromAmino(object: CommissionAmino): Commission { return { commissionRates: object?.commission_rates ? CommissionRates.fromAmino(object.commission_rates) : undefined, - updateTime: object.update_time + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: Commission): CommissionAmino { @@ -1280,11 +1280,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = omitDefault(message.moniker); + obj.identity = omitDefault(message.identity); + obj.website = omitDefault(message.website); + obj.security_contact = omitDefault(message.securityContact); + obj.details = omitDefault(message.details); return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1503,24 +1503,24 @@ export const Validator = { delegatorShares: object.delegator_shares, description: object?.description ? Description.fromAmino(object.description) : undefined, unbondingHeight: BigInt(object.unbonding_height), - unbondingTime: object.unbonding_time, + unbondingTime: object?.unbonding_time ? Timestamp.fromAmino(object.unbonding_time) : undefined, commission: object?.commission ? Commission.fromAmino(object.commission) : undefined, minSelfDelegation: object.min_self_delegation }; }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = omitDefault(message.operatorAddress); obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = message.status; - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = omitDefault(message.jailed); + obj.status = omitDefault(message.status); + obj.tokens = omitDefault(message.tokens); + obj.delegator_shares = padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = omitDefault(message.unbondingHeight); obj.unbonding_time = message.unbondingTime; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1721,8 +1721,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1936,9 +1936,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -2152,9 +2152,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.shares = padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2276,8 +2276,8 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { @@ -2404,17 +2404,17 @@ export const UnbondingDelegationEntry = { fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, balance: object.balance }; }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = omitDefault(message.initialBalance); + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2536,17 +2536,17 @@ export const RedelegationEntry = { fromAmino(object: RedelegationEntryAmino): RedelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, sharesDst: object.shares_dst }; }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = omitDefault(message.initialBalance); + obj.shares_dst = padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2681,9 +2681,9 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { @@ -2844,11 +2844,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = omitDefault(message.maxValidators); + obj.max_entries = omitDefault(message.maxEntries); + obj.historical_entries = omitDefault(message.historicalEntries); + obj.bond_denom = omitDefault(message.bondDenom); + obj.min_commission_rate = padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -3058,7 +3058,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts index a4e1051717..d27bf53b96 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -430,9 +430,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -635,9 +635,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = omitDefault(message.validatorAddress); + obj.commission_rate = padDecimal(message.commissionRate); + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -824,8 +824,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1026,9 +1026,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1112,7 +1112,7 @@ export const MsgBeginRedelegateResponse = { }, fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { @@ -1233,8 +1233,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1318,7 +1318,7 @@ export const MsgUndelegateResponse = { }, fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts index 878215b2a7..d5814c7ee7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts @@ -1,7 +1,7 @@ import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -441,7 +441,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { @@ -648,7 +648,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.signature = message.signature; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts index 9b0cf87734..969445629a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts @@ -4,7 +4,7 @@ import { TxResponse, TxResponseAmino, TxResponseSDKType, GasInfo, GasInfoAmino, import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockAmino, BlockSDKType } from "../../../tendermint/types/block"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -590,7 +590,7 @@ export const GetTxsEventRequest = { obj.events = []; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = message.orderBy; + obj.order_by = omitDefault(message.orderBy); return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -834,7 +834,7 @@ export const BroadcastTxRequest = { toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1222,7 +1222,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1433,7 +1433,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts index 2ba11ebaed..2ca24b45f7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { SignMode, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/s import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -1124,8 +1124,8 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.auth_info_bytes = message.authInfoBytes; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1288,9 +1288,9 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1462,8 +1462,8 @@ export const TxBody = { } else { obj.messages = []; } - obj.memo = message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.memo = omitDefault(message.memo); + obj.timeout_height = omitDefault(message.timeoutHeight); if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1727,7 +1727,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1921,7 +1921,7 @@ export const ModeInfo_Single = { }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -2179,9 +2179,9 @@ export const Fee = { } else { obj.amount = []; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.gas_limit = omitDefault(message.gasLimit); + obj.payer = omitDefault(message.payer); + obj.granter = omitDefault(message.granter); return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -2295,7 +2295,7 @@ export const Tip = { } else { obj.amount = []; } - obj.tipper = message.tipper; + obj.tipper = omitDefault(message.tipper); return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2424,9 +2424,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.sig = message.sig; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts index 3b2c1df709..d222314940 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -556,7 +556,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -646,7 +646,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -736,7 +736,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = omitDefault(message.lastHeight); return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -912,7 +912,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = message.moduleName; + obj.module_name = omitDefault(message.moduleName); return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -1171,7 +1171,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts index 9ddd4a4a7c..0905025ae5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -205,7 +205,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -365,7 +365,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts index 709f997eea..f1f2db6aac 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -330,7 +330,7 @@ export const Plan = { fromAmino(object: PlanAmino): Plan { return { name: object.name, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, height: BigInt(object.height), info: object.info, upgradedClientState: object?.upgraded_client_state ? Any.fromAmino(object.upgraded_client_state) : undefined @@ -338,10 +338,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.time = message.time; - obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.height = omitDefault(message.height); + obj.info = omitDefault(message.info); obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -458,8 +458,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -561,8 +561,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -665,8 +665,8 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.name = omitDefault(message.name); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts index 5a8dedec10..0b1c447426 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -293,15 +293,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.amount = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; - obj.delayed = message.delayed; + obj.end_time = omitDefault(message.endTime); + obj.delayed = omitDefault(message.delayed); return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -494,8 +494,8 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -708,9 +708,9 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts index 4860a67f19..15792eb736 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -363,7 +363,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = omitDefault(message.endTime); return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -469,7 +469,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -670,7 +670,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = omitDefault(message.length); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -802,7 +802,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts index 70d4a53c39..54430d5a1f 100644 --- a/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial } from "../helpers"; +import { isSet, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -250,8 +250,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -375,8 +375,8 @@ export const ScalarDescriptor = { }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); if (message.fieldType) { obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); } else { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts index 7358aeaa66..9a6c0461f4 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts @@ -1,7 +1,7 @@ import { MsgStoreCode, MsgStoreCodeAmino, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractAmino, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractAmino, MsgExecuteContractSDKType } from "./tx"; import { Params, ParamsAmino, ParamsSDKType, CodeInfo, CodeInfoAmino, CodeInfoSDKType, ContractInfo, ContractInfoAmino, ContractInfoSDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -572,10 +572,10 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes; - obj.pinned = message.pinned; + obj.pinned = omitDefault(message.pinned); return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -699,7 +699,7 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); @@ -809,7 +809,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts index b7b5f60eeb..7d555f7d33 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -182,9 +182,9 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.channel = omitDefault(message.channel); + obj.timeout_height = omitDefault(message.timeoutHeight); + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); obj.data = message.data; return obj; }, @@ -273,7 +273,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = omitDefault(message.channel); return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts index 883ae75eb4..b4643ac5b3 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -524,9 +524,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -717,12 +717,12 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -870,10 +870,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1001,9 +1001,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1165,10 +1165,10 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1301,10 +1301,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1418,9 +1418,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1551,8 +1551,8 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { @@ -1688,8 +1688,8 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts index d5d6c6fb9d..10f2232b08 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { ContractInfo, ContractInfoAmino, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, ContractCodeHistoryEntrySDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** @@ -663,7 +663,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -766,7 +766,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -870,7 +870,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1092,7 +1092,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1312,7 +1312,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1530,7 +1530,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData; return obj; }, @@ -1720,7 +1720,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1899,7 +1899,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { @@ -2015,8 +2015,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId; + obj.creator = omitDefault(message.creator); obj.data_hash = message.dataHash; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts index 78781a7df4..bc426335f9 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgStoreCode submit Wasm code to the system */ @@ -449,7 +449,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -541,7 +541,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -704,10 +704,10 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.sender = omitDefault(message.sender); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -814,7 +814,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.data = message.data; return obj; }, @@ -950,8 +950,8 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1174,9 +1174,9 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1379,9 +1379,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1553,8 +1553,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts index b41d97a6b4..34002213ca 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ @@ -438,7 +438,7 @@ export const AccessTypeParam = { }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -539,8 +539,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = message.permission; - obj.address = message.address; + obj.permission = omitDefault(message.permission); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -659,8 +659,8 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.instantiate_default_permission = omitDefault(message.instantiateDefaultPermission); + obj.max_wasm_code_size = omitDefault(message.maxWasmCodeSize); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -777,7 +777,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -950,12 +950,12 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.code_id = omitDefault(message.codeId); + obj.creator = omitDefault(message.creator); + obj.admin = omitDefault(message.admin); + obj.label = omitDefault(message.label); obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = omitDefault(message.ibcPortId); obj.extension = message.extension ? ContractInfoExtension_ToAmino((message.extension as Any)) : undefined; return obj; }, @@ -1087,8 +1087,8 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.operation = omitDefault(message.operation); + obj.code_id = omitDefault(message.codeId); obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1195,8 +1195,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); + obj.tx_index = omitDefault(message.txIndex); return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts index b366bebedf..5b564467c6 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -254,9 +254,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = message.action; - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = omitDefault(message.action); + obj.completed = omitDefault(message.completed); + obj.claimable_amount = omitDefault(message.claimableAmount); return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -380,8 +380,8 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = omitDefault(message.address); + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { @@ -497,7 +497,7 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts index 3621f9161e..5f88328ff7 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts @@ -2,7 +2,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKTy import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -348,7 +348,7 @@ export const Params = { fromAmino(object: ParamsAmino): Params { return { enableClaims: object.enable_claims, - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimsDenom: object.claims_denom, @@ -358,11 +358,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = omitDefault(message.enableClaims); obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = omitDefault(message.claimsDenom); if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts index 699e6cf782..7e47ecc9ad 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKType, Claim, ClaimAmino, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -787,7 +787,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -889,7 +889,7 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts index 29937ee523..2198571031 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -194,23 +194,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts index d39636981c..dc3fd4bb9b 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination: PageRequest; @@ -328,7 +328,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -411,7 +411,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts index 29029668b6..44d80dc522 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts @@ -1,6 +1,6 @@ import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -320,10 +320,10 @@ export const TokenPair = { }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = message.contractOwner; + obj.erc20_address = omitDefault(message.erc20Address); + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); + obj.contract_owner = omitDefault(message.contractOwner); return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -432,8 +432,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -541,9 +541,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.erc20address = omitDefault(message.erc20address); return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -650,9 +650,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts index e9ae34a5af..6f9516a4ec 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -248,8 +248,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = message.enableErc20; - obj.enable_evm_hook = message.enableEvmHook; + obj.enable_erc20 = omitDefault(message.enableErc20); + obj.enable_evm_hook = omitDefault(message.enableEvmHook); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts index 61e89fda08..f5c7634827 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -423,7 +423,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = message.token; + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts index 5f84463f34..b9fc4b78bc 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -205,8 +205,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -390,10 +390,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = omitDefault(message.contractAddress); + obj.amount = omitDefault(message.amount); + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts index 7dbd4ccc7b..37598f46aa 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -136,9 +136,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts index 97386fd300..16643c1756 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -315,11 +315,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = message.enableFees; - obj.developer_shares = message.developerShares; - obj.validator_shares = message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; - obj.min_gas_price = message.minGasPrice; + obj.enable_fees = omitDefault(message.enableFees); + obj.developer_shares = padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); + obj.min_gas_price = padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts index 6b88e91342..0a100291e6 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -496,7 +496,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -822,7 +822,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = omitDefault(message.deployerAddress); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts index 315ff7b713..bebeceeb9c 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -298,9 +298,9 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { @@ -463,8 +463,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -635,9 +635,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts index 0c43ec0bdf..65342d6165 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -308,10 +308,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = message.enableIncentives; - obj.allocation_limit = message.allocationLimit; - obj.incentives_epoch_identifier = message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler; + obj.enable_incentives = omitDefault(message.enableIncentives); + obj.allocation_limit = padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); + obj.reward_scaler = padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts index 9445fc4428..434af2e16a 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -280,21 +280,21 @@ export const Incentive = { contract: object.contract, allocations: Array.isArray(object?.allocations) ? object.allocations.map((e: any) => DecCoin.fromAmino(e)) : [], epochs: object.epochs, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, totalGas: BigInt(object.total_gas) }; }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); obj.start_time = message.startTime; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = omitDefault(message.totalGas); return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -403,9 +403,9 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); + obj.cumulative_gas = omitDefault(message.cumulativeGas); return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { @@ -547,15 +547,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -662,9 +662,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts index 085394e17a..f3837d498c 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, G import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -677,7 +677,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -856,7 +856,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1060,8 +1060,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1144,7 +1144,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = omitDefault(message.gasMeter); return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1417,7 +1417,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts index 769de0eaf1..45f2ec1555 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationAmino, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionAmino, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -204,10 +204,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.period = omitDefault(message.period); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.epochs_per_period = omitDefault(message.epochsPerPeriod); + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -331,10 +331,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = omitDefault(message.mintDenom); obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = omitDefault(message.enableInflation); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts index aec89e9561..ae5eef2760 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -224,9 +224,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards; - obj.usage_incentives = message.usageIncentives; - obj.community_pool = message.communityPool; + obj.staking_rewards = padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -359,11 +359,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a; - obj.r = message.r; - obj.c = message.c; - obj.bonding_target = message.bondingTarget; - obj.max_variance = message.maxVariance; + obj.a = padDecimal(message.a); + obj.r = padDecimal(message.r); + obj.c = padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts index 722ca1730e..cb1074a3a8 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -420,7 +420,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -714,7 +714,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -1006,7 +1006,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate; + obj.inflation_rate = padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts index 6c0b7867d6..2535dd4ccd 100644 --- a/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -211,7 +211,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = omitDefault(message.enableRecovery); obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts index 49d0eaad75..9935a056ec 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -127,7 +127,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts index dfe06ac3a2..bd7631e752 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -289,7 +289,7 @@ export const MsgCreateClawbackVestingAccount = { return { fromAddress: object.from_address, toAddress: object.to_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [], merge: object.merge @@ -297,8 +297,8 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); @@ -310,7 +310,7 @@ export const MsgCreateClawbackVestingAccount = { } else { obj.vesting_periods = []; } - obj.merge = message.merge; + obj.merge = omitDefault(message.merge); return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -481,9 +481,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = omitDefault(message.funderAddress); + obj.account_address = omitDefault(message.accountAddress); + obj.dest_address = omitDefault(message.destAddress); return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts index e4a15677f2..72168eae09 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts @@ -1,7 +1,7 @@ import { BaseVestingAccount, BaseVestingAccountAmino, BaseVestingAccountSDKType, Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -191,7 +191,7 @@ export const ClawbackVestingAccount = { return { baseVestingAccount: object?.base_vesting_account ? BaseVestingAccount.fromAmino(object.base_vesting_account) : undefined, funderAddress: object.funder_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [] }; @@ -199,7 +199,7 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = omitDefault(message.funderAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv2/google/api/auth.ts b/__fixtures__/v-next/outputv2/google/api/auth.ts index 9b330c8592..9877786169 100644 --- a/__fixtures__/v-next/outputv2/google/api/auth.ts +++ b/__fixtures__/v-next/outputv2/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -821,9 +821,9 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = omitDefault(message.allowWithoutCredential); if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { @@ -935,9 +935,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = omitDefault(message.header); + obj.query = omitDefault(message.query); + obj.value_prefix = omitDefault(message.valuePrefix); return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -1091,11 +1091,11 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = omitDefault(message.id); + obj.issuer = omitDefault(message.issuer); + obj.jwks_uri = omitDefault(message.jwksUri); + obj.audiences = omitDefault(message.audiences); + obj.authorization_url = omitDefault(message.authorizationUrl); if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { @@ -1181,7 +1181,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = omitDefault(message.canonicalScopes); return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1275,8 +1275,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = omitDefault(message.providerId); + obj.audiences = omitDefault(message.audiences); return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputv2/google/api/backend.ts b/__fixtures__/v-next/outputv2/google/api/backend.ts index 608118b70e..1b5788d225 100644 --- a/__fixtures__/v-next/outputv2/google/api/backend.ts +++ b/__fixtures__/v-next/outputv2/google/api/backend.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -573,15 +573,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = message.pathTranslation; - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = omitDefault(message.selector); + obj.address = omitDefault(message.address); + obj.deadline = omitDefault(message.deadline); + obj.min_deadline = omitDefault(message.minDeadline); + obj.operation_deadline = omitDefault(message.operationDeadline); + obj.path_translation = omitDefault(message.pathTranslation); + obj.jwt_audience = omitDefault(message.jwtAudience); + obj.disable_auth = omitDefault(message.disableAuth); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputv2/google/api/billing.ts b/__fixtures__/v-next/outputv2/google/api/billing.ts index 94267923d7..9c01304334 100644 --- a/__fixtures__/v-next/outputv2/google/api/billing.ts +++ b/__fixtures__/v-next/outputv2/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -356,7 +356,7 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/config_change.ts b/__fixtures__/v-next/outputv2/google/api/config_change.ts index 5b1b993522..4a90236981 100644 --- a/__fixtures__/v-next/outputv2/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv2/google/api/config_change.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -322,10 +322,10 @@ export const ConfigChange = { }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = message.changeType; + obj.element = omitDefault(message.element); + obj.old_value = omitDefault(message.oldValue); + obj.new_value = omitDefault(message.newValue); + obj.change_type = omitDefault(message.changeType); if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { @@ -411,7 +411,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputv2/google/api/consumer.ts b/__fixtures__/v-next/outputv2/google/api/consumer.ts index e68868b4da..a1192fcf7f 100644 --- a/__fixtures__/v-next/outputv2/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv2/google/api/consumer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -376,9 +376,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputv2/google/api/context.ts b/__fixtures__/v-next/outputv2/google/api/context.ts index 8cfd5f79cd..7d58d5c214 100644 --- a/__fixtures__/v-next/outputv2/google/api/context.ts +++ b/__fixtures__/v-next/outputv2/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -452,7 +452,7 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.requested) { obj.requested = message.requested.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/control.ts b/__fixtures__/v-next/outputv2/google/api/control.ts index 7e0c417bdc..3871ef448d 100644 --- a/__fixtures__/v-next/outputv2/google/api/control.ts +++ b/__fixtures__/v-next/outputv2/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -103,7 +103,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = message.environment; + obj.environment = omitDefault(message.environment); return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputv2/google/api/distribution.ts b/__fixtures__/v-next/outputv2/google/api/distribution.ts index 1e9f31f219..d5c7d128cc 100644 --- a/__fixtures__/v-next/outputv2/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/distribution.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../protobuf/timestamp"; import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -718,9 +718,9 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { @@ -826,8 +826,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = omitDefault(message.min); + obj.max = omitDefault(message.max); return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -1049,9 +1049,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1158,9 +1158,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1371,13 +1371,13 @@ export const Distribution_Exemplar = { fromAmino(object: Distribution_ExemplarAmino): Distribution_Exemplar { return { value: object.value, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, attachments: Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); obj.timestamp = message.timestamp; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv2/google/api/documentation.ts b/__fixtures__/v-next/outputv2/google/api/documentation.ts index 2a5fee565a..1db509a8a0 100644 --- a/__fixtures__/v-next/outputv2/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv2/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -546,7 +546,7 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = message.summary; + obj.summary = omitDefault(message.summary); if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { @@ -557,9 +557,9 @@ export const Documentation = { } else { obj.rules = []; } - obj.documentation_root_url = message.documentationRootUrl; - obj.service_root_url = message.serviceRootUrl; - obj.overview = message.overview; + obj.documentation_root_url = omitDefault(message.documentationRootUrl); + obj.service_root_url = omitDefault(message.serviceRootUrl); + obj.overview = omitDefault(message.overview); return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -666,9 +666,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.description = message.description; - obj.deprecation_description = message.deprecationDescription; + obj.selector = omitDefault(message.selector); + obj.description = omitDefault(message.description); + obj.deprecation_description = omitDefault(message.deprecationDescription); return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -783,8 +783,8 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = message.name; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.content = omitDefault(message.content); if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/endpoint.ts b/__fixtures__/v-next/outputv2/google/api/endpoint.ts index f966ac2c1f..fe753d68d0 100644 --- a/__fixtures__/v-next/outputv2/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv2/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -243,14 +243,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { obj.aliases = []; } - obj.target = message.target; - obj.allow_cors = message.allowCors; + obj.target = omitDefault(message.target); + obj.allow_cors = omitDefault(message.allowCors); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts index 2636c8fcc1..3167eb4fad 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -3,7 +3,7 @@ import { Decl, DeclAmino, DeclSDKType, CheckedExpr, CheckedExprAmino, CheckedExp import { ExprValue, ExprValueAmino, ExprValueSDKType } from "../../v1alpha1/eval"; import { Status, StatusAmino, StatusSDKType } from "../../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../../helpers"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -458,10 +458,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = omitDefault(message.celSource); + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.source_location = omitDefault(message.sourceLocation); + obj.disable_macros = omitDefault(message.disableMacros); return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -706,8 +706,8 @@ export const CheckRequest = { } else { obj.type_env = []; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = omitDefault(message.container); + obj.no_std_env = omitDefault(message.noStdEnv); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -911,7 +911,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -1076,7 +1076,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1296,9 +1296,9 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts index 5aabdffd4b..7ab8c3b049 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts @@ -2,7 +2,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType, Expr, ExprAmino, ExprSD import { Empty, EmptyAmino, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -976,7 +976,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -1068,7 +1068,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, @@ -1289,7 +1289,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = omitDefault(message.exprVersion); obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1542,15 +1542,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = message.null; - obj.primitive = message.primitive; - obj.wrapper = message.wrapper; - obj.well_known = message.wellKnown; + obj.null = omitDefault(message.null); + obj.primitive = omitDefault(message.primitive); + obj.wrapper = omitDefault(message.wrapper); + obj.well_known = omitDefault(message.wellKnown); obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = omitDefault(message.messageType); + obj.type_param = omitDefault(message.typeParam); obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1946,7 +1946,7 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -2062,7 +2062,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -2177,7 +2177,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2434,7 +2434,7 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = omitDefault(message.overloadId); if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -2446,8 +2446,8 @@ export const Decl_FunctionDecl_Overload = { obj.type_params = []; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = omitDefault(message.isInstanceFunction); + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2564,7 +2564,7 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts index 9d753c8eb2..1a9af2e2f3 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -461,8 +461,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = omitDefault(message.expr); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts index 78463f00d8..925d9528da 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -286,8 +286,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.value_index = message.valueIndex; + obj.id = omitDefault(message.id); + obj.value_index = omitDefault(message.valueIndex); return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts index 99a69af439..a1279fb7a9 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts @@ -2,7 +2,7 @@ import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -1165,7 +1165,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1253,7 +1253,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1363,8 +1363,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1482,7 +1482,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1682,7 +1682,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = omitDefault(message.messageName); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1813,8 +1813,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1985,9 +1985,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -2177,17 +2177,17 @@ export const Constant = { stringValue: object?.string_value, bytesValue: object?.bytes_value, durationValue: object?.duration_value ? Duration.fromAmino(object.duration_value) : undefined, - timestampValue: object?.timestamp_value + timestampValue: object?.timestamp_value ? Timestamp.fromAmino(object.timestamp_value) : undefined }; }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue; @@ -2285,8 +2285,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2377,7 +2377,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, @@ -2598,8 +2598,8 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -2736,10 +2736,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts index 2b5181cb4a..ed05ed8bed 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts @@ -1,7 +1,7 @@ import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -460,18 +460,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -565,8 +565,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts index 31382a6e1a..5c4fd93bb2 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprAmino, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -274,9 +274,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.doc = omitDefault(message.doc); obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -393,8 +393,8 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = omitDefault(message.id); + obj.type = omitDefault(message.type); if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { @@ -621,7 +621,7 @@ export const FunctionDecl = { obj.args = []; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = omitDefault(message.receiverFunction); return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts index 71caa44631..a6caca6c58 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -482,7 +482,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -864,7 +864,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts index 8b04f17720..0970551201 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts @@ -1,7 +1,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source"; import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -764,7 +764,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = omitDefault(message.syntaxVersion); return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -950,7 +950,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1038,7 +1038,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1148,8 +1148,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1267,7 +1267,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1467,7 +1467,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1596,8 +1596,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1768,9 +1768,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1937,12 +1937,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts index 9bae1d8305..f2e107fe27 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -212,8 +212,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -369,7 +369,7 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -500,10 +500,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts index 08393012fe..2343712803 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts @@ -1,7 +1,7 @@ import { NullValue, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -460,18 +460,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -565,8 +565,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputv2/google/api/http.ts b/__fixtures__/v-next/outputv2/google/api/http.ts index 15d802b87b..3598d9ab64 100644 --- a/__fixtures__/v-next/outputv2/google/api/http.ts +++ b/__fixtures__/v-next/outputv2/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -1114,7 +1114,7 @@ export const Http = { } else { obj.rules = []; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -1322,15 +1322,15 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = omitDefault(message.selector); + obj.get = omitDefault(message.get); + obj.put = omitDefault(message.put); + obj.post = omitDefault(message.post); + obj.delete = omitDefault(message.delete); + obj.patch = omitDefault(message.patch); obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = omitDefault(message.body); + obj.response_body = omitDefault(message.responseBody); if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { @@ -1429,8 +1429,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = omitDefault(message.kind); + obj.path = omitDefault(message.path); return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputv2/google/api/httpbody.ts b/__fixtures__/v-next/outputv2/google/api/httpbody.ts index 88fecec052..88c2c1bb22 100644 --- a/__fixtures__/v-next/outputv2/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv2/google/api/httpbody.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -268,7 +268,7 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = omitDefault(message.contentType); obj.data = message.data; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv2/google/api/label.ts b/__fixtures__/v-next/outputv2/google/api/label.ts index e6a5bdd780..0b1dd91e82 100644 --- a/__fixtures__/v-next/outputv2/google/api/label.ts +++ b/__fixtures__/v-next/outputv2/google/api/label.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -163,9 +163,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = message.valueType; - obj.description = message.description; + obj.key = omitDefault(message.key); + obj.value_type = omitDefault(message.valueType); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputv2/google/api/log.ts b/__fixtures__/v-next/outputv2/google/api/log.ts index 8001332f34..7f0e5949ff 100644 --- a/__fixtures__/v-next/outputv2/google/api/log.ts +++ b/__fixtures__/v-next/outputv2/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -205,14 +205,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.description = message.description; - obj.display_name = message.displayName; + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputv2/google/api/logging.ts b/__fixtures__/v-next/outputv2/google/api/logging.ts index 5b684b5d7c..a8ba5862c4 100644 --- a/__fixtures__/v-next/outputv2/google/api/logging.ts +++ b/__fixtures__/v-next/outputv2/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -392,7 +392,7 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.logs) { obj.logs = message.logs.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/metric.ts b/__fixtures__/v-next/outputv2/google/api/metric.ts index 37c4c40606..0039b5a82f 100644 --- a/__fixtures__/v-next/outputv2/google/api/metric.ts +++ b/__fixtures__/v-next/outputv2/google/api/metric.ts @@ -2,7 +2,7 @@ import { LaunchStage, launchStageFromJSON, launchStageToJSON } from "./launch_st import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -832,20 +832,20 @@ export const MetricDescriptor = { }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.metric_kind = message.metricKind; - obj.value_type = message.valueType; - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = omitDefault(message.metricKind); + obj.value_type = omitDefault(message.valueType); + obj.unit = omitDefault(message.unit); + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { @@ -961,7 +961,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -1056,8 +1056,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1183,7 +1183,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts index 312a4cc48a..56d5565f3a 100644 --- a/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts @@ -2,7 +2,7 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from ". import { LaunchStage, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Struct, StructAmino, StructSDKType } from "../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -467,16 +467,16 @@ export const MonitoredResourceDescriptor = { }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.display_name = omitDefault(message.displayName); + obj.description = omitDefault(message.description); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -569,8 +569,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -696,7 +696,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -795,8 +795,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputv2/google/api/monitoring.ts b/__fixtures__/v-next/outputv2/google/api/monitoring.ts index f32f41035a..6b0ccf52ff 100644 --- a/__fixtures__/v-next/outputv2/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv2/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -465,7 +465,7 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/quota.ts b/__fixtures__/v-next/outputv2/google/api/quota.ts index 6c3d730211..96fd994746 100644 --- a/__fixtures__/v-next/outputv2/google/api/quota.ts +++ b/__fixtures__/v-next/outputv2/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, isObject } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -704,8 +704,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -831,7 +831,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -932,8 +932,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1169,21 +1169,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; - obj.duration = message.duration; - obj.metric = message.metric; - obj.unit = message.unit; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.default_limit = omitDefault(message.defaultLimit); + obj.max_limit = omitDefault(message.maxLimit); + obj.free_tier = omitDefault(message.freeTier); + obj.duration = omitDefault(message.duration); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputv2/google/api/resource.ts b/__fixtures__/v-next/outputv2/google/api/resource.ts index f0da1bf2c5..d08dffd280 100644 --- a/__fixtures__/v-next/outputv2/google/api/resource.ts +++ b/__fixtures__/v-next/outputv2/google/api/resource.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -694,16 +694,16 @@ export const ResourceDescriptor = { }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { obj.pattern = []; } - obj.name_field = message.nameField; - obj.history = message.history; - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = omitDefault(message.nameField); + obj.history = omitDefault(message.history); + obj.plural = omitDefault(message.plural); + obj.singular = omitDefault(message.singular); if (message.style) { obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); } else { @@ -802,8 +802,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = omitDefault(message.type); + obj.child_type = omitDefault(message.childType); return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputv2/google/api/routing.ts b/__fixtures__/v-next/outputv2/google/api/routing.ts index 48febb5352..6128675b10 100644 --- a/__fixtures__/v-next/outputv2/google/api/routing.ts +++ b/__fixtures__/v-next/outputv2/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -1422,8 +1422,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = message.field; - obj.path_template = message.pathTemplate; + obj.field = omitDefault(message.field); + obj.path_template = omitDefault(message.pathTemplate); return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputv2/google/api/service.ts b/__fixtures__/v-next/outputv2/google/api/service.ts index fa940a4b83..cb8aa29aec 100644 --- a/__fixtures__/v-next/outputv2/google/api/service.ts +++ b/__fixtures__/v-next/outputv2/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersAmino, SystemParametersSDKType } from import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueAmino, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -783,10 +783,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; - obj.producer_project_id = message.producerProjectId; - obj.id = message.id; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.id = omitDefault(message.id); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts index e9ab0462d3..a56fb67357 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,6 @@ import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -362,9 +362,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.detail = omitDefault(message.detail); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts index 182170f855..c6c1cc98ff 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -520,11 +520,11 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.minimum = message.minimum; - obj.maximum = message.maximum; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.minimum = omitDefault(message.minimum); + obj.maximum = omitDefault(message.maximum); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { @@ -644,9 +644,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -753,9 +753,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts index 1d06492261..bf29cf9546 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -438,21 +438,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts index 3a4368a542..f84c8bd11c 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts @@ -4,7 +4,7 @@ import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "./http_reques import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { Struct, StructAmino, StructSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; @@ -382,8 +382,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -629,7 +629,7 @@ export const LogEntry = { fromAmino(object: LogEntryAmino): LogEntry { return { name: object.name, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, trace: object.trace, @@ -649,12 +649,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timestamp = message.timestamp; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = omitDefault(message.trace); + obj.insert_id = omitDefault(message.insertId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -662,7 +662,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -785,10 +785,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -897,9 +897,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts index dd41bde0ed..fd867817b5 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../protobuf/timestamp"; import { Distribution, DistributionAmino, DistributionSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; @@ -229,8 +229,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -427,8 +427,8 @@ export const MetricValue = { acc[key] = String(value); return acc; }, {}) : {}, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, boolValue: object?.bool_value, int64Value: object?.int64_value ? BigInt(object.int64_value) : undefined, doubleValue: object?.double_value, @@ -446,10 +446,10 @@ export const MetricValue = { } obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -552,7 +552,7 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts index 0732e12b10..4c29c951c2 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts @@ -3,7 +3,7 @@ import { MetricValueSet, MetricValueSetAmino, MetricValueSetSDKType } from "./me import { LogEntry, LogEntryAmino, LogEntrySDKType } from "./log_entry"; import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -328,8 +328,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -567,8 +567,8 @@ export const Operation = { operationId: object.operation_id, operationName: object.operation_name, consumerId: object.consumer_id, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -583,9 +583,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.operation_name = omitDefault(message.operationName); + obj.consumer_id = omitDefault(message.consumerId); obj.start_time = message.startTime; obj.end_time = message.endTime; obj.labels = {}; @@ -604,7 +604,7 @@ export const Operation = { } else { obj.log_entries = []; } - obj.importance = message.importance; + obj.importance = omitDefault(message.importance); if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts index 5e9a039347..1758ecf285 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts @@ -1,7 +1,7 @@ import { MetricValueSet, MetricValueSetAmino, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -586,9 +586,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -681,8 +681,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -868,9 +868,9 @@ export const QuotaOperation = { }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.method_name = omitDefault(message.methodName); + obj.consumer_id = omitDefault(message.consumerId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -882,7 +882,7 @@ export const QuotaOperation = { } else { obj.quota_metrics = []; } - obj.quota_mode = message.quotaMode; + obj.quota_mode = omitDefault(message.quotaMode); return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -1018,7 +1018,7 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { @@ -1029,7 +1029,7 @@ export const AllocateQuotaResponse = { } else { obj.quota_metrics = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1151,9 +1151,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.description = message.description; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts index 721ab43f5a..fb267fa11e 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts @@ -2,7 +2,7 @@ import { Operation, OperationAmino, OperationSDKType } from "./operation"; import { CheckError, CheckErrorAmino, CheckErrorSDKType } from "./check_error"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -564,9 +564,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -709,14 +709,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { obj.check_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -937,9 +937,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.project_number = omitDefault(message.projectNumber); + obj.type = omitDefault(message.type); + obj.consumer_number = omitDefault(message.consumerNumber); return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { @@ -1054,13 +1054,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { obj.operations = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1180,8 +1180,8 @@ export const ReportResponse = { } else { obj.report_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1277,7 +1277,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts index d66d15ca88..7bb71c41df 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextAmino, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -411,15 +411,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { obj.resources = []; } - obj.flags = message.flags; + obj.flags = omitDefault(message.flags); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -552,11 +552,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.permission = omitDefault(message.permission); + obj.container = omitDefault(message.container); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -649,8 +649,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -899,8 +899,8 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts index 6d1b561b09..d5a09c80e7 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../protobuf/timestamp"; import { ConfigChange, ConfigChangeAmino, ConfigChangeSDKType } from "../../config_change"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -908,8 +908,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = omitDefault(message.serviceName); + obj.producer_project_id = omitDefault(message.producerProjectId); return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -1040,7 +1040,7 @@ export const OperationMetadata = { resourceNames: Array.isArray(object?.resource_names) ? object.resource_names.map((e: any) => e) : [], steps: Array.isArray(object?.steps) ? object.steps.map((e: any) => OperationMetadata_Step.fromAmino(e)) : [], progressPercentage: object.progress_percentage, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: OperationMetadata): OperationMetadataAmino { @@ -1055,7 +1055,7 @@ export const OperationMetadata = { } else { obj.steps = []; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = omitDefault(message.progressPercentage); obj.start_time = message.startTime; return obj; }, @@ -1150,8 +1150,8 @@ export const OperationMetadata_Step = { }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = message.status; + obj.description = omitDefault(message.description); + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1258,9 +1258,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = message.kind; - obj.message = message.message; + obj.location = omitDefault(message.location); + obj.kind = omitDefault(message.kind); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1362,7 +1362,7 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { @@ -1474,9 +1474,9 @@ export const ConfigFile = { }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = omitDefault(message.filePath); obj.file_contents = message.fileContents; - obj.file_type = message.fileType; + obj.file_type = omitDefault(message.fileType); return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1557,7 +1557,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1803,7 +1803,7 @@ export const Rollout = { fromAmino(object: RolloutAmino): Rollout { return { rolloutId: object.rollout_id, - createTime: object.create_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, createdBy: object.created_by, status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: object?.traffic_percent_strategy ? Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy) : undefined, @@ -1813,13 +1813,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = omitDefault(message.rolloutId); obj.create_time = message.createTime; - obj.created_by = message.createdBy; - obj.status = message.status; + obj.created_by = omitDefault(message.createdBy); + obj.status = omitDefault(message.status); obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1912,8 +1912,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts index 25f5ad9259..15a8695afb 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts @@ -2,7 +2,7 @@ import { ManagedService, ManagedServiceAmino, ManagedServiceSDKType, ConfigSourc import { Service, ServiceAmino, ServiceSDKType } from "../../service"; import { Any, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -851,10 +851,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.consumer_id = omitDefault(message.consumerId); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -961,7 +961,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1042,7 +1042,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1206,7 +1206,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1287,7 +1287,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1477,9 +1477,9 @@ export const GetServiceConfigRequest = { }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = message.view; + obj.service_name = omitDefault(message.serviceName); + obj.config_id = omitDefault(message.configId); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1586,9 +1586,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1695,7 +1695,7 @@ export const ListServiceConfigsResponse = { } else { obj.service_configs = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1791,7 +1791,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1901,9 +1901,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = omitDefault(message.validateOnly); return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -2082,7 +2082,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -2203,10 +2203,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2313,7 +2313,7 @@ export const ListServiceRolloutsResponse = { } else { obj.rollouts = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2407,8 +2407,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = omitDefault(message.serviceName); + obj.rollout_id = omitDefault(message.rolloutId); return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2643,8 +2643,8 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = omitDefault(message.serviceName); + obj.id = omitDefault(message.id); if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts index 0b3d94323c..404e5e11c1 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -363,10 +363,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -598,8 +598,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts index b3368dc6b0..f72cf07103 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts @@ -1,6 +1,6 @@ import { Service, ServiceAmino, ServiceSDKType } from "./resources"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -633,7 +633,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -823,9 +823,9 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = message.checkIfServiceHasUsage; + obj.name = omitDefault(message.name); + obj.disable_dependent_services = omitDefault(message.disableDependentServices); + obj.check_if_service_has_usage = omitDefault(message.checkIfServiceHasUsage); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -989,7 +989,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1109,10 +1109,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1219,7 +1219,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1321,7 +1321,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -1539,8 +1539,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = omitDefault(message.serviceId); + obj.error_message = omitDefault(message.errorMessage); return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1642,7 +1642,7 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.names) { obj.names = message.names.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts index 88d1af0b79..6b6d7e69a4 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -1177,10 +1177,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1412,8 +1412,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { @@ -1688,9 +1688,9 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.display_name = omitDefault(message.displayName); if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { @@ -1701,7 +1701,7 @@ export const ConsumerQuotaMetric = { } else { obj.descendant_consumer_quota_limits = []; } - obj.unit = message.unit; + obj.unit = omitDefault(message.unit); return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1855,11 +1855,11 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.is_precise = omitDefault(message.isPrecise); + obj.allows_admin_overrides = omitDefault(message.allowsAdminOverrides); if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { @@ -1957,8 +1957,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -2146,8 +2146,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = omitDefault(message.effectiveLimit); + obj.default_limit = omitDefault(message.defaultLimit); obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2249,8 +2249,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2430,17 +2430,17 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.override_value = omitDefault(message.overrideValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.admin_override_ancestor = omitDefault(message.adminOverrideAncestor); return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2626,8 +2626,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2807,17 +2807,17 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.policy_value = omitDefault(message.policyValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2911,8 +2911,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = omitDefault(message.email); + obj.unique_id = omitDefault(message.uniqueId); return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts index 094b1b487e..d627174913 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,7 +1,7 @@ import { QuotaView, QuotaOverride, QuotaOverrideAmino, QuotaOverrideSDKType, QuotaSafetyCheck, OverrideInlineSource, OverrideInlineSourceAmino, OverrideInlineSourceSDKType, Service, ServiceAmino, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricAmino, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicyAmino, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentityAmino, ServiceIdentitySDKType, quotaViewFromJSON, quotaViewToJSON, quotaSafetyCheckFromJSON, quotaSafetyCheckToJSON } from "./resources"; import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../../protobuf/field_mask"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -1627,7 +1627,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1708,7 +1708,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1789,7 +1789,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1909,10 +1909,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -2019,7 +2019,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -2121,7 +2121,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -2246,10 +2246,10 @@ export const ListConsumerQuotaMetricsRequest = { }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = message.view; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -2356,7 +2356,7 @@ export const ListConsumerQuotaMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -2450,8 +2450,8 @@ export const GetConsumerQuotaMetricRequest = { }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -2545,8 +2545,8 @@ export const GetConsumerQuotaLimitRequest = { }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2685,9 +2685,9 @@ export const CreateAdminOverrideRequest = { }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -2846,9 +2846,9 @@ export const UpdateAdminOverrideRequest = { }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -2978,8 +2978,8 @@ export const DeleteAdminOverrideRequest = { }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3091,9 +3091,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -3200,7 +3200,7 @@ export const ListAdminOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -3432,9 +3432,9 @@ export const ImportAdminOverridesRequest = { }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3735,9 +3735,9 @@ export const CreateConsumerOverrideRequest = { }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3896,9 +3896,9 @@ export const UpdateConsumerOverrideRequest = { }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -4028,8 +4028,8 @@ export const DeleteConsumerOverrideRequest = { }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -4141,9 +4141,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -4250,7 +4250,7 @@ export const ListConsumerOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -4482,9 +4482,9 @@ export const ImportConsumerOverridesRequest = { }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -5076,7 +5076,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -5173,7 +5173,7 @@ export const GetServiceIdentityResponse = { toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputv2/google/api/system_parameter.ts b/__fixtures__/v-next/outputv2/google/api/system_parameter.ts index 489518920e..608ef905db 100644 --- a/__fixtures__/v-next/outputv2/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv2/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -394,7 +394,7 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { @@ -506,9 +506,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = message.name; - obj.http_header = message.httpHeader; - obj.url_query_parameter = message.urlQueryParameter; + obj.name = omitDefault(message.name); + obj.http_header = omitDefault(message.httpHeader); + obj.url_query_parameter = omitDefault(message.urlQueryParameter); return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputv2/google/api/usage.ts b/__fixtures__/v-next/outputv2/google/api/usage.ts index 1396a92955..555ef88caa 100644 --- a/__fixtures__/v-next/outputv2/google/api/usage.ts +++ b/__fixtures__/v-next/outputv2/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -329,7 +329,7 @@ export const Usage = { } else { obj.rules = []; } - obj.producer_notification_channel = message.producerNotificationChannel; + obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -436,9 +436,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.allow_unregistered_calls = message.allowUnregisteredCalls; - obj.skip_service_control = message.skipServiceControl; + obj.selector = omitDefault(message.selector); + obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); + obj.skip_service_control = omitDefault(message.skipServiceControl); return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputv2/google/api/visibility.ts b/__fixtures__/v-next/outputv2/google/api/visibility.ts index e04a9fbe5f..336322e08d 100644 --- a/__fixtures__/v-next/outputv2/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv2/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -344,8 +344,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.restriction = message.restriction; + obj.selector = omitDefault(message.selector); + obj.restriction = omitDefault(message.restriction); return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts index af1be6b307..8f589c01c7 100644 --- a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -442,21 +442,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts index dd5e5171ba..33ccb398b9 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts @@ -5,7 +5,7 @@ import { Timestamp } from "../../protobuf/timestamp"; import { LogSeverity, logSeverityFromJSON, logSeverityToJSON } from "../type/log_severity"; import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "../type/http_request"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; @@ -614,8 +614,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -929,8 +929,8 @@ export const LogEntry = { protoPayload: object?.proto_payload ? Any.fromAmino(object.proto_payload) : undefined, textPayload: object?.text_payload, jsonPayload: object?.json_payload ? Struct.fromAmino(object.json_payload) : undefined, - timestamp: object.timestamp, - receiveTimestamp: object.receive_timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, + receiveTimestamp: object?.receive_timestamp ? Timestamp.fromAmino(object.receive_timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: object.insert_id, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, @@ -950,15 +950,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp; obj.receive_timestamp = message.receiveTimestamp; - obj.severity = message.severity; - obj.insert_id = message.insertId; + obj.severity = omitDefault(message.severity); + obj.insert_id = omitDefault(message.insertId); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -967,9 +967,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = omitDefault(message.trace); + obj.span_id = omitDefault(message.spanId); + obj.trace_sampled = omitDefault(message.traceSampled); obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -1091,10 +1091,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1203,9 +1203,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1312,9 +1312,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = omitDefault(message.uid); + obj.index = omitDefault(message.index); + obj.total_splits = omitDefault(message.totalSplits); return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts index db20f71b83..0b8f9abc9a 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts @@ -3,7 +3,7 @@ import { LogEntry, LogEntryAmino, LogEntrySDKType } from "./log_entry"; import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { Status, StatusAmino, StatusSDKType } from "../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -1013,7 +1013,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -1106,8 +1106,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -1295,7 +1295,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -1308,8 +1308,8 @@ export const WriteLogEntriesRequest = { } else { obj.entries = []; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = omitDefault(message.partialSuccess); + obj.dry_run = omitDefault(message.dryRun); return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1468,7 +1468,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1733,10 +1733,10 @@ export const ListLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = omitDefault(message.filter); + obj.order_by = omitDefault(message.orderBy); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1843,7 +1843,7 @@ export const ListLogEntriesResponse = { } else { obj.entries = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1937,8 +1937,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -2045,7 +2045,7 @@ export const ListMonitoredResourceDescriptorsResponse = { } else { obj.resource_descriptors = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -2173,9 +2173,9 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { @@ -2287,7 +2287,7 @@ export const ListLogsResponse = { } else { obj.log_names = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2409,7 +2409,7 @@ export const TailLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2623,8 +2623,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.suppressed_count = message.suppressedCount; + obj.reason = omitDefault(message.reason); + obj.suppressed_count = omitDefault(message.suppressedCount); return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts index 2f6b5d36eb..82ab43842c 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts @@ -1,7 +1,7 @@ import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -3198,8 +3198,8 @@ export const LogBucket = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, retentionDays: object.retention_days, locked: object.locked, lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : -1, @@ -3209,13 +3209,13 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = message.lifecycleState; + obj.retention_days = omitDefault(message.retentionDays); + obj.locked = omitDefault(message.locked); + obj.lifecycle_state = omitDefault(message.lifecycleState); if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { @@ -3347,18 +3347,18 @@ export const LogView = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, filter: object.filter }; }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -3586,25 +3586,25 @@ export const LogSink = { writerIdentity: object.writer_identity, includeChildren: object.include_children, bigqueryOptions: object?.bigquery_options ? BigQueryOptions.fromAmino(object.bigquery_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.destination = omitDefault(message.destination); + obj.filter = omitDefault(message.filter); + obj.description = omitDefault(message.description); + obj.disabled = omitDefault(message.disabled); if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { obj.exclusions = []; } - obj.output_version_format = message.outputVersionFormat; - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = omitDefault(message.outputVersionFormat); + obj.writer_identity = omitDefault(message.writerIdentity); + obj.include_children = omitDefault(message.includeChildren); obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; @@ -3701,8 +3701,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = omitDefault(message.usePartitionedTables); + obj.uses_timestamp_column_partitioning = omitDefault(message.usesTimestampColumnPartitioning); return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -3809,9 +3809,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -3918,7 +3918,7 @@ export const ListBucketsResponse = { } else { obj.buckets = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -4027,8 +4027,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = omitDefault(message.parent); + obj.bucket_id = omitDefault(message.bucketId); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -4140,7 +4140,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -4223,7 +4223,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -4304,7 +4304,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -4385,7 +4385,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -4492,9 +4492,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -4601,7 +4601,7 @@ export const ListViewsResponse = { } else { obj.views = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -4710,8 +4710,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = omitDefault(message.parent); + obj.view_id = omitDefault(message.viewId); obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -4823,7 +4823,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -4906,7 +4906,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -4987,7 +4987,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -5094,9 +5094,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -5203,7 +5203,7 @@ export const ListSinksResponse = { } else { obj.sinks = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -5284,7 +5284,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -5393,9 +5393,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -5519,9 +5519,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -5603,7 +5603,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -5743,16 +5743,16 @@ export const LogExclusion = { description: object.description, filter: object.filter, disabled: object.disabled, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.create_time = message.createTime; obj.update_time = message.updateTime; return obj; @@ -5861,9 +5861,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -5970,7 +5970,7 @@ export const ListExclusionsResponse = { } else { obj.exclusions = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -6051,7 +6051,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -6147,7 +6147,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -6259,7 +6259,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6342,7 +6342,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -6423,7 +6423,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -6534,7 +6534,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6643,9 +6643,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.service_account_id = omitDefault(message.serviceAccountId); return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -6726,7 +6726,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -6837,7 +6837,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6972,11 +6972,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.kms_service_account_id = omitDefault(message.kmsServiceAccountId); + obj.storage_location = omitDefault(message.storageLocation); + obj.disable_default_sink = omitDefault(message.disableDefaultSink); return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -7083,9 +7083,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.destination = omitDefault(message.destination); return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -7235,8 +7235,8 @@ export const CopyLogEntriesMetadata = { }, fromAmino(object: CopyLogEntriesMetadataAmino): CopyLogEntriesMetadata { return { - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: object.cancellation_requested, request: object?.request ? CopyLogEntriesRequest.fromAmino(object.request) : undefined, @@ -7248,11 +7248,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.state = message.state; - obj.cancellation_requested = message.cancellationRequested; + obj.state = omitDefault(message.state); + obj.cancellation_requested = omitDefault(message.cancellationRequested); obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = omitDefault(message.progress); + obj.writer_identity = omitDefault(message.writerIdentity); return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { @@ -7335,7 +7335,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = omitDefault(message.logEntriesCopiedCount); return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts index 311c729e42..ad4e9bfec8 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts @@ -2,7 +2,7 @@ import { MetricDescriptor, MetricDescriptorAmino, MetricDescriptorSDKType } from import { Distribution_BucketOptions } from "../../api/distribution"; import { Timestamp } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -679,8 +679,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -920,19 +920,19 @@ export const LogMetric = { return acc; }, {}) : {}, bucketOptions: object?.bucket_options ? Distribution_BucketOptions.fromAmino(object.bucket_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = omitDefault(message.valueExtractor); obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -942,7 +942,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -1049,9 +1049,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -1158,7 +1158,7 @@ export const ListLogMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1239,7 +1239,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1335,7 +1335,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1432,7 +1432,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1514,7 +1514,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputv2/google/longrunning/operations.ts b/__fixtures__/v-next/outputv2/google/longrunning/operations.ts index 778cf33be3..299e7694e2 100644 --- a/__fixtures__/v-next/outputv2/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv2/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { Status, StatusAmino, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -481,9 +481,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = message.done; + obj.done = omitDefault(message.done); obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -566,7 +566,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -686,10 +686,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -796,7 +796,7 @@ export const ListOperationsResponse = { } else { obj.operations = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -877,7 +877,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -958,7 +958,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -1054,7 +1054,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1149,8 +1149,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = omitDefault(message.responseType); + obj.metadata_type = omitDefault(message.metadataType); return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/api.ts b/__fixtures__/v-next/outputv2/google/protobuf/api.ts index 2e1f6927ba..e093fbc65e 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/api.ts @@ -1,7 +1,7 @@ import { Option, OptionAmino, OptionSDKType, Syntax, syntaxFromJSON, syntaxToJSON } from "./type"; import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -625,7 +625,7 @@ export const Api = { }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { @@ -636,14 +636,14 @@ export const Api = { } else { obj.options = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { obj.mixins = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -810,17 +810,17 @@ export const Method = { }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = omitDefault(message.name); + obj.request_type_url = omitDefault(message.requestTypeUrl); + obj.request_streaming = omitDefault(message.requestStreaming); + obj.response_type_url = omitDefault(message.responseTypeUrl); + obj.response_streaming = omitDefault(message.responseStreaming); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -914,8 +914,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = omitDefault(message.name); + obj.root = omitDefault(message.root); return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts index 7a48e3641d..979bc9bad3 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -390,10 +390,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = message.major; - obj.minor = message.minor; - obj.patch = message.patch; - obj.suffix = message.suffix; + obj.major = omitDefault(message.major); + obj.minor = omitDefault(message.minor); + obj.patch = omitDefault(message.patch); + obj.suffix = omitDefault(message.suffix); return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -536,7 +536,7 @@ export const CodeGeneratorRequest = { } else { obj.file_to_generate = []; } - obj.parameter = message.parameter; + obj.parameter = omitDefault(message.parameter); if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { @@ -644,7 +644,7 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { @@ -756,9 +756,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = message.name; - obj.insertion_point = message.insertionPoint; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.insertion_point = omitDefault(message.insertionPoint); + obj.content = omitDefault(message.content); return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts index 75024ce553..9a61ec8a99 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -2573,8 +2573,8 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = omitDefault(message.name); + obj.package = omitDefault(message.package); if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { @@ -2612,7 +2612,7 @@ export const FileDescriptorProto = { } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2876,7 +2876,7 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { @@ -3026,8 +3026,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3122,8 +3122,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3416,15 +3416,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = message.label; - obj.type = message.type; - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.label = omitDefault(message.label); + obj.type = omitDefault(message.type); + obj.type_name = omitDefault(message.typeName); + obj.extendee = omitDefault(message.extendee); + obj.default_value = omitDefault(message.defaultValue); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.json_name = omitDefault(message.jsonName); obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3521,7 +3521,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3681,7 +3681,7 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { @@ -3791,8 +3791,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3901,8 +3901,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4020,7 +4020,7 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { @@ -4174,12 +4174,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = omitDefault(message.name); + obj.input_type = omitDefault(message.inputType); + obj.output_type = omitDefault(message.outputType); obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = omitDefault(message.clientStreaming); + obj.server_streaming = omitDefault(message.serverStreaming); return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4528,26 +4528,26 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = message.optimizeFor; - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = omitDefault(message.javaPackage); + obj.java_outer_classname = omitDefault(message.javaOuterClassname); + obj.java_multiple_files = omitDefault(message.javaMultipleFiles); + obj.java_generate_equals_and_hash = omitDefault(message.javaGenerateEqualsAndHash); + obj.java_string_check_utf8 = omitDefault(message.javaStringCheckUtf8); + obj.optimize_for = omitDefault(message.optimizeFor); + obj.go_package = omitDefault(message.goPackage); + obj.cc_generic_services = omitDefault(message.ccGenericServices); + obj.java_generic_services = omitDefault(message.javaGenericServices); + obj.py_generic_services = omitDefault(message.pyGenericServices); + obj.php_generic_services = omitDefault(message.phpGenericServices); + obj.deprecated = omitDefault(message.deprecated); + obj.cc_enable_arenas = omitDefault(message.ccEnableArenas); + obj.objc_class_prefix = omitDefault(message.objcClassPrefix); + obj.csharp_namespace = omitDefault(message.csharpNamespace); + obj.swift_prefix = omitDefault(message.swiftPrefix); + obj.php_class_prefix = omitDefault(message.phpClassPrefix); + obj.php_namespace = omitDefault(message.phpNamespace); + obj.php_metadata_namespace = omitDefault(message.phpMetadataNamespace); + obj.ruby_package = omitDefault(message.rubyPackage); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4693,10 +4693,10 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = omitDefault(message.messageSetWireFormat); + obj.no_standard_descriptor_accessor = omitDefault(message.noStandardDescriptorAccessor); + obj.deprecated = omitDefault(message.deprecated); + obj.map_entry = omitDefault(message.mapEntry); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4868,12 +4868,12 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = message.ctype; - obj.packed = message.packed; - obj.jstype = message.jstype; - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = omitDefault(message.ctype); + obj.packed = omitDefault(message.packed); + obj.jstype = omitDefault(message.jstype); + obj.lazy = omitDefault(message.lazy); + obj.deprecated = omitDefault(message.deprecated); + obj.weak = omitDefault(message.weak); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5086,8 +5086,8 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = omitDefault(message.allowAlias); + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5194,7 +5194,7 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5301,7 +5301,7 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5421,8 +5421,8 @@ export const MethodOptions = { }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = message.idempotencyLevel; + obj.deprecated = omitDefault(message.deprecated); + obj.idempotency_level = omitDefault(message.idempotencyLevel); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5603,12 +5603,12 @@ export const UninterpretedOption = { } else { obj.name = []; } - obj.identifier_value = message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.identifier_value = omitDefault(message.identifierValue); + obj.positive_int_value = omitDefault(message.positiveIntValue); + obj.negative_int_value = omitDefault(message.negativeIntValue); + obj.double_value = omitDefault(message.doubleValue); obj.string_value = message.stringValue; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = omitDefault(message.aggregateValue); return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5702,8 +5702,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = omitDefault(message.namePart); + obj.is_extension = omitDefault(message.isExtension); return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5981,8 +5981,8 @@ export const SourceCodeInfo_Location = { } else { obj.span = []; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = omitDefault(message.leadingComments); + obj.trailing_comments = omitDefault(message.trailingComments); if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { @@ -6222,9 +6222,9 @@ export const GeneratedCodeInfo_Annotation = { } else { obj.path = []; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = omitDefault(message.sourceFile); + obj.begin = omitDefault(message.begin); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts index 72517caaf8..25db75ce49 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -100,7 +100,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = message.fileName; + obj.file_name = omitDefault(message.fileName); return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/struct.ts b/__fixtures__/v-next/outputv2/google/protobuf/struct.ts index dac6458ba6..4acaa7d5f5 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/struct.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -287,7 +287,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -556,10 +556,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = omitDefault(message.nullValue); + obj.number_value = omitDefault(message.numberValue); + obj.string_value = omitDefault(message.stringValue); + obj.bool_value = omitDefault(message.boolValue); obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/google/protobuf/type.ts b/__fixtures__/v-next/outputv2/google/protobuf/type.ts index d71ea3185b..92e21b64ba 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/type.ts @@ -1,7 +1,7 @@ import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { Any, AnyAmino, AnySDKType } from "./any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -650,7 +650,7 @@ export const Type = { }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { @@ -667,7 +667,7 @@ export const Type = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -873,20 +873,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = message.kind; - obj.cardinality = message.cardinality; - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = omitDefault(message.kind); + obj.cardinality = omitDefault(message.cardinality); + obj.number = omitDefault(message.number); + obj.name = omitDefault(message.name); + obj.type_url = omitDefault(message.typeUrl); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.packed = omitDefault(message.packed); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = omitDefault(message.jsonName); + obj.default_value = omitDefault(message.defaultValue); return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -1037,7 +1037,7 @@ export const Enum = { }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { @@ -1049,7 +1049,7 @@ export const Enum = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1164,8 +1164,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { @@ -1266,7 +1266,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts index e4e804cb03..c16e32f7c3 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -369,7 +369,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -450,7 +450,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -533,7 +533,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -616,7 +616,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -697,7 +697,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -778,7 +778,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -859,7 +859,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -940,7 +940,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts index a05d5f6e67..3329a657a7 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts @@ -3,7 +3,7 @@ import { Timestamp } from "../../protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { Any, AnyAmino, AnySDKType } from "../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "google.rpc.context"; /** * This message defines the standard attribute vocabulary for Google APIs. @@ -1284,8 +1284,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1452,16 +1452,16 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.ip = omitDefault(message.ip); + obj.port = omitDefault(message.port); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = omitDefault(message.principal); + obj.region_code = omitDefault(message.regionCode); return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1581,10 +1581,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = omitDefault(message.service); + obj.operation = omitDefault(message.operation); + obj.protocol = omitDefault(message.protocol); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1735,13 +1735,13 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = omitDefault(message.principal); if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { obj.audiences = []; } - obj.presenter = message.presenter; + obj.presenter = omitDefault(message.presenter); obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); @@ -1840,8 +1840,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -2092,7 +2092,7 @@ export const AttributeContext_Request = { host: object.host, scheme: object.scheme, query: object.query, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, size: BigInt(object.size), protocol: object.protocol, reason: object.reason, @@ -2101,22 +2101,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = omitDefault(message.id); + obj.method = omitDefault(message.method); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = omitDefault(message.path); + obj.host = omitDefault(message.host); + obj.scheme = omitDefault(message.scheme); + obj.query = omitDefault(message.query); obj.time = message.time; - obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.size = omitDefault(message.size); + obj.protocol = omitDefault(message.protocol); + obj.reason = omitDefault(message.reason); obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -2210,8 +2210,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2376,14 +2376,14 @@ export const AttributeContext_Response = { acc[key] = String(value); return acc; }, {}) : {}, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, backendLatency: object?.backend_latency ? Duration.fromAmino(object.backend_latency) : undefined }; }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = omitDefault(message.code); + obj.size = omitDefault(message.size); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { @@ -2484,8 +2484,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2572,8 +2572,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2858,37 +2858,37 @@ export const AttributeContext_Resource = { return acc; }, {}) : {}, displayName: object.display_name, - createTime: object.create_time, - updateTime: object.update_time, - deleteTime: object.delete_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, + deleteTime: object?.delete_time ? Timestamp.fromAmino(object.delete_time) : undefined, etag: object.etag, location: object.location }; }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = omitDefault(message.service); + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = omitDefault(message.uid); obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); obj.create_time = message.createTime; obj.update_time = message.updateTime; obj.delete_time = message.deleteTime; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = omitDefault(message.etag); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputv2/google/rpc/error_details.ts b/__fixtures__/v-next/outputv2/google/rpc/error_details.ts index c9e98359cd..4f994ea795 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -949,7 +949,7 @@ export const DebugInfo = { } else { obj.stack_entries = []; } - obj.detail = message.detail; + obj.detail = omitDefault(message.detail); return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -1136,8 +1136,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = message.subject; - obj.description = message.description; + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -1230,8 +1230,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1370,8 +1370,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.domain = message.domain; + obj.reason = omitDefault(message.reason); + obj.domain = omitDefault(message.domain); obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1577,9 +1577,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = message.type; - obj.subject = message.subject; - obj.description = message.description; + obj.type = omitDefault(message.type); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1766,8 +1766,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = message.field; - obj.description = message.description; + obj.field = omitDefault(message.field); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1861,8 +1861,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = message.requestId; - obj.serving_data = message.servingData; + obj.request_id = omitDefault(message.requestId); + obj.serving_data = omitDefault(message.servingData); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1982,10 +1982,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = message.resourceType; - obj.resource_name = message.resourceName; - obj.owner = message.owner; - obj.description = message.description; + obj.resource_type = omitDefault(message.resourceType); + obj.resource_name = omitDefault(message.resourceName); + obj.owner = omitDefault(message.owner); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -2172,8 +2172,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = message.description; - obj.url = message.url; + obj.description = omitDefault(message.description); + obj.url = omitDefault(message.url); return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -2267,8 +2267,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = message.locale; - obj.message = message.message; + obj.locale = omitDefault(message.locale); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputv2/google/rpc/status.ts b/__fixtures__/v-next/outputv2/google/rpc/status.ts index 9ebaa314c1..436fbb7f79 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -168,8 +168,8 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = message.code; - obj.message = message.message; + obj.code = omitDefault(message.code); + obj.message = omitDefault(message.message); if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/helpers.ts b/__fixtures__/v-next/outputv2/helpers.ts index f92d2b935a..b18c95df6c 100644 --- a/__fixtures__/v-next/outputv2/helpers.ts +++ b/__fixtures__/v-next/outputv2/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -255,3 +261,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts index d3bcc37b40..4659b27d0c 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -127,7 +127,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts index 1136520878..9639e31b05 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -231,7 +231,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts index 344c6550b5..6d253263ab 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -173,8 +173,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = message.path; - obj.base_denom = message.baseDenom; + obj.path = omitDefault(message.path); + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -275,8 +275,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = message.sendEnabled; - obj.receive_enabled = message.receiveEnabled; + obj.send_enabled = omitDefault(message.sendEnabled); + obj.receive_enabled = omitDefault(message.receiveEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts index e163ddffbd..6cbbd497e5 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -240,13 +240,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts index 02f810af50..ca9b84d04a 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -152,10 +152,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts index 244c9bad9c..a56b60a7bb 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts @@ -1,6 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: @@ -555,15 +555,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -739,17 +739,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = omitDefault(message.version); + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -850,8 +850,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -1036,14 +1036,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.sequence = omitDefault(message.sequence); + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); + obj.destination_port = omitDefault(message.destinationPort); + obj.destination_channel = omitDefault(message.destinationChannel); obj.data = message.data; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1172,9 +1172,9 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); obj.data = message.data; return obj; }, @@ -1277,7 +1277,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts index 443e1d4df4..b9c4b713d1 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -327,7 +327,7 @@ export const GenesisState = { } else { obj.ack_sequences = []; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = omitDefault(message.nextChannelSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -443,9 +443,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts index 5610c3c9f0..83ee8de8d8 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts @@ -3,7 +3,7 @@ import { Channel, ChannelAmino, ChannelSDKType, IdentifiedChannel, IdentifiedCha import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** QueryChannelRequest is the request type for the Query/Channel RPC method */ export interface QueryChannelRequest { @@ -1103,8 +1103,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1549,7 +1549,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = omitDefault(message.connection); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1783,8 +1783,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -2035,10 +2035,10 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -2170,7 +2170,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2288,9 +2288,9 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2524,8 +2524,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2774,9 +2774,9 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2892,7 +2892,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = omitDefault(message.received); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -3010,9 +3010,9 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -3276,8 +3276,8 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); @@ -3546,8 +3546,8 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { @@ -3808,8 +3808,8 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { @@ -4040,8 +4040,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { @@ -4159,7 +4159,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = omitDefault(message.nextSequenceReceive); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts index 3417e57c78..ffb8179836 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts @@ -1,7 +1,7 @@ import { Channel, ChannelAmino, ChannelSDKType, Packet, PacketAmino, PacketSDKType } from "./channel"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It @@ -634,9 +634,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -877,13 +877,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = omitDefault(message.portId); + obj.previous_channel_id = omitDefault(message.previousChannelId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -1122,13 +1122,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.counterparty_channel_id = omitDefault(message.counterpartyChannelId); + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_try = message.proofTry; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1341,11 +1341,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1530,9 +1530,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1745,11 +1745,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1954,7 +1954,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -2174,8 +2174,8 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2409,8 +2409,8 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived; obj.proof_close = message.proofClose; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2629,7 +2629,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement; obj.proof_acked = message.proofAcked; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts index 48e2267af9..c4883ac7fc 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -387,7 +387,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -603,7 +603,7 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { @@ -736,10 +736,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.subject_client_id = omitDefault(message.subjectClientId); + obj.substitute_client_id = omitDefault(message.substituteClientId); return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -871,8 +871,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -979,8 +979,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts index a4c0962c7f..09367067fd 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -287,8 +287,8 @@ export const GenesisState = { obj.clients_metadata = []; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.create_localhost = omitDefault(message.createLocalhost); + obj.next_client_sequence = omitDefault(message.nextClientSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -499,7 +499,7 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts index 39bd98dcc1..a8a44bd0d1 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -599,7 +599,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -1056,10 +1056,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.client_id = omitDefault(message.clientId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); + obj.latest_height = omitDefault(message.latestHeight); return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1282,7 +1282,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1487,7 +1487,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1575,7 +1575,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts index 0ffe67d995..366a54c3b7 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** MsgCreateClient defines a message to create an IBC client */ export interface MsgCreateClient { @@ -344,7 +344,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -531,9 +531,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -761,12 +761,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -953,9 +953,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts index 7b90f030f2..67a5e342c5 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts @@ -1,6 +1,6 @@ import { MerklePrefix, MerklePrefixAmino, MerklePrefixSDKType } from "../../commitment/v1/commitment"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * State defines if a connection is in one of the following states: @@ -476,15 +476,15 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -649,16 +649,16 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = omitDefault(message.id); + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -774,8 +774,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = omitDefault(message.clientId); + obj.connection_id = omitDefault(message.connectionId); obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -985,7 +985,7 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.paths) { obj.paths = message.paths.map(e => e); } else { @@ -1099,7 +1099,7 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); if (message.features) { obj.features = message.features.map(e => e); } else { @@ -1194,7 +1194,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = omitDefault(message.maxExpectedTimePerBlock); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts index b897a45494..569b53c618 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -165,7 +165,7 @@ export const GenesisState = { } else { obj.client_connection_paths = []; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts index 8b6560ae20..9016e79270 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts @@ -3,7 +3,7 @@ import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType, IdentifiedConn import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -440,7 +440,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -870,7 +870,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -1088,7 +1088,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1326,9 +1326,9 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.connection_id = omitDefault(message.connectionId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { @@ -1460,7 +1460,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts index 48c71de72a..2f6667d883 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts @@ -2,7 +2,7 @@ import { Counterparty, CounterpartyAmino, CounterpartySDKType, Version, VersionA import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to @@ -430,11 +430,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.delay_period = omitDefault(message.delayPeriod); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -754,11 +754,11 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = omitDefault(message.clientId); + obj.previous_connection_id = omitDefault(message.previousConnectionId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { @@ -769,7 +769,7 @@ export const MsgConnectionOpenTry = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -1053,8 +1053,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = omitDefault(message.connectionId); + obj.counterparty_connection_id = omitDefault(message.counterpartyConnectionId); obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1062,7 +1062,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1262,10 +1262,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts index 17f410d138..acb10f9c6b 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts @@ -1,6 +1,6 @@ import { Order, Counterparty, CounterpartyAmino, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.port.v1"; /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ export interface QueryAppVersionRequest { @@ -188,11 +188,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = message.ordering; + obj.port_id = omitDefault(message.portId); + obj.connection_id = omitDefault(message.connectionId); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = omitDefault(message.proposedVersion); return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -293,8 +293,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = omitDefault(message.portId); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts index c1ebda88f8..706faf9d8d 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -116,7 +116,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts index 64cb0ef19e..49d8a4861e 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; /** * DataType defines the type of solo machine proof being created. This is done @@ -755,10 +755,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.frozen_sequence = omitDefault(message.frozenSequence); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -877,8 +877,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -1024,11 +1024,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1161,8 +1161,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1294,9 +1294,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1400,7 +1400,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1544,10 +1544,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1652,7 +1652,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2464,7 +2464,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts index 39d22ccc3e..e354dc8f7d 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; /** * DataType defines the type of solo machine proof being created. This is done @@ -753,10 +753,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.sequence = omitDefault(message.sequence); + obj.is_frozen = omitDefault(message.isFrozen); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -875,8 +875,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -1022,11 +1022,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1159,8 +1159,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1292,9 +1292,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1398,7 +1398,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1542,10 +1542,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1650,7 +1650,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2462,7 +2462,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts index ad9fbe5626..10067f865f 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts @@ -6,7 +6,7 @@ import { MerkleRoot, MerkleRootAmino, MerkleRootSDKType } from "../../../core/co import { SignedHeader, SignedHeaderAmino, SignedHeaderSDKType } from "../../../../tendermint/types/types"; import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; /** * ClientState from Tendermint tracks the current validator set, latest height, @@ -511,7 +511,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -528,8 +528,8 @@ export const ClientState = { } else { obj.upgrade_path = []; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); + obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -638,7 +638,7 @@ export const ConsensusState = { }, fromAmino(object: ConsensusStateAmino): ConsensusState { return { - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, root: object?.root ? MerkleRoot.fromAmino(object.root) : undefined, nextValidatorsHash: object.next_validators_hash }; @@ -765,7 +765,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; @@ -1010,8 +1010,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = omitDefault(message.numerator); + obj.denominator = omitDefault(message.denominator); return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts index bfa8c35d21..e648c7c89a 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -198,7 +198,7 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts index f9b3eb9030..697a954eda 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** Params defines the claim module's parameters. */ export interface Params { @@ -132,7 +132,7 @@ export const Params = { }, fromAmino(object: ParamsAmino): Params { return { - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimDenom: object.claim_denom @@ -143,7 +143,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = omitDefault(message.claimDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts index d3586243cb..0a51d6347f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Action, ClaimRecord, ClaimRecordAmino, ClaimRecordSDKType, actionFromJS import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryModuleAccountBalanceRequest {} @@ -576,7 +576,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -767,8 +767,8 @@ export const QueryClaimableForActionRequest = { }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = message.action; + obj.address = omitDefault(message.address); + obj.action = omitDefault(message.action); return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -956,7 +956,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts index 13921f38c6..ce54b6512d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * EpochInfo is a struct that describes the data going into @@ -297,23 +297,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts index 11faf2b20d..e48539ca14 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { @@ -298,7 +298,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -388,7 +388,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts index 52b73dc077..c9ab33fbd4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp } from "../../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -380,7 +380,7 @@ export const SmoothWeightChangeParams = { }, fromAmino(object: SmoothWeightChangeParamsAmino): SmoothWeightChangeParams { return { - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, initialPoolWeights: Array.isArray(object?.initial_pool_weights) ? object.initial_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [], targetPoolWeights: Array.isArray(object?.target_pool_weights) ? object.target_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [] @@ -515,8 +515,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -621,7 +621,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -802,17 +802,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts index 8da45dc761..0d570e4728 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType, PoolAsset, PoolAssetAmino, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -163,14 +163,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -260,7 +260,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index fa7238955d..823c1df540 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -188,8 +188,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -400,10 +400,10 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -415,7 +415,7 @@ export const Pool = { } else { obj.scaling_factors = []; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts index 4a2be6739d..1296d86f9f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -259,7 +259,7 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -271,8 +271,8 @@ export const MsgCreateStableswapPool = { } else { obj.scaling_factors = []; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -362,7 +362,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -495,8 +495,8 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts index 12119c6488..d982495f2a 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts @@ -7,7 +7,7 @@ import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stableswap_pool"; import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -266,7 +266,7 @@ export const GenesisState = { } else { obj.pools = []; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = omitDefault(message.nextPoolNumber); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts index 5c8512f016..d3561e878f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts @@ -9,7 +9,7 @@ import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stableswap_pool"; import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -712,7 +712,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -1169,7 +1169,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = omitDefault(message.numPools); return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1259,7 +1259,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1347,7 +1347,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1458,7 +1458,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1572,7 +1572,7 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1680,8 +1680,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1871,7 +1871,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -2051,7 +2051,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2241,7 +2241,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2442,7 +2442,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2561,7 +2561,7 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { } else { obj.tokens_out = []; } - obj.shares_out = message.sharesOut; + obj.shares_out = omitDefault(message.sharesOut); return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2677,9 +2677,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2808,7 +2808,7 @@ export const QueryPoolsWithFilterRequest = { } else { obj.min_liquidity = []; } - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3013,7 +3013,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -3150,9 +3150,9 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { @@ -3245,7 +3245,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3382,14 +3382,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_out = message.tokenOut; + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3477,7 +3477,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts index 96ed95dc10..4b44820295 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -549,9 +549,9 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -665,7 +665,7 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -807,9 +807,9 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1017,8 +1017,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -1155,14 +1155,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { obj.routes = []; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1250,7 +1250,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1353,8 +1353,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1491,13 +1491,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1586,7 +1586,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1717,10 +1717,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1808,7 +1808,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1950,11 +1950,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -2042,7 +2042,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2184,11 +2184,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.share_in_amount = omitDefault(message.shareInAmount); + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2276,7 +2276,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2407,10 +2407,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2498,7 +2498,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts index 69dcd3bf00..f9ae9a6966 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -158,9 +158,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -248,7 +248,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts index facadcc6db..889a5991d0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -84,7 +84,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts index b655e26649..dc862fae38 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * Gauge is an object that stores and distributes yields to recipients who @@ -299,7 +299,7 @@ export const Gauge = { isPerpetual: object.is_perpetual, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over), filledEpochs: BigInt(object.filled_epochs), distributedCoins: Array.isArray(object?.distributed_coins) ? object.distributed_coins.map((e: any) => Coin.fromAmino(e)) : [] @@ -307,8 +307,8 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.id = omitDefault(message.id); + obj.is_perpetual = omitDefault(message.isPerpetual); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -316,8 +316,8 @@ export const Gauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); + obj.filled_epochs = omitDefault(message.filledEpochs); if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts index d76c3b5572..fe0bac513b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -195,7 +195,7 @@ export const GenesisState = { } else { obj.lockable_durations = []; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = omitDefault(message.lastGaugeId); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts index 3bb0dc167f..bcb39d75e8 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -92,7 +92,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = message.distrEpochIdentifier; + obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts index 30a658560d..4ea15e20d2 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestProtoMsg { @@ -624,7 +624,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1229,7 +1229,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1655,7 +1655,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1905,13 +1905,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { obj.lock_ids = []; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = omitDefault(message.endEpoch); return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts index 5db8aad821..1cbca622db 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts @@ -2,7 +2,7 @@ import { QueryCondition, QueryConditionAmino, QueryConditionSDKType } from "../l import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** MsgCreateGauge creates a gague to distribute rewards to users */ export interface MsgCreateGauge { @@ -263,14 +263,14 @@ export const MsgCreateGauge = { owner: object.owner, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over) }; }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = omitDefault(message.isPerpetual); + obj.owner = omitDefault(message.owner); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -278,7 +278,7 @@ export const MsgCreateGauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -473,8 +473,8 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.gauge_id = omitDefault(message.gaugeId); if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts index 21563d058b..a793e81614 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -135,7 +135,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = omitDefault(message.lastLockId); if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts index 30339738a7..a077e118e4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Timestamp } from "../../google/protobuf/timestamp"; import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** * LockQueryType defines the type of the lock query that can @@ -390,14 +390,14 @@ export const PeriodLock = { ID: BigInt(object.ID), owner: object.owner, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [] }; }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.ID = omitDefault(message.ID); + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime; if (message.coins) { @@ -528,13 +528,13 @@ export const QueryCondition = { lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : -1, denom: object.denom, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = message.lockQueryType; - obj.denom = message.denom; + obj.lock_query_type = omitDefault(message.lockQueryType); + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp; return obj; @@ -661,14 +661,14 @@ export const SyntheticLock = { return { underlyingLockId: BigInt(object.underlying_lock_id), synthDenom: object.synth_denom, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined }; }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.underlying_lock_id = omitDefault(message.underlyingLockId); + obj.synth_denom = omitDefault(message.synthDenom); obj.end_time = message.endTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts index abb1bef4c7..4d0a9d5a79 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts @@ -4,7 +4,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface ModuleBalanceRequest {} export interface ModuleBalanceRequestProtoMsg { @@ -1004,7 +1004,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -1192,7 +1192,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1380,7 +1380,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1576,12 +1576,12 @@ export const AccountLockedPastTimeRequest = { fromAmino(object: AccountLockedPastTimeRequestAmino): AccountLockedPastTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1778,12 +1778,12 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { fromAmino(object: AccountLockedPastTimeNotUnlockingOnlyRequestAmino): AccountLockedPastTimeNotUnlockingOnlyRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1980,12 +1980,12 @@ export const AccountUnlockedBeforeTimeRequest = { fromAmino(object: AccountUnlockedBeforeTimeRequestAmino): AccountUnlockedBeforeTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -2194,15 +2194,15 @@ export const AccountLockedPastTimeDenomRequest = { fromAmino(object: AccountLockedPastTimeDenomRequestAmino): AccountLockedPastTimeDenomRequest { return { owner: object.owner, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, denom: object.denom }; }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2405,7 +2405,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2494,7 +2494,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2584,7 +2584,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2764,7 +2764,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { @@ -2967,7 +2967,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3171,7 +3171,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3375,7 +3375,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3592,9 +3592,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts index 12bf79f736..3a836c52f4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -333,7 +333,7 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -429,7 +429,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -517,7 +517,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -741,8 +741,8 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -835,7 +835,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -953,8 +953,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1043,7 +1043,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1167,8 +1167,8 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1261,7 +1261,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts index c022324276..d604ceb8a9 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -137,7 +137,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts index 1a79564c3a..243060a92f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -288,7 +288,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -389,8 +389,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = omitDefault(message.address); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -517,10 +517,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -713,18 +713,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.mint_denom = omitDefault(message.mintDenom); + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); + obj.reduction_factor = padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { obj.weighted_developer_rewards_receivers = []; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts index 3a5e99a3e2..ceac4cf532 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordAmino, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -204,8 +204,8 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -333,8 +333,8 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts index e19ee074e7..5371b73575 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -191,7 +191,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = omitDefault(message.mintedDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -400,7 +400,7 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -508,8 +508,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.gauge_id = omitDefault(message.gaugeId); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -629,8 +629,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts index 4d8b3b75da..1dc672aac9 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { DistrInfo, DistrInfoAmino, DistrInfoSDKType, Params, ParamsAmino, ParamsSDKType } from "./incentives"; import { Gauge, GaugeAmino, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -289,7 +289,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -507,9 +507,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -1193,9 +1193,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts index 3ff680ab3f..059eeea8bf 100644 --- a/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.store.v1beta1"; export interface Node { children: Child[]; @@ -232,7 +232,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index; - obj.accumulation = message.accumulation; + obj.accumulation = omitDefault(message.accumulation); return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts index 4fa2b7908c..7e1f1dfd78 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -97,7 +97,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor; + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts index f34735df75..38c01666f5 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts @@ -5,7 +5,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "../lockup/lock"; import { DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface QueryParamsRequest {} export interface QueryParamsRequestProtoMsg { @@ -807,7 +807,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -895,7 +895,7 @@ export const AssetTypeResponse = { }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = message.assetType; + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -1154,7 +1154,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1373,10 +1373,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1672,7 +1672,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { @@ -1850,7 +1850,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -2064,9 +2064,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = omitDefault(message.valAddr); + obj.amount_sfsd = omitDefault(message.amountSfsd); + obj.osmo_equivalent = omitDefault(message.osmoEquivalent); return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -2225,7 +2225,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = omitDefault(message.totalDelegations); return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2339,9 +2339,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2529,7 +2529,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2772,8 +2772,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -3026,8 +3026,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -3228,8 +3228,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3417,7 +3417,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts index ac67db0457..71fae4570e 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -330,8 +330,8 @@ export const SuperfluidAsset = { }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = message.assetType; + obj.denom = omitDefault(message.denom); + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -447,9 +447,9 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -565,9 +565,9 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.epoch_number = omitDefault(message.epochNumber); + obj.denom = omitDefault(message.denom); + obj.multiplier = padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -698,8 +698,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -804,8 +804,8 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.lock_id = omitDefault(message.lockId); + obj.intermediary_account = omitDefault(message.intermediaryAccount); return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts index 0dc6c5d9d5..1b21c441a6 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -311,9 +311,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.val_addr = message.valAddr; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -487,8 +487,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -662,8 +662,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -856,13 +856,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.coins = []; } - obj.val_addr = message.valAddr; + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -952,7 +952,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1055,8 +1055,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts index 917441ad92..656e8a97ca 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -214,8 +214,8 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { @@ -343,8 +343,8 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { @@ -494,14 +494,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { obj.ids = []; } - obj.is_overwrite = message.isOverwrite; + obj.is_overwrite = omitDefault(message.isOverwrite); return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index bf22119441..9246542440 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -98,7 +98,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts index aac7ebb65a..4a0c8b611b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -257,7 +257,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts index af6c897598..1eff3e874c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -379,7 +379,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -557,7 +557,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts index eca791e594..81b465b0d4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -362,8 +362,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = omitDefault(message.sender); + obj.subdenom = omitDefault(message.subdenom); return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -451,7 +451,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = omitDefault(message.newTokenDenom); return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -554,7 +554,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -729,7 +729,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -915,9 +915,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = omitDefault(message.sender); + obj.denom = omitDefault(message.denom); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -1091,7 +1091,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts index 8a3a6c2867..d307a607a9 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordAmino, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -131,7 +131,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts index 24600b3598..bb11f64578 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -232,15 +232,15 @@ export const ArithmeticTwapRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time, - endTime: object?.end_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined }; }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; obj.end_time = message.endTime; return obj; @@ -330,7 +330,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -454,14 +454,14 @@ export const ArithmeticTwapToNowRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; return obj; }, @@ -550,7 +550,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts index 6661a3c439..e4bfdecc37 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -280,25 +280,25 @@ export const TwapRecord = { asset0Denom: object.asset0_denom, asset1Denom: object.asset1_denom, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, p0LastSpotPrice: object.p0_last_spot_price, p1LastSpotPrice: object.p1_last_spot_price, p0ArithmeticTwapAccumulator: object.p0_arithmetic_twap_accumulator, p1ArithmeticTwapAccumulator: object.p1_arithmetic_twap_accumulator, - lastErrorTime: object.last_error_time + lastErrorTime: object?.last_error_time ? Timestamp.fromAmino(object.last_error_time) : undefined }; }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.asset0_denom = omitDefault(message.asset0Denom); + obj.asset1_denom = omitDefault(message.asset1Denom); + obj.height = message.height; obj.time = message.time; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts index 0a1c9bac0a..ef94370948 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -117,8 +117,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts index 96d72f1f93..a3d2497a46 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -109,7 +109,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = message.basedenom; + obj.basedenom = omitDefault(message.basedenom); if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts index 082f5d4012..63a26d4bf8 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -140,8 +140,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts index 9ba0451cf8..8509af65a5 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -388,7 +388,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -491,8 +491,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; - obj.spot_price = message.spotPrice; + obj.poolID = omitDefault(message.poolID); + obj.spot_price = padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -580,7 +580,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -670,7 +670,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -829,7 +829,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = message.baseDenom; + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts index 2889275eec..acaff04fb8 100644 --- a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts @@ -4,7 +4,7 @@ import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.abci"; export enum CheckTxType { NEW = 0, @@ -1755,7 +1755,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1930,9 +1930,9 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.version = omitDefault(message.version); + obj.block_version = omitDefault(message.blockVersion); + obj.p2p_version = omitDefault(message.p2pVersion); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -2026,8 +2026,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -2175,7 +2175,7 @@ export const RequestInitChain = { }, fromAmino(object: RequestInitChainAmino): RequestInitChain { return { - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, chainId: object.chain_id, consensusParams: object?.consensus_params ? ConsensusParams.fromAmino(object.consensus_params) : undefined, validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromAmino(e)) : [], @@ -2186,7 +2186,7 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); @@ -2194,7 +2194,7 @@ export const RequestInitChain = { obj.validators = []; } obj.app_state_bytes = message.appStateBytes; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = omitDefault(message.initialHeight); return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -2317,9 +2317,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data; - obj.path = message.path; - obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.path = omitDefault(message.path); + obj.height = omitDefault(message.height); + obj.prove = omitDefault(message.prove); return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2553,7 +2553,7 @@ export const RequestCheckTx = { toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx; - obj.type = message.type; + obj.type = omitDefault(message.type); return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2717,7 +2717,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -3051,9 +3051,9 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunk = omitDefault(message.chunk); return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -3160,9 +3160,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.chunk = message.chunk; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3566,7 +3566,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3647,7 +3647,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3848,10 +3848,10 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.data = omitDefault(message.data); + obj.version = omitDefault(message.version); + obj.app_version = omitDefault(message.appVersion); + obj.last_block_height = omitDefault(message.lastBlockHeight); obj.last_block_app_hash = message.lastBlockAppHash; return obj; }, @@ -3959,9 +3959,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -4275,15 +4275,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.index = omitDefault(message.index); obj.key = message.key; obj.value = message.value; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.height = omitDefault(message.height); + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4560,18 +4560,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4755,18 +4755,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4998,7 +4998,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = omitDefault(message.retainHeight); return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -5172,7 +5172,7 @@ export const ResponseOfferSnapshot = { }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -5385,7 +5385,7 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { @@ -5624,8 +5624,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -5727,7 +5727,7 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = omitDefault(message.round); if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { @@ -5834,7 +5834,7 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { @@ -5948,7 +5948,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.index = message.index; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -6072,8 +6072,8 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.height = omitDefault(message.height); + obj.index = omitDefault(message.index); obj.tx = message.tx; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -6172,7 +6172,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -6271,7 +6271,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6368,7 +6368,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = omitDefault(message.signedLastBlock); return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6501,17 +6501,17 @@ export const Evidence = { type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: object?.validator ? Validator.fromAmino(object.validator) : undefined, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, totalVotingPower: BigInt(object.total_voting_power) }; }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6646,9 +6646,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata; return obj; diff --git a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts index d7fe98e6c5..409b91374a 100644 --- a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.crypto"; export interface Proof { total: bigint; @@ -245,8 +245,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = omitDefault(message.total); + obj.index = omitDefault(message.index); obj.leaf_hash = message.leafHash; if (message.aunts) { obj.aunts = message.aunts.map(e => e); @@ -456,9 +456,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = omitDefault(message.key); + obj.input = omitDefault(message.input); + obj.output = omitDefault(message.output); return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -565,7 +565,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.key = message.key; obj.data = message.data; return obj; diff --git a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts index d876b85f9f..3563ab2584 100644 --- a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -115,7 +115,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = omitDefault(message.bits); if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts index 62b251eb24..0a205fd64f 100644 --- a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts @@ -1,6 +1,6 @@ import { Timestamp } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.p2p"; export interface ProtocolVersion { p2p: bigint; @@ -226,9 +226,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = omitDefault(message.p2p); + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { @@ -405,12 +405,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = omitDefault(message.nodeId); + obj.listen_addr = omitDefault(message.listenAddr); + obj.network = omitDefault(message.network); + obj.version = omitDefault(message.version); obj.channels = message.channels; - obj.moniker = message.moniker; + obj.moniker = omitDefault(message.moniker); obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -505,8 +505,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = omitDefault(message.txIndex); + obj.rpc_address = omitDefault(message.rpcAddress); return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -616,12 +616,12 @@ export const PeerInfo = { return { id: object.id, addressInfo: Array.isArray(object?.address_info) ? object.address_info.map((e: any) => PeerAddressInfo.fromAmino(e)) : [], - lastConnected: object.last_connected + lastConnected: object?.last_connected ? Timestamp.fromAmino(object.last_connected) : undefined }; }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { @@ -740,17 +740,17 @@ export const PeerAddressInfo = { fromAmino(object: PeerAddressInfoAmino): PeerAddressInfo { return { address: object.address, - lastDialSuccess: object.last_dial_success, - lastDialFailure: object.last_dial_failure, + lastDialSuccess: object?.last_dial_success ? Timestamp.fromAmino(object.last_dial_success) : undefined, + lastDialFailure: object?.last_dial_failure ? Timestamp.fromAmino(object.last_dial_failure) : undefined, dialFailures: object.dial_failures }; }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.last_dial_success = message.lastDialSuccess; obj.last_dial_failure = message.lastDialFailure; - obj.dial_failures = message.dialFailures; + obj.dial_failures = omitDefault(message.dialFailures); return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts index 7c68bca487..544c3a1498 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts @@ -2,7 +2,7 @@ import { Vote, VoteAmino, VoteSDKType, LightBlock, LightBlockAmino, LightBlockSD import { Timestamp } from "../../google/protobuf/timestamp"; import { Validator, ValidatorAmino, ValidatorSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; @@ -321,15 +321,15 @@ export const DuplicateVoteEvidence = { voteB: object?.vote_b ? Vote.fromAmino(object.vote_b) : undefined, totalVotingPower: BigInt(object.total_voting_power), validatorPower: BigInt(object.validator_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.validator_power = omitDefault(message.validatorPower); obj.timestamp = message.timestamp; return obj; }, @@ -472,19 +472,19 @@ export const LightClientAttackEvidence = { commonHeight: BigInt(object.common_height), byzantineValidators: Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Validator.fromAmino(e)) : [], totalVotingPower: BigInt(object.total_voting_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = omitDefault(message.commonHeight); if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = []; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); obj.timestamp = message.timestamp; return obj; }, diff --git a/__fixtures__/v-next/outputv2/tendermint/types/params.ts b/__fixtures__/v-next/outputv2/tendermint/types/params.ts index 914ccc4085..9e31b4ee23 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -465,9 +465,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); + obj.time_iota_ms = omitDefault(message.timeIotaMs); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -580,9 +580,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -758,7 +758,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = omitDefault(message.appVersion); return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -856,8 +856,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = omitDefault(message.blockMaxBytes); + obj.block_max_gas = omitDefault(message.blockMaxGas); return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/types.ts b/__fixtures__/v-next/outputv2/tendermint/types/types.ts index 69f87e9984..76a38f6ed4 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/types.ts @@ -3,7 +3,7 @@ import { Consensus, ConsensusAmino, ConsensusSDKType } from "../version/types"; import { Timestamp } from "../../google/protobuf/timestamp"; import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -585,7 +585,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = omitDefault(message.total); obj.hash = message.hash; return obj; }, @@ -695,7 +695,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.bytes = message.bytes; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -1035,7 +1035,7 @@ export const Header = { version: object?.version ? Consensus.fromAmino(object.version) : undefined, chainId: object.chain_id, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, lastBlockId: object?.last_block_id ? BlockID.fromAmino(object.last_block_id) : undefined, lastCommitHash: object.last_commit_hash, dataHash: object.data_hash, @@ -1051,8 +1051,8 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.height = omitDefault(message.height); obj.time = message.time; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash; @@ -1324,7 +1324,7 @@ export const Vote = { height: BigInt(object.height), round: object.round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, validatorAddress: object.validator_address, validatorIndex: object.validator_index, signature: object.signature @@ -1332,13 +1332,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.validator_address = message.validatorAddress; - obj.validator_index = message.validatorIndex; + obj.validator_index = omitDefault(message.validatorIndex); obj.signature = message.signature; return obj; }, @@ -1471,8 +1471,8 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); @@ -1592,13 +1592,13 @@ export const CommitSig = { return { blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : -1, validatorAddress: object.validator_address, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = message.blockIdFlag; + obj.block_id_flag = omitDefault(message.blockIdFlag); obj.validator_address = message.validatorAddress; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -1758,16 +1758,16 @@ export const Proposal = { round: object.round, polRound: object.pol_round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); + obj.pol_round = omitDefault(message.polRound); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -2097,9 +2097,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = omitDefault(message.blockSize); obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = omitDefault(message.numTxs); return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts index 331625671f..6028292cf3 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -177,7 +177,7 @@ export const ValidatorSet = { obj.validators = []; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -305,8 +305,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -405,7 +405,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv2/tendermint/version/types.ts b/__fixtures__/v-next/outputv2/tendermint/version/types.ts index 15a6e03855..df15af4b1a 100644 --- a/__fixtures__/v-next/outputv2/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -148,8 +148,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; - obj.software = message.software; + obj.protocol = omitDefault(message.protocol); + obj.software = omitDefault(message.software); return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -247,8 +247,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts index 464ff93dfe..db25d04767 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -322,8 +322,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -502,7 +502,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -597,8 +597,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -694,7 +694,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = omitDefault(message.auditor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts index 0ac064e272..d5372b0b1a 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -168,8 +168,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts index 8f01b44978..5c12f81802 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -118,7 +118,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts index d659b8c3a2..2f1a92f3ee 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -168,8 +168,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts index 84c40f7c7d..ce6fa21203 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -141,7 +141,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); obj.sequence_number = message.sequenceNumber; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts index 0aabd73d86..b343bb8120 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts @@ -3,7 +3,7 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -1057,7 +1057,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1184,7 +1184,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -1294,7 +1294,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts index db543e0f2d..4f5224f8fc 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirement import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -801,7 +801,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, @@ -1054,7 +1054,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts index 04dafb7e03..7bd11ffa47 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -199,7 +199,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -326,7 +326,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -436,7 +436,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts index e7af877ac0..546168571a 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -198,7 +198,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts index fa0766e6dc..ebaf29d633 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts @@ -118,7 +118,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts index 9dab0d0044..72135d5ca9 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -232,10 +232,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -493,11 +493,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts index 82f70526f6..583f346072 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts @@ -443,7 +443,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts index 899ec3ab0a..2fe3a4821c 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -232,10 +232,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -493,11 +493,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts index f402ec4856..5d7b67e7ba 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts @@ -495,7 +495,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; obj.depositor = message.depositor; obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts index e84c8105eb..c103ff8007 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -134,9 +134,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor; - obj.initial_inflation = message.initialInflation; - obj.variance = message.variance; + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); + obj.initial_inflation = padDecimal(message.initialInflation); + obj.variance = padDecimal(message.variance); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts index 958cd6f747..aff68fd9ee 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDAmino, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -698,7 +698,7 @@ export const BidID = { toAmino(message: BidID): BidIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -830,7 +830,7 @@ export const Bid = { obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -979,7 +979,7 @@ export const BidFilters = { toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts index f7ae60dc62..d5f9e29353 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDAmino, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -370,7 +370,7 @@ export const LeaseID = { toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -517,8 +517,8 @@ export const Lease = { obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); + obj.closed_on = omitDefault(message.closedOn); return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -667,7 +667,7 @@ export const LeaseFilters = { toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts index 4fb8ab7620..7738d42f0d 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -245,7 +245,7 @@ export const OrderID = { toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; return obj; @@ -376,7 +376,7 @@ export const Order = { obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; obj.state = message.state; obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -512,7 +512,7 @@ export const OrderFilters = { toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.state = message.state; diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts index d6707bd716..acdfbdbf68 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -340,7 +340,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputv3/confio/proofs.ts b/__fixtures__/v-next/outputv3/confio/proofs.ts index f4fe2a52a0..40132e0083 100644 --- a/__fixtures__/v-next/outputv3/confio/proofs.ts +++ b/__fixtures__/v-next/outputv3/confio/proofs.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "ics23"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ @@ -1249,10 +1249,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = message.hash; - obj.prehash_key = message.prehashKey; - obj.prehash_value = message.prehashValue; - obj.length = message.length; + obj.hash = omitDefault(message.hash); + obj.prehash_key = omitDefault(message.prehashKey); + obj.prehash_value = omitDefault(message.prehashValue); + obj.length = omitDefault(message.length); obj.prefix = message.prefix; return obj; }, @@ -1360,7 +1360,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); obj.prefix = message.prefix; obj.suffix = message.suffix; return obj; @@ -1488,8 +1488,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = omitDefault(message.maxDepth); + obj.min_depth = omitDefault(message.minDepth); return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1657,11 +1657,11 @@ export const InnerSpec = { } else { obj.child_order = []; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = omitDefault(message.childSize); + obj.min_prefix_length = omitDefault(message.minPrefixLength); + obj.max_prefix_length = omitDefault(message.maxPrefixLength); obj.empty_child = message.emptyChild; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts index b536b82672..8112974d30 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -281,7 +281,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts index a25f885557..18e1d4ebff 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -312,7 +312,7 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = message.goImport; + obj.go_import = omitDefault(message.goImport); if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { @@ -423,8 +423,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = message.name; - obj.revision = message.revision; + obj.name = omitDefault(message.name); + obj.revision = omitDefault(message.revision); return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -512,7 +512,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = message.module; + obj.module = omitDefault(message.module); return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts index a32e459bbc..d65ca029fc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -214,10 +214,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -343,7 +343,7 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { @@ -498,11 +498,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = omitDefault(message.maxMemoCharacters); + obj.tx_sig_limit = omitDefault(message.txSigLimit); + obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); + obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); + obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts index 8a0ff7e146..ea2494acf7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -583,7 +583,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -1164,7 +1164,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = message.bech32Prefix; + obj.bech32_prefix = omitDefault(message.bech32Prefix); return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1340,7 +1340,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1428,7 +1428,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts index a56684ab24..885d81c771 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts @@ -9,7 +9,7 @@ import { DepositDeploymentAuthorizationSDKType as DepositDeploymentAuthorization import { SendAuthorization, SendAuthorizationProtoMsg, SendAuthorizationSDKType } from "../../bank/v1beta1/authz"; import { StakeAuthorization, StakeAuthorizationProtoMsg, StakeAuthorizationSDKType } from "../../staking/v1beta1/authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -216,7 +216,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = omitDefault(message.msg); return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -314,7 +314,7 @@ export const Grant = { fromAmino(object: GrantAmino): Grant { return { authorization: object?.authorization ? Authorization_FromAmino(object.authorization) : undefined, - expiration: object?.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: Grant): GrantAmino { @@ -444,13 +444,13 @@ export const GrantAuthorization = { granter: object.granter, grantee: object.grantee, authorization: object?.authorization ? Authorization_FromAmino(object.authorization) : undefined, - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; obj.expiration = message.expiration; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts index c999fb50b4..8068bd9820 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -271,9 +271,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -493,7 +493,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -713,7 +713,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts index 65680ced69..f13a65bb08 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -265,8 +265,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -476,7 +476,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Sdk_MsgauthzAuthorization_ToAmino((e as Any)) : undefined); } else { @@ -666,9 +666,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts index c481d30eb2..3859b64e57 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -388,7 +388,7 @@ export const Params = { } else { obj.send_enabled = []; } - obj.default_send_enabled = message.defaultSendEnabled; + obj.default_send_enabled = omitDefault(message.defaultSendEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -489,8 +489,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = message.denom; - obj.enabled = message.enabled; + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -599,7 +599,7 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -713,7 +713,7 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -941,8 +941,8 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = message.denom; - obj.exponent = message.exponent; + obj.denom = omitDefault(message.denom); + obj.exponent = omitDefault(message.exponent); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { @@ -1134,18 +1134,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { obj.denom_units = []; } - obj.base = message.base; - obj.display = message.display; - obj.name = message.name; - obj.symbol = message.symbol; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.base = omitDefault(message.base); + obj.display = omitDefault(message.display); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts index d04997686d..60f7d12574 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -334,7 +334,7 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts index 8fdb321255..bc02e33f2a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -639,8 +639,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = omitDefault(message.address); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -833,7 +833,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1053,7 +1053,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1464,7 +1464,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -2009,7 +2009,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -2202,7 +2202,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2306,7 +2306,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts index 7d68969327..ba4ee7d059 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -177,8 +177,8 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts index 81289d1634..f8e886c877 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventAmino, EventSDKType } from "../../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.abci.v1beta1"; /** * TxResponse defines a structure containing relevant tx data and metadata. The @@ -715,22 +715,22 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.height = omitDefault(message.height); + obj.txhash = omitDefault(message.txhash); + obj.codespace = omitDefault(message.codespace); + obj.code = omitDefault(message.code); + obj.data = omitDefault(message.data); + obj.raw_log = omitDefault(message.rawLog); if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { obj.logs = []; } - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = omitDefault(message.timestamp); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -858,7 +858,7 @@ export const ABCIMessageLog = { toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { @@ -972,7 +972,7 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -1078,8 +1078,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1184,8 +1184,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1329,7 +1329,7 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -1546,7 +1546,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = omitDefault(message.msgType); obj.data = message.data; return obj; }, @@ -1844,11 +1844,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = omitDefault(message.totalCount); + obj.count = omitDefault(message.count); + obj.page_number = omitDefault(message.pageNumber); + obj.page_total = omitDefault(message.pageTotal); + obj.limit = omitDefault(message.limit); if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts index df0bcd01b3..6cc467f7aa 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.query.v1beta1"; /** * PageRequest is to be embedded in gRPC request messages for efficient @@ -292,10 +292,10 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.offset = omitDefault(message.offset); + obj.limit = omitDefault(message.limit); + obj.count_total = omitDefault(message.countTotal); + obj.reverse = omitDefault(message.reverse); return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { @@ -399,7 +399,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = omitDefault(message.total); return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts index e39c0bf892..5fdb17b85b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -331,7 +331,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = message.interfaceName; + obj.interface_name = omitDefault(message.interfaceName); return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts index 1338c7017f..5d80b9fb0f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -955,7 +955,7 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { @@ -1174,9 +1174,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1264,7 +1264,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1494,7 +1494,7 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { @@ -1605,8 +1605,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.type_url = message.typeUrl; + obj.fullname = omitDefault(message.fullname); + obj.type_url = omitDefault(message.typeUrl); return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1715,7 +1715,7 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { @@ -1808,7 +1808,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1896,7 +1896,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = message.msgTypeUrl; + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -3084,8 +3084,8 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.is_module = message.isModule; + obj.fullname = omitDefault(message.fullname); + obj.is_module = omitDefault(message.isModule); if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { @@ -3191,8 +3191,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.full_query_path = message.fullQueryPath; + obj.name = omitDefault(message.name); + obj.full_query_path = omitDefault(message.fullQueryPath); return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts index a1ca4b0ca6..2d2ad2d436 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; /** Snapshot contains Tendermint state sync snapshot info. */ export interface Snapshot { @@ -348,9 +348,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -710,7 +710,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -841,8 +841,8 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.version = omitDefault(message.version); + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -943,8 +943,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = omitDefault(message.name); + obj.format = omitDefault(message.format); return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts index 16dbf3a415..f927113d27 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -183,7 +183,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -291,7 +291,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, @@ -395,7 +395,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); obj.hash = message.hash; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts index 13e21425eb..b8bef1b5e5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) @@ -154,8 +154,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = omitDefault(message.storeKey); + obj.delete = omitDefault(message.delete); obj.key = message.key; obj.value = message.value; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts index 8941de9796..d17a9e0def 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../../tendermint/ty import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoAmino, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -444,7 +444,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -571,7 +571,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -793,7 +793,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -932,10 +932,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1025,7 +1025,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1467,7 +1467,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = omitDefault(message.syncing); return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1831,18 +1831,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = omitDefault(message.name); + obj.app_name = omitDefault(message.appName); + obj.version = omitDefault(message.version); + obj.git_commit = omitDefault(message.gitCommit); + obj.build_tags = omitDefault(message.buildTags); + obj.go_version = omitDefault(message.goVersion); if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { obj.build_deps = []; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1956,9 +1956,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = omitDefault(message.path); + obj.version = omitDefault(message.version); + obj.sum = omitDefault(message.sum); return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts index e5cec5299d..75789f66fe 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -193,8 +193,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -295,8 +295,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -384,7 +384,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = omitDefault(message.int); return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -472,7 +472,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = omitDefault(message.dec); return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts index 6a8b8a8f51..e817b5b070 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -156,7 +156,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -257,8 +257,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = omitDefault(message.module); + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts index ef43a86d5b..a059c5bd54 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersAmino, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -142,7 +142,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -254,7 +254,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts index 192224e402..ae821065ce 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -130,9 +130,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = message.sender; - obj.invariant_module_name = message.invariantModuleName; - obj.invariant_route = message.invariantRoute; + obj.sender = omitDefault(message.sender); + obj.invariant_module_name = omitDefault(message.invariantModuleName); + obj.invariant_route = omitDefault(message.invariantRoute); return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts index 8656f13028..efe0d7b8d1 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -164,11 +164,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = message.purpose; - obj.coin_type = message.coinType; - obj.account = message.account; - obj.change = message.change; - obj.address_index = message.addressIndex; + obj.purpose = omitDefault(message.purpose); + obj.coin_type = omitDefault(message.coinType); + obj.account = omitDefault(message.account); + obj.change = omitDefault(message.change); + obj.address_index = omitDefault(message.addressIndex); return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts index ceef497146..20cdcaec4f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -268,7 +268,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -377,7 +377,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = omitDefault(message.privKeyType); return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts index caf7047c01..b3e1c886fc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -121,7 +121,7 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts index f07ed5aa6a..038862ac9b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { bytesFromBase64, base64FromBytes, DeepPartial, isSet } from "../../../../helpers"; +import { bytesFromBase64, base64FromBytes, DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. @@ -247,7 +247,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = omitDefault(message.extraBitsStored); obj.elems = message.elems; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts index 0eb4b85630..76cd3146d5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -528,10 +528,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax; - obj.base_proposer_reward = message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward; - obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + obj.community_tax = padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -645,7 +645,7 @@ export const ValidatorHistoricalRewards = { } else { obj.cumulative_reward_ratio = []; } - obj.reference_count = message.referenceCount; + obj.reference_count = omitDefault(message.referenceCount); return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -761,7 +761,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = []; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -1064,8 +1064,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; - obj.fraction = message.fraction; + obj.validator_period = omitDefault(message.validatorPeriod); + obj.fraction = padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1400,9 +1400,9 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1525,9 +1525,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; - obj.stake = message.stake; - obj.height = message.height ? message.height.toString() : undefined; + obj.previous_period = omitDefault(message.previousPeriod); + obj.stake = padDecimal(message.stake); + obj.height = message.height; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1636,7 +1636,7 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -1781,11 +1781,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; - obj.amount = message.amount; - obj.deposit = message.deposit; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); + obj.amount = omitDefault(message.amount); + obj.deposit = omitDefault(message.deposit); return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts index 1e509d6a57..b754112b50 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsAmino, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsAmino, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoAmino, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, Params, ParamsAmino, ParamsSDKType, FeePool, FeePoolAmino, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -385,8 +385,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -495,7 +495,7 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -603,7 +603,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -722,8 +722,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.period = omitDefault(message.period); obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -827,7 +827,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -944,8 +944,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -1079,9 +1079,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.height = omitDefault(message.height); + obj.period = omitDefault(message.period); obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1354,7 +1354,7 @@ export const GenesisState = { } else { obj.delegator_withdraw_infos = []; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = omitDefault(message.previousProposer); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts index a930724db1..93fbc7cbe2 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Params, ParamsAmino, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsAmino, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardAmino, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -780,7 +780,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -958,7 +958,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1181,9 +1181,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.starting_height = omitDefault(message.startingHeight); + obj.ending_height = omitDefault(message.endingHeight); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1401,8 +1401,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1590,7 +1590,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1804,7 +1804,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1992,7 +1992,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -2080,7 +2080,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts index f76a7eed91..e8544df278 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -271,8 +271,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -444,8 +444,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -633,7 +633,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -847,7 +847,7 @@ export const MsgFundCommunityPool = { } else { obj.amount = []; } - obj.depositor = message.depositor; + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts index b16109e9eb..3451deadac 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * Equivocation implements the Evidence interface and defines evidence of double @@ -139,17 +139,17 @@ export const Equivocation = { fromAmino(object: EquivocationAmino): Equivocation { return { height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, power: BigInt(object.power), consensusAddress: object.consensus_address }; }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.power = omitDefault(message.power); + obj.consensus_address = omitDefault(message.consensusAddress); return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts index 6b28f25a17..fe2cb4db81 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -137,7 +137,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = omitDefault(message.submitter); obj.evidence = message.evidence ? Evidence_ToAmino((message.evidence as Any)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts index d5860c3c69..872d458df9 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -271,7 +271,7 @@ export const BasicAllowance = { fromAmino(object: BasicAllowanceAmino): BasicAllowance { return { spendLimit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromAmino(e)) : [], - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: BasicAllowance): BasicAllowanceAmino { @@ -437,7 +437,7 @@ export const PeriodicAllowance = { period: object?.period ? Duration.fromAmino(object.period) : undefined, periodSpendLimit: Array.isArray(object?.period_spend_limit) ? object.period_spend_limit.map((e: any) => Coin.fromAmino(e)) : [], periodCanSpend: Array.isArray(object?.period_can_spend) ? object.period_can_spend.map((e: any) => Coin.fromAmino(e)) : [], - periodReset: object.period_reset + periodReset: object?.period_reset ? Timestamp.fromAmino(object.period_reset) : undefined }; }, toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { @@ -687,8 +687,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts index 8c173b84fd..c27cc0e05d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -232,8 +232,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -426,7 +426,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -646,7 +646,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts index 7e8481c36f..d084f8058a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -193,8 +193,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, @@ -367,8 +367,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts index b336b1dc20..eb58a67458 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -227,7 +227,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts index 48a18a015b..5c6a3aae3d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -500,8 +500,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -625,8 +625,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -846,23 +846,23 @@ export const Proposal = { messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [], status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time, + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined, metadata: object.metadata }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -873,7 +873,7 @@ export const Proposal = { } obj.voting_start_time = message.votingStartTime; obj.voting_end_time = message.votingEndTime; - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -1000,10 +1000,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1140,14 +1140,14 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1467,9 +1467,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = omitDefault(message.quorum); + obj.threshold = omitDefault(message.threshold); + obj.veto_threshold = omitDefault(message.vetoThreshold); return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts index d74a3a41ea..5127187c7d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -489,7 +489,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -708,9 +708,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -930,8 +930,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1126,7 +1126,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1331,7 +1331,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1556,8 +1556,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1752,7 +1752,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1959,7 +1959,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts index 05a681ef4f..2701fb1a8c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts @@ -8,7 +8,7 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, R import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -380,8 +380,8 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = omitDefault(message.proposer); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -471,7 +471,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -575,7 +575,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -775,10 +775,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -986,14 +986,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1188,8 +1188,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts index ec230e57fb..6c7e3134bc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -227,7 +227,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts index cebc21df6d..157975b85f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts @@ -9,7 +9,7 @@ import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSu import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -563,8 +563,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -666,8 +666,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -791,8 +791,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -994,18 +994,18 @@ export const Proposal = { content: object?.content ? ProposalContentI_FromAmino(object.content) : undefined, status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -1142,10 +1142,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = omitDefault(message.yes); + obj.abstain = omitDefault(message.abstain); + obj.no = omitDefault(message.no); + obj.no_with_veto = omitDefault(message.noWithVeto); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1282,9 +1282,9 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts index 1430226874..f104e8b8f6 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -489,7 +489,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -708,9 +708,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -930,8 +930,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1126,7 +1126,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1331,7 +1331,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1556,8 +1556,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1752,7 +1752,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1959,7 +1959,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts index a5a84aa602..0b9360b72e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts @@ -7,7 +7,7 @@ import { ReplacePoolIncentivesProposal, ReplacePoolIncentivesProposalProtoMsg, R import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSuperfluidAssetsProposalSDKType, RemoveSuperfluidAssetsProposal, RemoveSuperfluidAssetsProposalProtoMsg, RemoveSuperfluidAssetsProposalSDKType, UpdateUnpoolWhiteListProposal, UpdateUnpoolWhiteListProposalProtoMsg, UpdateUnpoolWhiteListProposalSDKType } from "../../../osmosis/superfluid/v1beta1/gov"; import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -316,7 +316,7 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; + obj.proposer = omitDefault(message.proposer); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -406,7 +406,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -522,9 +522,9 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -719,8 +719,8 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { @@ -920,8 +920,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts index a4e026e41f..d009fdaad7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts @@ -1,6 +1,6 @@ import { ProposalExecutorResult, ProposalExecutorResultSDKType, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** EventCreateGroup is an event emitted when a group is created. */ export interface EventCreateGroup { @@ -275,7 +275,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -365,7 +365,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -453,7 +453,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -541,7 +541,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -631,7 +631,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -721,7 +721,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -811,7 +811,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -914,8 +914,8 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = message.result; + obj.proposal_id = omitDefault(message.proposalId); + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -1018,8 +1018,8 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.group_id = omitDefault(message.groupId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts index da5fe5a841..7024c6e20e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -277,7 +277,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = omitDefault(message.groupSeq); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -288,13 +288,13 @@ export const GenesisState = { } else { obj.group_members = []; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = omitDefault(message.groupPolicySeq); if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = []; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = omitDefault(message.proposalSeq); if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts index 2016fec933..7d5b1c2eea 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -725,7 +725,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -903,7 +903,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -1098,7 +1098,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1318,7 +1318,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1540,7 +1540,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1760,7 +1760,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1967,7 +1967,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2160,7 +2160,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2380,8 +2380,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2576,7 +2576,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2796,7 +2796,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = omitDefault(message.voter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3016,7 +3016,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3223,7 +3223,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts index 617578da4d..288f17c806 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts @@ -1,7 +1,7 @@ import { Member, MemberAmino, MemberSDKType, VoteOption, VoteOptionSDKType, ThresholdDecisionPolicy, ThresholdDecisionPolicyProtoMsg, ThresholdDecisionPolicySDKType, PercentageDecisionPolicy, PercentageDecisionPolicyProtoMsg, PercentageDecisionPolicySDKType, voteOptionFromJSON, voteOptionToJSON } from "./types"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -884,13 +884,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -980,7 +980,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -1104,8 +1104,8 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1297,9 +1297,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1486,9 +1486,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1690,9 +1690,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -1781,7 +1781,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1895,9 +1895,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -2060,15 +2060,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = omitDefault(message.groupMetadata); + obj.group_policy_metadata = omitDefault(message.groupPolicyMetadata); + obj.group_policy_as_admin = omitDefault(message.groupPolicyAsAdmin); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -2172,8 +2172,8 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_id = omitDefault(message.groupId); + obj.group_policy_address = omitDefault(message.groupPolicyAddress); return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2360,8 +2360,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -2547,9 +2547,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2776,19 +2776,19 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.exec = message.exec; + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2878,7 +2878,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2981,8 +2981,8 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.proposal_id = omitDefault(message.proposalId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -3195,11 +3195,11 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; - obj.exec = message.exec; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3373,8 +3373,8 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.proposal_id = omitDefault(message.proposalId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3548,8 +3548,8 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts index 8783acd0d5..24cf696544 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -858,14 +858,14 @@ export const Member = { address: object.address, weight: object.weight, metadata: object.metadata, - addedAt: object.added_at + addedAt: object?.added_at ? Timestamp.fromAmino(object.added_at) : undefined }; }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = omitDefault(message.address); + obj.weight = omitDefault(message.weight); + obj.metadata = omitDefault(message.metadata); obj.added_at = message.addedAt; return obj; }, @@ -1070,7 +1070,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1175,7 +1175,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = omitDefault(message.percentage); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1434,16 +1434,16 @@ export const GroupInfo = { metadata: object.metadata, version: BigInt(object.version), totalWeight: object.total_weight, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.id = omitDefault(message.id); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); + obj.total_weight = omitDefault(message.totalWeight); obj.created_at = message.createdAt; return obj; }, @@ -1549,7 +1549,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1717,16 +1717,16 @@ export const GroupPolicyInfo = { metadata: object.metadata, version: BigInt(object.version), decisionPolicy: object?.decision_policy ? DecisionPolicy_FromAmino(object.decision_policy) : undefined, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; obj.created_at = message.createdAt; return obj; @@ -1983,35 +1983,35 @@ export const Proposal = { address: object.address, metadata: object.metadata, proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => e) : [], - submitTime: object.submit_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, groupVersion: BigInt(object.group_version), groupPolicyVersion: BigInt(object.group_policy_version), status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - votingPeriodEnd: object.voting_period_end, + votingPeriodEnd: object?.voting_period_end ? Timestamp.fromAmino(object.voting_period_end) : undefined, executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.id = omitDefault(message.id); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } obj.submit_time = message.submitTime; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = message.status; - obj.result = message.result; + obj.group_version = omitDefault(message.groupVersion); + obj.group_policy_version = omitDefault(message.groupPolicyVersion); + obj.status = omitDefault(message.status); + obj.result = omitDefault(message.result); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd; - obj.executor_result = message.executorResult; + obj.executor_result = omitDefault(message.executorResult); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -2143,10 +2143,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2283,15 +2283,15 @@ export const Vote = { voter: object.voter, option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object.metadata, - submitTime: object.submit_time + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined }; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); obj.submit_time = message.submitTime; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts index 4ae7e90b3a..0f4729255d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -152,8 +152,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation; - obj.annual_provisions = message.annualProvisions; + obj.inflation = padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -308,12 +308,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange; - obj.inflation_max = message.inflationMax; - obj.inflation_min = message.inflationMin; - obj.goal_bonded = message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.mint_denom = omitDefault(message.mintDenom); + obj.inflation_rate_change = padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded); + obj.blocks_per_year = omitDefault(message.blocksPerYear); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts index 20fe0a6317..669a6a2b57 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -184,10 +184,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -301,9 +301,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -417,9 +417,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts index 5451bd5017..bec132d99b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -264,7 +264,7 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts index 091573a295..7989b96268 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -239,12 +239,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.description = omitDefault(message.description); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -387,10 +387,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts index 0430458e59..85a4255913 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTAmino, NFTSDKType, Class, ClassAmino, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -382,8 +382,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -473,7 +473,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -574,8 +574,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -663,7 +663,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -751,7 +751,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -841,7 +841,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -957,8 +957,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1176,8 +1176,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1355,7 +1355,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts index 1d2a04b9da..9310859864 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -154,10 +154,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts index 53af4499b0..d6d5d0c813 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -333,7 +333,7 @@ export const TableDescriptor = { } else { obj.index = []; } - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -434,8 +434,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.auto_increment = message.autoIncrement; + obj.fields = omitDefault(message.fields); + obj.auto_increment = omitDefault(message.autoIncrement); return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -549,9 +549,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.id = message.id; - obj.unique = message.unique; + obj.fields = omitDefault(message.fields); + obj.id = omitDefault(message.id); + obj.unique = omitDefault(message.unique); return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -639,7 +639,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts index 7e32a637b5..d23acf713e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -374,9 +374,9 @@ export const ModuleSchemaDescriptor_FileEntry = { }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = message.storageType; + obj.id = omitDefault(message.id); + obj.proto_file_name = omitDefault(message.protoFileName); + obj.storage_type = omitDefault(message.storageType); return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts index f9e2ec45e2..94bea85d9c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -159,8 +159,8 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { @@ -279,9 +279,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; - obj.value = message.value; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts index 45c327fea9..be175e6c85 100644 --- a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -211,8 +211,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -582,7 +582,7 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = message.subspace; + obj.subspace = omitDefault(message.subspace); if (message.keys) { obj.keys = message.keys.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts index 73a2c86042..ace824b09d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -356,7 +356,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -466,7 +466,7 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { @@ -574,8 +574,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.index = omitDefault(message.index); + obj.missed = omitDefault(message.missed); return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts index 7c8c5ff2a6..4c761eba01 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -386,7 +386,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = message.consAddress; + obj.cons_address = omitDefault(message.consAddress); return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts index 4a952d3311..a39774376e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -236,19 +236,19 @@ export const ValidatorSigningInfo = { address: object.address, startHeight: BigInt(object.start_height), indexOffset: BigInt(object.index_offset), - jailedUntil: object.jailed_until, + jailedUntil: object?.jailed_until ? Timestamp.fromAmino(object.jailed_until) : undefined, tombstoned: object.tombstoned, missedBlocksCounter: BigInt(object.missed_blocks_counter) }; }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.address = omitDefault(message.address); + obj.start_height = omitDefault(message.startHeight); + obj.index_offset = omitDefault(message.indexOffset); obj.jailed_until = message.jailedUntil; - obj.tombstoned = message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.tombstoned = omitDefault(message.tombstoned); + obj.missed_blocks_counter = omitDefault(message.missedBlocksCounter); return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -392,7 +392,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = omitDefault(message.signedBlocksWindow); obj.min_signed_per_window = message.minSignedPerWindow; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign; diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts index 2d9bd049b3..845bc638db 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -250,7 +250,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = message.authorizationType; + obj.authorization_type = omitDefault(message.authorizationType); return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts index d96977ed5d..661dd082a0 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -319,7 +319,7 @@ export const GenesisState = { } else { obj.redelegations = []; } - obj.exported = message.exported; + obj.exported = omitDefault(message.exported); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -422,8 +422,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.address = omitDefault(message.address); + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts index ed5c817d6d..ff0a10a75b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -930,7 +930,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1135,7 +1135,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1328,7 +1328,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1548,7 +1548,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1766,8 +1766,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1958,8 +1958,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -2152,7 +2152,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2372,7 +2372,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2618,9 +2618,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.src_validator_addr = omitDefault(message.srcValidatorAddr); + obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2840,7 +2840,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3058,8 +3058,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -3239,7 +3239,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts index b685c00807..098316932f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -1034,9 +1034,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1134,7 +1134,7 @@ export const Commission = { fromAmino(object: CommissionAmino): Commission { return { commissionRates: object?.commission_rates ? CommissionRates.fromAmino(object.commission_rates) : undefined, - updateTime: object.update_time + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: Commission): CommissionAmino { @@ -1280,11 +1280,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = omitDefault(message.moniker); + obj.identity = omitDefault(message.identity); + obj.website = omitDefault(message.website); + obj.security_contact = omitDefault(message.securityContact); + obj.details = omitDefault(message.details); return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1503,24 +1503,24 @@ export const Validator = { delegatorShares: object.delegator_shares, description: object?.description ? Description.fromAmino(object.description) : undefined, unbondingHeight: BigInt(object.unbonding_height), - unbondingTime: object.unbonding_time, + unbondingTime: object?.unbonding_time ? Timestamp.fromAmino(object.unbonding_time) : undefined, commission: object?.commission ? Commission.fromAmino(object.commission) : undefined, minSelfDelegation: object.min_self_delegation }; }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = omitDefault(message.operatorAddress); obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = message.status; - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = omitDefault(message.jailed); + obj.status = omitDefault(message.status); + obj.tokens = omitDefault(message.tokens); + obj.delegator_shares = padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = omitDefault(message.unbondingHeight); obj.unbonding_time = message.unbondingTime; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1721,8 +1721,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1936,9 +1936,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -2152,9 +2152,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.shares = padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2276,8 +2276,8 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { @@ -2404,17 +2404,17 @@ export const UnbondingDelegationEntry = { fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, balance: object.balance }; }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = omitDefault(message.initialBalance); + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2536,17 +2536,17 @@ export const RedelegationEntry = { fromAmino(object: RedelegationEntryAmino): RedelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, sharesDst: object.shares_dst }; }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = omitDefault(message.initialBalance); + obj.shares_dst = padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2681,9 +2681,9 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { @@ -2844,11 +2844,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = omitDefault(message.maxValidators); + obj.max_entries = omitDefault(message.maxEntries); + obj.historical_entries = omitDefault(message.historicalEntries); + obj.bond_denom = omitDefault(message.bondDenom); + obj.min_commission_rate = padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -3058,7 +3058,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts index 34b8356930..709ffe155e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -430,9 +430,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -635,9 +635,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = omitDefault(message.validatorAddress); + obj.commission_rate = padDecimal(message.commissionRate); + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -824,8 +824,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1026,9 +1026,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1112,7 +1112,7 @@ export const MsgBeginRedelegateResponse = { }, fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { @@ -1233,8 +1233,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1318,7 +1318,7 @@ export const MsgUndelegateResponse = { }, fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts index 1e68a77936..7cc99786d5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts @@ -1,7 +1,7 @@ import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -441,7 +441,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { @@ -648,7 +648,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.signature = message.signature; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts index 9b0cf87734..969445629a 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts @@ -4,7 +4,7 @@ import { TxResponse, TxResponseAmino, TxResponseSDKType, GasInfo, GasInfoAmino, import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockAmino, BlockSDKType } from "../../../tendermint/types/block"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -590,7 +590,7 @@ export const GetTxsEventRequest = { obj.events = []; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = message.orderBy; + obj.order_by = omitDefault(message.orderBy); return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -834,7 +834,7 @@ export const BroadcastTxRequest = { toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1222,7 +1222,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1433,7 +1433,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts index 797c6ecb83..c8ccba7dce 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../ import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -1124,8 +1124,8 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.auth_info_bytes = message.authInfoBytes; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1288,9 +1288,9 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1462,8 +1462,8 @@ export const TxBody = { } else { obj.messages = []; } - obj.memo = message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.memo = omitDefault(message.memo); + obj.timeout_height = omitDefault(message.timeoutHeight); if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1727,7 +1727,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1921,7 +1921,7 @@ export const ModeInfo_Single = { }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -2179,9 +2179,9 @@ export const Fee = { } else { obj.amount = []; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.gas_limit = omitDefault(message.gasLimit); + obj.payer = omitDefault(message.payer); + obj.granter = omitDefault(message.granter); return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -2295,7 +2295,7 @@ export const Tip = { } else { obj.amount = []; } - obj.tipper = message.tipper; + obj.tipper = omitDefault(message.tipper); return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2424,9 +2424,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.sig = message.sig; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts index 3b2c1df709..d222314940 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -556,7 +556,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -646,7 +646,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -736,7 +736,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = omitDefault(message.lastHeight); return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -912,7 +912,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = message.moduleName; + obj.module_name = omitDefault(message.moduleName); return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -1171,7 +1171,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts index 9ddd4a4a7c..0905025ae5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -205,7 +205,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -365,7 +365,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts index 9d4fa849df..4053285dc9 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -330,7 +330,7 @@ export const Plan = { fromAmino(object: PlanAmino): Plan { return { name: object.name, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, height: BigInt(object.height), info: object.info, upgradedClientState: object?.upgraded_client_state ? Any.fromAmino(object.upgraded_client_state) : undefined @@ -338,10 +338,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.time = message.time; - obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.height = omitDefault(message.height); + obj.info = omitDefault(message.info); obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -458,8 +458,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -561,8 +561,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -665,8 +665,8 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.name = omitDefault(message.name); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts index 5a8dedec10..0b1c447426 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -293,15 +293,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.amount = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; - obj.delayed = message.delayed; + obj.end_time = omitDefault(message.endTime); + obj.delayed = omitDefault(message.delayed); return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -494,8 +494,8 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -708,9 +708,9 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts index 4860a67f19..15792eb736 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -363,7 +363,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = omitDefault(message.endTime); return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -469,7 +469,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -670,7 +670,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = omitDefault(message.length); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -802,7 +802,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts index 70d4a53c39..54430d5a1f 100644 --- a/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial } from "../helpers"; +import { isSet, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -250,8 +250,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -375,8 +375,8 @@ export const ScalarDescriptor = { }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); if (message.fieldType) { obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); } else { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts index 7358aeaa66..9a6c0461f4 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts @@ -1,7 +1,7 @@ import { MsgStoreCode, MsgStoreCodeAmino, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractAmino, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractAmino, MsgExecuteContractSDKType } from "./tx"; import { Params, ParamsAmino, ParamsSDKType, CodeInfo, CodeInfoAmino, CodeInfoSDKType, ContractInfo, ContractInfoAmino, ContractInfoSDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -572,10 +572,10 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes; - obj.pinned = message.pinned; + obj.pinned = omitDefault(message.pinned); return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -699,7 +699,7 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); @@ -809,7 +809,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts index b7b5f60eeb..7d555f7d33 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -182,9 +182,9 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.channel = omitDefault(message.channel); + obj.timeout_height = omitDefault(message.timeoutHeight); + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); obj.data = message.data; return obj; }, @@ -273,7 +273,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = omitDefault(message.channel); return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts index 883ae75eb4..b4643ac5b3 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -524,9 +524,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -717,12 +717,12 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -870,10 +870,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1001,9 +1001,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1165,10 +1165,10 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1301,10 +1301,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1418,9 +1418,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1551,8 +1551,8 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { @@ -1688,8 +1688,8 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts index d5d6c6fb9d..10f2232b08 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { ContractInfo, ContractInfoAmino, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntryAmino, ContractCodeHistoryEntrySDKType, Model, ModelAmino, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** @@ -663,7 +663,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -766,7 +766,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -870,7 +870,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1092,7 +1092,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1312,7 +1312,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1530,7 +1530,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData; return obj; }, @@ -1720,7 +1720,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1899,7 +1899,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { @@ -2015,8 +2015,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId; + obj.creator = omitDefault(message.creator); obj.data_hash = message.dataHash; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts index 78781a7df4..bc426335f9 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgStoreCode submit Wasm code to the system */ @@ -449,7 +449,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -541,7 +541,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -704,10 +704,10 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.sender = omitDefault(message.sender); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -814,7 +814,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.data = message.data; return obj; }, @@ -950,8 +950,8 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1174,9 +1174,9 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1379,9 +1379,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1553,8 +1553,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts index b41d97a6b4..34002213ca 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ @@ -438,7 +438,7 @@ export const AccessTypeParam = { }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -539,8 +539,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = message.permission; - obj.address = message.address; + obj.permission = omitDefault(message.permission); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -659,8 +659,8 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.instantiate_default_permission = omitDefault(message.instantiateDefaultPermission); + obj.max_wasm_code_size = omitDefault(message.maxWasmCodeSize); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -777,7 +777,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -950,12 +950,12 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.code_id = omitDefault(message.codeId); + obj.creator = omitDefault(message.creator); + obj.admin = omitDefault(message.admin); + obj.label = omitDefault(message.label); obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = omitDefault(message.ibcPortId); obj.extension = message.extension ? ContractInfoExtension_ToAmino((message.extension as Any)) : undefined; return obj; }, @@ -1087,8 +1087,8 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.operation = omitDefault(message.operation); + obj.code_id = omitDefault(message.codeId); obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1195,8 +1195,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); + obj.tx_index = omitDefault(message.txIndex); return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts index b366bebedf..5b564467c6 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -254,9 +254,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = message.action; - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = omitDefault(message.action); + obj.completed = omitDefault(message.completed); + obj.claimable_amount = omitDefault(message.claimableAmount); return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -380,8 +380,8 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = omitDefault(message.address); + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { @@ -497,7 +497,7 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts index 1aa289343c..77ab635741 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts @@ -2,7 +2,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKTy import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -348,7 +348,7 @@ export const Params = { fromAmino(object: ParamsAmino): Params { return { enableClaims: object.enable_claims, - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimsDenom: object.claims_denom, @@ -358,11 +358,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = omitDefault(message.enableClaims); obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = omitDefault(message.claimsDenom); if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts index 699e6cf782..7e47ecc9ad 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKType, Claim, ClaimAmino, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -787,7 +787,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -889,7 +889,7 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts index eb49c6ceb6..67f55455a7 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -194,23 +194,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts index d39636981c..dc3fd4bb9b 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination: PageRequest; @@ -328,7 +328,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -411,7 +411,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts index 29029668b6..44d80dc522 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts @@ -1,6 +1,6 @@ import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -320,10 +320,10 @@ export const TokenPair = { }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = message.contractOwner; + obj.erc20_address = omitDefault(message.erc20Address); + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); + obj.contract_owner = omitDefault(message.contractOwner); return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -432,8 +432,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -541,9 +541,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.erc20address = omitDefault(message.erc20address); return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -650,9 +650,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts index e9ae34a5af..6f9516a4ec 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -248,8 +248,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = message.enableErc20; - obj.enable_evm_hook = message.enableEvmHook; + obj.enable_erc20 = omitDefault(message.enableErc20); + obj.enable_evm_hook = omitDefault(message.enableEvmHook); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts index 61e89fda08..f5c7634827 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -423,7 +423,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = message.token; + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts index 5f84463f34..b9fc4b78bc 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -205,8 +205,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -390,10 +390,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = omitDefault(message.contractAddress); + obj.amount = omitDefault(message.amount); + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts index 7dbd4ccc7b..37598f46aa 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -136,9 +136,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts index 97386fd300..16643c1756 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -315,11 +315,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = message.enableFees; - obj.developer_shares = message.developerShares; - obj.validator_shares = message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; - obj.min_gas_price = message.minGasPrice; + obj.enable_fees = omitDefault(message.enableFees); + obj.developer_shares = padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); + obj.min_gas_price = padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts index 6b88e91342..0a100291e6 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -496,7 +496,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -822,7 +822,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = omitDefault(message.deployerAddress); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts index 315ff7b713..bebeceeb9c 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -298,9 +298,9 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { @@ -463,8 +463,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -635,9 +635,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts index 0c43ec0bdf..65342d6165 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -308,10 +308,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = message.enableIncentives; - obj.allocation_limit = message.allocationLimit; - obj.incentives_epoch_identifier = message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler; + obj.enable_incentives = omitDefault(message.enableIncentives); + obj.allocation_limit = padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); + obj.reward_scaler = padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts index 53133b6d32..3517434970 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -280,21 +280,21 @@ export const Incentive = { contract: object.contract, allocations: Array.isArray(object?.allocations) ? object.allocations.map((e: any) => DecCoin.fromAmino(e)) : [], epochs: object.epochs, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, totalGas: BigInt(object.total_gas) }; }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); obj.start_time = message.startTime; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = omitDefault(message.totalGas); return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -403,9 +403,9 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); + obj.cumulative_gas = omitDefault(message.cumulativeGas); return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { @@ -547,15 +547,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -662,9 +662,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts index 085394e17a..f3837d498c 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, G import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -677,7 +677,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -856,7 +856,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1060,8 +1060,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1144,7 +1144,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = omitDefault(message.gasMeter); return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1417,7 +1417,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts index 769de0eaf1..45f2ec1555 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationAmino, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionAmino, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -204,10 +204,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.period = omitDefault(message.period); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.epochs_per_period = omitDefault(message.epochsPerPeriod); + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -331,10 +331,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = omitDefault(message.mintDenom); obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = omitDefault(message.enableInflation); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts index aec89e9561..ae5eef2760 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -224,9 +224,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards; - obj.usage_incentives = message.usageIncentives; - obj.community_pool = message.communityPool; + obj.staking_rewards = padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -359,11 +359,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a; - obj.r = message.r; - obj.c = message.c; - obj.bonding_target = message.bondingTarget; - obj.max_variance = message.maxVariance; + obj.a = padDecimal(message.a); + obj.r = padDecimal(message.r); + obj.c = padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts index 722ca1730e..cb1074a3a8 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -420,7 +420,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -714,7 +714,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -1006,7 +1006,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate; + obj.inflation_rate = padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts index 6c0b7867d6..2535dd4ccd 100644 --- a/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -211,7 +211,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = omitDefault(message.enableRecovery); obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts index 49d0eaad75..9935a056ec 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -127,7 +127,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts index 75ecdf37e2..ccf51a2ad1 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -289,7 +289,7 @@ export const MsgCreateClawbackVestingAccount = { return { fromAddress: object.from_address, toAddress: object.to_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [], merge: object.merge @@ -297,8 +297,8 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); @@ -310,7 +310,7 @@ export const MsgCreateClawbackVestingAccount = { } else { obj.vesting_periods = []; } - obj.merge = message.merge; + obj.merge = omitDefault(message.merge); return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -481,9 +481,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = omitDefault(message.funderAddress); + obj.account_address = omitDefault(message.accountAddress); + obj.dest_address = omitDefault(message.destAddress); return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts index c2d82f2063..1534c84536 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts @@ -1,7 +1,7 @@ import { BaseVestingAccount, BaseVestingAccountAmino, BaseVestingAccountSDKType, Period, PeriodAmino, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -191,7 +191,7 @@ export const ClawbackVestingAccount = { return { baseVestingAccount: object?.base_vesting_account ? BaseVestingAccount.fromAmino(object.base_vesting_account) : undefined, funderAddress: object.funder_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [] }; @@ -199,7 +199,7 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = omitDefault(message.funderAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv3/google/api/auth.ts b/__fixtures__/v-next/outputv3/google/api/auth.ts index 9b330c8592..9877786169 100644 --- a/__fixtures__/v-next/outputv3/google/api/auth.ts +++ b/__fixtures__/v-next/outputv3/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -821,9 +821,9 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = omitDefault(message.allowWithoutCredential); if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { @@ -935,9 +935,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = omitDefault(message.header); + obj.query = omitDefault(message.query); + obj.value_prefix = omitDefault(message.valuePrefix); return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -1091,11 +1091,11 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = omitDefault(message.id); + obj.issuer = omitDefault(message.issuer); + obj.jwks_uri = omitDefault(message.jwksUri); + obj.audiences = omitDefault(message.audiences); + obj.authorization_url = omitDefault(message.authorizationUrl); if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { @@ -1181,7 +1181,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = omitDefault(message.canonicalScopes); return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1275,8 +1275,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = omitDefault(message.providerId); + obj.audiences = omitDefault(message.audiences); return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputv3/google/api/backend.ts b/__fixtures__/v-next/outputv3/google/api/backend.ts index 608118b70e..1b5788d225 100644 --- a/__fixtures__/v-next/outputv3/google/api/backend.ts +++ b/__fixtures__/v-next/outputv3/google/api/backend.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -573,15 +573,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = message.pathTranslation; - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = omitDefault(message.selector); + obj.address = omitDefault(message.address); + obj.deadline = omitDefault(message.deadline); + obj.min_deadline = omitDefault(message.minDeadline); + obj.operation_deadline = omitDefault(message.operationDeadline); + obj.path_translation = omitDefault(message.pathTranslation); + obj.jwt_audience = omitDefault(message.jwtAudience); + obj.disable_auth = omitDefault(message.disableAuth); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputv3/google/api/billing.ts b/__fixtures__/v-next/outputv3/google/api/billing.ts index 94267923d7..9c01304334 100644 --- a/__fixtures__/v-next/outputv3/google/api/billing.ts +++ b/__fixtures__/v-next/outputv3/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -356,7 +356,7 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/config_change.ts b/__fixtures__/v-next/outputv3/google/api/config_change.ts index 5b1b993522..4a90236981 100644 --- a/__fixtures__/v-next/outputv3/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv3/google/api/config_change.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -322,10 +322,10 @@ export const ConfigChange = { }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = message.changeType; + obj.element = omitDefault(message.element); + obj.old_value = omitDefault(message.oldValue); + obj.new_value = omitDefault(message.newValue); + obj.change_type = omitDefault(message.changeType); if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { @@ -411,7 +411,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputv3/google/api/consumer.ts b/__fixtures__/v-next/outputv3/google/api/consumer.ts index e68868b4da..a1192fcf7f 100644 --- a/__fixtures__/v-next/outputv3/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv3/google/api/consumer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -376,9 +376,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputv3/google/api/context.ts b/__fixtures__/v-next/outputv3/google/api/context.ts index 8cfd5f79cd..7d58d5c214 100644 --- a/__fixtures__/v-next/outputv3/google/api/context.ts +++ b/__fixtures__/v-next/outputv3/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -452,7 +452,7 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.requested) { obj.requested = message.requested.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/control.ts b/__fixtures__/v-next/outputv3/google/api/control.ts index 7e0c417bdc..3871ef448d 100644 --- a/__fixtures__/v-next/outputv3/google/api/control.ts +++ b/__fixtures__/v-next/outputv3/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -103,7 +103,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = message.environment; + obj.environment = omitDefault(message.environment); return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputv3/google/api/distribution.ts b/__fixtures__/v-next/outputv3/google/api/distribution.ts index 1f43861b9a..ede4434030 100644 --- a/__fixtures__/v-next/outputv3/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/distribution.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../protobuf/timestamp"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -718,9 +718,9 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { @@ -826,8 +826,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = omitDefault(message.min); + obj.max = omitDefault(message.max); return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -1049,9 +1049,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1158,9 +1158,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1371,13 +1371,13 @@ export const Distribution_Exemplar = { fromAmino(object: Distribution_ExemplarAmino): Distribution_Exemplar { return { value: object.value, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, attachments: Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); obj.timestamp = message.timestamp; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv3/google/api/documentation.ts b/__fixtures__/v-next/outputv3/google/api/documentation.ts index 2a5fee565a..1db509a8a0 100644 --- a/__fixtures__/v-next/outputv3/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv3/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -546,7 +546,7 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = message.summary; + obj.summary = omitDefault(message.summary); if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { @@ -557,9 +557,9 @@ export const Documentation = { } else { obj.rules = []; } - obj.documentation_root_url = message.documentationRootUrl; - obj.service_root_url = message.serviceRootUrl; - obj.overview = message.overview; + obj.documentation_root_url = omitDefault(message.documentationRootUrl); + obj.service_root_url = omitDefault(message.serviceRootUrl); + obj.overview = omitDefault(message.overview); return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -666,9 +666,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.description = message.description; - obj.deprecation_description = message.deprecationDescription; + obj.selector = omitDefault(message.selector); + obj.description = omitDefault(message.description); + obj.deprecation_description = omitDefault(message.deprecationDescription); return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -783,8 +783,8 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = message.name; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.content = omitDefault(message.content); if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/endpoint.ts b/__fixtures__/v-next/outputv3/google/api/endpoint.ts index f966ac2c1f..fe753d68d0 100644 --- a/__fixtures__/v-next/outputv3/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv3/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -243,14 +243,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { obj.aliases = []; } - obj.target = message.target; - obj.allow_cors = message.allowCors; + obj.target = omitDefault(message.target); + obj.allow_cors = omitDefault(message.allowCors); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts index 2636c8fcc1..3167eb4fad 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -3,7 +3,7 @@ import { Decl, DeclAmino, DeclSDKType, CheckedExpr, CheckedExprAmino, CheckedExp import { ExprValue, ExprValueAmino, ExprValueSDKType } from "../../v1alpha1/eval"; import { Status, StatusAmino, StatusSDKType } from "../../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../../helpers"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -458,10 +458,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = omitDefault(message.celSource); + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.source_location = omitDefault(message.sourceLocation); + obj.disable_macros = omitDefault(message.disableMacros); return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -706,8 +706,8 @@ export const CheckRequest = { } else { obj.type_env = []; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = omitDefault(message.container); + obj.no_std_env = omitDefault(message.noStdEnv); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -911,7 +911,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -1076,7 +1076,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1296,9 +1296,9 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts index f334828e7f..664a4ede9f 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts @@ -2,7 +2,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType, Expr, ExprAmino, ExprSD import { Empty, EmptyAmino, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -976,7 +976,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -1068,7 +1068,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, @@ -1289,7 +1289,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = omitDefault(message.exprVersion); obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1542,15 +1542,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = message.null; - obj.primitive = message.primitive; - obj.wrapper = message.wrapper; - obj.well_known = message.wellKnown; + obj.null = omitDefault(message.null); + obj.primitive = omitDefault(message.primitive); + obj.wrapper = omitDefault(message.wrapper); + obj.well_known = omitDefault(message.wellKnown); obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = omitDefault(message.messageType); + obj.type_param = omitDefault(message.typeParam); obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1946,7 +1946,7 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -2062,7 +2062,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -2177,7 +2177,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2434,7 +2434,7 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = omitDefault(message.overloadId); if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -2446,8 +2446,8 @@ export const Decl_FunctionDecl_Overload = { obj.type_params = []; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = omitDefault(message.isInstanceFunction); + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2564,7 +2564,7 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts index 9d753c8eb2..1a9af2e2f3 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -461,8 +461,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = omitDefault(message.expr); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts index 78463f00d8..925d9528da 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -286,8 +286,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.value_index = message.valueIndex; + obj.id = omitDefault(message.id); + obj.value_index = omitDefault(message.valueIndex); return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts index 6c3a15cee0..df82d94ced 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts @@ -2,7 +2,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -1165,7 +1165,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1253,7 +1253,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1363,8 +1363,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1482,7 +1482,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1682,7 +1682,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = omitDefault(message.messageName); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1813,8 +1813,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1985,9 +1985,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -2177,17 +2177,17 @@ export const Constant = { stringValue: object?.string_value, bytesValue: object?.bytes_value, durationValue: object?.duration_value ? Duration.fromAmino(object.duration_value) : undefined, - timestampValue: object?.timestamp_value + timestampValue: object?.timestamp_value ? Timestamp.fromAmino(object.timestamp_value) : undefined }; }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue; @@ -2285,8 +2285,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2377,7 +2377,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, @@ -2598,8 +2598,8 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -2736,10 +2736,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts index 00291ea687..85113ddd9b 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts @@ -1,7 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -460,18 +460,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -565,8 +565,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts index 31382a6e1a..5c4fd93bb2 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprAmino, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -274,9 +274,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.doc = omitDefault(message.doc); obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -393,8 +393,8 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = omitDefault(message.id); + obj.type = omitDefault(message.type); if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { @@ -621,7 +621,7 @@ export const FunctionDecl = { obj.args = []; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = omitDefault(message.receiverFunction); return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts index 71caa44631..a6caca6c58 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -482,7 +482,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -864,7 +864,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts index 2aac391a12..5b9fc4f42e 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts @@ -1,7 +1,7 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -764,7 +764,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = omitDefault(message.syntaxVersion); return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -950,7 +950,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1038,7 +1038,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1148,8 +1148,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1267,7 +1267,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1467,7 +1467,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1596,8 +1596,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1768,9 +1768,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1937,12 +1937,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts index 9bae1d8305..f2e107fe27 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -212,8 +212,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -369,7 +369,7 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -500,10 +500,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts index fa841dfdba..89ee004ac9 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts @@ -1,7 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -460,18 +460,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -565,8 +565,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputv3/google/api/http.ts b/__fixtures__/v-next/outputv3/google/api/http.ts index 15d802b87b..3598d9ab64 100644 --- a/__fixtures__/v-next/outputv3/google/api/http.ts +++ b/__fixtures__/v-next/outputv3/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -1114,7 +1114,7 @@ export const Http = { } else { obj.rules = []; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -1322,15 +1322,15 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = omitDefault(message.selector); + obj.get = omitDefault(message.get); + obj.put = omitDefault(message.put); + obj.post = omitDefault(message.post); + obj.delete = omitDefault(message.delete); + obj.patch = omitDefault(message.patch); obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = omitDefault(message.body); + obj.response_body = omitDefault(message.responseBody); if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { @@ -1429,8 +1429,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = omitDefault(message.kind); + obj.path = omitDefault(message.path); return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputv3/google/api/httpbody.ts b/__fixtures__/v-next/outputv3/google/api/httpbody.ts index 6518e768b7..4eb5088a58 100644 --- a/__fixtures__/v-next/outputv3/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv3/google/api/httpbody.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -268,7 +268,7 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = omitDefault(message.contentType); obj.data = message.data; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv3/google/api/label.ts b/__fixtures__/v-next/outputv3/google/api/label.ts index e6a5bdd780..0b1dd91e82 100644 --- a/__fixtures__/v-next/outputv3/google/api/label.ts +++ b/__fixtures__/v-next/outputv3/google/api/label.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -163,9 +163,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = message.valueType; - obj.description = message.description; + obj.key = omitDefault(message.key); + obj.value_type = omitDefault(message.valueType); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputv3/google/api/log.ts b/__fixtures__/v-next/outputv3/google/api/log.ts index 8001332f34..7f0e5949ff 100644 --- a/__fixtures__/v-next/outputv3/google/api/log.ts +++ b/__fixtures__/v-next/outputv3/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -205,14 +205,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.description = message.description; - obj.display_name = message.displayName; + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputv3/google/api/logging.ts b/__fixtures__/v-next/outputv3/google/api/logging.ts index 5b684b5d7c..a8ba5862c4 100644 --- a/__fixtures__/v-next/outputv3/google/api/logging.ts +++ b/__fixtures__/v-next/outputv3/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -392,7 +392,7 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.logs) { obj.logs = message.logs.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/metric.ts b/__fixtures__/v-next/outputv3/google/api/metric.ts index d1c7990452..f97e647a11 100644 --- a/__fixtures__/v-next/outputv3/google/api/metric.ts +++ b/__fixtures__/v-next/outputv3/google/api/metric.ts @@ -2,7 +2,7 @@ import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -832,20 +832,20 @@ export const MetricDescriptor = { }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.metric_kind = message.metricKind; - obj.value_type = message.valueType; - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = omitDefault(message.metricKind); + obj.value_type = omitDefault(message.valueType); + obj.unit = omitDefault(message.unit); + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { @@ -961,7 +961,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -1056,8 +1056,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1183,7 +1183,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts index 47e171621b..27d9401747 100644 --- a/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts @@ -2,7 +2,7 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from ". import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Struct, StructAmino, StructSDKType } from "../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -467,16 +467,16 @@ export const MonitoredResourceDescriptor = { }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.display_name = omitDefault(message.displayName); + obj.description = omitDefault(message.description); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -569,8 +569,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -696,7 +696,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -795,8 +795,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputv3/google/api/monitoring.ts b/__fixtures__/v-next/outputv3/google/api/monitoring.ts index f32f41035a..6b0ccf52ff 100644 --- a/__fixtures__/v-next/outputv3/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv3/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -465,7 +465,7 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/quota.ts b/__fixtures__/v-next/outputv3/google/api/quota.ts index 6c3d730211..96fd994746 100644 --- a/__fixtures__/v-next/outputv3/google/api/quota.ts +++ b/__fixtures__/v-next/outputv3/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, isObject } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -704,8 +704,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -831,7 +831,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -932,8 +932,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1169,21 +1169,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; - obj.duration = message.duration; - obj.metric = message.metric; - obj.unit = message.unit; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.default_limit = omitDefault(message.defaultLimit); + obj.max_limit = omitDefault(message.maxLimit); + obj.free_tier = omitDefault(message.freeTier); + obj.duration = omitDefault(message.duration); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputv3/google/api/resource.ts b/__fixtures__/v-next/outputv3/google/api/resource.ts index f0da1bf2c5..d08dffd280 100644 --- a/__fixtures__/v-next/outputv3/google/api/resource.ts +++ b/__fixtures__/v-next/outputv3/google/api/resource.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -694,16 +694,16 @@ export const ResourceDescriptor = { }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { obj.pattern = []; } - obj.name_field = message.nameField; - obj.history = message.history; - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = omitDefault(message.nameField); + obj.history = omitDefault(message.history); + obj.plural = omitDefault(message.plural); + obj.singular = omitDefault(message.singular); if (message.style) { obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); } else { @@ -802,8 +802,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = omitDefault(message.type); + obj.child_type = omitDefault(message.childType); return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputv3/google/api/routing.ts b/__fixtures__/v-next/outputv3/google/api/routing.ts index 48febb5352..6128675b10 100644 --- a/__fixtures__/v-next/outputv3/google/api/routing.ts +++ b/__fixtures__/v-next/outputv3/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -1422,8 +1422,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = message.field; - obj.path_template = message.pathTemplate; + obj.field = omitDefault(message.field); + obj.path_template = omitDefault(message.pathTemplate); return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputv3/google/api/service.ts b/__fixtures__/v-next/outputv3/google/api/service.ts index fa940a4b83..cb8aa29aec 100644 --- a/__fixtures__/v-next/outputv3/google/api/service.ts +++ b/__fixtures__/v-next/outputv3/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersAmino, SystemParametersSDKType } from import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueAmino, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -783,10 +783,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; - obj.producer_project_id = message.producerProjectId; - obj.id = message.id; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.id = omitDefault(message.id); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts index e9ab0462d3..a56fb67357 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,6 @@ import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -362,9 +362,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.detail = omitDefault(message.detail); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts index 182170f855..c6c1cc98ff 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -520,11 +520,11 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.minimum = message.minimum; - obj.maximum = message.maximum; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.minimum = omitDefault(message.minimum); + obj.maximum = omitDefault(message.maximum); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { @@ -644,9 +644,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -753,9 +753,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts index 1d06492261..bf29cf9546 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -438,21 +438,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts index 5dd7f48b46..6432508984 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts @@ -4,7 +4,7 @@ import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "./http_reques import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { Struct, StructAmino, StructSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; @@ -382,8 +382,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -629,7 +629,7 @@ export const LogEntry = { fromAmino(object: LogEntryAmino): LogEntry { return { name: object.name, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, trace: object.trace, @@ -649,12 +649,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timestamp = message.timestamp; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = omitDefault(message.trace); + obj.insert_id = omitDefault(message.insertId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -662,7 +662,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -785,10 +785,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -897,9 +897,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts index ccbabb67a1..e3f306b9a0 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/timestamp"; import { Distribution, DistributionAmino, DistributionSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; @@ -229,8 +229,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -427,8 +427,8 @@ export const MetricValue = { acc[key] = String(value); return acc; }, {}) : {}, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, boolValue: object?.bool_value, int64Value: object?.int64_value ? BigInt(object.int64_value) : undefined, doubleValue: object?.double_value, @@ -446,10 +446,10 @@ export const MetricValue = { } obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -552,7 +552,7 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts index 8973a207d4..5849a5f65b 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts @@ -3,7 +3,7 @@ import { MetricValueSet, MetricValueSetAmino, MetricValueSetSDKType } from "./me import { LogEntry, LogEntryAmino, LogEntrySDKType } from "./log_entry"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -328,8 +328,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -567,8 +567,8 @@ export const Operation = { operationId: object.operation_id, operationName: object.operation_name, consumerId: object.consumer_id, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -583,9 +583,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.operation_name = omitDefault(message.operationName); + obj.consumer_id = omitDefault(message.consumerId); obj.start_time = message.startTime; obj.end_time = message.endTime; obj.labels = {}; @@ -604,7 +604,7 @@ export const Operation = { } else { obj.log_entries = []; } - obj.importance = message.importance; + obj.importance = omitDefault(message.importance); if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts index 5e9a039347..1758ecf285 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts @@ -1,7 +1,7 @@ import { MetricValueSet, MetricValueSetAmino, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -586,9 +586,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -681,8 +681,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -868,9 +868,9 @@ export const QuotaOperation = { }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.method_name = omitDefault(message.methodName); + obj.consumer_id = omitDefault(message.consumerId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -882,7 +882,7 @@ export const QuotaOperation = { } else { obj.quota_metrics = []; } - obj.quota_mode = message.quotaMode; + obj.quota_mode = omitDefault(message.quotaMode); return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -1018,7 +1018,7 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { @@ -1029,7 +1029,7 @@ export const AllocateQuotaResponse = { } else { obj.quota_metrics = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1151,9 +1151,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.description = message.description; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts index 721ab43f5a..fb267fa11e 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts @@ -2,7 +2,7 @@ import { Operation, OperationAmino, OperationSDKType } from "./operation"; import { CheckError, CheckErrorAmino, CheckErrorSDKType } from "./check_error"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -564,9 +564,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -709,14 +709,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { obj.check_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -937,9 +937,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.project_number = omitDefault(message.projectNumber); + obj.type = omitDefault(message.type); + obj.consumer_number = omitDefault(message.consumerNumber); return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { @@ -1054,13 +1054,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { obj.operations = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1180,8 +1180,8 @@ export const ReportResponse = { } else { obj.report_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1277,7 +1277,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts index d66d15ca88..7bb71c41df 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextAmino, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -411,15 +411,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { obj.resources = []; } - obj.flags = message.flags; + obj.flags = omitDefault(message.flags); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -552,11 +552,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.permission = omitDefault(message.permission); + obj.container = omitDefault(message.container); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -649,8 +649,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -899,8 +899,8 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts index 096bd3aa39..47dbe15eb5 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/timestamp"; import { ConfigChange, ConfigChangeAmino, ConfigChangeSDKType } from "../../config_change"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -908,8 +908,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = omitDefault(message.serviceName); + obj.producer_project_id = omitDefault(message.producerProjectId); return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -1040,7 +1040,7 @@ export const OperationMetadata = { resourceNames: Array.isArray(object?.resource_names) ? object.resource_names.map((e: any) => e) : [], steps: Array.isArray(object?.steps) ? object.steps.map((e: any) => OperationMetadata_Step.fromAmino(e)) : [], progressPercentage: object.progress_percentage, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: OperationMetadata): OperationMetadataAmino { @@ -1055,7 +1055,7 @@ export const OperationMetadata = { } else { obj.steps = []; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = omitDefault(message.progressPercentage); obj.start_time = message.startTime; return obj; }, @@ -1150,8 +1150,8 @@ export const OperationMetadata_Step = { }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = message.status; + obj.description = omitDefault(message.description); + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1258,9 +1258,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = message.kind; - obj.message = message.message; + obj.location = omitDefault(message.location); + obj.kind = omitDefault(message.kind); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1362,7 +1362,7 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { @@ -1474,9 +1474,9 @@ export const ConfigFile = { }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = omitDefault(message.filePath); obj.file_contents = message.fileContents; - obj.file_type = message.fileType; + obj.file_type = omitDefault(message.fileType); return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1557,7 +1557,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1803,7 +1803,7 @@ export const Rollout = { fromAmino(object: RolloutAmino): Rollout { return { rolloutId: object.rollout_id, - createTime: object.create_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, createdBy: object.created_by, status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: object?.traffic_percent_strategy ? Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy) : undefined, @@ -1813,13 +1813,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = omitDefault(message.rolloutId); obj.create_time = message.createTime; - obj.created_by = message.createdBy; - obj.status = message.status; + obj.created_by = omitDefault(message.createdBy); + obj.status = omitDefault(message.status); obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1912,8 +1912,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts index 26641fc3fb..4c5faea8a7 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts @@ -2,7 +2,7 @@ import { ManagedService, ManagedServiceAmino, ManagedServiceSDKType, ConfigSourc import { Service, ServiceAmino, ServiceSDKType } from "../../service"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -851,10 +851,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.consumer_id = omitDefault(message.consumerId); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -961,7 +961,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1042,7 +1042,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1206,7 +1206,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1287,7 +1287,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1477,9 +1477,9 @@ export const GetServiceConfigRequest = { }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = message.view; + obj.service_name = omitDefault(message.serviceName); + obj.config_id = omitDefault(message.configId); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1586,9 +1586,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1695,7 +1695,7 @@ export const ListServiceConfigsResponse = { } else { obj.service_configs = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1791,7 +1791,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1901,9 +1901,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = omitDefault(message.validateOnly); return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -2082,7 +2082,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -2203,10 +2203,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2313,7 +2313,7 @@ export const ListServiceRolloutsResponse = { } else { obj.rollouts = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2407,8 +2407,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = omitDefault(message.serviceName); + obj.rollout_id = omitDefault(message.rolloutId); return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2643,8 +2643,8 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = omitDefault(message.serviceName); + obj.id = omitDefault(message.id); if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts index 0b3d94323c..404e5e11c1 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -363,10 +363,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -598,8 +598,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts index b3368dc6b0..f72cf07103 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts @@ -1,6 +1,6 @@ import { Service, ServiceAmino, ServiceSDKType } from "./resources"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -633,7 +633,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -823,9 +823,9 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = message.checkIfServiceHasUsage; + obj.name = omitDefault(message.name); + obj.disable_dependent_services = omitDefault(message.disableDependentServices); + obj.check_if_service_has_usage = omitDefault(message.checkIfServiceHasUsage); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -989,7 +989,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1109,10 +1109,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1219,7 +1219,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1321,7 +1321,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -1539,8 +1539,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = omitDefault(message.serviceId); + obj.error_message = omitDefault(message.errorMessage); return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1642,7 +1642,7 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.names) { obj.names = message.names.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts index 88d1af0b79..6b6d7e69a4 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointAmino, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorAmino, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringAmino, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -1177,10 +1177,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1412,8 +1412,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { @@ -1688,9 +1688,9 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.display_name = omitDefault(message.displayName); if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { @@ -1701,7 +1701,7 @@ export const ConsumerQuotaMetric = { } else { obj.descendant_consumer_quota_limits = []; } - obj.unit = message.unit; + obj.unit = omitDefault(message.unit); return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1855,11 +1855,11 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.is_precise = omitDefault(message.isPrecise); + obj.allows_admin_overrides = omitDefault(message.allowsAdminOverrides); if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { @@ -1957,8 +1957,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -2146,8 +2146,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = omitDefault(message.effectiveLimit); + obj.default_limit = omitDefault(message.defaultLimit); obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2249,8 +2249,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2430,17 +2430,17 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.override_value = omitDefault(message.overrideValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.admin_override_ancestor = omitDefault(message.adminOverrideAncestor); return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2626,8 +2626,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2807,17 +2807,17 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.policy_value = omitDefault(message.policyValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2911,8 +2911,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = omitDefault(message.email); + obj.unique_id = omitDefault(message.uniqueId); return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts index 1177f72e92..bfaa3fd5fc 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,7 +1,7 @@ import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideAmino, QuotaOverrideSDKType, QuotaSafetyCheck, QuotaSafetyCheckSDKType, OverrideInlineSource, OverrideInlineSourceAmino, OverrideInlineSourceSDKType, Service, ServiceAmino, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricAmino, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicyAmino, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentityAmino, ServiceIdentitySDKType, quotaViewFromJSON, quotaViewToJSON, quotaSafetyCheckFromJSON, quotaSafetyCheckToJSON } from "./resources"; import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../../protobuf/field_mask"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -1627,7 +1627,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1708,7 +1708,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1789,7 +1789,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1909,10 +1909,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -2019,7 +2019,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -2121,7 +2121,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -2246,10 +2246,10 @@ export const ListConsumerQuotaMetricsRequest = { }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = message.view; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -2356,7 +2356,7 @@ export const ListConsumerQuotaMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -2450,8 +2450,8 @@ export const GetConsumerQuotaMetricRequest = { }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -2545,8 +2545,8 @@ export const GetConsumerQuotaLimitRequest = { }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2685,9 +2685,9 @@ export const CreateAdminOverrideRequest = { }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -2846,9 +2846,9 @@ export const UpdateAdminOverrideRequest = { }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -2978,8 +2978,8 @@ export const DeleteAdminOverrideRequest = { }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3091,9 +3091,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -3200,7 +3200,7 @@ export const ListAdminOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -3432,9 +3432,9 @@ export const ImportAdminOverridesRequest = { }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3735,9 +3735,9 @@ export const CreateConsumerOverrideRequest = { }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3896,9 +3896,9 @@ export const UpdateConsumerOverrideRequest = { }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -4028,8 +4028,8 @@ export const DeleteConsumerOverrideRequest = { }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -4141,9 +4141,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -4250,7 +4250,7 @@ export const ListConsumerOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -4482,9 +4482,9 @@ export const ImportConsumerOverridesRequest = { }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -5076,7 +5076,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -5173,7 +5173,7 @@ export const GetServiceIdentityResponse = { toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputv3/google/api/system_parameter.ts b/__fixtures__/v-next/outputv3/google/api/system_parameter.ts index 489518920e..608ef905db 100644 --- a/__fixtures__/v-next/outputv3/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv3/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -394,7 +394,7 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { @@ -506,9 +506,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = message.name; - obj.http_header = message.httpHeader; - obj.url_query_parameter = message.urlQueryParameter; + obj.name = omitDefault(message.name); + obj.http_header = omitDefault(message.httpHeader); + obj.url_query_parameter = omitDefault(message.urlQueryParameter); return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputv3/google/api/usage.ts b/__fixtures__/v-next/outputv3/google/api/usage.ts index 1396a92955..555ef88caa 100644 --- a/__fixtures__/v-next/outputv3/google/api/usage.ts +++ b/__fixtures__/v-next/outputv3/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -329,7 +329,7 @@ export const Usage = { } else { obj.rules = []; } - obj.producer_notification_channel = message.producerNotificationChannel; + obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -436,9 +436,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.allow_unregistered_calls = message.allowUnregisteredCalls; - obj.skip_service_control = message.skipServiceControl; + obj.selector = omitDefault(message.selector); + obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); + obj.skip_service_control = omitDefault(message.skipServiceControl); return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputv3/google/api/visibility.ts b/__fixtures__/v-next/outputv3/google/api/visibility.ts index e04a9fbe5f..336322e08d 100644 --- a/__fixtures__/v-next/outputv3/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv3/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -344,8 +344,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.restriction = message.restriction; + obj.selector = omitDefault(message.selector); + obj.restriction = omitDefault(message.restriction); return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts index af1be6b307..8f589c01c7 100644 --- a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -442,21 +442,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts index daf59a5625..c1da059784 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts @@ -5,7 +5,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/time import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../type/log_severity"; import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "../type/http_request"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; @@ -614,8 +614,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -929,8 +929,8 @@ export const LogEntry = { protoPayload: object?.proto_payload ? Any.fromAmino(object.proto_payload) : undefined, textPayload: object?.text_payload, jsonPayload: object?.json_payload ? Struct.fromAmino(object.json_payload) : undefined, - timestamp: object.timestamp, - receiveTimestamp: object.receive_timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, + receiveTimestamp: object?.receive_timestamp ? Timestamp.fromAmino(object.receive_timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: object.insert_id, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, @@ -950,15 +950,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp; obj.receive_timestamp = message.receiveTimestamp; - obj.severity = message.severity; - obj.insert_id = message.insertId; + obj.severity = omitDefault(message.severity); + obj.insert_id = omitDefault(message.insertId); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -967,9 +967,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = omitDefault(message.trace); + obj.span_id = omitDefault(message.spanId); + obj.trace_sampled = omitDefault(message.traceSampled); obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -1091,10 +1091,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1203,9 +1203,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1312,9 +1312,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = omitDefault(message.uid); + obj.index = omitDefault(message.index); + obj.total_splits = omitDefault(message.totalSplits); return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts index db20f71b83..0b8f9abc9a 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts @@ -3,7 +3,7 @@ import { LogEntry, LogEntryAmino, LogEntrySDKType } from "./log_entry"; import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { Status, StatusAmino, StatusSDKType } from "../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -1013,7 +1013,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -1106,8 +1106,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -1295,7 +1295,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -1308,8 +1308,8 @@ export const WriteLogEntriesRequest = { } else { obj.entries = []; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = omitDefault(message.partialSuccess); + obj.dry_run = omitDefault(message.dryRun); return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1468,7 +1468,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1733,10 +1733,10 @@ export const ListLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = omitDefault(message.filter); + obj.order_by = omitDefault(message.orderBy); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1843,7 +1843,7 @@ export const ListLogEntriesResponse = { } else { obj.entries = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1937,8 +1937,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -2045,7 +2045,7 @@ export const ListMonitoredResourceDescriptorsResponse = { } else { obj.resource_descriptors = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -2173,9 +2173,9 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { @@ -2287,7 +2287,7 @@ export const ListLogsResponse = { } else { obj.log_names = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2409,7 +2409,7 @@ export const TailLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2623,8 +2623,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.suppressed_count = message.suppressedCount; + obj.reason = omitDefault(message.reason); + obj.suppressed_count = omitDefault(message.suppressedCount); return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts index 2ebec8050b..59260c6b23 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts @@ -1,7 +1,7 @@ import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -3198,8 +3198,8 @@ export const LogBucket = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, retentionDays: object.retention_days, locked: object.locked, lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : -1, @@ -3209,13 +3209,13 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = message.lifecycleState; + obj.retention_days = omitDefault(message.retentionDays); + obj.locked = omitDefault(message.locked); + obj.lifecycle_state = omitDefault(message.lifecycleState); if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { @@ -3347,18 +3347,18 @@ export const LogView = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, filter: object.filter }; }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -3586,25 +3586,25 @@ export const LogSink = { writerIdentity: object.writer_identity, includeChildren: object.include_children, bigqueryOptions: object?.bigquery_options ? BigQueryOptions.fromAmino(object.bigquery_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.destination = omitDefault(message.destination); + obj.filter = omitDefault(message.filter); + obj.description = omitDefault(message.description); + obj.disabled = omitDefault(message.disabled); if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { obj.exclusions = []; } - obj.output_version_format = message.outputVersionFormat; - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = omitDefault(message.outputVersionFormat); + obj.writer_identity = omitDefault(message.writerIdentity); + obj.include_children = omitDefault(message.includeChildren); obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; @@ -3701,8 +3701,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = omitDefault(message.usePartitionedTables); + obj.uses_timestamp_column_partitioning = omitDefault(message.usesTimestampColumnPartitioning); return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -3809,9 +3809,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -3918,7 +3918,7 @@ export const ListBucketsResponse = { } else { obj.buckets = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -4027,8 +4027,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = omitDefault(message.parent); + obj.bucket_id = omitDefault(message.bucketId); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -4140,7 +4140,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -4223,7 +4223,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -4304,7 +4304,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -4385,7 +4385,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -4492,9 +4492,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -4601,7 +4601,7 @@ export const ListViewsResponse = { } else { obj.views = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -4710,8 +4710,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = omitDefault(message.parent); + obj.view_id = omitDefault(message.viewId); obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -4823,7 +4823,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -4906,7 +4906,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -4987,7 +4987,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -5094,9 +5094,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -5203,7 +5203,7 @@ export const ListSinksResponse = { } else { obj.sinks = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -5284,7 +5284,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -5393,9 +5393,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -5519,9 +5519,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -5603,7 +5603,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -5743,16 +5743,16 @@ export const LogExclusion = { description: object.description, filter: object.filter, disabled: object.disabled, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.create_time = message.createTime; obj.update_time = message.updateTime; return obj; @@ -5861,9 +5861,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -5970,7 +5970,7 @@ export const ListExclusionsResponse = { } else { obj.exclusions = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -6051,7 +6051,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -6147,7 +6147,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -6259,7 +6259,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6342,7 +6342,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -6423,7 +6423,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -6534,7 +6534,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6643,9 +6643,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.service_account_id = omitDefault(message.serviceAccountId); return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -6726,7 +6726,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -6837,7 +6837,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6972,11 +6972,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.kms_service_account_id = omitDefault(message.kmsServiceAccountId); + obj.storage_location = omitDefault(message.storageLocation); + obj.disable_default_sink = omitDefault(message.disableDefaultSink); return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -7083,9 +7083,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.destination = omitDefault(message.destination); return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -7235,8 +7235,8 @@ export const CopyLogEntriesMetadata = { }, fromAmino(object: CopyLogEntriesMetadataAmino): CopyLogEntriesMetadata { return { - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: object.cancellation_requested, request: object?.request ? CopyLogEntriesRequest.fromAmino(object.request) : undefined, @@ -7248,11 +7248,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.state = message.state; - obj.cancellation_requested = message.cancellationRequested; + obj.state = omitDefault(message.state); + obj.cancellation_requested = omitDefault(message.cancellationRequested); obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = omitDefault(message.progress); + obj.writer_identity = omitDefault(message.writerIdentity); return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { @@ -7335,7 +7335,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = omitDefault(message.logEntriesCopiedCount); return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts index 3477f06f05..7c84a2ca78 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts @@ -2,7 +2,7 @@ import { MetricDescriptor, MetricDescriptorAmino, MetricDescriptorSDKType } from import { Distribution_BucketOptions } from "../../api/distribution"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -679,8 +679,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -920,19 +920,19 @@ export const LogMetric = { return acc; }, {}) : {}, bucketOptions: object?.bucket_options ? Distribution_BucketOptions.fromAmino(object.bucket_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = omitDefault(message.valueExtractor); obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -942,7 +942,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -1049,9 +1049,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -1158,7 +1158,7 @@ export const ListLogMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1239,7 +1239,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1335,7 +1335,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1432,7 +1432,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1514,7 +1514,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputv3/google/longrunning/operations.ts b/__fixtures__/v-next/outputv3/google/longrunning/operations.ts index 3e21f3f930..202a72c81f 100644 --- a/__fixtures__/v-next/outputv3/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv3/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { Status, StatusAmino, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -481,9 +481,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = message.done; + obj.done = omitDefault(message.done); obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -566,7 +566,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -686,10 +686,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -796,7 +796,7 @@ export const ListOperationsResponse = { } else { obj.operations = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -877,7 +877,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -958,7 +958,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -1054,7 +1054,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1149,8 +1149,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = omitDefault(message.responseType); + obj.metadata_type = omitDefault(message.metadataType); return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/any.ts b/__fixtures__/v-next/outputv3/google/protobuf/any.ts index be2b531bba..6486151064 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/any.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/__fixtures__/v-next/outputv3/google/protobuf/api.ts b/__fixtures__/v-next/outputv3/google/protobuf/api.ts index 6457e12ed3..cce73cd67b 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/api.ts @@ -1,7 +1,7 @@ import { Option, OptionAmino, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJSON } from "./type"; import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -625,7 +625,7 @@ export const Api = { }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { @@ -636,14 +636,14 @@ export const Api = { } else { obj.options = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { obj.mixins = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -810,17 +810,17 @@ export const Method = { }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = omitDefault(message.name); + obj.request_type_url = omitDefault(message.requestTypeUrl); + obj.request_streaming = omitDefault(message.requestStreaming); + obj.response_type_url = omitDefault(message.responseTypeUrl); + obj.response_streaming = omitDefault(message.responseStreaming); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -914,8 +914,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = omitDefault(message.name); + obj.root = omitDefault(message.root); return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts index 7a48e3641d..979bc9bad3 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -390,10 +390,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = message.major; - obj.minor = message.minor; - obj.patch = message.patch; - obj.suffix = message.suffix; + obj.major = omitDefault(message.major); + obj.minor = omitDefault(message.minor); + obj.patch = omitDefault(message.patch); + obj.suffix = omitDefault(message.suffix); return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -536,7 +536,7 @@ export const CodeGeneratorRequest = { } else { obj.file_to_generate = []; } - obj.parameter = message.parameter; + obj.parameter = omitDefault(message.parameter); if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { @@ -644,7 +644,7 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { @@ -756,9 +756,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = message.name; - obj.insertion_point = message.insertionPoint; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.insertion_point = omitDefault(message.insertionPoint); + obj.content = omitDefault(message.content); return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts index 75024ce553..9a61ec8a99 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -2573,8 +2573,8 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = omitDefault(message.name); + obj.package = omitDefault(message.package); if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { @@ -2612,7 +2612,7 @@ export const FileDescriptorProto = { } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2876,7 +2876,7 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { @@ -3026,8 +3026,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3122,8 +3122,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3416,15 +3416,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = message.label; - obj.type = message.type; - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.label = omitDefault(message.label); + obj.type = omitDefault(message.type); + obj.type_name = omitDefault(message.typeName); + obj.extendee = omitDefault(message.extendee); + obj.default_value = omitDefault(message.defaultValue); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.json_name = omitDefault(message.jsonName); obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3521,7 +3521,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3681,7 +3681,7 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { @@ -3791,8 +3791,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3901,8 +3901,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4020,7 +4020,7 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { @@ -4174,12 +4174,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = omitDefault(message.name); + obj.input_type = omitDefault(message.inputType); + obj.output_type = omitDefault(message.outputType); obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = omitDefault(message.clientStreaming); + obj.server_streaming = omitDefault(message.serverStreaming); return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4528,26 +4528,26 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = message.optimizeFor; - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = omitDefault(message.javaPackage); + obj.java_outer_classname = omitDefault(message.javaOuterClassname); + obj.java_multiple_files = omitDefault(message.javaMultipleFiles); + obj.java_generate_equals_and_hash = omitDefault(message.javaGenerateEqualsAndHash); + obj.java_string_check_utf8 = omitDefault(message.javaStringCheckUtf8); + obj.optimize_for = omitDefault(message.optimizeFor); + obj.go_package = omitDefault(message.goPackage); + obj.cc_generic_services = omitDefault(message.ccGenericServices); + obj.java_generic_services = omitDefault(message.javaGenericServices); + obj.py_generic_services = omitDefault(message.pyGenericServices); + obj.php_generic_services = omitDefault(message.phpGenericServices); + obj.deprecated = omitDefault(message.deprecated); + obj.cc_enable_arenas = omitDefault(message.ccEnableArenas); + obj.objc_class_prefix = omitDefault(message.objcClassPrefix); + obj.csharp_namespace = omitDefault(message.csharpNamespace); + obj.swift_prefix = omitDefault(message.swiftPrefix); + obj.php_class_prefix = omitDefault(message.phpClassPrefix); + obj.php_namespace = omitDefault(message.phpNamespace); + obj.php_metadata_namespace = omitDefault(message.phpMetadataNamespace); + obj.ruby_package = omitDefault(message.rubyPackage); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4693,10 +4693,10 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = omitDefault(message.messageSetWireFormat); + obj.no_standard_descriptor_accessor = omitDefault(message.noStandardDescriptorAccessor); + obj.deprecated = omitDefault(message.deprecated); + obj.map_entry = omitDefault(message.mapEntry); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4868,12 +4868,12 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = message.ctype; - obj.packed = message.packed; - obj.jstype = message.jstype; - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = omitDefault(message.ctype); + obj.packed = omitDefault(message.packed); + obj.jstype = omitDefault(message.jstype); + obj.lazy = omitDefault(message.lazy); + obj.deprecated = omitDefault(message.deprecated); + obj.weak = omitDefault(message.weak); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5086,8 +5086,8 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = omitDefault(message.allowAlias); + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5194,7 +5194,7 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5301,7 +5301,7 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5421,8 +5421,8 @@ export const MethodOptions = { }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = message.idempotencyLevel; + obj.deprecated = omitDefault(message.deprecated); + obj.idempotency_level = omitDefault(message.idempotencyLevel); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -5603,12 +5603,12 @@ export const UninterpretedOption = { } else { obj.name = []; } - obj.identifier_value = message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.identifier_value = omitDefault(message.identifierValue); + obj.positive_int_value = omitDefault(message.positiveIntValue); + obj.negative_int_value = omitDefault(message.negativeIntValue); + obj.double_value = omitDefault(message.doubleValue); obj.string_value = message.stringValue; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = omitDefault(message.aggregateValue); return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5702,8 +5702,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = omitDefault(message.namePart); + obj.is_extension = omitDefault(message.isExtension); return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5981,8 +5981,8 @@ export const SourceCodeInfo_Location = { } else { obj.span = []; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = omitDefault(message.leadingComments); + obj.trailing_comments = omitDefault(message.trailingComments); if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { @@ -6222,9 +6222,9 @@ export const GeneratedCodeInfo_Annotation = { } else { obj.path = []; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = omitDefault(message.sourceFile); + obj.begin = omitDefault(message.begin); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/duration.ts b/__fixtures__/v-next/outputv3/google/protobuf/duration.ts index 38fd177755..bdbec663f5 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/duration.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented diff --git a/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts index 72517caaf8..25db75ce49 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -100,7 +100,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = message.fileName; + obj.file_name = omitDefault(message.fileName); return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/struct.ts b/__fixtures__/v-next/outputv3/google/protobuf/struct.ts index dac6458ba6..4acaa7d5f5 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/struct.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -287,7 +287,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -556,10 +556,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = omitDefault(message.nullValue); + obj.number_value = omitDefault(message.numberValue); + obj.string_value = omitDefault(message.stringValue); + obj.bool_value = omitDefault(message.boolValue); obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts index 895f2983d9..2faabee3d9 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, fromJsonTimestamp, omitDefault, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local diff --git a/__fixtures__/v-next/outputv3/google/protobuf/type.ts b/__fixtures__/v-next/outputv3/google/protobuf/type.ts index f16f574510..8b5d01dc0b 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/type.ts @@ -1,7 +1,7 @@ import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "./any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -650,7 +650,7 @@ export const Type = { }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { @@ -667,7 +667,7 @@ export const Type = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -873,20 +873,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = message.kind; - obj.cardinality = message.cardinality; - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = omitDefault(message.kind); + obj.cardinality = omitDefault(message.cardinality); + obj.number = omitDefault(message.number); + obj.name = omitDefault(message.name); + obj.type_url = omitDefault(message.typeUrl); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.packed = omitDefault(message.packed); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = omitDefault(message.jsonName); + obj.default_value = omitDefault(message.defaultValue); return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -1037,7 +1037,7 @@ export const Enum = { }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { @@ -1049,7 +1049,7 @@ export const Enum = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1164,8 +1164,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { @@ -1266,7 +1266,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts index e4e804cb03..c16e32f7c3 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -369,7 +369,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -450,7 +450,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -533,7 +533,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -616,7 +616,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -697,7 +697,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -778,7 +778,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -859,7 +859,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -940,7 +940,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts index 8c98b93dda..d6d03d6efe 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/time import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "google.rpc.context"; /** * This message defines the standard attribute vocabulary for Google APIs. @@ -1284,8 +1284,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1452,16 +1452,16 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.ip = omitDefault(message.ip); + obj.port = omitDefault(message.port); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = omitDefault(message.principal); + obj.region_code = omitDefault(message.regionCode); return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1581,10 +1581,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = omitDefault(message.service); + obj.operation = omitDefault(message.operation); + obj.protocol = omitDefault(message.protocol); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1735,13 +1735,13 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = omitDefault(message.principal); if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { obj.audiences = []; } - obj.presenter = message.presenter; + obj.presenter = omitDefault(message.presenter); obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); @@ -1840,8 +1840,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -2092,7 +2092,7 @@ export const AttributeContext_Request = { host: object.host, scheme: object.scheme, query: object.query, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, size: BigInt(object.size), protocol: object.protocol, reason: object.reason, @@ -2101,22 +2101,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = omitDefault(message.id); + obj.method = omitDefault(message.method); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = omitDefault(message.path); + obj.host = omitDefault(message.host); + obj.scheme = omitDefault(message.scheme); + obj.query = omitDefault(message.query); obj.time = message.time; - obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.size = omitDefault(message.size); + obj.protocol = omitDefault(message.protocol); + obj.reason = omitDefault(message.reason); obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -2210,8 +2210,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2376,14 +2376,14 @@ export const AttributeContext_Response = { acc[key] = String(value); return acc; }, {}) : {}, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, backendLatency: object?.backend_latency ? Duration.fromAmino(object.backend_latency) : undefined }; }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = omitDefault(message.code); + obj.size = omitDefault(message.size); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { @@ -2484,8 +2484,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2572,8 +2572,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2858,37 +2858,37 @@ export const AttributeContext_Resource = { return acc; }, {}) : {}, displayName: object.display_name, - createTime: object.create_time, - updateTime: object.update_time, - deleteTime: object.delete_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, + deleteTime: object?.delete_time ? Timestamp.fromAmino(object.delete_time) : undefined, etag: object.etag, location: object.location }; }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = omitDefault(message.service); + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = omitDefault(message.uid); obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); obj.create_time = message.createTime; obj.update_time = message.updateTime; obj.delete_time = message.deleteTime; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = omitDefault(message.etag); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputv3/google/rpc/error_details.ts b/__fixtures__/v-next/outputv3/google/rpc/error_details.ts index c9e98359cd..4f994ea795 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -949,7 +949,7 @@ export const DebugInfo = { } else { obj.stack_entries = []; } - obj.detail = message.detail; + obj.detail = omitDefault(message.detail); return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -1136,8 +1136,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = message.subject; - obj.description = message.description; + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -1230,8 +1230,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1370,8 +1370,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.domain = message.domain; + obj.reason = omitDefault(message.reason); + obj.domain = omitDefault(message.domain); obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1577,9 +1577,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = message.type; - obj.subject = message.subject; - obj.description = message.description; + obj.type = omitDefault(message.type); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1766,8 +1766,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = message.field; - obj.description = message.description; + obj.field = omitDefault(message.field); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1861,8 +1861,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = message.requestId; - obj.serving_data = message.servingData; + obj.request_id = omitDefault(message.requestId); + obj.serving_data = omitDefault(message.servingData); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1982,10 +1982,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = message.resourceType; - obj.resource_name = message.resourceName; - obj.owner = message.owner; - obj.description = message.description; + obj.resource_type = omitDefault(message.resourceType); + obj.resource_name = omitDefault(message.resourceName); + obj.owner = omitDefault(message.owner); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -2172,8 +2172,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = message.description; - obj.url = message.url; + obj.description = omitDefault(message.description); + obj.url = omitDefault(message.url); return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -2267,8 +2267,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = message.locale; - obj.message = message.message; + obj.locale = omitDefault(message.locale); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputv3/google/rpc/status.ts b/__fixtures__/v-next/outputv3/google/rpc/status.ts index ee0549e9ae..fe01958ec2 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -168,8 +168,8 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = message.code; - obj.message = message.message; + obj.code = omitDefault(message.code); + obj.message = omitDefault(message.message); if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/helpers.ts b/__fixtures__/v-next/outputv3/helpers.ts index f92d2b935a..b18c95df6c 100644 --- a/__fixtures__/v-next/outputv3/helpers.ts +++ b/__fixtures__/v-next/outputv3/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -255,3 +261,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts index d3bcc37b40..4659b27d0c 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -127,7 +127,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts index 1136520878..9639e31b05 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -231,7 +231,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts index 344c6550b5..6d253263ab 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -173,8 +173,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = message.path; - obj.base_denom = message.baseDenom; + obj.path = omitDefault(message.path); + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -275,8 +275,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = message.sendEnabled; - obj.receive_enabled = message.receiveEnabled; + obj.send_enabled = omitDefault(message.sendEnabled); + obj.receive_enabled = omitDefault(message.receiveEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts index e163ddffbd..6cbbd497e5 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -240,13 +240,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts index 02f810af50..ca9b84d04a 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -152,10 +152,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts index 244c9bad9c..a56b60a7bb 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts @@ -1,6 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: @@ -555,15 +555,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -739,17 +739,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = omitDefault(message.version); + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -850,8 +850,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -1036,14 +1036,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.sequence = omitDefault(message.sequence); + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); + obj.destination_port = omitDefault(message.destinationPort); + obj.destination_channel = omitDefault(message.destinationChannel); obj.data = message.data; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1172,9 +1172,9 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); obj.data = message.data; return obj; }, @@ -1277,7 +1277,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts index 443e1d4df4..b9c4b713d1 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -327,7 +327,7 @@ export const GenesisState = { } else { obj.ack_sequences = []; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = omitDefault(message.nextChannelSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -443,9 +443,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts index c005fe4ef4..48ba03eec4 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts @@ -3,7 +3,7 @@ import { Channel, ChannelAmino, ChannelSDKType, IdentifiedChannel, IdentifiedCha import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** QueryChannelRequest is the request type for the Query/Channel RPC method */ export interface QueryChannelRequest { @@ -1103,8 +1103,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1549,7 +1549,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = omitDefault(message.connection); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1783,8 +1783,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -2035,10 +2035,10 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -2170,7 +2170,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2288,9 +2288,9 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2524,8 +2524,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2774,9 +2774,9 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2892,7 +2892,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = omitDefault(message.received); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -3010,9 +3010,9 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -3276,8 +3276,8 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); @@ -3546,8 +3546,8 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { @@ -3808,8 +3808,8 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { @@ -4040,8 +4040,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { @@ -4159,7 +4159,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = omitDefault(message.nextSequenceReceive); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts index 3417e57c78..ffb8179836 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts @@ -1,7 +1,7 @@ import { Channel, ChannelAmino, ChannelSDKType, Packet, PacketAmino, PacketSDKType } from "./channel"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It @@ -634,9 +634,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -877,13 +877,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = omitDefault(message.portId); + obj.previous_channel_id = omitDefault(message.previousChannelId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -1122,13 +1122,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.counterparty_channel_id = omitDefault(message.counterpartyChannelId); + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_try = message.proofTry; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1341,11 +1341,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1530,9 +1530,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1745,11 +1745,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1954,7 +1954,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -2174,8 +2174,8 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2409,8 +2409,8 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived; obj.proof_close = message.proofClose; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2629,7 +2629,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement; obj.proof_acked = message.proofAcked; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts index e088dfe781..455b427d4a 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -387,7 +387,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -603,7 +603,7 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { @@ -736,10 +736,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.subject_client_id = omitDefault(message.subjectClientId); + obj.substitute_client_id = omitDefault(message.substituteClientId); return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -871,8 +871,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -979,8 +979,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts index a4c0962c7f..09367067fd 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -287,8 +287,8 @@ export const GenesisState = { obj.clients_metadata = []; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.create_localhost = omitDefault(message.createLocalhost); + obj.next_client_sequence = omitDefault(message.nextClientSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -499,7 +499,7 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts index 9f1916d63c..030cf59163 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -599,7 +599,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -1056,10 +1056,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.client_id = omitDefault(message.clientId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); + obj.latest_height = omitDefault(message.latestHeight); return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1282,7 +1282,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1487,7 +1487,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1575,7 +1575,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts index 472bee7776..7220733c76 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** MsgCreateClient defines a message to create an IBC client */ export interface MsgCreateClient { @@ -344,7 +344,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -531,9 +531,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -761,12 +761,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -953,9 +953,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts index 7b90f030f2..67a5e342c5 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts @@ -1,6 +1,6 @@ import { MerklePrefix, MerklePrefixAmino, MerklePrefixSDKType } from "../../commitment/v1/commitment"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * State defines if a connection is in one of the following states: @@ -476,15 +476,15 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -649,16 +649,16 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = omitDefault(message.id); + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -774,8 +774,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = omitDefault(message.clientId); + obj.connection_id = omitDefault(message.connectionId); obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -985,7 +985,7 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.paths) { obj.paths = message.paths.map(e => e); } else { @@ -1099,7 +1099,7 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); if (message.features) { obj.features = message.features.map(e => e); } else { @@ -1194,7 +1194,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = omitDefault(message.maxExpectedTimePerBlock); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts index b897a45494..569b53c618 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -165,7 +165,7 @@ export const GenesisState = { } else { obj.client_connection_paths = []; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts index debe060e28..06a0c3252e 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts @@ -3,7 +3,7 @@ import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType, IdentifiedConn import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -440,7 +440,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -870,7 +870,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -1088,7 +1088,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1326,9 +1326,9 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.connection_id = omitDefault(message.connectionId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { @@ -1460,7 +1460,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts index d60a25bc31..b6f09e7917 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts @@ -2,7 +2,7 @@ import { Counterparty, CounterpartyAmino, CounterpartySDKType, Version, VersionA import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to @@ -430,11 +430,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.delay_period = omitDefault(message.delayPeriod); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -754,11 +754,11 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = omitDefault(message.clientId); + obj.previous_connection_id = omitDefault(message.previousConnectionId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { @@ -769,7 +769,7 @@ export const MsgConnectionOpenTry = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -1053,8 +1053,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = omitDefault(message.connectionId); + obj.counterparty_connection_id = omitDefault(message.counterpartyConnectionId); obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1062,7 +1062,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1262,10 +1262,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts index 3fffafa0e7..6a3fbbe908 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts @@ -1,6 +1,6 @@ import { Order, OrderSDKType, Counterparty, CounterpartyAmino, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.port.v1"; /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ export interface QueryAppVersionRequest { @@ -188,11 +188,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = message.ordering; + obj.port_id = omitDefault(message.portId); + obj.connection_id = omitDefault(message.connectionId); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = omitDefault(message.proposedVersion); return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -293,8 +293,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = omitDefault(message.portId); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts index c1ebda88f8..706faf9d8d 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -116,7 +116,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts index fcc60158c5..13e2b65201 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/proto import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; /** * DataType defines the type of solo machine proof being created. This is done @@ -755,10 +755,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.frozen_sequence = omitDefault(message.frozenSequence); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -877,8 +877,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -1024,11 +1024,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1161,8 +1161,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1294,9 +1294,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1400,7 +1400,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1544,10 +1544,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1652,7 +1652,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2464,7 +2464,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts index 1c5e52b3d0..157e0944df 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../../google/proto import { ConnectionEnd, ConnectionEndAmino, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelAmino, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; /** * DataType defines the type of solo machine proof being created. This is done @@ -753,10 +753,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.sequence = omitDefault(message.sequence); + obj.is_frozen = omitDefault(message.isFrozen); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -875,8 +875,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -1022,11 +1022,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1159,8 +1159,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1292,9 +1292,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1398,7 +1398,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1542,10 +1542,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1650,7 +1650,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2462,7 +2462,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts index b19908de7b..28d5550f2d 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts @@ -6,7 +6,7 @@ import { MerkleRoot, MerkleRootAmino, MerkleRootSDKType } from "../../../core/co import { SignedHeader, SignedHeaderAmino, SignedHeaderSDKType } from "../../../../tendermint/types/types"; import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; /** * ClientState from Tendermint tracks the current validator set, latest height, @@ -511,7 +511,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -528,8 +528,8 @@ export const ClientState = { } else { obj.upgrade_path = []; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); + obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -638,7 +638,7 @@ export const ConsensusState = { }, fromAmino(object: ConsensusStateAmino): ConsensusState { return { - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, root: object?.root ? MerkleRoot.fromAmino(object.root) : undefined, nextValidatorsHash: object.next_validators_hash }; @@ -765,7 +765,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; @@ -1010,8 +1010,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = omitDefault(message.numerator); + obj.denominator = omitDefault(message.denominator); return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts index bfa8c35d21..e648c7c89a 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -198,7 +198,7 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts index cb9fbcfdec..95b774bc50 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** Params defines the claim module's parameters. */ export interface Params { @@ -132,7 +132,7 @@ export const Params = { }, fromAmino(object: ParamsAmino): Params { return { - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimDenom: object.claim_denom @@ -143,7 +143,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = omitDefault(message.claimDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts index 3e72ed610b..e11aeb8e7e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Action, ActionSDKType, ClaimRecord, ClaimRecordAmino, ClaimRecordSDKTyp import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryModuleAccountBalanceRequest {} @@ -576,7 +576,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -767,8 +767,8 @@ export const QueryClaimableForActionRequest = { }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = message.action; + obj.address = omitDefault(message.address); + obj.action = omitDefault(message.action); return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -956,7 +956,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts index 67532b261e..6fbee75cab 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * EpochInfo is a struct that describes the data going into @@ -297,23 +297,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts index 11faf2b20d..e48539ca14 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { @@ -298,7 +298,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -388,7 +388,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts index 66056fcc66..fed522ab23 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../../google/ import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -380,7 +380,7 @@ export const SmoothWeightChangeParams = { }, fromAmino(object: SmoothWeightChangeParamsAmino): SmoothWeightChangeParams { return { - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, initialPoolWeights: Array.isArray(object?.initial_pool_weights) ? object.initial_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [], targetPoolWeights: Array.isArray(object?.target_pool_weights) ? object.target_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [] @@ -515,8 +515,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -621,7 +621,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -802,17 +802,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts index 8da45dc761..0d570e4728 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType, PoolAsset, PoolAssetAmino, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -163,14 +163,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -260,7 +260,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index fa7238955d..823c1df540 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -188,8 +188,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -400,10 +400,10 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -415,7 +415,7 @@ export const Pool = { } else { obj.scaling_factors = []; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts index 4a2be6739d..1296d86f9f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -259,7 +259,7 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -271,8 +271,8 @@ export const MsgCreateStableswapPool = { } else { obj.scaling_factors = []; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -362,7 +362,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -495,8 +495,8 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts index 12119c6488..d982495f2a 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts @@ -7,7 +7,7 @@ import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stableswap_pool"; import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -266,7 +266,7 @@ export const GenesisState = { } else { obj.pools = []; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = omitDefault(message.nextPoolNumber); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts index 5c8512f016..d3561e878f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts @@ -9,7 +9,7 @@ import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stableswap_pool"; import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -712,7 +712,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -1169,7 +1169,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = omitDefault(message.numPools); return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1259,7 +1259,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1347,7 +1347,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1458,7 +1458,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1572,7 +1572,7 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1680,8 +1680,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1871,7 +1871,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -2051,7 +2051,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2241,7 +2241,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2442,7 +2442,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2561,7 +2561,7 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { } else { obj.tokens_out = []; } - obj.shares_out = message.sharesOut; + obj.shares_out = omitDefault(message.sharesOut); return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2677,9 +2677,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2808,7 +2808,7 @@ export const QueryPoolsWithFilterRequest = { } else { obj.min_liquidity = []; } - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3013,7 +3013,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -3150,9 +3150,9 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { @@ -3245,7 +3245,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3382,14 +3382,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_out = message.tokenOut; + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3477,7 +3477,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts index 96ed95dc10..4b44820295 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -549,9 +549,9 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -665,7 +665,7 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -807,9 +807,9 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1017,8 +1017,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -1155,14 +1155,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { obj.routes = []; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1250,7 +1250,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1353,8 +1353,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1491,13 +1491,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1586,7 +1586,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1717,10 +1717,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1808,7 +1808,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1950,11 +1950,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -2042,7 +2042,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2184,11 +2184,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.share_in_amount = omitDefault(message.shareInAmount); + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2276,7 +2276,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2407,10 +2407,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2498,7 +2498,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts index 69dcd3bf00..f9ae9a6966 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -158,9 +158,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -248,7 +248,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts index facadcc6db..889a5991d0 100644 --- a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -84,7 +84,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts index 8a4f55d515..40151daa8f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * Gauge is an object that stores and distributes yields to recipients who @@ -299,7 +299,7 @@ export const Gauge = { isPerpetual: object.is_perpetual, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over), filledEpochs: BigInt(object.filled_epochs), distributedCoins: Array.isArray(object?.distributed_coins) ? object.distributed_coins.map((e: any) => Coin.fromAmino(e)) : [] @@ -307,8 +307,8 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.id = omitDefault(message.id); + obj.is_perpetual = omitDefault(message.isPerpetual); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -316,8 +316,8 @@ export const Gauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); + obj.filled_epochs = omitDefault(message.filledEpochs); if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts index d76c3b5572..fe0bac513b 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -195,7 +195,7 @@ export const GenesisState = { } else { obj.lockable_durations = []; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = omitDefault(message.lastGaugeId); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts index 3bb0dc167f..bcb39d75e8 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -92,7 +92,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = message.distrEpochIdentifier; + obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts index 30a658560d..4ea15e20d2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestProtoMsg { @@ -624,7 +624,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1229,7 +1229,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1655,7 +1655,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1905,13 +1905,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { obj.lock_ids = []; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = omitDefault(message.endEpoch); return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts index d04bb03392..9c664d11b4 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts @@ -2,7 +2,7 @@ import { QueryCondition, QueryConditionAmino, QueryConditionSDKType } from "../l import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** MsgCreateGauge creates a gague to distribute rewards to users */ export interface MsgCreateGauge { @@ -263,14 +263,14 @@ export const MsgCreateGauge = { owner: object.owner, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over) }; }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = omitDefault(message.isPerpetual); + obj.owner = omitDefault(message.owner); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -278,7 +278,7 @@ export const MsgCreateGauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -473,8 +473,8 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.gauge_id = omitDefault(message.gaugeId); if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts index 21563d058b..a793e81614 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -135,7 +135,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = omitDefault(message.lastLockId); if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts index 9e72a52661..d24c6e69fd 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** * LockQueryType defines the type of the lock query that can @@ -390,14 +390,14 @@ export const PeriodLock = { ID: BigInt(object.ID), owner: object.owner, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [] }; }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.ID = omitDefault(message.ID); + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime; if (message.coins) { @@ -528,13 +528,13 @@ export const QueryCondition = { lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : -1, denom: object.denom, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = message.lockQueryType; - obj.denom = message.denom; + obj.lock_query_type = omitDefault(message.lockQueryType); + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp; return obj; @@ -661,14 +661,14 @@ export const SyntheticLock = { return { underlyingLockId: BigInt(object.underlying_lock_id), synthDenom: object.synth_denom, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined }; }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.underlying_lock_id = omitDefault(message.underlyingLockId); + obj.synth_denom = omitDefault(message.synthDenom); obj.end_time = message.endTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts index 811201ca33..c35397ddee 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts @@ -4,7 +4,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface ModuleBalanceRequest {} export interface ModuleBalanceRequestProtoMsg { @@ -1004,7 +1004,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -1192,7 +1192,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1380,7 +1380,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1576,12 +1576,12 @@ export const AccountLockedPastTimeRequest = { fromAmino(object: AccountLockedPastTimeRequestAmino): AccountLockedPastTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1778,12 +1778,12 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { fromAmino(object: AccountLockedPastTimeNotUnlockingOnlyRequestAmino): AccountLockedPastTimeNotUnlockingOnlyRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1980,12 +1980,12 @@ export const AccountUnlockedBeforeTimeRequest = { fromAmino(object: AccountUnlockedBeforeTimeRequestAmino): AccountUnlockedBeforeTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -2194,15 +2194,15 @@ export const AccountLockedPastTimeDenomRequest = { fromAmino(object: AccountLockedPastTimeDenomRequestAmino): AccountLockedPastTimeDenomRequest { return { owner: object.owner, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, denom: object.denom }; }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2405,7 +2405,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2494,7 +2494,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2584,7 +2584,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2764,7 +2764,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { @@ -2967,7 +2967,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3171,7 +3171,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3375,7 +3375,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3592,9 +3592,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts index 12bf79f736..3a836c52f4 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -333,7 +333,7 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -429,7 +429,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -517,7 +517,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -741,8 +741,8 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -835,7 +835,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -953,8 +953,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1043,7 +1043,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1167,8 +1167,8 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1261,7 +1261,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts index c022324276..d604ceb8a9 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -137,7 +137,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts index 1a79564c3a..243060a92f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -288,7 +288,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -389,8 +389,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = omitDefault(message.address); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -517,10 +517,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -713,18 +713,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.mint_denom = omitDefault(message.mintDenom); + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); + obj.reduction_factor = padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { obj.weighted_developer_rewards_receivers = []; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts index 3a5e99a3e2..ceac4cf532 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordAmino, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -204,8 +204,8 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -333,8 +333,8 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts index e19ee074e7..5371b73575 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -191,7 +191,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = omitDefault(message.mintedDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -400,7 +400,7 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -508,8 +508,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.gauge_id = omitDefault(message.gaugeId); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -629,8 +629,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts index 4d8b3b75da..1dc672aac9 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { DistrInfo, DistrInfoAmino, DistrInfoSDKType, Params, ParamsAmino, ParamsSDKType } from "./incentives"; import { Gauge, GaugeAmino, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -289,7 +289,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -507,9 +507,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -1193,9 +1193,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts index 3ff680ab3f..059eeea8bf 100644 --- a/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.store.v1beta1"; export interface Node { children: Child[]; @@ -232,7 +232,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index; - obj.accumulation = message.accumulation; + obj.accumulation = omitDefault(message.accumulation); return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts index 4fa2b7908c..7e1f1dfd78 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -97,7 +97,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor; + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts index b520799f5d..25c7053b62 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts @@ -5,7 +5,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "../lockup/lock"; import { DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface QueryParamsRequest {} export interface QueryParamsRequestProtoMsg { @@ -807,7 +807,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -895,7 +895,7 @@ export const AssetTypeResponse = { }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = message.assetType; + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -1154,7 +1154,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1373,10 +1373,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1672,7 +1672,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { @@ -1850,7 +1850,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -2064,9 +2064,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = omitDefault(message.valAddr); + obj.amount_sfsd = omitDefault(message.amountSfsd); + obj.osmo_equivalent = omitDefault(message.osmoEquivalent); return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -2225,7 +2225,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = omitDefault(message.totalDelegations); return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2339,9 +2339,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2529,7 +2529,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2772,8 +2772,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -3026,8 +3026,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -3228,8 +3228,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3417,7 +3417,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts index ac67db0457..71fae4570e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -330,8 +330,8 @@ export const SuperfluidAsset = { }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = message.assetType; + obj.denom = omitDefault(message.denom); + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -447,9 +447,9 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -565,9 +565,9 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.epoch_number = omitDefault(message.epochNumber); + obj.denom = omitDefault(message.denom); + obj.multiplier = padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -698,8 +698,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -804,8 +804,8 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.lock_id = omitDefault(message.lockId); + obj.intermediary_account = omitDefault(message.intermediaryAccount); return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts index 0dc6c5d9d5..1b21c441a6 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -311,9 +311,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.val_addr = message.valAddr; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -487,8 +487,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -662,8 +662,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -856,13 +856,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.coins = []; } - obj.val_addr = message.valAddr; + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -952,7 +952,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1055,8 +1055,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts index 917441ad92..656e8a97ca 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -214,8 +214,8 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { @@ -343,8 +343,8 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { @@ -494,14 +494,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { obj.ids = []; } - obj.is_overwrite = message.isOverwrite; + obj.is_overwrite = omitDefault(message.isOverwrite); return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index bf22119441..9246542440 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -98,7 +98,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts index aac7ebb65a..4a0c8b611b 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -257,7 +257,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts index af6c897598..1eff3e874c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -379,7 +379,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -557,7 +557,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts index eca791e594..81b465b0d4 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -362,8 +362,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = omitDefault(message.sender); + obj.subdenom = omitDefault(message.subdenom); return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -451,7 +451,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = omitDefault(message.newTokenDenom); return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -554,7 +554,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -729,7 +729,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -915,9 +915,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = omitDefault(message.sender); + obj.denom = omitDefault(message.denom); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -1091,7 +1091,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts index 8a3a6c2867..d307a607a9 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordAmino, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -131,7 +131,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts index a4d963ed64..e5db8afde3 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -232,15 +232,15 @@ export const ArithmeticTwapRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time, - endTime: object?.end_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined }; }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; obj.end_time = message.endTime; return obj; @@ -330,7 +330,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -454,14 +454,14 @@ export const ArithmeticTwapToNowRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; return obj; }, @@ -550,7 +550,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts index e798beadcf..494151b5fc 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -280,25 +280,25 @@ export const TwapRecord = { asset0Denom: object.asset0_denom, asset1Denom: object.asset1_denom, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, p0LastSpotPrice: object.p0_last_spot_price, p1LastSpotPrice: object.p1_last_spot_price, p0ArithmeticTwapAccumulator: object.p0_arithmetic_twap_accumulator, p1ArithmeticTwapAccumulator: object.p1_arithmetic_twap_accumulator, - lastErrorTime: object.last_error_time + lastErrorTime: object?.last_error_time ? Timestamp.fromAmino(object.last_error_time) : undefined }; }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.asset0_denom = omitDefault(message.asset0Denom); + obj.asset1_denom = omitDefault(message.asset1Denom); + obj.height = message.height; obj.time = message.time; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts index 0a1c9bac0a..ef94370948 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -117,8 +117,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts index 96d72f1f93..a3d2497a46 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -109,7 +109,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = message.basedenom; + obj.basedenom = omitDefault(message.basedenom); if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts index 082f5d4012..63a26d4bf8 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -140,8 +140,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts index 9ba0451cf8..8509af65a5 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -388,7 +388,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -491,8 +491,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; - obj.spot_price = message.spotPrice; + obj.poolID = omitDefault(message.poolID); + obj.spot_price = padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -580,7 +580,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -670,7 +670,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -829,7 +829,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = message.baseDenom; + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts index ef84dd55bf..83bf665c50 100644 --- a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts @@ -4,7 +4,7 @@ import { ProofOps, ProofOpsAmino, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsAmino, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsAmino, ValidatorParamsSDKType, VersionParams, VersionParamsAmino, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.abci"; export enum CheckTxType { NEW = 0, @@ -1755,7 +1755,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1930,9 +1930,9 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.version = omitDefault(message.version); + obj.block_version = omitDefault(message.blockVersion); + obj.p2p_version = omitDefault(message.p2pVersion); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -2026,8 +2026,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -2175,7 +2175,7 @@ export const RequestInitChain = { }, fromAmino(object: RequestInitChainAmino): RequestInitChain { return { - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, chainId: object.chain_id, consensusParams: object?.consensus_params ? ConsensusParams.fromAmino(object.consensus_params) : undefined, validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromAmino(e)) : [], @@ -2186,7 +2186,7 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); @@ -2194,7 +2194,7 @@ export const RequestInitChain = { obj.validators = []; } obj.app_state_bytes = message.appStateBytes; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = omitDefault(message.initialHeight); return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -2317,9 +2317,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data; - obj.path = message.path; - obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.path = omitDefault(message.path); + obj.height = omitDefault(message.height); + obj.prove = omitDefault(message.prove); return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2553,7 +2553,7 @@ export const RequestCheckTx = { toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx; - obj.type = message.type; + obj.type = omitDefault(message.type); return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2717,7 +2717,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -3051,9 +3051,9 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunk = omitDefault(message.chunk); return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -3160,9 +3160,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.chunk = message.chunk; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3566,7 +3566,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3647,7 +3647,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3848,10 +3848,10 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.data = omitDefault(message.data); + obj.version = omitDefault(message.version); + obj.app_version = omitDefault(message.appVersion); + obj.last_block_height = omitDefault(message.lastBlockHeight); obj.last_block_app_hash = message.lastBlockAppHash; return obj; }, @@ -3959,9 +3959,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -4275,15 +4275,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.index = omitDefault(message.index); obj.key = message.key; obj.value = message.value; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.height = omitDefault(message.height); + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4560,18 +4560,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4755,18 +4755,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4998,7 +4998,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = omitDefault(message.retainHeight); return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -5172,7 +5172,7 @@ export const ResponseOfferSnapshot = { }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -5385,7 +5385,7 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { @@ -5624,8 +5624,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -5727,7 +5727,7 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = omitDefault(message.round); if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { @@ -5834,7 +5834,7 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { @@ -5948,7 +5948,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.index = message.index; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -6072,8 +6072,8 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.height = omitDefault(message.height); + obj.index = omitDefault(message.index); obj.tx = message.tx; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -6172,7 +6172,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -6271,7 +6271,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6368,7 +6368,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = omitDefault(message.signedLastBlock); return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6501,17 +6501,17 @@ export const Evidence = { type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: object?.validator ? Validator.fromAmino(object.validator) : undefined, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, totalVotingPower: BigInt(object.total_voting_power) }; }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6646,9 +6646,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata; return obj; diff --git a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts index d7fe98e6c5..409b91374a 100644 --- a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.crypto"; export interface Proof { total: bigint; @@ -245,8 +245,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = omitDefault(message.total); + obj.index = omitDefault(message.index); obj.leaf_hash = message.leafHash; if (message.aunts) { obj.aunts = message.aunts.map(e => e); @@ -456,9 +456,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = omitDefault(message.key); + obj.input = omitDefault(message.input); + obj.output = omitDefault(message.output); return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -565,7 +565,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.key = message.key; obj.data = message.data; return obj; diff --git a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts index d876b85f9f..3563ab2584 100644 --- a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -115,7 +115,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = omitDefault(message.bits); if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts index 9df596b946..5ae75de845 100644 --- a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.p2p"; export interface ProtocolVersion { p2p: bigint; @@ -226,9 +226,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = omitDefault(message.p2p); + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { @@ -405,12 +405,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = omitDefault(message.nodeId); + obj.listen_addr = omitDefault(message.listenAddr); + obj.network = omitDefault(message.network); + obj.version = omitDefault(message.version); obj.channels = message.channels; - obj.moniker = message.moniker; + obj.moniker = omitDefault(message.moniker); obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -505,8 +505,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = omitDefault(message.txIndex); + obj.rpc_address = omitDefault(message.rpcAddress); return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -616,12 +616,12 @@ export const PeerInfo = { return { id: object.id, addressInfo: Array.isArray(object?.address_info) ? object.address_info.map((e: any) => PeerAddressInfo.fromAmino(e)) : [], - lastConnected: object.last_connected + lastConnected: object?.last_connected ? Timestamp.fromAmino(object.last_connected) : undefined }; }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { @@ -740,17 +740,17 @@ export const PeerAddressInfo = { fromAmino(object: PeerAddressInfoAmino): PeerAddressInfo { return { address: object.address, - lastDialSuccess: object.last_dial_success, - lastDialFailure: object.last_dial_failure, + lastDialSuccess: object?.last_dial_success ? Timestamp.fromAmino(object.last_dial_success) : undefined, + lastDialFailure: object?.last_dial_failure ? Timestamp.fromAmino(object.last_dial_failure) : undefined, dialFailures: object.dial_failures }; }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.last_dial_success = message.lastDialSuccess; obj.last_dial_failure = message.lastDialFailure; - obj.dial_failures = message.dialFailures; + obj.dial_failures = omitDefault(message.dialFailures); return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts index 46f8a71570..c30c84c1d6 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts @@ -2,7 +2,7 @@ import { Vote, VoteAmino, VoteSDKType, LightBlock, LightBlockAmino, LightBlockSD import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Validator, ValidatorAmino, ValidatorSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; @@ -321,15 +321,15 @@ export const DuplicateVoteEvidence = { voteB: object?.vote_b ? Vote.fromAmino(object.vote_b) : undefined, totalVotingPower: BigInt(object.total_voting_power), validatorPower: BigInt(object.validator_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.validator_power = omitDefault(message.validatorPower); obj.timestamp = message.timestamp; return obj; }, @@ -472,19 +472,19 @@ export const LightClientAttackEvidence = { commonHeight: BigInt(object.common_height), byzantineValidators: Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Validator.fromAmino(e)) : [], totalVotingPower: BigInt(object.total_voting_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = omitDefault(message.commonHeight); if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = []; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); obj.timestamp = message.timestamp; return obj; }, diff --git a/__fixtures__/v-next/outputv3/tendermint/types/params.ts b/__fixtures__/v-next/outputv3/tendermint/types/params.ts index 914ccc4085..9e31b4ee23 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -465,9 +465,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); + obj.time_iota_ms = omitDefault(message.timeIotaMs); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -580,9 +580,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -758,7 +758,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = omitDefault(message.appVersion); return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -856,8 +856,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = omitDefault(message.blockMaxBytes); + obj.block_max_gas = omitDefault(message.blockMaxGas); return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/types.ts b/__fixtures__/v-next/outputv3/tendermint/types/types.ts index a3599911e4..a6c855cbd8 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/types.ts @@ -3,7 +3,7 @@ import { Consensus, ConsensusAmino, ConsensusSDKType } from "../version/types"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../google/protobuf/timestamp"; import { ValidatorSet, ValidatorSetAmino, ValidatorSetSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -585,7 +585,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = omitDefault(message.total); obj.hash = message.hash; return obj; }, @@ -695,7 +695,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.bytes = message.bytes; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -1035,7 +1035,7 @@ export const Header = { version: object?.version ? Consensus.fromAmino(object.version) : undefined, chainId: object.chain_id, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, lastBlockId: object?.last_block_id ? BlockID.fromAmino(object.last_block_id) : undefined, lastCommitHash: object.last_commit_hash, dataHash: object.data_hash, @@ -1051,8 +1051,8 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.height = omitDefault(message.height); obj.time = message.time; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash; @@ -1324,7 +1324,7 @@ export const Vote = { height: BigInt(object.height), round: object.round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, validatorAddress: object.validator_address, validatorIndex: object.validator_index, signature: object.signature @@ -1332,13 +1332,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.validator_address = message.validatorAddress; - obj.validator_index = message.validatorIndex; + obj.validator_index = omitDefault(message.validatorIndex); obj.signature = message.signature; return obj; }, @@ -1471,8 +1471,8 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); @@ -1592,13 +1592,13 @@ export const CommitSig = { return { blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : -1, validatorAddress: object.validator_address, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = message.blockIdFlag; + obj.block_id_flag = omitDefault(message.blockIdFlag); obj.validator_address = message.validatorAddress; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -1758,16 +1758,16 @@ export const Proposal = { round: object.round, polRound: object.pol_round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); + obj.pol_round = omitDefault(message.polRound); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -2097,9 +2097,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = omitDefault(message.blockSize); obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = omitDefault(message.numTxs); return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts index 331625671f..6028292cf3 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -177,7 +177,7 @@ export const ValidatorSet = { obj.validators = []; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -305,8 +305,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -405,7 +405,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv3/tendermint/version/types.ts b/__fixtures__/v-next/outputv3/tendermint/version/types.ts index 15a6e03855..df15af4b1a 100644 --- a/__fixtures__/v-next/outputv3/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -148,8 +148,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; - obj.software = message.software; + obj.protocol = omitDefault(message.protocol); + obj.software = omitDefault(message.software); return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -247,8 +247,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts index 20b34cb7ca..533d7261bf 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts @@ -31,8 +31,8 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) @@ -62,8 +62,8 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, keys: keys }; }, diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts index 573aa1bbc9..e6f7269391 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts @@ -31,8 +31,8 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) @@ -62,8 +62,8 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner: omitDefault(owner), - auditor: omitDefault(auditor), + owner: owner, + auditor: auditor, keys: keys }; }, diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts index afd6952c83..266090cc08 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -263,8 +263,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -466,7 +466,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -573,8 +573,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = omitDefault(message.auditor); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -682,7 +682,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = omitDefault(message.auditor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts index c339da9d41..2517a6c629 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -126,8 +126,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts index dabcbff037..257a7d2b75 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -110,7 +110,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts index a903237dc4..770310d80c 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -126,8 +126,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts index 94e7f16423..1d001181c1 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** This describes how the endpoint is implemented when the lease is deployed */ export enum Endpoint_Kind { @@ -133,7 +133,7 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = message.kind; + obj.kind = omitDefault(message.kind); obj.sequence_number = message.sequenceNumber; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts index 8087e380cd..3d90abcb1e 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts @@ -1,6 +1,5 @@ /* eslint-disable */ import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { CertificateID, CertificateIDSDKType, MsgCreateCertificate, MsgCreateCertificateSDKType, MsgRevokeCertificate, MsgRevokeCertificateSDKType } from "./cert"; export interface MsgCreateCertificateAminoType extends AminoMsg { type: "akash/cert/v1beta2/testonly-create-certificate"; @@ -28,7 +27,7 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner: omitDefault(owner), + owner: owner, cert: cert, pubkey: pubkey }; @@ -52,8 +51,8 @@ export const AminoConverter = { }: MsgRevokeCertificate): MsgRevokeCertificateAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - serial: omitDefault(id.serial) + owner: id.owner, + serial: id.serial } }; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts index ddbd624a1b..3b779a9800 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts @@ -3,7 +3,7 @@ import { GroupSpec, GroupSpecSDKType, GroupID, GroupIDSDKType } from "./group"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, Exact, Rpc } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, Exact, omitDefault, Rpc } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -1012,7 +1012,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1153,7 +1153,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -1276,7 +1276,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts index bdeca84c1b..939252dfa6 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsSDKType } from "../../base/ import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, Exact } from "../../../helpers"; +import { isSet, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -744,7 +744,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, @@ -1024,7 +1024,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts index b4f4ea12bf..922bbe530b 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, Exact, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of deployment */ export enum Deployment_State { @@ -162,7 +162,7 @@ export const DeploymentID = { toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -303,7 +303,7 @@ export const Deployment = { obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; obj.state = message.state; obj.version = message.version; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { @@ -426,7 +426,7 @@ export const DeploymentFilters = { toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.state = message.state; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts index a791357f55..c1bedac918 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -190,7 +190,7 @@ export const Group = { obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; obj.state = message.state; obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts index 42e34eee18..bc19c0196d 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts @@ -111,7 +111,7 @@ export const GroupID = { toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index 73fbc73897..0e6cf7a88d 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -157,11 +157,11 @@ export const AminoConverter = { }: MsgCreateDeployment): MsgCreateDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, groups: groups.map(el0 => ({ - name: omitDefault(el0.name), + name: el0.name, requirements: { signed_by: { all_of: el0.requirements.signedBy.allOf, @@ -193,7 +193,7 @@ export const AminoConverter = { })) }, storage: el1.resources.storage.map(el2 => ({ - name: omitDefault(el2.name), + name: el2.name, quantity: { val: el2.quantity.val }, @@ -219,7 +219,7 @@ export const AminoConverter = { denom: deposit.denom, amount: deposit.amount }, - depositor: omitDefault(depositor) + depositor: depositor }; }, fromAmino: ({ @@ -306,14 +306,14 @@ export const AminoConverter = { }: MsgDepositDeployment): MsgDepositDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, amount: { denom: amount.denom, amount: amount.amount }, - depositor: omitDefault(depositor) + depositor: depositor }; }, fromAmino: ({ @@ -342,8 +342,8 @@ export const AminoConverter = { }: MsgUpdateDeployment): MsgUpdateDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() }, version: version }; @@ -368,8 +368,8 @@ export const AminoConverter = { }: MsgCloseDeployment): MsgCloseDeploymentAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString() + owner: id.owner, + dseq: id.dseq?.toString?.() } }; }, @@ -391,8 +391,8 @@ export const AminoConverter = { }: MsgCloseGroup): MsgCloseGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -416,8 +416,8 @@ export const AminoConverter = { }: MsgPauseGroup): MsgPauseGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -441,8 +441,8 @@ export const AminoConverter = { }: MsgStartGroup): MsgStartGroupAminoType["value"] => { return { id: { - owner: omitDefault(id.owner), - dseq: id.dseq.toString(), + owner: id.owner, + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts index 4eb6492d22..011598f7ce 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -182,10 +182,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -471,11 +471,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts index fb439addf5..e0c6272482 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts @@ -409,7 +409,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts index 988ed5deb2..e1c3203bd6 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -182,10 +182,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -471,11 +471,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = omitDefault(message.scope); + obj.xid = omitDefault(message.xid); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); + obj.state = omitDefault(message.state); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts index df5279c813..d72f47240e 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts @@ -452,7 +452,7 @@ export const Account = { obj.state = message.state; obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.settled_at = message.settledAt; obj.depositor = message.depositor; obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts index 3e227529a6..c4e1cc7f86 100644 --- a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, padDecimal } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -118,9 +118,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor; - obj.initial_inflation = message.initialInflation; - obj.variance = message.variance; + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); + obj.initial_inflation = padDecimal(message.initialInflation); + obj.variance = padDecimal(message.variance); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts index dfa7debe4a..fd11998792 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -651,7 +651,7 @@ export const BidID = { toAmino(message: BidID): BidIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -797,7 +797,7 @@ export const Bid = { obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -962,7 +962,7 @@ export const BidFilters = { toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts index 34e0fd92d7..e8ec975d97 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -263,7 +263,7 @@ export const LeaseID = { toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; @@ -425,8 +425,8 @@ export const Lease = { obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; obj.state = message.state; obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); + obj.closed_on = omitDefault(message.closedOn); return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -591,7 +591,7 @@ export const LeaseFilters = { toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.provider = message.provider; diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts index 2a390d9fe7..519d41b295 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -206,7 +206,7 @@ export const OrderID = { toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; return obj; @@ -351,7 +351,7 @@ export const Order = { obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; obj.state = message.state; obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = omitDefault(message.createdAt); return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -502,7 +502,7 @@ export const OrderFilters = { toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.dseq = message.dseq; obj.gseq = message.gseq; obj.oseq = message.oseq; obj.state = message.state; diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts index 31c5984835..e8401755fa 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts @@ -84,12 +84,12 @@ export const AminoConverter = { }: MsgCreateBid): MsgCreateBidAminoType["value"] => { return { order: { - owner: omitDefault(order.owner), - dseq: order.dseq.toString(), + owner: order.owner, + dseq: order.dseq?.toString?.(), gseq: order.gseq, oseq: order.oseq }, - provider: omitDefault(provider), + provider: provider, price: { denom: omitDefault(price.denom), amount: omitDefault(price.amount) @@ -132,11 +132,11 @@ export const AminoConverter = { }: MsgCloseBid): MsgCloseBidAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -161,11 +161,11 @@ export const AminoConverter = { }: MsgWithdrawLease): MsgWithdrawLeaseAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -190,11 +190,11 @@ export const AminoConverter = { }: MsgCreateLease): MsgCreateLeaseAminoType["value"] => { return { bid_id: { - owner: omitDefault(bidId.owner), - dseq: bidId.dseq.toString(), + owner: bidId.owner, + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, - provider: omitDefault(bidId.provider) + provider: bidId.provider } }; }, @@ -219,11 +219,11 @@ export const AminoConverter = { }: MsgCloseLease): MsgCloseLeaseAminoType["value"] => { return { lease_id: { - owner: omitDefault(leaseId.owner), - dseq: leaseId.dseq.toString(), + owner: leaseId.owner, + dseq: leaseId.dseq?.toString?.(), gseq: leaseId.gseq, oseq: leaseId.oseq, - provider: omitDefault(leaseId.provider) + provider: leaseId.provider } }; }, diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts index a7497ddc96..831b4eea3c 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts @@ -49,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -90,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -128,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner: omitDefault(owner) + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts index d2a861a256..d90c974036 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts @@ -49,15 +49,15 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -90,15 +90,15 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner: omitDefault(owner), - host_uri: omitDefault(hostUri), + owner: owner, + host_uri: hostUri, attributes: attributes.map(el0 => ({ key: omitDefault(el0.key), value: omitDefault(el0.value) })), info: { - email: omitDefault(info.email), - website: omitDefault(info.website) + email: info.email, + website: info.website } }; }, @@ -128,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner: omitDefault(owner) + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts index 57351ee90d..e71032f28f 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -319,7 +319,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputv4/confio/proofs.ts b/__fixtures__/v-next/outputv4/confio/proofs.ts index 77c4d1a168..323eae2b52 100644 --- a/__fixtures__/v-next/outputv4/confio/proofs.ts +++ b/__fixtures__/v-next/outputv4/confio/proofs.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "ics23"; export enum HashOp { /** NO_HASH - NO_HASH is the default if no data passed. Note this is an illegal argument some places. */ @@ -1001,10 +1001,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = message.hash; - obj.prehash_key = message.prehashKey; - obj.prehash_value = message.prehashValue; - obj.length = message.length; + obj.hash = omitDefault(message.hash); + obj.prehash_key = omitDefault(message.prehashKey); + obj.prehash_value = omitDefault(message.prehashValue); + obj.length = omitDefault(message.length); obj.prefix = message.prefix; return obj; }, @@ -1119,7 +1119,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); obj.prefix = message.prefix; obj.suffix = message.suffix; return obj; @@ -1255,8 +1255,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = omitDefault(message.maxDepth); + obj.min_depth = omitDefault(message.minDepth); return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1434,11 +1434,11 @@ export const InnerSpec = { } else { obj.child_order = []; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = omitDefault(message.childSize); + obj.min_prefix_length = omitDefault(message.minPrefixLength); + obj.max_prefix_length = omitDefault(message.maxPrefixLength); obj.empty_child = message.emptyChild; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts index a339822c81..f6f87e28dc 100644 --- a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -240,7 +240,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts index 11a70c72dd..cf7917d26e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -212,7 +212,7 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = message.goImport; + obj.go_import = omitDefault(message.goImport); if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { @@ -328,8 +328,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = message.name; - obj.revision = message.revision; + obj.name = omitDefault(message.name); + obj.revision = omitDefault(message.revision); return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -421,7 +421,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = message.module; + obj.module = omitDefault(message.module); return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts index ea11fb4837..4770d8cf5f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -167,10 +167,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -301,7 +301,7 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { @@ -464,11 +464,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = omitDefault(message.maxMemoCharacters); + obj.tx_sig_limit = omitDefault(message.txSigLimit); + obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); + obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); + obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts index ac1c95dc46..91c6dc76ae 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -410,7 +410,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -1013,7 +1013,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = message.bech32Prefix; + obj.bech32_prefix = omitDefault(message.bech32Prefix); return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1197,7 +1197,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1289,7 +1289,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = omitDefault(message.addressString); return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts index 4f22eabede..3ba6cd6247 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * GenericAuthorization gives the grantee unrestricted permissions to execute @@ -135,7 +135,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = omitDefault(message.msg); return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -238,7 +238,7 @@ export const Grant = { fromAmino(object: GrantAmino): Grant { return { authorization: object?.authorization ? Any.fromAmino(object.authorization) : undefined, - expiration: object?.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: Grant): GrantAmino { @@ -375,13 +375,13 @@ export const GrantAuthorization = { granter: object.granter, grantee: object.grantee, authorization: object?.authorization ? Any.fromAmino(object.authorization) : undefined, - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; obj.expiration = message.expiration; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts index 247930ce13..22feeea84e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -188,9 +188,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -420,7 +420,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -650,7 +650,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts index aab078faa5..332d1ef289 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -175,8 +175,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -395,7 +395,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -593,9 +593,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts index 2ac4b591c6..497e9383bb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -243,7 +243,7 @@ export const Params = { } else { obj.send_enabled = []; } - obj.default_send_enabled = message.defaultSendEnabled; + obj.default_send_enabled = omitDefault(message.defaultSendEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -349,8 +349,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = message.denom; - obj.enabled = message.enabled; + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -464,7 +464,7 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -583,7 +583,7 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -820,8 +820,8 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = message.denom; - obj.exponent = message.exponent; + obj.denom = omitDefault(message.denom); + obj.exponent = omitDefault(message.exponent); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { @@ -1024,18 +1024,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { obj.denom_units = []; } - obj.base = message.base; - obj.display = message.display; - obj.name = message.name; - obj.symbol = message.symbol; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.base = omitDefault(message.base); + obj.display = omitDefault(message.display); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts index f2c41fe484..31808e6b73 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -306,7 +306,7 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts index dec0244554..8c96e8e5df 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -345,8 +345,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = omitDefault(message.address); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -548,7 +548,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -778,7 +778,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1207,7 +1207,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1775,7 +1775,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -1977,7 +1977,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2086,7 +2086,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts index 12690f3524..c1f4021806 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -136,8 +136,8 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts index 0a8f0f32eb..b7c22a8f39 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Event, EventSDKType } from "../../../../tendermint/abci/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.abci.v1beta1"; /** * TxResponse defines a structure containing relevant tx data and metadata. The @@ -501,22 +501,22 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.height = omitDefault(message.height); + obj.txhash = omitDefault(message.txhash); + obj.codespace = omitDefault(message.codespace); + obj.code = omitDefault(message.code); + obj.data = omitDefault(message.data); + obj.raw_log = omitDefault(message.rawLog); if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { obj.logs = []; } - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = omitDefault(message.timestamp); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -650,7 +650,7 @@ export const ABCIMessageLog = { toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { @@ -769,7 +769,7 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -880,8 +880,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -991,8 +991,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1143,7 +1143,7 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data; - obj.log = message.log; + obj.log = omitDefault(message.log); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -1370,7 +1370,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = omitDefault(message.msgType); obj.data = message.data; return obj; }, @@ -1682,11 +1682,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = omitDefault(message.totalCount); + obj.count = omitDefault(message.count); + obj.page_number = omitDefault(message.pageNumber); + obj.page_total = omitDefault(message.pageTotal); + obj.limit = omitDefault(message.limit); if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts index d2f421c600..d71cedf9bb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.query.v1beta1"; /** * PageRequest is to be embedded in gRPC request messages for efficient @@ -221,10 +221,10 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.offset = omitDefault(message.offset); + obj.limit = omitDefault(message.limit); + obj.count_total = omitDefault(message.countTotal); + obj.reverse = omitDefault(message.reverse); return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { @@ -333,7 +333,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = omitDefault(message.total); return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts index ed1e7160c0..b702716741 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -287,7 +287,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = message.interfaceName; + obj.interface_name = omitDefault(message.interfaceName); return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts index 0a125868fa..9b9ab2ea27 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -576,7 +576,7 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { @@ -805,9 +805,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -899,7 +899,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1139,7 +1139,7 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { @@ -1255,8 +1255,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.type_url = message.typeUrl; + obj.fullname = omitDefault(message.fullname); + obj.type_url = omitDefault(message.typeUrl); return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1370,7 +1370,7 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = omitDefault(message.fullname); if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { @@ -1467,7 +1467,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1559,7 +1559,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = message.msgTypeUrl; + obj.msg_type_url = omitDefault(message.msgTypeUrl); return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -2793,8 +2793,8 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.is_module = message.isModule; + obj.fullname = omitDefault(message.fullname); + obj.is_module = omitDefault(message.isModule); if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { @@ -2905,8 +2905,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.full_query_path = message.fullQueryPath; + obj.name = omitDefault(message.name); + obj.full_query_path = omitDefault(message.fullQueryPath); return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts index 7b993d8f66..54de2abed5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.snapshots.v1beta1"; /** Snapshot contains Tendermint state sync snapshot info. */ export interface Snapshot { @@ -231,9 +231,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -610,7 +610,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -748,8 +748,8 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.version = omitDefault(message.version); + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -855,8 +855,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = omitDefault(message.name); + obj.format = omitDefault(message.format); return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts index 38b730524f..9ee7ace65b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * CommitInfo defines commit information used by the multi-store when committing @@ -140,7 +140,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, @@ -362,7 +362,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = omitDefault(message.version); obj.hash = message.hash; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts index 444537ee0c..1b7290bdba 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.store.v1beta1"; /** * StoreKVPair is a KVStore KVPair used for listening to state changes (Sets and Deletes) @@ -138,8 +138,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = omitDefault(message.storeKey); + obj.delete = omitDefault(message.delete); obj.key = message.key; obj.value = message.value; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts index d389d22e10..742f8b0ec0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -247,7 +247,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -380,7 +380,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -612,7 +612,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -758,10 +758,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -855,7 +855,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1315,7 +1315,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = omitDefault(message.syncing); return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1697,18 +1697,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = omitDefault(message.name); + obj.app_name = omitDefault(message.appName); + obj.version = omitDefault(message.version); + obj.git_commit = omitDefault(message.gitCommit); + obj.build_tags = omitDefault(message.buildTags); + obj.go_version = omitDefault(message.goVersion); if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { obj.build_deps = []; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1828,9 +1828,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = omitDefault(message.path); + obj.version = omitDefault(message.version); + obj.sum = omitDefault(message.sum); return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts index 87701611c4..c632be3ffc 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -138,8 +138,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -245,8 +245,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -338,7 +338,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = omitDefault(message.int); return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -430,7 +430,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = omitDefault(message.dec); return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts index 1d957f18ce..e158235ecd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -114,7 +114,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -220,8 +220,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = omitDefault(message.module); + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { diff --git a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts index 90e92260c2..bb9edbce63 100644 --- a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -114,7 +114,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -231,7 +231,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = omitDefault(message.index); if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts index aae20862bc..827dc44fce 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -112,9 +112,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = message.sender; - obj.invariant_module_name = message.invariantModuleName; - obj.invariant_route = message.invariantRoute; + obj.sender = omitDefault(message.sender); + obj.invariant_module_name = omitDefault(message.invariantModuleName); + obj.invariant_route = omitDefault(message.invariantRoute); return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts index b9882ec4dd..1d31ed5663 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -148,11 +148,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = message.purpose; - obj.coin_type = message.coinType; - obj.account = message.account; - obj.change = message.change; - obj.address_index = message.addressIndex; + obj.purpose = omitDefault(message.purpose); + obj.coin_type = omitDefault(message.coinType); + obj.account = omitDefault(message.account); + obj.change = omitDefault(message.change); + obj.address_index = omitDefault(message.addressIndex); return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts index a9c0b65774..95fc0f7912 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -206,7 +206,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -320,7 +320,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = omitDefault(message.privKeyType); return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts index b53b47ec4f..ba08085fea 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -109,7 +109,7 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts index 2ffe9ec003..49b2ea7ce1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { bytesFromBase64, base64FromBytes, DeepPartial, isSet } from "../../../../helpers"; +import { bytesFromBase64, base64FromBytes, DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig.v1beta1"; /** * MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey. @@ -222,7 +222,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = omitDefault(message.extraBitsStored); obj.elems = message.elems; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts index 54e4335ed4..0d8df0278f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -330,10 +330,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax; - obj.base_proposer_reward = message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward; - obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + obj.community_tax = padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -452,7 +452,7 @@ export const ValidatorHistoricalRewards = { } else { obj.cumulative_reward_ratio = []; } - obj.reference_count = message.referenceCount; + obj.reference_count = omitDefault(message.referenceCount); return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -573,7 +573,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = []; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -889,8 +889,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; - obj.fraction = message.fraction; + obj.validator_period = omitDefault(message.validatorPeriod); + obj.fraction = padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1240,9 +1240,9 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1371,9 +1371,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; - obj.stake = message.stake; - obj.height = message.height ? message.height.toString() : undefined; + obj.previous_period = omitDefault(message.previousPeriod); + obj.stake = padDecimal(message.stake); + obj.height = message.height; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1487,7 +1487,7 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -1640,11 +1640,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; - obj.amount = message.amount; - obj.deposit = message.deposit; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.recipient = omitDefault(message.recipient); + obj.amount = omitDefault(message.amount); + obj.deposit = omitDefault(message.deposit); return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts index a9f8f3e972..b58235d74c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, Params, ParamsSDKType, FeePool, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -236,8 +236,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -351,7 +351,7 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { @@ -464,7 +464,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -589,8 +589,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.period = omitDefault(message.period); obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -699,7 +699,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -822,8 +822,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -964,9 +964,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.height = omitDefault(message.height); + obj.period = omitDefault(message.period); obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1252,7 +1252,7 @@ export const GenesisState = { } else { obj.delegator_withdraw_infos = []; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = omitDefault(message.previousProposer); if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts index 390cebc589..ac9c5a25ac 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -503,7 +503,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -689,7 +689,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -923,9 +923,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.validator_address = omitDefault(message.validatorAddress); + obj.starting_height = omitDefault(message.startingHeight); + obj.ending_height = omitDefault(message.endingHeight); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1153,8 +1153,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1350,7 +1350,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1573,7 +1573,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1769,7 +1769,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -1861,7 +1861,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts index 3b7b18fe72..1d004480f0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -169,8 +169,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -349,8 +349,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -546,7 +546,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -769,7 +769,7 @@ export const MsgFundCommunityPool = { } else { obj.amount = []; } - obj.depositor = message.depositor; + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts index 3a5d784e1f..b60cfef4c5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * Equivocation implements the Evidence interface and defines evidence of double @@ -128,17 +128,17 @@ export const Equivocation = { fromAmino(object: EquivocationAmino): Equivocation { return { height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, power: BigInt(object.power), consensusAddress: object.consensus_address }; }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.power = omitDefault(message.power); + obj.consensus_address = omitDefault(message.consensusAddress); return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts index 058b9031ec..e6e6a83ff8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -110,7 +110,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = omitDefault(message.submitter); obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts index fbd87f7342..9f12f66521 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * BasicAllowance implements Allowance with a one-time grant of tokens @@ -175,7 +175,7 @@ export const BasicAllowance = { fromAmino(object: BasicAllowanceAmino): BasicAllowance { return { spendLimit: Array.isArray(object?.spend_limit) ? object.spend_limit.map((e: any) => Coin.fromAmino(e)) : [], - expiration: object.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: BasicAllowance): BasicAllowanceAmino { @@ -348,7 +348,7 @@ export const PeriodicAllowance = { period: object?.period ? Duration.fromAmino(object.period) : undefined, periodSpendLimit: Array.isArray(object?.period_spend_limit) ? object.period_spend_limit.map((e: any) => Coin.fromAmino(e)) : [], periodCanSpend: Array.isArray(object?.period_can_spend) ? object.period_can_spend.map((e: any) => Coin.fromAmino(e)) : [], - periodReset: object.period_reset + periodReset: object?.period_reset ? Timestamp.fromAmino(object.period_reset) : undefined }; }, toAmino(message: PeriodicAllowance): PeriodicAllowanceAmino { @@ -608,8 +608,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts index 4b2b641467..49a9d85bb6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -151,8 +151,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -354,7 +354,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = omitDefault(message.grantee); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -584,7 +584,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = omitDefault(message.granter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts index 4034439c19..11824078ec 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -140,8 +140,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, @@ -321,8 +321,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = omitDefault(message.granter); + obj.grantee = omitDefault(message.grantee); return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts index f399a1247e..70ec82465b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -212,7 +212,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts index 3b48d2ef71..40a11749a3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -358,8 +358,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -489,8 +489,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -723,23 +723,23 @@ export const Proposal = { messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [], status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time, + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined, metadata: object.metadata }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -750,7 +750,7 @@ export const Proposal = { } obj.voting_start_time = message.votingStartTime; obj.voting_end_time = message.votingEndTime; - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -884,10 +884,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1031,14 +1031,14 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1373,9 +1373,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = omitDefault(message.quorum); + obj.threshold = omitDefault(message.threshold); + obj.veto_threshold = omitDefault(message.vetoThreshold); return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts index 05478ece3a..96e89dcb3f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -258,7 +258,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -488,9 +488,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -720,8 +720,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -925,7 +925,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1139,7 +1139,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1375,8 +1375,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1580,7 +1580,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1796,7 +1796,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index e417d411e7..3ee8d1dcaa 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -139,7 +139,7 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), option: option, metadata: omitDefault(metadata) @@ -168,7 +168,7 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, @@ -202,7 +202,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), depositor: omitDefault(depositor), amount: amount.map(el0 => ({ denom: omitDefault(el0.denom), diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts index cf236bddba..2bb6c8f41c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -242,8 +242,8 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = omitDefault(message.proposer); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -337,7 +337,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -446,7 +446,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -655,10 +655,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -875,14 +875,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { obj.options = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1085,8 +1085,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts index a0262522e4..61b0d15c36 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -212,7 +212,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = omitDefault(message.startingProposalId); if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts index 681b5a70f8..7bc4a0c67f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts @@ -4,7 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -387,8 +387,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = message.option; - obj.weight = message.weight; + obj.option = omitDefault(message.option); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -494,8 +494,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -625,8 +625,8 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -840,18 +840,18 @@ export const Proposal = { content: object?.content ? Any.fromAmino(object.content) : undefined, status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - submitTime: object.submit_time, - depositEndTime: object.deposit_end_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, + depositEndTime: object?.deposit_end_time ? Timestamp.fromAmino(object.deposit_end_time) : undefined, totalDeposit: Array.isArray(object?.total_deposit) ? object.total_deposit.map((e: any) => Coin.fromAmino(e)) : [], - votingStartTime: object.voting_start_time, - votingEndTime: object.voting_end_time + votingStartTime: object?.voting_start_time ? Timestamp.fromAmino(object.voting_start_time) : undefined, + votingEndTime: object?.voting_end_time ? Timestamp.fromAmino(object.voting_end_time) : undefined }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime; obj.deposit_end_time = message.depositEndTime; @@ -995,10 +995,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = omitDefault(message.yes); + obj.abstain = omitDefault(message.abstain); + obj.no = omitDefault(message.no); + obj.no_with_veto = omitDefault(message.noWithVeto); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1142,9 +1142,9 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts index 27395199bc..c7c773b4e6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts @@ -1,7 +1,7 @@ import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, VotingParams, VotingParamsSDKType, DepositParams, DepositParamsSDKType, TallyParams, TallyParamsSDKType, Deposit, DepositSDKType, TallyResult, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** QueryProposalRequest is the request type for the Query/Proposal RPC method. */ export interface QueryProposalRequest { @@ -258,7 +258,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -488,9 +488,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = message.proposalStatus; - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = omitDefault(message.proposalStatus); + obj.voter = omitDefault(message.voter); + obj.depositor = omitDefault(message.depositor); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -720,8 +720,8 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -925,7 +925,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1139,7 +1139,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = omitDefault(message.paramsType); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1375,8 +1375,8 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = omitDefault(message.proposalId); + obj.depositor = omitDefault(message.depositor); return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1580,7 +1580,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1796,7 +1796,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index f7ce81597e..8614717a58 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -94,7 +94,7 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), voter: omitDefault(voter), option: option }; @@ -119,7 +119,7 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, @@ -150,7 +150,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: proposalId?.toString?.(), depositor: omitDefault(depositor), amount: amount.map(el0 => ({ denom: omitDefault(el0.denom), diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts index 1ca8a77938..b79cb9aa79 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** * MsgSubmitProposal defines an sdk.Msg type that supports submitting arbitrary @@ -205,7 +205,7 @@ export const MsgSubmitProposal = { } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; + obj.proposer = omitDefault(message.proposer); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -299,7 +299,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -421,9 +421,9 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -626,8 +626,8 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId; + obj.voter = omitDefault(message.voter); if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { @@ -835,8 +835,8 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId; + obj.depositor = omitDefault(message.depositor); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts index 68982782ef..dc565eedc3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts @@ -1,6 +1,6 @@ import { ProposalExecutorResult, ProposalExecutorResultSDKType, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** EventCreateGroup is an event emitted when a group is created. */ export interface EventCreateGroup { @@ -158,7 +158,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -252,7 +252,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -344,7 +344,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -436,7 +436,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -530,7 +530,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -624,7 +624,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -718,7 +718,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -826,8 +826,8 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = message.result; + obj.proposal_id = omitDefault(message.proposalId); + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -935,8 +935,8 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.group_id = omitDefault(message.groupId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts index 4de1d2804d..512fa8f609 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoSDKType, GroupMember, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -252,7 +252,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = omitDefault(message.groupSeq); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -263,13 +263,13 @@ export const GenesisState = { } else { obj.group_members = []; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = omitDefault(message.groupPolicySeq); if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = []; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = omitDefault(message.proposalSeq); if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts index 5aabcba62f..7cb12bc262 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -357,7 +357,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -543,7 +543,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -747,7 +747,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -977,7 +977,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1209,7 +1209,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1439,7 +1439,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1655,7 +1655,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -1857,7 +1857,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2087,8 +2087,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2292,7 +2292,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2522,7 +2522,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = omitDefault(message.voter); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2752,7 +2752,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2968,7 +2968,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index e6c6b6e10f..fb944f6918 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -202,7 +202,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ address: omitDefault(el0.address), weight: omitDefault(el0.weight), @@ -237,7 +237,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), new_admin: omitDefault(newAdmin) }; }, @@ -262,7 +262,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), metadata: omitDefault(metadata) }; }, @@ -288,7 +288,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin: omitDefault(admin), - group_id: groupId.toString(), + group_id: omitDefault(groupId)?.toString?.(), metadata: omitDefault(metadata), decision_policy: { type_url: omitDefault(decisionPolicy.typeUrl), @@ -333,7 +333,7 @@ export const AminoConverter = { })), group_metadata: omitDefault(groupMetadata), group_policy_metadata: omitDefault(groupPolicyMetadata), - group_policy_as_admin: groupPolicyAsAdmin, + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value @@ -493,7 +493,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), address: omitDefault(address) }; }, @@ -517,7 +517,7 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), voter: omitDefault(voter), option: option, metadata: omitDefault(metadata), @@ -547,7 +547,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), + proposal_id: omitDefault(proposalId)?.toString?.(), signer: omitDefault(signer) }; }, @@ -569,7 +569,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address: omitDefault(address), - group_id: groupId.toString() + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts index 33bd78364d..6ff7a7b329 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts @@ -1,7 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** Exec defines modes of execution of a proposal on creation or on new vote. */ export enum Exec { @@ -465,13 +465,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -565,7 +565,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -695,8 +695,8 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -896,9 +896,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1093,9 +1093,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1306,9 +1306,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.group_id = omitDefault(message.groupId); + obj.metadata = omitDefault(message.metadata); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1401,7 +1401,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1521,9 +1521,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -1695,15 +1695,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { obj.members = []; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = omitDefault(message.groupMetadata); + obj.group_policy_metadata = omitDefault(message.groupPolicyMetadata); + obj.group_policy_as_admin = omitDefault(message.groupPolicyAsAdmin); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1812,8 +1812,8 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_id = omitDefault(message.groupId); + obj.group_policy_address = omitDefault(message.groupPolicyAddress); return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2008,8 +2008,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -2203,9 +2203,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = omitDefault(message.admin); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2442,19 +2442,19 @@ export const MsgSubmitProposal = { }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } - obj.metadata = message.metadata; + obj.metadata = omitDefault(message.metadata); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { obj.messages = []; } - obj.exec = message.exec; + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2548,7 +2548,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = omitDefault(message.proposalId); return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2656,8 +2656,8 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.proposal_id = omitDefault(message.proposalId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -2880,11 +2880,11 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; - obj.exec = message.exec; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); + obj.exec = omitDefault(message.exec); return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3065,8 +3065,8 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.proposal_id = omitDefault(message.proposalId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3247,8 +3247,8 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts index cb4146a233..e62cfe66e6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** VoteOption enumerates the valid vote options for a given proposal. */ export enum VoteOption { @@ -586,14 +586,14 @@ export const Member = { address: object.address, weight: object.weight, metadata: object.metadata, - addedAt: object.added_at + addedAt: object?.added_at ? Timestamp.fromAmino(object.added_at) : undefined }; }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = omitDefault(message.address); + obj.weight = omitDefault(message.weight); + obj.metadata = omitDefault(message.metadata); obj.added_at = message.addedAt; return obj; }, @@ -806,7 +806,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = omitDefault(message.threshold); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -915,7 +915,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = omitDefault(message.percentage); obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1188,16 +1188,16 @@ export const GroupInfo = { metadata: object.metadata, version: BigInt(object.version), totalWeight: object.total_weight, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.id = omitDefault(message.id); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); + obj.total_weight = omitDefault(message.totalWeight); obj.created_at = message.createdAt; return obj; }, @@ -1308,7 +1308,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = omitDefault(message.groupId); obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1486,16 +1486,16 @@ export const GroupPolicyInfo = { metadata: object.metadata, version: BigInt(object.version), decisionPolicy: object?.decision_policy ? Any.fromAmino(object.decision_policy) : undefined, - createdAt: object.created_at + createdAt: object?.created_at ? Timestamp.fromAmino(object.created_at) : undefined }; }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.address = omitDefault(message.address); + obj.group_id = omitDefault(message.groupId); + obj.admin = omitDefault(message.admin); + obj.metadata = omitDefault(message.metadata); + obj.version = omitDefault(message.version); obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt; return obj; @@ -1768,35 +1768,35 @@ export const Proposal = { address: object.address, metadata: object.metadata, proposers: Array.isArray(object?.proposers) ? object.proposers.map((e: any) => e) : [], - submitTime: object.submit_time, + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined, groupVersion: BigInt(object.group_version), groupPolicyVersion: BigInt(object.group_policy_version), status: isSet(object.status) ? proposalStatusFromJSON(object.status) : -1, result: isSet(object.result) ? proposalResultFromJSON(object.result) : -1, finalTallyResult: object?.final_tally_result ? TallyResult.fromAmino(object.final_tally_result) : undefined, - votingPeriodEnd: object.voting_period_end, + votingPeriodEnd: object?.voting_period_end ? Timestamp.fromAmino(object.voting_period_end) : undefined, executorResult: isSet(object.executor_result) ? proposalExecutorResultFromJSON(object.executor_result) : -1, messages: Array.isArray(object?.messages) ? object.messages.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.id = omitDefault(message.id); + obj.address = omitDefault(message.address); + obj.metadata = omitDefault(message.metadata); if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { obj.proposers = []; } obj.submit_time = message.submitTime; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = message.status; - obj.result = message.result; + obj.group_version = omitDefault(message.groupVersion); + obj.group_policy_version = omitDefault(message.groupPolicyVersion); + obj.status = omitDefault(message.status); + obj.result = omitDefault(message.result); obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd; - obj.executor_result = message.executorResult; + obj.executor_result = omitDefault(message.executorResult); if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1935,10 +1935,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = omitDefault(message.yesCount); + obj.abstain_count = omitDefault(message.abstainCount); + obj.no_count = omitDefault(message.noCount); + obj.no_with_veto_count = omitDefault(message.noWithVetoCount); return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2083,15 +2083,15 @@ export const Vote = { voter: object.voter, option: isSet(object.option) ? voteOptionFromJSON(object.option) : -1, metadata: object.metadata, - submitTime: object.submit_time + submitTime: object?.submit_time ? Timestamp.fromAmino(object.submit_time) : undefined }; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = message.option; - obj.metadata = message.metadata; + obj.proposal_id = omitDefault(message.proposalId); + obj.voter = omitDefault(message.voter); + obj.option = omitDefault(message.option); + obj.metadata = omitDefault(message.metadata); obj.submit_time = message.submitTime; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts index 44f017497f..0ab50f8759 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -119,8 +119,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation; - obj.annual_provisions = message.annualProvisions; + obj.inflation = padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -284,12 +284,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange; - obj.inflation_max = message.inflationMax; - obj.inflation_min = message.inflationMin; - obj.goal_bonded = message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.mint_denom = omitDefault(message.mintDenom); + obj.inflation_rate_change = padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded); + obj.blocks_per_year = omitDefault(message.blocksPerYear); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts index 8fb32c08d3..34f54e0fa0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -148,10 +148,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -271,9 +271,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -393,9 +393,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts index 45e9371332..517d016e54 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -245,7 +245,7 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts index bd5d25bba2..90a487ed03 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -203,12 +203,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.symbol = omitDefault(message.symbol); + obj.description = omitDefault(message.description); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -359,10 +359,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.uri = omitDefault(message.uri); + obj.uri_hash = omitDefault(message.uriHash); obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts index c01ffa8f2a..c69a6ca010 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -211,8 +211,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -306,7 +306,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -412,8 +412,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -505,7 +505,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -597,7 +597,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -691,7 +691,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -813,8 +813,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = omitDefault(message.classId); + obj.owner = omitDefault(message.owner); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1042,8 +1042,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1229,7 +1229,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = omitDefault(message.classId); return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts index b34333179f..c8507e5cf7 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -132,10 +132,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = omitDefault(message.classId); + obj.id = omitDefault(message.id); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts index 81bd7ea5a6..15237c3b36 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -220,7 +220,7 @@ export const TableDescriptor = { } else { obj.index = []; } - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -326,8 +326,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.auto_increment = message.autoIncrement; + obj.fields = omitDefault(message.fields); + obj.auto_increment = omitDefault(message.autoIncrement); return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -447,9 +447,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.id = message.id; - obj.unique = message.unique; + obj.fields = omitDefault(message.fields); + obj.id = omitDefault(message.id); + obj.unique = omitDefault(message.unique); return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -541,7 +541,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts index 4df89cf81f..fd5aa9038a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1alpha1"; /** StorageType */ export enum StorageType { @@ -339,9 +339,9 @@ export const ModuleSchemaDescriptor_FileEntry = { }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = message.storageType; + obj.id = omitDefault(message.id); + obj.proto_file_name = omitDefault(message.protoFileName); + obj.storage_type = omitDefault(message.storageType); return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts index b970fe44b0..ae90e276f2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -134,8 +134,8 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { @@ -260,9 +260,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; - obj.value = message.value; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts index 6f7f57d7a4..202e6abea3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -144,8 +144,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; + obj.subspace = omitDefault(message.subspace); + obj.key = omitDefault(message.key); return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -530,7 +530,7 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = message.subspace; + obj.subspace = omitDefault(message.subspace); if (message.keys) { obj.keys = message.keys.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts index 94dfeb2788..6fd7469c6d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -296,7 +296,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -411,7 +411,7 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { @@ -524,8 +524,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.index = omitDefault(message.index); + obj.missed = omitDefault(message.missed); return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts index a13ed2228a..6fcfeeed8d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -310,7 +310,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = message.consAddress; + obj.cons_address = omitDefault(message.consAddress); return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts index c2433a6fe8..1cae6e8596 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** * ValidatorSigningInfo defines a validator's signing info for monitoring their @@ -194,19 +194,19 @@ export const ValidatorSigningInfo = { address: object.address, startHeight: BigInt(object.start_height), indexOffset: BigInt(object.index_offset), - jailedUntil: object.jailed_until, + jailedUntil: object?.jailed_until ? Timestamp.fromAmino(object.jailed_until) : undefined, tombstoned: object.tombstoned, missedBlocksCounter: BigInt(object.missed_blocks_counter) }; }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.address = omitDefault(message.address); + obj.start_height = omitDefault(message.startHeight); + obj.index_offset = omitDefault(message.indexOffset); obj.jailed_until = message.jailedUntil; - obj.tombstoned = message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.tombstoned = omitDefault(message.tombstoned); + obj.missed_blocks_counter = omitDefault(message.missedBlocksCounter); return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -358,7 +358,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = omitDefault(message.signedBlocksWindow); obj.min_signed_per_window = message.minSignedPerWindow; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign; diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts index 94ba73ca94..9a3e9b11e4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.amino.ts @@ -1,5 +1,4 @@ import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgUnjail, MsgUnjailSDKType } from "./tx"; export interface MsgUnjailAminoType extends AminoMsg { type: "cosmos-sdk/MsgUnjail"; @@ -14,7 +13,7 @@ export const AminoConverter = { validatorAddr }: MsgUnjail): MsgUnjailAminoType["value"] => { return { - validator_addr: omitDefault(validatorAddr) + validator_addr: validatorAddr }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts index d57646c7a5..f8cd3ce80b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** * AuthorizationType defines the type of staking module authorization type @@ -212,7 +212,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = message.authorizationType; + obj.authorization_type = omitDefault(message.authorizationType); return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts index cf708862fc..84bc70d2f2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -283,7 +283,7 @@ export const GenesisState = { } else { obj.redelegations = []; } - obj.exported = message.exported; + obj.exported = omitDefault(message.exported); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -391,8 +391,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.address = omitDefault(message.address); + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts index 92cc12caa1..ae19867acc 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -489,7 +489,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -703,7 +703,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -905,7 +905,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1135,7 +1135,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = omitDefault(message.validatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1363,8 +1363,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1564,8 +1564,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -1767,7 +1767,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1997,7 +1997,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2255,9 +2255,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.src_validator_addr = omitDefault(message.srcValidatorAddr); + obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2487,7 +2487,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2715,8 +2715,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.validator_addr = omitDefault(message.validatorAddr); return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -2904,7 +2904,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts index 113e21c5e1..17a8323bff 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -663,9 +663,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -768,7 +768,7 @@ export const Commission = { fromAmino(object: CommissionAmino): Commission { return { commissionRates: object?.commission_rates ? CommissionRates.fromAmino(object.commission_rates) : undefined, - updateTime: object.update_time + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: Commission): CommissionAmino { @@ -922,11 +922,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = omitDefault(message.moniker); + obj.identity = omitDefault(message.identity); + obj.website = omitDefault(message.website); + obj.security_contact = omitDefault(message.securityContact); + obj.details = omitDefault(message.details); return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1159,24 +1159,24 @@ export const Validator = { delegatorShares: object.delegator_shares, description: object?.description ? Description.fromAmino(object.description) : undefined, unbondingHeight: BigInt(object.unbonding_height), - unbondingTime: object.unbonding_time, + unbondingTime: object?.unbonding_time ? Timestamp.fromAmino(object.unbonding_time) : undefined, commission: object?.commission ? Commission.fromAmino(object.commission) : undefined, minSelfDelegation: object.min_self_delegation }; }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = omitDefault(message.operatorAddress); obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = message.status; - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = omitDefault(message.jailed); + obj.status = omitDefault(message.status); + obj.tokens = omitDefault(message.tokens); + obj.delegator_shares = padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = omitDefault(message.unbondingHeight); obj.unbonding_time = message.unbondingTime; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1386,8 +1386,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1611,9 +1611,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -1837,9 +1837,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.shares = padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -1967,8 +1967,8 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { @@ -2102,17 +2102,17 @@ export const UnbondingDelegationEntry = { fromAmino(object: UnbondingDelegationEntryAmino): UnbondingDelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, balance: object.balance }; }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = omitDefault(message.initialBalance); + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2241,17 +2241,17 @@ export const RedelegationEntry = { fromAmino(object: RedelegationEntryAmino): RedelegationEntry { return { creationHeight: BigInt(object.creation_height), - completionTime: object.completion_time, + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined, initialBalance: object.initial_balance, sharesDst: object.shares_dst }; }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = omitDefault(message.creationHeight); obj.completion_time = message.completionTime; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = omitDefault(message.initialBalance); + obj.shares_dst = padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2393,9 +2393,9 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { @@ -2565,11 +2565,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = omitDefault(message.maxValidators); + obj.max_entries = omitDefault(message.maxEntries); + obj.historical_entries = omitDefault(message.historicalEntries); + obj.bond_denom = omitDefault(message.bondDenom); + obj.min_commission_rate = padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2789,7 +2789,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = omitDefault(message.balance); return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts index ea873e3838..a6b65b1855 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -292,9 +292,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -506,9 +506,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = omitDefault(message.validatorAddress); + obj.commission_rate = padDecimal(message.commissionRate); + obj.min_self_delegation = omitDefault(message.minSelfDelegation); return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -703,8 +703,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -914,9 +914,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_src_address = omitDefault(message.validatorSrcAddress); + obj.validator_dst_address = omitDefault(message.validatorDstAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1004,7 +1004,7 @@ export const MsgBeginRedelegateResponse = { }, fromAmino(object: MsgBeginRedelegateResponseAmino): MsgBeginRedelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgBeginRedelegateResponse): MsgBeginRedelegateResponseAmino { @@ -1131,8 +1131,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1220,7 +1220,7 @@ export const MsgUndelegateResponse = { }, fromAmino(object: MsgUndelegateResponseAmino): MsgUndelegateResponse { return { - completionTime: object.completion_time + completionTime: object?.completion_time ? Timestamp.fromAmino(object.completion_time) : undefined }; }, toAmino(message: MsgUndelegateResponse): MsgUndelegateResponseAmino { diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts index 85b817db5a..1da12c038e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts @@ -1,7 +1,7 @@ import { CompactBitArray, CompactBitArraySDKType } from "../../../crypto/multisig/v1beta1/multisig"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "cosmos.tx.signing.v1beta1"; /** * SignMode represents a signing mode with its own security guarantees. @@ -367,7 +367,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { @@ -584,7 +584,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.signature = message.signature; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts index 710e566f2f..b71e397cdf 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts @@ -4,7 +4,7 @@ import { TxResponse, TxResponseSDKType, GasInfo, GasInfoSDKType, Result, ResultS import { BlockID, BlockIDSDKType } from "../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../tendermint/types/block"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** OrderBy defines the sorting order */ export enum OrderBy { @@ -406,7 +406,7 @@ export const GetTxsEventRequest = { obj.events = []; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = message.orderBy; + obj.order_by = omitDefault(message.orderBy); return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -661,7 +661,7 @@ export const BroadcastTxRequest = { toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1067,7 +1067,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1288,7 +1288,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts index 532ca5ded6..a27730c66b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../ import { CompactBitArray, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.tx.v1beta1"; /** Tx is the standard type used for broadcasting transactions. */ export interface Tx { @@ -773,8 +773,8 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.auth_info_bytes = message.authInfoBytes; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -946,9 +946,9 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.account_number = omitDefault(message.accountNumber); + obj.sequence = omitDefault(message.sequence); obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1128,8 +1128,8 @@ export const TxBody = { } else { obj.messages = []; } - obj.memo = message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.memo = omitDefault(message.memo); + obj.timeout_height = omitDefault(message.timeoutHeight); if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1405,7 +1405,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1608,7 +1608,7 @@ export const ModeInfo_Single = { }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -1878,9 +1878,9 @@ export const Fee = { } else { obj.amount = []; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.gas_limit = omitDefault(message.gasLimit); + obj.payer = omitDefault(message.payer); + obj.granter = omitDefault(message.granter); return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -1999,7 +1999,7 @@ export const Tip = { } else { obj.amount = []; } - obj.tipper = message.tipper; + obj.tipper = omitDefault(message.tipper); return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2135,9 +2135,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.sig = message.sig; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts index 899ab3620e..43880a598f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -398,7 +398,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -492,7 +492,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -586,7 +586,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = omitDefault(message.lastHeight); return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -770,7 +770,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = message.moduleName; + obj.module_name = omitDefault(message.moduleName); return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -1039,7 +1039,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts index a70e117cfb..92dc39510b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -41,7 +41,7 @@ export const AminoConverter = { plan: { name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), + height: omitDefault(plan.height)?.toString?.(), info: omitDefault(plan.info), upgraded_client_state: { type_url: omitDefault(plan.upgradedClientState.typeUrl), diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts index 141940cfa8..d3ef81c446 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -146,7 +146,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -312,7 +312,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = omitDefault(message.authority); return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts index e291633b16..1391160f73 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** Plan specifies information about a planned upgrade and when it should occur. */ export interface Plan { @@ -235,7 +235,7 @@ export const Plan = { fromAmino(object: PlanAmino): Plan { return { name: object.name, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, height: BigInt(object.height), info: object.info, upgradedClientState: object?.upgraded_client_state ? Any.fromAmino(object.upgraded_client_state) : undefined @@ -243,10 +243,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.time = message.time; - obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.height = omitDefault(message.height); + obj.info = omitDefault(message.info); obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -369,8 +369,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -477,8 +477,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -586,8 +586,8 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.name = omitDefault(message.name); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index dbe24d82a8..e840986a6c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -59,8 +59,8 @@ export const AminoConverter = { denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) })), - end_time: endTime.toString(), - delayed: delayed + end_time: omitDefault(endTime)?.toString?.(), + delayed: omitDefault(delayed) }; }, fromAmino: ({ @@ -124,9 +124,9 @@ export const AminoConverter = { return { from_address: omitDefault(fromAddress), to_address: omitDefault(toAddress), - start_time: startTime.toString(), + start_time: omitDefault(startTime)?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts index 0ffa7d49fc..1d9feb06c8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -214,15 +214,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.amount = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; - obj.delayed = message.delayed; + obj.end_time = omitDefault(message.endTime); + obj.delayed = omitDefault(message.delayed); return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -423,8 +423,8 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -646,9 +646,9 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts index 9eec54684a..a07c8182c3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -272,7 +272,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = []; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = omitDefault(message.endTime); return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -383,7 +383,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -593,7 +593,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = omitDefault(message.length); if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -731,7 +731,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = omitDefault(message.startTime); if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts index 4488bf64d0..2f33bf7915 100644 --- a/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial } from "../helpers"; +import { isSet, DeepPartial, omitDefault } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -190,8 +190,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -322,8 +322,8 @@ export const ScalarDescriptor = { }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); if (message.fieldType) { obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); } else { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts index 9326203d97..7f03b0bfb5 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts @@ -1,7 +1,7 @@ import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType } from "./tx"; import { Params, ParamsSDKType, CodeInfo, CodeInfoSDKType, ContractInfo, ContractInfoSDKType, Model, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** GenesisState - genesis state of x/wasm */ export interface GenesisState { @@ -517,10 +517,10 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes; - obj.pinned = message.pinned; + obj.pinned = omitDefault(message.pinned); return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -650,7 +650,7 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); @@ -765,7 +765,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts index b05536ed8e..dbcf34b80f 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgIBCSend */ export interface MsgIBCSend { @@ -149,9 +149,9 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.channel = omitDefault(message.channel); + obj.timeout_height = omitDefault(message.timeoutHeight); + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); obj.data = message.data; return obj; }, @@ -244,7 +244,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = omitDefault(message.channel); return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts index f159d4cb23..680079888d 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -336,9 +336,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -540,12 +540,12 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -701,10 +701,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -839,9 +839,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1012,10 +1012,10 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.run_as = omitDefault(message.runAs); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1155,10 +1155,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1278,9 +1278,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1417,8 +1417,8 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { @@ -1560,8 +1560,8 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts index 5020be717f..d2d016fe9b 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { ContractInfo, ContractInfoSDKType, ContractCodeHistoryEntry, ContractCodeHistoryEntrySDKType, Model, ModelSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** @@ -359,7 +359,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -467,7 +467,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -576,7 +576,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -808,7 +808,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1038,7 +1038,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1266,7 +1266,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData; return obj; }, @@ -1465,7 +1465,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1652,7 +1652,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { @@ -1774,8 +1774,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId; + obj.creator = omitDefault(message.creator); obj.data_hash = message.dataHash; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index 87c0a7e409..476501027c 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), admin: omitDefault(admin), - code_id: codeId.toString(), + code_id: omitDefault(codeId)?.toString?.(), label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +186,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), contract: omitDefault(contract), - code_id: codeId.toString(), + code_id: omitDefault(codeId)?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts index 070f1e29c4..766e8d1cb9 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** MsgStoreCode submit Wasm code to the system */ @@ -262,7 +262,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -358,7 +358,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = omitDefault(message.codeId); return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -530,10 +530,10 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.sender = omitDefault(message.sender); + obj.admin = omitDefault(message.admin); + obj.code_id = omitDefault(message.codeId); + obj.label = omitDefault(message.label); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -645,7 +645,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.data = message.data; return obj; }, @@ -788,8 +788,8 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -1023,9 +1023,9 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); + obj.code_id = omitDefault(message.codeId); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1238,9 +1238,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.new_admin = omitDefault(message.newAdmin); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1419,8 +1419,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts index 43780ef81c..9e92c5cc95 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; import { toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** AccessType permission types */ @@ -293,7 +293,7 @@ export const AccessTypeParam = { }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -399,8 +399,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = message.permission; - obj.address = message.address; + obj.permission = omitDefault(message.permission); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -525,8 +525,8 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.instantiate_default_permission = omitDefault(message.instantiateDefaultPermission); + obj.max_wasm_code_size = omitDefault(message.maxWasmCodeSize); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -649,7 +649,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -832,12 +832,12 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.code_id = omitDefault(message.codeId); + obj.creator = omitDefault(message.creator); + obj.admin = omitDefault(message.admin); + obj.label = omitDefault(message.label); obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = omitDefault(message.ibcPortId); obj.extension = message.extension ? Any.toAmino(message.extension) : undefined; return obj; }, @@ -976,8 +976,8 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.operation = omitDefault(message.operation); + obj.code_id = omitDefault(message.codeId); obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1089,8 +1089,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = omitDefault(message.blockHeight); + obj.tx_index = omitDefault(message.txIndex); return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts index 751dcbaec7..2bcba38883 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** Action defines the list of available actions to claim the airdrop tokens. */ export enum Action { @@ -205,9 +205,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = message.action; - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = omitDefault(message.action); + obj.completed = omitDefault(message.completed); + obj.claimable_amount = omitDefault(message.claimableAmount); return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -338,8 +338,8 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = omitDefault(message.address); + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { @@ -461,7 +461,7 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts index 3b0bd4e836..7166a9e265 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts @@ -2,7 +2,7 @@ import { ClaimsRecordAddress, ClaimsRecordAddressSDKType } from "./claims"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** GenesisState define the claims module's genesis state. */ export interface GenesisState { @@ -322,7 +322,7 @@ export const Params = { fromAmino(object: ParamsAmino): Params { return { enableClaims: object.enable_claims, - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimsDenom: object.claims_denom, @@ -332,11 +332,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = omitDefault(message.enableClaims); obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = omitDefault(message.claimsDenom); if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts index 540fb8522b..56a386658a 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -699,7 +699,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -807,7 +807,7 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts index a666e1671d..1346359197 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface EpochInfo { identifier: string; @@ -176,23 +176,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts index 8966a77dca..2268f3ab7d 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination: PageRequest; @@ -299,7 +299,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -387,7 +387,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts index ffa17c3f4f..eb0e43d64c 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts @@ -1,6 +1,6 @@ import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** Owner enumerates the ownership of a ERC20 contract. */ export enum Owner { @@ -242,10 +242,10 @@ export const TokenPair = { }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = message.contractOwner; + obj.erc20_address = omitDefault(message.erc20Address); + obj.denom = omitDefault(message.denom); + obj.enabled = omitDefault(message.enabled); + obj.contract_owner = omitDefault(message.contractOwner); return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -361,8 +361,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -477,9 +477,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.erc20address = omitDefault(message.erc20address); return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -593,9 +593,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts index c21d5f2c7e..4b12cd7c4b 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -226,8 +226,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = message.enableErc20; - obj.enable_evm_hook = message.enableEvmHook; + obj.enable_erc20 = omitDefault(message.enableErc20); + obj.enable_evm_hook = omitDefault(message.enableEvmHook); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts index f997e07036..617820825e 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { TokenPair, TokenPairSDKType } from "./erc20"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -350,7 +350,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = message.token; + obj.token = omitDefault(message.token); return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts index b437b44f77..18c876dfd9 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -150,8 +150,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -346,10 +346,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = omitDefault(message.contractAddress); + obj.amount = omitDefault(message.amount); + obj.receiver = omitDefault(message.receiver); + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts index c755740df7..c176befb11 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -120,9 +120,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts index 8fc2666ea6..e853cfec5d 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -285,11 +285,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = message.enableFees; - obj.developer_shares = message.developerShares; - obj.validator_shares = message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; - obj.min_gas_price = message.minGasPrice; + obj.enable_fees = omitDefault(message.enableFees); + obj.developer_shares = padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); + obj.min_gas_price = padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts index 3777796809..c0c15a6bdc 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -388,7 +388,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -733,7 +733,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = omitDefault(message.deployerAddress); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts index 9c5bcd8bc7..39dc625122 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -209,9 +209,9 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { @@ -383,8 +383,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -565,9 +565,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts index 91e2fa16b0..919af09629 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -287,10 +287,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = message.enableIncentives; - obj.allocation_limit = message.allocationLimit; - obj.incentives_epoch_identifier = message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler; + obj.enable_incentives = omitDefault(message.enableIncentives); + obj.allocation_limit = padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); + obj.reward_scaler = padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts index 81745b124b..a82aecf588 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * Incentive defines an instance that organizes distribution conditions for a @@ -208,21 +208,21 @@ export const Incentive = { contract: object.contract, allocations: Array.isArray(object?.allocations) ? object.allocations.map((e: any) => DecCoin.fromAmino(e)) : [], epochs: object.epochs, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, totalGas: BigInt(object.total_gas) }; }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); obj.start_time = message.startTime; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = omitDefault(message.totalGas); return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -338,9 +338,9 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); + obj.cumulative_gas = omitDefault(message.cumulativeGas); return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { @@ -490,15 +490,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { obj.allocations = []; } - obj.epochs = message.epochs; + obj.epochs = omitDefault(message.epochs); return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -612,9 +612,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts index 471e4fb5e4..c0bfca1905 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -474,7 +474,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -664,7 +664,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = omitDefault(message.contract); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -880,8 +880,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = omitDefault(message.contract); + obj.participant = omitDefault(message.participant); return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -969,7 +969,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = omitDefault(message.gasMeter); return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1258,7 +1258,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts index 7f1944befd..643efc4bcc 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -173,10 +173,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.period = omitDefault(message.period); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.epochs_per_period = omitDefault(message.epochsPerPeriod); + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -308,10 +308,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = omitDefault(message.mintDenom); obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = omitDefault(message.enableInflation); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts index 04d4093668..3b7476b932 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -170,9 +170,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards; - obj.usage_incentives = message.usageIncentives; - obj.community_pool = message.communityPool; + obj.staking_rewards = padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -314,11 +314,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a; - obj.r = message.r; - obj.c = message.c; - obj.bonding_target = message.bondingTarget; - obj.max_variance = message.maxVariance; + obj.a = padDecimal(message.a); + obj.r = padDecimal(message.r); + obj.c = padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts index 81d8e73258..865e56838e 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -266,7 +266,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = omitDefault(message.period); return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -576,7 +576,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = omitDefault(message.skippedEpochs); return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -884,7 +884,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate; + obj.inflation_rate = padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts index c3c483854a..858c51c62e 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -194,7 +194,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = omitDefault(message.enableRecovery); obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts index 9be9a7e885..101200a088 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -99,7 +99,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index 92314cb295..85cb68563a 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -54,20 +54,20 @@ export const AminoConverter = { to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ denom: omitDefault(el1.denom), amount: omitDefault(el1.amount) })) })), - merge: merge + merge: omitDefault(merge) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts index a07b3535de..b639de571a 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** MsgCreateClawbackVestingAccount defines a message that enables creating a ClawbackVestingAccount. */ export interface MsgCreateClawbackVestingAccount { @@ -220,7 +220,7 @@ export const MsgCreateClawbackVestingAccount = { return { fromAddress: object.from_address, toAddress: object.to_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [], merge: object.merge @@ -228,8 +228,8 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = omitDefault(message.fromAddress); + obj.to_address = omitDefault(message.toAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); @@ -241,7 +241,7 @@ export const MsgCreateClawbackVestingAccount = { } else { obj.vesting_periods = []; } - obj.merge = message.merge; + obj.merge = omitDefault(message.merge); return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -422,9 +422,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = omitDefault(message.funderAddress); + obj.account_address = omitDefault(message.accountAddress); + obj.dest_address = omitDefault(message.destAddress); return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts index 6f37ce9774..d0135ea8cc 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts @@ -1,7 +1,7 @@ import { BaseVestingAccount, BaseVestingAccountSDKType, Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** * ClawbackVestingAccount implements the VestingAccount interface. It provides @@ -171,7 +171,7 @@ export const ClawbackVestingAccount = { return { baseVestingAccount: object?.base_vesting_account ? BaseVestingAccount.fromAmino(object.base_vesting_account) : undefined, funderAddress: object.funder_address, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, lockupPeriods: Array.isArray(object?.lockup_periods) ? object.lockup_periods.map((e: any) => Period.fromAmino(e)) : [], vestingPeriods: Array.isArray(object?.vesting_periods) ? object.vesting_periods.map((e: any) => Period.fromAmino(e)) : [] }; @@ -179,7 +179,7 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = omitDefault(message.funderAddress); obj.start_time = message.startTime; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv4/google/api/auth.ts b/__fixtures__/v-next/outputv4/google/api/auth.ts index a4438550a2..fff95a2058 100644 --- a/__fixtures__/v-next/outputv4/google/api/auth.ts +++ b/__fixtures__/v-next/outputv4/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -562,9 +562,9 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = omitDefault(message.allowWithoutCredential); if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { @@ -683,9 +683,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = omitDefault(message.header); + obj.query = omitDefault(message.query); + obj.value_prefix = omitDefault(message.valuePrefix); return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -849,11 +849,11 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = omitDefault(message.id); + obj.issuer = omitDefault(message.issuer); + obj.jwks_uri = omitDefault(message.jwksUri); + obj.audiences = omitDefault(message.audiences); + obj.authorization_url = omitDefault(message.authorizationUrl); if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { @@ -944,7 +944,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = omitDefault(message.canonicalScopes); return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1044,8 +1044,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = omitDefault(message.providerId); + obj.audiences = omitDefault(message.audiences); return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputv4/google/api/backend.ts b/__fixtures__/v-next/outputv4/google/api/backend.ts index c406d57900..5e95b3ef0c 100644 --- a/__fixtures__/v-next/outputv4/google/api/backend.ts +++ b/__fixtures__/v-next/outputv4/google/api/backend.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Path Translation specifies how to combine the backend address with the @@ -480,15 +480,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = message.pathTranslation; - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = omitDefault(message.selector); + obj.address = omitDefault(message.address); + obj.deadline = omitDefault(message.deadline); + obj.min_deadline = omitDefault(message.minDeadline); + obj.operation_deadline = omitDefault(message.operationDeadline); + obj.path_translation = omitDefault(message.pathTranslation); + obj.jwt_audience = omitDefault(message.jwtAudience); + obj.disable_auth = omitDefault(message.disableAuth); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputv4/google/api/billing.ts b/__fixtures__/v-next/outputv4/google/api/billing.ts index 79823ca751..5a45a88dc7 100644 --- a/__fixtures__/v-next/outputv4/google/api/billing.ts +++ b/__fixtures__/v-next/outputv4/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -292,7 +292,7 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/config_change.ts b/__fixtures__/v-next/outputv4/google/api/config_change.ts index a1642d35b0..35ffdab655 100644 --- a/__fixtures__/v-next/outputv4/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv4/google/api/config_change.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Classifies set of possible modifications to an object in the service @@ -264,10 +264,10 @@ export const ConfigChange = { }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = message.changeType; + obj.element = omitDefault(message.element); + obj.old_value = omitDefault(message.oldValue); + obj.new_value = omitDefault(message.newValue); + obj.change_type = omitDefault(message.changeType); if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { @@ -358,7 +358,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputv4/google/api/consumer.ts b/__fixtures__/v-next/outputv4/google/api/consumer.ts index ee15cfc764..dc3d29cdea 100644 --- a/__fixtures__/v-next/outputv4/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv4/google/api/consumer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Supported data type of the property values */ export enum Property_PropertyType { @@ -329,9 +329,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputv4/google/api/context.ts b/__fixtures__/v-next/outputv4/google/api/context.ts index 314428f17c..172ca2b130 100644 --- a/__fixtures__/v-next/outputv4/google/api/context.ts +++ b/__fixtures__/v-next/outputv4/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -378,7 +378,7 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.requested) { obj.requested = message.requested.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/control.ts b/__fixtures__/v-next/outputv4/google/api/control.ts index 0c3f2ed807..b4fa6154e3 100644 --- a/__fixtures__/v-next/outputv4/google/api/control.ts +++ b/__fixtures__/v-next/outputv4/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -88,7 +88,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = message.environment; + obj.environment = omitDefault(message.environment); return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputv4/google/api/distribution.ts b/__fixtures__/v-next/outputv4/google/api/distribution.ts index c1dc44b355..5250959bf3 100644 --- a/__fixtures__/v-next/outputv4/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/distribution.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../protobuf/timestamp"; import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Distribution` contains summary statistics for a population of values. It @@ -485,9 +485,9 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { @@ -599,8 +599,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = omitDefault(message.min); + obj.max = omitDefault(message.max); return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -836,9 +836,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -952,9 +952,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1177,13 +1177,13 @@ export const Distribution_Exemplar = { fromAmino(object: Distribution_ExemplarAmino): Distribution_Exemplar { return { value: object.value, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, attachments: Array.isArray(object?.attachments) ? object.attachments.map((e: any) => Any.fromAmino(e)) : [] }; }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); obj.timestamp = message.timestamp; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv4/google/api/documentation.ts b/__fixtures__/v-next/outputv4/google/api/documentation.ts index 67216fd745..52c6417db2 100644 --- a/__fixtures__/v-next/outputv4/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv4/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -383,7 +383,7 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = message.summary; + obj.summary = omitDefault(message.summary); if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { @@ -394,9 +394,9 @@ export const Documentation = { } else { obj.rules = []; } - obj.documentation_root_url = message.documentationRootUrl; - obj.service_root_url = message.serviceRootUrl; - obj.overview = message.overview; + obj.documentation_root_url = omitDefault(message.documentationRootUrl); + obj.service_root_url = omitDefault(message.serviceRootUrl); + obj.overview = omitDefault(message.overview); return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -510,9 +510,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.description = message.description; - obj.deprecation_description = message.deprecationDescription; + obj.selector = omitDefault(message.selector); + obj.description = omitDefault(message.description); + obj.deprecation_description = omitDefault(message.deprecationDescription); return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -634,8 +634,8 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = message.name; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.content = omitDefault(message.content); if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/endpoint.ts b/__fixtures__/v-next/outputv4/google/api/endpoint.ts index a3ef7eb417..b571fbedb3 100644 --- a/__fixtures__/v-next/outputv4/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv4/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -193,14 +193,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { obj.aliases = []; } - obj.target = message.target; - obj.allow_cors = message.allowCors; + obj.target = omitDefault(message.target); + obj.allow_cors = omitDefault(message.allowCors); return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts index 33edb39ccf..825c85f863 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -3,7 +3,7 @@ import { Decl, DeclSDKType, CheckedExpr, CheckedExprSDKType } from "../../v1alph import { ExprValue, ExprValueSDKType } from "../../v1alpha1/eval"; import { Status, StatusSDKType } from "../../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../../helpers"; export const protobufPackage = "google.api.expr.conformance.v1alpha1"; /** Severities of issues. */ export enum IssueDetails_Severity { @@ -309,10 +309,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = omitDefault(message.celSource); + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.source_location = omitDefault(message.sourceLocation); + obj.disable_macros = omitDefault(message.disableMacros); return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -571,8 +571,8 @@ export const CheckRequest = { } else { obj.type_env = []; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = omitDefault(message.container); + obj.no_std_env = omitDefault(message.noStdEnv); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -788,7 +788,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -966,7 +966,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1199,9 +1199,9 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts index fa40189410..4e80d543ea 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts @@ -2,7 +2,7 @@ import { SourceInfo, SourceInfoSDKType, Expr, ExprSDKType, Constant, ConstantSDK import { Empty, EmptySDKType } from "../../../protobuf/empty"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** CEL primitive types. */ export enum Type_PrimitiveType { @@ -607,7 +607,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -705,7 +705,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, @@ -945,7 +945,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = omitDefault(message.exprVersion); obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1215,15 +1215,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = message.null; - obj.primitive = message.primitive; - obj.wrapper = message.wrapper; - obj.well_known = message.wellKnown; + obj.null = omitDefault(message.null); + obj.primitive = omitDefault(message.primitive); + obj.wrapper = omitDefault(message.wrapper); + obj.well_known = omitDefault(message.wellKnown); obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = omitDefault(message.messageType); + obj.type_param = omitDefault(message.typeParam); obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1642,7 +1642,7 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -1765,7 +1765,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -1887,7 +1887,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2159,7 +2159,7 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = omitDefault(message.overloadId); if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -2171,8 +2171,8 @@ export const Decl_FunctionDecl_Overload = { obj.type_params = []; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = omitDefault(message.isInstanceFunction); + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2296,7 +2296,7 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts index cae2744f74..881744a71a 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -341,8 +341,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = omitDefault(message.expr); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts index 6ea27b9e56..ed8a338d4c 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -253,8 +253,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.value_index = message.valueIndex; + obj.id = omitDefault(message.id); + obj.value_index = omitDefault(message.valueIndex); return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts index d6f7b3be66..388f7742e2 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts @@ -2,7 +2,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -766,7 +766,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -859,7 +859,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -976,8 +976,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1102,7 +1102,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1313,7 +1313,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = omitDefault(message.messageName); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1452,8 +1452,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1635,9 +1635,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1840,17 +1840,17 @@ export const Constant = { stringValue: object?.string_value, bytesValue: object?.bytes_value, durationValue: object?.duration_value ? Duration.fromAmino(object.duration_value) : undefined, - timestampValue: object?.timestamp_value + timestampValue: object?.timestamp_value ? Timestamp.fromAmino(object.timestamp_value) : undefined }; }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue; @@ -1954,8 +1954,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2052,7 +2052,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = omitDefault(message.key); obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, @@ -2292,8 +2292,8 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -2438,10 +2438,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts index 374deec283..33bc3ab2fc 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts @@ -1,7 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Represents a CEL value. @@ -360,18 +360,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -471,8 +471,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts index dc6eceb764..b5abda589b 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -205,9 +205,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = omitDefault(message.id); + obj.name = omitDefault(message.name); + obj.doc = omitDefault(message.doc); obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -331,8 +331,8 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = omitDefault(message.id); + obj.type = omitDefault(message.type); if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { @@ -572,7 +572,7 @@ export const FunctionDecl = { obj.args = []; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = omitDefault(message.receiverFunction); return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts index 77fa01bca9..9ba2de4dfd 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet } from "../../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -349,7 +349,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -753,7 +753,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts index 5afcde41a1..9c966b6209 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts @@ -1,7 +1,7 @@ import { SourceInfo, SourceInfoSDKType } from "./source"; import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** An expression together with source information as returned by the parser. */ export interface ParsedExpr { @@ -467,7 +467,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = omitDefault(message.syntaxVersion); return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -665,7 +665,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -758,7 +758,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -875,8 +875,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = omitDefault(message.field); + obj.test_only = omitDefault(message.testOnly); return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1001,7 +1001,7 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = omitDefault(message.function); if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { @@ -1212,7 +1212,7 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { @@ -1349,8 +1349,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = omitDefault(message.id); + obj.field_key = omitDefault(message.fieldKey); obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1532,9 +1532,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = omitDefault(message.iterVar); obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = omitDefault(message.accuVar); obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1712,12 +1712,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts index 42064caa02..f6f9a2330d 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -147,8 +147,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -316,7 +316,7 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -455,10 +455,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = omitDefault(message.location); + obj.offset = omitDefault(message.offset); + obj.line = omitDefault(message.line); + obj.column = omitDefault(message.column); return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts index ddc48628cb..554a52ea54 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts @@ -1,7 +1,7 @@ import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * Represents a CEL value. @@ -360,18 +360,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = omitDefault(message.typeValue); return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -471,8 +471,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = omitDefault(message.type); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { diff --git a/__fixtures__/v-next/outputv4/google/api/http.ts b/__fixtures__/v-next/outputv4/google/api/http.ts index 291a96196a..67ddbb0591 100644 --- a/__fixtures__/v-next/outputv4/google/api/http.ts +++ b/__fixtures__/v-next/outputv4/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -744,7 +744,7 @@ export const Http = { } else { obj.rules = []; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -966,15 +966,15 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = omitDefault(message.selector); + obj.get = omitDefault(message.get); + obj.put = omitDefault(message.put); + obj.post = omitDefault(message.post); + obj.delete = omitDefault(message.delete); + obj.patch = omitDefault(message.patch); obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = omitDefault(message.body); + obj.response_body = omitDefault(message.responseBody); if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { @@ -1079,8 +1079,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = omitDefault(message.kind); + obj.path = omitDefault(message.path); return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputv4/google/api/httpbody.ts b/__fixtures__/v-next/outputv4/google/api/httpbody.ts index 88a560de04..36d68fc2bc 100644 --- a/__fixtures__/v-next/outputv4/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv4/google/api/httpbody.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Message that represents an arbitrary HTTP body. It should only be used for @@ -211,7 +211,7 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = omitDefault(message.contentType); obj.data = message.data; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv4/google/api/label.ts b/__fixtures__/v-next/outputv4/google/api/label.ts index cd45d4ccc9..a4d33cd250 100644 --- a/__fixtures__/v-next/outputv4/google/api/label.ts +++ b/__fixtures__/v-next/outputv4/google/api/label.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Value types that can be used as label values. */ export enum LabelDescriptor_ValueType { @@ -152,9 +152,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = message.valueType; - obj.description = message.description; + obj.key = omitDefault(message.key); + obj.value_type = omitDefault(message.valueType); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputv4/google/api/log.ts b/__fixtures__/v-next/outputv4/google/api/log.ts index 1ed694d1c5..d9a00ad061 100644 --- a/__fixtures__/v-next/outputv4/google/api/log.ts +++ b/__fixtures__/v-next/outputv4/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -170,14 +170,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.description = message.description; - obj.display_name = message.displayName; + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputv4/google/api/logging.ts b/__fixtures__/v-next/outputv4/google/api/logging.ts index 88de054cc5..9978bd7e7c 100644 --- a/__fixtures__/v-next/outputv4/google/api/logging.ts +++ b/__fixtures__/v-next/outputv4/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -323,7 +323,7 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.logs) { obj.logs = message.logs.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/metric.ts b/__fixtures__/v-next/outputv4/google/api/metric.ts index e3b52150d9..2326723435 100644 --- a/__fixtures__/v-next/outputv4/google/api/metric.ts +++ b/__fixtures__/v-next/outputv4/google/api/metric.ts @@ -2,7 +2,7 @@ import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON import { Duration, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * The kind of measurement. It describes how the data is reported. @@ -607,20 +607,20 @@ export const MetricDescriptor = { }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.metric_kind = message.metricKind; - obj.value_type = message.valueType; - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = omitDefault(message.metricKind); + obj.value_type = omitDefault(message.valueType); + obj.unit = omitDefault(message.unit); + obj.description = omitDefault(message.description); + obj.display_name = omitDefault(message.displayName); obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { @@ -743,7 +743,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -844,8 +844,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -982,7 +982,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts index ae22042765..b877298f1d 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts @@ -2,7 +2,7 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; import { Struct, StructSDKType } from "../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * An object that describes the schema of a [MonitoredResource][google.api.MonitoredResource] object using a @@ -324,16 +324,16 @@ export const MonitoredResourceDescriptor = { }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.display_name = omitDefault(message.displayName); + obj.description = omitDefault(message.description); if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { obj.labels = []; } - obj.launch_stage = message.launchStage; + obj.launch_stage = omitDefault(message.launchStage); return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -432,8 +432,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -570,7 +570,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -675,8 +675,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputv4/google/api/monitoring.ts b/__fixtures__/v-next/outputv4/google/api/monitoring.ts index eba13e94f0..391d815d8b 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -371,7 +371,7 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = omitDefault(message.monitoredResource); if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/quota.ts b/__fixtures__/v-next/outputv4/google/api/quota.ts index 0c3fb62d7b..acd0e16930 100644 --- a/__fixtures__/v-next/outputv4/google/api/quota.ts +++ b/__fixtures__/v-next/outputv4/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, isObject } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -488,8 +488,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -626,7 +626,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -733,8 +733,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -989,21 +989,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; - obj.duration = message.duration; - obj.metric = message.metric; - obj.unit = message.unit; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.default_limit = omitDefault(message.defaultLimit); + obj.max_limit = omitDefault(message.maxLimit); + obj.free_tier = omitDefault(message.freeTier); + obj.duration = omitDefault(message.duration); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputv4/google/api/resource.ts b/__fixtures__/v-next/outputv4/google/api/resource.ts index 498a58d103..9bdf8d14ba 100644 --- a/__fixtures__/v-next/outputv4/google/api/resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/resource.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of the historical or future-looking state of the @@ -512,16 +512,16 @@ export const ResourceDescriptor = { }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { obj.pattern = []; } - obj.name_field = message.nameField; - obj.history = message.history; - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = omitDefault(message.nameField); + obj.history = omitDefault(message.history); + obj.plural = omitDefault(message.plural); + obj.singular = omitDefault(message.singular); if (message.style) { obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); } else { @@ -626,8 +626,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = omitDefault(message.type); + obj.child_type = omitDefault(message.childType); return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputv4/google/api/routing.ts b/__fixtures__/v-next/outputv4/google/api/routing.ts index 324da43024..80905e9d36 100644 --- a/__fixtures__/v-next/outputv4/google/api/routing.ts +++ b/__fixtures__/v-next/outputv4/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -983,8 +983,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = message.field; - obj.path_template = message.pathTemplate; + obj.field = omitDefault(message.field); + obj.path_template = omitDefault(message.pathTemplate); return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputv4/google/api/service.ts b/__fixtures__/v-next/outputv4/google/api/service.ts index 770e54e814..031ab4baaf 100644 --- a/__fixtures__/v-next/outputv4/google/api/service.ts +++ b/__fixtures__/v-next/outputv4/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersSDKType } from "./system_parameter"; import { SourceInfo, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -682,10 +682,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; - obj.producer_project_id = message.producerProjectId; - obj.id = message.id; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.id = omitDefault(message.id); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts index 31474b179e..77cbcd6991 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts @@ -1,6 +1,6 @@ import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Error codes for Check responses. */ export enum CheckError_Code { @@ -336,9 +336,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.detail = omitDefault(message.detail); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts index 40c1a54d60..70b45a1d89 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -384,11 +384,11 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.minimum = message.minimum; - obj.maximum = message.maximum; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.count = omitDefault(message.count); + obj.mean = omitDefault(message.mean); + obj.minimum = omitDefault(message.minimum); + obj.maximum = omitDefault(message.maximum); + obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { @@ -515,9 +515,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.width = omitDefault(message.width); + obj.offset = omitDefault(message.offset); return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -631,9 +631,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); + obj.growth_factor = omitDefault(message.growthFactor); + obj.scale = omitDefault(message.scale); return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts index 14bb78cacc..137e64f1ba 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -372,21 +372,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts index 18100b2543..b83a9636bd 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts @@ -4,7 +4,7 @@ import { HttpRequest, HttpRequestSDKType } from "./http_request"; import { Any, AnySDKType } from "../../../protobuf/any"; import { Struct, StructSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface LogEntry_LabelsEntry { key: string; @@ -241,8 +241,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -509,7 +509,7 @@ export const LogEntry = { fromAmino(object: LogEntryAmino): LogEntry { return { name: object.name, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, trace: object.trace, @@ -529,12 +529,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timestamp = message.timestamp; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = omitDefault(message.trace); + obj.insert_id = omitDefault(message.insertId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -542,7 +542,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -673,10 +673,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -792,9 +792,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts index 6b46b95a93..913ec01d39 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { Distribution, DistributionSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; export interface MetricValue_LabelsEntry { key: string; @@ -160,8 +160,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -375,8 +375,8 @@ export const MetricValue = { acc[key] = String(value); return acc; }, {}) : {}, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, boolValue: object?.bool_value, int64Value: object?.int64_value ? BigInt(object.int64_value) : undefined, doubleValue: object?.double_value, @@ -394,10 +394,10 @@ export const MetricValue = { } obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -506,7 +506,7 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts index 3dc2366383..64c3dc0678 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts @@ -3,7 +3,7 @@ import { MetricValueSet, MetricValueSetSDKType } from "./metric_value"; import { LogEntry, LogEntrySDKType } from "./log_entry"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Defines the importance of the data contained in the operation. */ export enum Operation_Importance { @@ -231,8 +231,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -489,8 +489,8 @@ export const Operation = { operationId: object.operation_id, operationName: object.operation_name, consumerId: object.consumer_id, - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ [key: string]: string; }>((acc, [key, value]) => { @@ -505,9 +505,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.operation_name = omitDefault(message.operationName); + obj.consumer_id = omitDefault(message.consumerId); obj.start_time = message.startTime; obj.end_time = message.endTime; obj.labels = {}; @@ -526,7 +526,7 @@ export const Operation = { } else { obj.log_entries = []; } - obj.importance = message.importance; + obj.importance = omitDefault(message.importance); if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts index eced9cad17..cc8c70f8c3 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts @@ -1,7 +1,7 @@ import { MetricValueSet, MetricValueSetSDKType } from "./metric_value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** Supported quota modes. */ export enum QuotaOperation_QuotaMode { @@ -427,9 +427,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -528,8 +528,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -730,9 +730,9 @@ export const QuotaOperation = { }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = omitDefault(message.operationId); + obj.method_name = omitDefault(message.methodName); + obj.consumer_id = omitDefault(message.consumerId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -744,7 +744,7 @@ export const QuotaOperation = { } else { obj.quota_metrics = []; } - obj.quota_mode = message.quotaMode; + obj.quota_mode = omitDefault(message.quotaMode); return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -888,7 +888,7 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { @@ -899,7 +899,7 @@ export const AllocateQuotaResponse = { } else { obj.quota_metrics = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1029,9 +1029,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = message.code; - obj.subject = message.subject; - obj.description = message.description; + obj.code = omitDefault(message.code); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts index 94140df8b2..13f5cf9361 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts @@ -2,7 +2,7 @@ import { Operation, OperationSDKType } from "./operation"; import { CheckError, CheckErrorSDKType } from "./check_error"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * The type of the consumer as defined in @@ -361,9 +361,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -515,14 +515,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { obj.check_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -756,9 +756,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.project_number = omitDefault(message.projectNumber); + obj.type = omitDefault(message.type); + obj.consumer_number = omitDefault(message.consumerNumber); return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { @@ -880,13 +880,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { obj.operations = []; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = omitDefault(message.serviceConfigId); return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1013,8 +1013,8 @@ export const ReportResponse = { } else { obj.report_errors = []; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_rollout_id = omitDefault(message.serviceRolloutId); return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1116,7 +1116,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = omitDefault(message.operationId); obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts index 33343b4034..c06bc55864 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -273,15 +273,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { obj.resources = []; } - obj.flags = message.flags; + obj.flags = omitDefault(message.flags); return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -423,11 +423,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); + obj.permission = omitDefault(message.permission); + obj.container = omitDefault(message.container); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -526,8 +526,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -794,8 +794,8 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = omitDefault(message.serviceName); + obj.service_config_id = omitDefault(message.serviceConfigId); if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts index cd01fd4c8b..781a3d869a 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../protobuf/timestamp"; import { ConfigChange, ConfigChangeSDKType } from "../../config_change"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; /** Code describes the status of the operation (or one of its steps). */ export enum OperationMetadata_Status { @@ -630,8 +630,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = omitDefault(message.serviceName); + obj.producer_project_id = omitDefault(message.producerProjectId); return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -770,7 +770,7 @@ export const OperationMetadata = { resourceNames: Array.isArray(object?.resource_names) ? object.resource_names.map((e: any) => e) : [], steps: Array.isArray(object?.steps) ? object.steps.map((e: any) => OperationMetadata_Step.fromAmino(e)) : [], progressPercentage: object.progress_percentage, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: OperationMetadata): OperationMetadataAmino { @@ -785,7 +785,7 @@ export const OperationMetadata = { } else { obj.steps = []; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = omitDefault(message.progressPercentage); obj.start_time = message.startTime; return obj; }, @@ -886,8 +886,8 @@ export const OperationMetadata_Step = { }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = message.status; + obj.description = omitDefault(message.description); + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1001,9 +1001,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = message.kind; - obj.message = message.message; + obj.location = omitDefault(message.location); + obj.kind = omitDefault(message.kind); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1111,7 +1111,7 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { @@ -1230,9 +1230,9 @@ export const ConfigFile = { }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = omitDefault(message.filePath); obj.file_contents = message.fileContents; - obj.file_type = message.fileType; + obj.file_type = omitDefault(message.fileType); return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1318,7 +1318,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1580,7 +1580,7 @@ export const Rollout = { fromAmino(object: RolloutAmino): Rollout { return { rolloutId: object.rollout_id, - createTime: object.create_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, createdBy: object.created_by, status: isSet(object.status) ? rollout_RolloutStatusFromJSON(object.status) : -1, trafficPercentStrategy: object?.traffic_percent_strategy ? Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy) : undefined, @@ -1590,13 +1590,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = omitDefault(message.rolloutId); obj.create_time = message.createTime; - obj.created_by = message.createdBy; - obj.status = message.status; + obj.created_by = omitDefault(message.createdBy); + obj.status = omitDefault(message.status); obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1695,8 +1695,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts index f9c6027846..7067f6064c 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts @@ -2,7 +2,7 @@ import { ManagedService, ManagedServiceSDKType, ConfigSource, ConfigSourceSDKTyp import { Service, ServiceSDKType } from "../../service"; import { Any, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.servicemanagement.v1"; export enum GetServiceConfigRequest_ConfigView { /** BASIC - Server response includes all fields except SourceInfo. */ @@ -478,10 +478,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = omitDefault(message.producerProjectId); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.consumer_id = omitDefault(message.consumerId); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -594,7 +594,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -680,7 +680,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -854,7 +854,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -940,7 +940,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1142,9 +1142,9 @@ export const GetServiceConfigRequest = { }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = message.view; + obj.service_name = omitDefault(message.serviceName); + obj.config_id = omitDefault(message.configId); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1258,9 +1258,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1373,7 +1373,7 @@ export const ListServiceConfigsResponse = { } else { obj.service_configs = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1475,7 +1475,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1592,9 +1592,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = omitDefault(message.validateOnly); return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -1784,7 +1784,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = omitDefault(message.serviceName); obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -1913,10 +1913,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = omitDefault(message.serviceName); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2029,7 +2029,7 @@ export const ListServiceRolloutsResponse = { } else { obj.rollouts = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2129,8 +2129,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = omitDefault(message.serviceName); + obj.rollout_id = omitDefault(message.rolloutId); return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2379,8 +2379,8 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = omitDefault(message.serviceName); + obj.id = omitDefault(message.id); if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts index 4db51c1afe..1dc3de1642 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -269,10 +269,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -518,8 +518,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts index 318f17db8c..55f1d4aced 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts @@ -1,6 +1,6 @@ import { Service, ServiceSDKType } from "./resources"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1"; /** * Enum to determine if service usage should be checked when disabling a @@ -364,7 +364,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -566,9 +566,9 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = message.checkIfServiceHasUsage; + obj.name = omitDefault(message.name); + obj.disable_dependent_services = omitDefault(message.disableDependentServices); + obj.check_if_service_has_usage = omitDefault(message.checkIfServiceHasUsage); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -742,7 +742,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -870,10 +870,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -986,7 +986,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1094,7 +1094,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -1324,8 +1324,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = omitDefault(message.serviceId); + obj.error_message = omitDefault(message.errorMessage); return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1433,7 +1433,7 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.names) { obj.names = message.names.map(e => e); } else { diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts index d53e65e47d..d0eaaa2ee9 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts @@ -7,7 +7,7 @@ import { Endpoint, EndpointSDKType } from "../../endpoint"; import { MonitoredResourceDescriptor, MonitoredResourceDescriptorSDKType } from "../../monitored_resource"; import { Monitoring, MonitoringSDKType } from "../../monitoring"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Whether or not a service has been enabled for use by a consumer. */ export enum State { @@ -723,10 +723,10 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = omitDefault(message.name); + obj.parent = omitDefault(message.parent); obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -972,8 +972,8 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = omitDefault(message.name); + obj.title = omitDefault(message.title); if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { @@ -1263,9 +1263,9 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.display_name = omitDefault(message.displayName); if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { @@ -1276,7 +1276,7 @@ export const ConsumerQuotaMetric = { } else { obj.descendant_consumer_quota_limits = []; } - obj.unit = message.unit; + obj.unit = omitDefault(message.unit); return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1440,11 +1440,11 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = omitDefault(message.name); + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.is_precise = omitDefault(message.isPrecise); + obj.allows_admin_overrides = omitDefault(message.allowsAdminOverrides); if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { @@ -1548,8 +1548,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -1752,8 +1752,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = omitDefault(message.effectiveLimit); + obj.default_limit = omitDefault(message.defaultLimit); obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -1861,8 +1861,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2057,17 +2057,17 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.override_value = omitDefault(message.overrideValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.admin_override_ancestor = omitDefault(message.adminOverrideAncestor); return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2264,8 +2264,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2460,17 +2460,17 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.name = omitDefault(message.name); + obj.policy_value = omitDefault(message.policyValue); obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = omitDefault(message.metric); + obj.unit = omitDefault(message.unit); + obj.container = omitDefault(message.container); return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2570,8 +2570,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = omitDefault(message.email); + obj.unique_id = omitDefault(message.uniqueId); return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts index 367c95fe30..02d65eb28d 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,7 +1,7 @@ import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideSDKType, QuotaSafetyCheck, QuotaSafetyCheckSDKType, OverrideInlineSource, OverrideInlineSourceSDKType, Service, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentitySDKType, quotaViewFromJSON, quotaViewToJSON, quotaSafetyCheckFromJSON, quotaSafetyCheckToJSON } from "./resources"; import { FieldMask, FieldMaskSDKType } from "../../../protobuf/field_mask"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "google.api.serviceusage.v1beta1"; /** Enum for service identity state. */ export enum GetServiceIdentityResponse_IdentityState { @@ -823,7 +823,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -909,7 +909,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -995,7 +995,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1123,10 +1123,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1239,7 +1239,7 @@ export const ListServicesResponse = { } else { obj.services = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1347,7 +1347,7 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { @@ -1480,10 +1480,10 @@ export const ListConsumerQuotaMetricsRequest = { }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = message.view; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -1596,7 +1596,7 @@ export const ListConsumerQuotaMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -1696,8 +1696,8 @@ export const GetConsumerQuotaMetricRequest = { }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -1797,8 +1797,8 @@ export const GetConsumerQuotaLimitRequest = { }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = message.view; + obj.name = omitDefault(message.name); + obj.view = omitDefault(message.view); return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -1945,9 +1945,9 @@ export const CreateAdminOverrideRequest = { }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -2115,9 +2115,9 @@ export const UpdateAdminOverrideRequest = { }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -2254,8 +2254,8 @@ export const DeleteAdminOverrideRequest = { }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -2374,9 +2374,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -2489,7 +2489,7 @@ export const ListAdminOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -2734,9 +2734,9 @@ export const ImportAdminOverridesRequest = { }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3053,9 +3053,9 @@ export const CreateConsumerOverrideRequest = { }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3223,9 +3223,9 @@ export const UpdateConsumerOverrideRequest = { }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); @@ -3362,8 +3362,8 @@ export const DeleteConsumerOverrideRequest = { }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = omitDefault(message.name); + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -3482,9 +3482,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -3597,7 +3597,7 @@ export const ListConsumerOverridesResponse = { } else { obj.overrides = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -3842,9 +3842,9 @@ export const ImportConsumerOverridesRequest = { }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = omitDefault(message.force); if (message.forceOnly) { obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); } else { @@ -4466,7 +4466,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -4569,7 +4569,7 @@ export const GetServiceIdentityResponse = { toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = message.state; + obj.state = omitDefault(message.state); return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts index 2f1c8fe711..edd0255c4d 100644 --- a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -299,7 +299,7 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { @@ -418,9 +418,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = message.name; - obj.http_header = message.httpHeader; - obj.url_query_parameter = message.urlQueryParameter; + obj.name = omitDefault(message.name); + obj.http_header = omitDefault(message.httpHeader); + obj.url_query_parameter = omitDefault(message.urlQueryParameter); return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputv4/google/api/usage.ts b/__fixtures__/v-next/outputv4/google/api/usage.ts index 78b90f4af7..3b4ac7bb8b 100644 --- a/__fixtures__/v-next/outputv4/google/api/usage.ts +++ b/__fixtures__/v-next/outputv4/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -240,7 +240,7 @@ export const Usage = { } else { obj.rules = []; } - obj.producer_notification_channel = message.producerNotificationChannel; + obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -354,9 +354,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.allow_unregistered_calls = message.allowUnregisteredCalls; - obj.skip_service_control = message.skipServiceControl; + obj.selector = omitDefault(message.selector); + obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); + obj.skip_service_control = omitDefault(message.skipServiceControl); return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputv4/google/api/visibility.ts b/__fixtures__/v-next/outputv4/google/api/visibility.ts index 450ea80efc..09da1f0c53 100644 --- a/__fixtures__/v-next/outputv4/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv4/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -277,8 +277,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.restriction = message.restriction; + obj.selector = omitDefault(message.selector); + obj.restriction = omitDefault(message.restriction); return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts index 8880746560..5fc51323d8 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -374,21 +374,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.request_method = omitDefault(message.requestMethod); + obj.request_url = omitDefault(message.requestUrl); + obj.request_size = omitDefault(message.requestSize); + obj.status = omitDefault(message.status); + obj.response_size = omitDefault(message.responseSize); + obj.user_agent = omitDefault(message.userAgent); + obj.remote_ip = omitDefault(message.remoteIp); + obj.server_ip = omitDefault(message.serverIp); + obj.referer = omitDefault(message.referer); obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.cache_lookup = omitDefault(message.cacheLookup); + obj.cache_hit = omitDefault(message.cacheHit); + obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); + obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); + obj.protocol = omitDefault(message.protocol); return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts index 4cc281d303..49378fc5b7 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts @@ -5,7 +5,7 @@ import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../type/log_severity"; import { HttpRequest, HttpRequestSDKType } from "../type/http_request"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; export interface LogEntry_LabelsEntry { key: string; @@ -361,8 +361,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -702,8 +702,8 @@ export const LogEntry = { protoPayload: object?.proto_payload ? Any.fromAmino(object.proto_payload) : undefined, textPayload: object?.text_payload, jsonPayload: object?.json_payload ? Struct.fromAmino(object.json_payload) : undefined, - timestamp: object.timestamp, - receiveTimestamp: object.receive_timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, + receiveTimestamp: object?.receive_timestamp ? Timestamp.fromAmino(object.receive_timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, insertId: object.insert_id, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, @@ -723,15 +723,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp; obj.receive_timestamp = message.receiveTimestamp; - obj.severity = message.severity; - obj.insert_id = message.insertId; + obj.severity = omitDefault(message.severity); + obj.insert_id = omitDefault(message.insertId); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -740,9 +740,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = omitDefault(message.trace); + obj.span_id = omitDefault(message.spanId); + obj.trace_sampled = omitDefault(message.traceSampled); obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -872,10 +872,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = omitDefault(message.id); + obj.producer = omitDefault(message.producer); + obj.first = omitDefault(message.first); + obj.last = omitDefault(message.last); return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -991,9 +991,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; - obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.file = omitDefault(message.file); + obj.line = omitDefault(message.line); + obj.function = omitDefault(message.function); return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1107,9 +1107,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = omitDefault(message.uid); + obj.index = omitDefault(message.index); + obj.total_splits = omitDefault(message.totalSplits); return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts index 388e3851d5..61cfe29fa2 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts @@ -3,7 +3,7 @@ import { LogEntry, LogEntrySDKType } from "./log_entry"; import { Duration, DurationSDKType } from "../../protobuf/duration"; import { Status, StatusSDKType } from "../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** An indicator of why entries were omitted. */ export enum TailLogEntriesResponse_SuppressionInfo_Reason { @@ -550,7 +550,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -649,8 +649,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -853,7 +853,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = omitDefault(message.logName); obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -866,8 +866,8 @@ export const WriteLogEntriesRequest = { } else { obj.entries = []; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = omitDefault(message.partialSuccess); + obj.dry_run = omitDefault(message.dryRun); return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1035,7 +1035,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1319,10 +1319,10 @@ export const ListLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = omitDefault(message.filter); + obj.order_by = omitDefault(message.orderBy); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1435,7 +1435,7 @@ export const ListLogEntriesResponse = { } else { obj.entries = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1535,8 +1535,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -1649,7 +1649,7 @@ export const ListMonitoredResourceDescriptorsResponse = { } else { obj.resource_descriptors = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -1785,9 +1785,9 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = omitDefault(message.parent); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { @@ -1905,7 +1905,7 @@ export const ListLogsResponse = { } else { obj.log_names = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2034,7 +2034,7 @@ export const TailLogEntriesRequest = { } else { obj.resource_names = []; } - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2260,8 +2260,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.suppressed_count = message.suppressedCount; + obj.reason = omitDefault(message.reason); + obj.suppressed_count = omitDefault(message.suppressedCount); return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts index 8c50a1c143..2577fcbe0a 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts @@ -1,7 +1,7 @@ import { FieldMask, FieldMaskSDKType } from "../../protobuf/field_mask"; import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Deprecated. This is unused. */ export enum LogSink_VersionFormat { @@ -1763,8 +1763,8 @@ export const LogBucket = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, retentionDays: object.retention_days, locked: object.locked, lifecycleState: isSet(object.lifecycle_state) ? lifecycleStateFromJSON(object.lifecycle_state) : -1, @@ -1774,13 +1774,13 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = message.lifecycleState; + obj.retention_days = omitDefault(message.retentionDays); + obj.locked = omitDefault(message.locked); + obj.lifecycle_state = omitDefault(message.lifecycleState); if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { @@ -1921,18 +1921,18 @@ export const LogView = { return { name: object.name, description: object.description, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, filter: object.filter }; }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.filter = message.filter; + obj.filter = omitDefault(message.filter); return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -2176,25 +2176,25 @@ export const LogSink = { writerIdentity: object.writer_identity, includeChildren: object.include_children, bigqueryOptions: object?.bigquery_options ? BigQueryOptions.fromAmino(object.bigquery_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.destination = omitDefault(message.destination); + obj.filter = omitDefault(message.filter); + obj.description = omitDefault(message.description); + obj.disabled = omitDefault(message.disabled); if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { obj.exclusions = []; } - obj.output_version_format = message.outputVersionFormat; - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = omitDefault(message.outputVersionFormat); + obj.writer_identity = omitDefault(message.writerIdentity); + obj.include_children = omitDefault(message.includeChildren); obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; @@ -2297,8 +2297,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = omitDefault(message.usePartitionedTables); + obj.uses_timestamp_column_partitioning = omitDefault(message.usesTimestampColumnPartitioning); return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -2412,9 +2412,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -2527,7 +2527,7 @@ export const ListBucketsResponse = { } else { obj.buckets = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -2643,8 +2643,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = omitDefault(message.parent); + obj.bucket_id = omitDefault(message.bucketId); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -2763,7 +2763,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -2851,7 +2851,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -2937,7 +2937,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -3023,7 +3023,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -3137,9 +3137,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -3252,7 +3252,7 @@ export const ListViewsResponse = { } else { obj.views = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -3368,8 +3368,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = omitDefault(message.parent); + obj.view_id = omitDefault(message.viewId); obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -3488,7 +3488,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3576,7 +3576,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -3662,7 +3662,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -3776,9 +3776,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -3891,7 +3891,7 @@ export const ListSinksResponse = { } else { obj.sinks = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -3977,7 +3977,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -4093,9 +4093,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -4227,9 +4227,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = omitDefault(message.uniqueWriterIdentity); obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -4316,7 +4316,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = omitDefault(message.sinkName); return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -4466,16 +4466,16 @@ export const LogExclusion = { description: object.description, filter: object.filter, disabled: object.disabled, - createTime: object.create_time, - updateTime: object.update_time + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined }; }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.create_time = message.createTime; obj.update_time = message.updateTime; return obj; @@ -4591,9 +4591,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -4706,7 +4706,7 @@ export const ListExclusionsResponse = { } else { obj.exclusions = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -4792,7 +4792,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -4894,7 +4894,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -5013,7 +5013,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5101,7 +5101,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -5187,7 +5187,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -5305,7 +5305,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5421,9 +5421,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.service_account_id = omitDefault(message.serviceAccountId); return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -5509,7 +5509,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -5627,7 +5627,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5771,11 +5771,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = omitDefault(message.name); + obj.kms_key_name = omitDefault(message.kmsKeyName); + obj.kms_service_account_id = omitDefault(message.kmsServiceAccountId); + obj.storage_location = omitDefault(message.storageLocation); + obj.disable_default_sink = omitDefault(message.disableDefaultSink); return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -5889,9 +5889,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.destination = omitDefault(message.destination); return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -6052,8 +6052,8 @@ export const CopyLogEntriesMetadata = { }, fromAmino(object: CopyLogEntriesMetadataAmino): CopyLogEntriesMetadata { return { - startTime: object.start_time, - endTime: object.end_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, state: isSet(object.state) ? operationStateFromJSON(object.state) : -1, cancellationRequested: object.cancellation_requested, request: object?.request ? CopyLogEntriesRequest.fromAmino(object.request) : undefined, @@ -6065,11 +6065,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime; obj.end_time = message.endTime; - obj.state = message.state; - obj.cancellation_requested = message.cancellationRequested; + obj.state = omitDefault(message.state); + obj.cancellation_requested = omitDefault(message.cancellationRequested); obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = omitDefault(message.progress); + obj.writer_identity = omitDefault(message.writerIdentity); return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { @@ -6157,7 +6157,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = omitDefault(message.logEntriesCopiedCount); return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts index be81f74a54..91fbecc7fa 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts @@ -2,7 +2,7 @@ import { MetricDescriptor, MetricDescriptorSDKType } from "../../api/metric"; import { Distribution_BucketOptions } from "../../api/distribution"; import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, isObject } from "../../../helpers"; export const protobufPackage = "google.logging.v2"; /** Logging API version. */ export enum LogMetric_ApiVersion { @@ -398,8 +398,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -659,19 +659,19 @@ export const LogMetric = { return acc; }, {}) : {}, bucketOptions: object?.bucket_options ? Distribution_BucketOptions.fromAmino(object.bucket_options) : undefined, - createTime: object.create_time, - updateTime: object.update_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, version: isSet(object.version) ? logMetric_ApiVersionFromJSON(object.version) : -1 }; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = omitDefault(message.name); + obj.description = omitDefault(message.description); + obj.filter = omitDefault(message.filter); + obj.disabled = omitDefault(message.disabled); obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = omitDefault(message.valueExtractor); obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -681,7 +681,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime; obj.update_time = message.updateTime; - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -795,9 +795,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = omitDefault(message.parent); + obj.page_token = omitDefault(message.pageToken); + obj.page_size = omitDefault(message.pageSize); return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -910,7 +910,7 @@ export const ListLogMetricsResponse = { } else { obj.metrics = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -996,7 +996,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1098,7 +1098,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = omitDefault(message.parent); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1201,7 +1201,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1288,7 +1288,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = omitDefault(message.metricName); return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts index 29d585c7fd..46b3ec481f 100644 --- a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { Any, AnySDKType } from "../protobuf/any"; import { Status, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -308,9 +308,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = message.done; + obj.done = omitDefault(message.done); obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -398,7 +398,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -526,10 +526,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = omitDefault(message.name); + obj.filter = omitDefault(message.filter); + obj.page_size = omitDefault(message.pageSize); + obj.page_token = omitDefault(message.pageToken); return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -642,7 +642,7 @@ export const ListOperationsResponse = { } else { obj.operations = []; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = omitDefault(message.nextPageToken); return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -728,7 +728,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -814,7 +814,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -916,7 +916,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1017,8 +1017,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = omitDefault(message.responseType); + obj.metadata_type = omitDefault(message.metadataType); return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/any.ts b/__fixtures__/v-next/outputv4/google/protobuf/any.ts index 8ff01399fb..52d244df0c 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/any.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/__fixtures__/v-next/outputv4/google/protobuf/api.ts b/__fixtures__/v-next/outputv4/google/protobuf/api.ts index f62c8dc86f..1055d61480 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/api.ts @@ -1,7 +1,7 @@ import { Option, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJSON } from "./type"; import { SourceContext, SourceContextSDKType } from "./source_context"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Api is a light-weight descriptor for an API Interface. @@ -453,7 +453,7 @@ export const Api = { }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { @@ -464,14 +464,14 @@ export const Api = { } else { obj.options = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { obj.mixins = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -649,17 +649,17 @@ export const Method = { }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = omitDefault(message.name); + obj.request_type_url = omitDefault(message.requestTypeUrl); + obj.request_streaming = omitDefault(message.requestStreaming); + obj.response_type_url = omitDefault(message.responseTypeUrl); + obj.response_streaming = omitDefault(message.responseStreaming); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -759,8 +759,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = omitDefault(message.name); + obj.root = omitDefault(message.root); return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts index 789733e394..834b2ea2ae 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -251,10 +251,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = message.major; - obj.minor = message.minor; - obj.patch = message.patch; - obj.suffix = message.suffix; + obj.major = omitDefault(message.major); + obj.minor = omitDefault(message.minor); + obj.patch = omitDefault(message.patch); + obj.suffix = omitDefault(message.suffix); return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -405,7 +405,7 @@ export const CodeGeneratorRequest = { } else { obj.file_to_generate = []; } - obj.parameter = message.parameter; + obj.parameter = omitDefault(message.parameter); if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { @@ -519,7 +519,7 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { @@ -638,9 +638,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = message.name; - obj.insertion_point = message.insertionPoint; - obj.content = message.content; + obj.name = omitDefault(message.name); + obj.insertion_point = omitDefault(message.insertionPoint); + obj.content = omitDefault(message.content); return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts index fd096b3f36..6249333b1a 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; export enum FieldDescriptorProto_Type { /** @@ -1675,8 +1675,8 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = omitDefault(message.name); + obj.package = omitDefault(message.package); if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { @@ -1714,7 +1714,7 @@ export const FileDescriptorProto = { } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -1992,7 +1992,7 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { @@ -2149,8 +2149,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2251,8 +2251,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2564,15 +2564,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = message.label; - obj.type = message.type; - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); + obj.label = omitDefault(message.label); + obj.type = omitDefault(message.type); + obj.type_name = omitDefault(message.typeName); + obj.extendee = omitDefault(message.extendee); + obj.default_value = omitDefault(message.defaultValue); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.json_name = omitDefault(message.jsonName); obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2675,7 +2675,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -2844,7 +2844,7 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { @@ -2960,8 +2960,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = omitDefault(message.start); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3077,8 +3077,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3203,7 +3203,7 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { @@ -3367,12 +3367,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = omitDefault(message.name); + obj.input_type = omitDefault(message.inputType); + obj.output_type = omitDefault(message.outputType); obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = omitDefault(message.clientStreaming); + obj.server_streaming = omitDefault(message.serverStreaming); return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3746,26 +3746,26 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = message.optimizeFor; - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = omitDefault(message.javaPackage); + obj.java_outer_classname = omitDefault(message.javaOuterClassname); + obj.java_multiple_files = omitDefault(message.javaMultipleFiles); + obj.java_generate_equals_and_hash = omitDefault(message.javaGenerateEqualsAndHash); + obj.java_string_check_utf8 = omitDefault(message.javaStringCheckUtf8); + obj.optimize_for = omitDefault(message.optimizeFor); + obj.go_package = omitDefault(message.goPackage); + obj.cc_generic_services = omitDefault(message.ccGenericServices); + obj.java_generic_services = omitDefault(message.javaGenericServices); + obj.py_generic_services = omitDefault(message.pyGenericServices); + obj.php_generic_services = omitDefault(message.phpGenericServices); + obj.deprecated = omitDefault(message.deprecated); + obj.cc_enable_arenas = omitDefault(message.ccEnableArenas); + obj.objc_class_prefix = omitDefault(message.objcClassPrefix); + obj.csharp_namespace = omitDefault(message.csharpNamespace); + obj.swift_prefix = omitDefault(message.swiftPrefix); + obj.php_class_prefix = omitDefault(message.phpClassPrefix); + obj.php_namespace = omitDefault(message.phpNamespace); + obj.php_metadata_namespace = omitDefault(message.phpMetadataNamespace); + obj.ruby_package = omitDefault(message.rubyPackage); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -3920,10 +3920,10 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = omitDefault(message.messageSetWireFormat); + obj.no_standard_descriptor_accessor = omitDefault(message.noStandardDescriptorAccessor); + obj.deprecated = omitDefault(message.deprecated); + obj.map_entry = omitDefault(message.mapEntry); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4106,12 +4106,12 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = message.ctype; - obj.packed = message.packed; - obj.jstype = message.jstype; - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = omitDefault(message.ctype); + obj.packed = omitDefault(message.packed); + obj.jstype = omitDefault(message.jstype); + obj.lazy = omitDefault(message.lazy); + obj.deprecated = omitDefault(message.deprecated); + obj.weak = omitDefault(message.weak); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4336,8 +4336,8 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = omitDefault(message.allowAlias); + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4450,7 +4450,7 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4563,7 +4563,7 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = omitDefault(message.deprecated); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4690,8 +4690,8 @@ export const MethodOptions = { }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = message.idempotencyLevel; + obj.deprecated = omitDefault(message.deprecated); + obj.idempotency_level = omitDefault(message.idempotencyLevel); if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { @@ -4883,12 +4883,12 @@ export const UninterpretedOption = { } else { obj.name = []; } - obj.identifier_value = message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.identifier_value = omitDefault(message.identifierValue); + obj.positive_int_value = omitDefault(message.positiveIntValue); + obj.negative_int_value = omitDefault(message.negativeIntValue); + obj.double_value = omitDefault(message.doubleValue); obj.string_value = message.stringValue; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = omitDefault(message.aggregateValue); return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -4988,8 +4988,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = omitDefault(message.namePart); + obj.is_extension = omitDefault(message.isExtension); return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5281,8 +5281,8 @@ export const SourceCodeInfo_Location = { } else { obj.span = []; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = omitDefault(message.leadingComments); + obj.trailing_comments = omitDefault(message.trailingComments); if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { @@ -5535,9 +5535,9 @@ export const GeneratedCodeInfo_Annotation = { } else { obj.path = []; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = omitDefault(message.sourceFile); + obj.begin = omitDefault(message.begin); + obj.end = omitDefault(message.end); return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts index ba895107af..eeeb250233 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented diff --git a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts index 78f5cf26ff..9788681aa4 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -86,7 +86,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = message.fileName; + obj.file_name = omitDefault(message.fileName); return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts index e6a5646424..7440ed0abf 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `NullValue` is a singleton enumeration to represent the null value for the @@ -209,7 +209,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = omitDefault(message.key); obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -498,10 +498,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = omitDefault(message.nullValue); + obj.number_value = omitDefault(message.numberValue); + obj.string_value = omitDefault(message.stringValue); + obj.bool_value = omitDefault(message.boolValue); obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts index 3cc10e2e5b..c1aba26243 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, fromJsonTimestamp, omitDefault, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local diff --git a/__fixtures__/v-next/outputv4/google/protobuf/type.ts b/__fixtures__/v-next/outputv4/google/protobuf/type.ts index 4464ccb561..9982e23e51 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/type.ts @@ -1,7 +1,7 @@ import { SourceContext, SourceContextSDKType } from "./source_context"; import { Any, AnySDKType } from "./any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** Basic field types. */ export enum Field_Kind { @@ -531,7 +531,7 @@ export const Type = { }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { @@ -548,7 +548,7 @@ export const Type = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -768,20 +768,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = message.kind; - obj.cardinality = message.cardinality; - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = omitDefault(message.kind); + obj.cardinality = omitDefault(message.cardinality); + obj.number = omitDefault(message.number); + obj.name = omitDefault(message.name); + obj.type_url = omitDefault(message.typeUrl); + obj.oneof_index = omitDefault(message.oneofIndex); + obj.packed = omitDefault(message.packed); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { obj.options = []; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = omitDefault(message.jsonName); + obj.default_value = omitDefault(message.defaultValue); return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -941,7 +941,7 @@ export const Enum = { }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { @@ -953,7 +953,7 @@ export const Enum = { obj.options = []; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = message.syntax; + obj.syntax = omitDefault(message.syntax); return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1075,8 +1075,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = omitDefault(message.name); + obj.number = omitDefault(message.number); if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { @@ -1183,7 +1183,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts index 03d4f6b1a0..a79cd09b7e 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -221,7 +221,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -307,7 +307,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -395,7 +395,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -483,7 +483,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -569,7 +569,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -655,7 +655,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -741,7 +741,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -827,7 +827,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts index 3c3c86d0de..9275ece229 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts @@ -3,7 +3,7 @@ import { Timestamp, TimestampSDKType } from "../../protobuf/timestamp"; import { Duration, DurationSDKType } from "../../protobuf/duration"; import { Any, AnySDKType } from "../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject, toTimestamp, fromTimestamp } from "../../../helpers"; export const protobufPackage = "google.rpc.context"; /** * This message defines the standard attribute vocabulary for Google APIs. @@ -826,8 +826,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1008,16 +1008,16 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.ip = omitDefault(message.ip); + obj.port = omitDefault(message.port); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = omitDefault(message.principal); + obj.region_code = omitDefault(message.regionCode); return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1145,10 +1145,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = omitDefault(message.service); + obj.operation = omitDefault(message.operation); + obj.protocol = omitDefault(message.protocol); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1308,13 +1308,13 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = omitDefault(message.principal); if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { obj.audiences = []; } - obj.presenter = message.presenter; + obj.presenter = omitDefault(message.presenter); obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); @@ -1419,8 +1419,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -1692,7 +1692,7 @@ export const AttributeContext_Request = { host: object.host, scheme: object.scheme, query: object.query, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, size: BigInt(object.size), protocol: object.protocol, reason: object.reason, @@ -1701,22 +1701,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = omitDefault(message.id); + obj.method = omitDefault(message.method); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = omitDefault(message.path); + obj.host = omitDefault(message.host); + obj.scheme = omitDefault(message.scheme); + obj.query = omitDefault(message.query); obj.time = message.time; - obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.size = omitDefault(message.size); + obj.protocol = omitDefault(message.protocol); + obj.reason = omitDefault(message.reason); obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -1816,8 +1816,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -1996,14 +1996,14 @@ export const AttributeContext_Response = { acc[key] = String(value); return acc; }, {}) : {}, - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, backendLatency: object?.backend_latency ? Duration.fromAmino(object.backend_latency) : undefined }; }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = omitDefault(message.code); + obj.size = omitDefault(message.size); obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { @@ -2110,8 +2110,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2204,8 +2204,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2516,37 +2516,37 @@ export const AttributeContext_Resource = { return acc; }, {}) : {}, displayName: object.display_name, - createTime: object.create_time, - updateTime: object.update_time, - deleteTime: object.delete_time, + createTime: object?.create_time ? Timestamp.fromAmino(object.create_time) : undefined, + updateTime: object?.update_time ? Timestamp.fromAmino(object.update_time) : undefined, + deleteTime: object?.delete_time ? Timestamp.fromAmino(object.delete_time) : undefined, etag: object.etag, location: object.location }; }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = omitDefault(message.service); + obj.name = omitDefault(message.name); + obj.type = omitDefault(message.type); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = omitDefault(message.uid); obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = omitDefault(message.displayName); obj.create_time = message.createTime; obj.update_time = message.updateTime; obj.delete_time = message.deleteTime; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = omitDefault(message.etag); + obj.location = omitDefault(message.location); return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputv4/google/rpc/error_details.ts b/__fixtures__/v-next/outputv4/google/rpc/error_details.ts index 27f17b0d83..4fa194151d 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, isObject } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -587,7 +587,7 @@ export const DebugInfo = { } else { obj.stack_entries = []; } - obj.detail = message.detail; + obj.detail = omitDefault(message.detail); return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -785,8 +785,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = message.subject; - obj.description = message.description; + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -885,8 +885,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1037,8 +1037,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.domain = message.domain; + obj.reason = omitDefault(message.reason); + obj.domain = omitDefault(message.domain); obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1256,9 +1256,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = message.type; - obj.subject = message.subject; - obj.description = message.description; + obj.type = omitDefault(message.type); + obj.subject = omitDefault(message.subject); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1456,8 +1456,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = message.field; - obj.description = message.description; + obj.field = omitDefault(message.field); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1557,8 +1557,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = message.requestId; - obj.serving_data = message.servingData; + obj.request_id = omitDefault(message.requestId); + obj.serving_data = omitDefault(message.servingData); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1686,10 +1686,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = message.resourceType; - obj.resource_name = message.resourceName; - obj.owner = message.owner; - obj.description = message.description; + obj.resource_type = omitDefault(message.resourceType); + obj.resource_name = omitDefault(message.resourceName); + obj.owner = omitDefault(message.owner); + obj.description = omitDefault(message.description); return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -1887,8 +1887,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = message.description; - obj.url = message.url; + obj.description = omitDefault(message.description); + obj.url = omitDefault(message.url); return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -1988,8 +1988,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = message.locale; - obj.message = message.message; + obj.locale = omitDefault(message.locale); + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputv4/google/rpc/status.ts b/__fixtures__/v-next/outputv4/google/rpc/status.ts index d8ad9676d8..508234cd96 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -143,8 +143,8 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = message.code; - obj.message = message.message; + obj.code = omitDefault(message.code); + obj.message = omitDefault(message.message); if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/helpers.ts b/__fixtures__/v-next/outputv4/helpers.ts index f92d2b935a..b18c95df6c 100644 --- a/__fixtures__/v-next/outputv4/helpers.ts +++ b/__fixtures__/v-next/outputv4/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -255,3 +261,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts index 17a460edbf..9ebec07a16 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -119,7 +119,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts index 12a26fc005..05163bb695 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -146,7 +146,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = omitDefault(message.hash); return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts index ec7285eabb..4bb32c157d 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -131,8 +131,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = message.path; - obj.base_denom = message.baseDenom; + obj.path = omitDefault(message.path); + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -238,8 +238,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = message.sendEnabled; - obj.receive_enabled = message.receiveEnabled; + obj.send_enabled = omitDefault(message.sendEnabled); + obj.receive_enabled = omitDefault(message.receiveEnabled); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index b6c87f6d09..3f350560f0 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp.toString() + timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts index 30ae17c344..dae3011140 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -205,13 +205,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts index a6e937adf2..ab4ba44b25 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -136,10 +136,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.denom = omitDefault(message.denom); + obj.amount = omitDefault(message.amount); + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts index 04190baa8f..78b3038c94 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts @@ -1,6 +1,6 @@ import { Height, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * State defines if a channel is in one of the following states: @@ -411,15 +411,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -605,17 +605,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = message.state; - obj.ordering = message.ordering; + obj.state = omitDefault(message.state); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { obj.connection_hops = []; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = omitDefault(message.version); + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -721,8 +721,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -918,14 +918,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.sequence = omitDefault(message.sequence); + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); + obj.destination_port = omitDefault(message.destinationPort); + obj.destination_channel = omitDefault(message.destinationChannel); obj.data = message.data; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1061,9 +1061,9 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); obj.data = message.data; return obj; }, @@ -1171,7 +1171,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts index 4caffc7b8e..8de4c2b8a7 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -301,7 +301,7 @@ export const GenesisState = { } else { obj.ack_sequences = []; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = omitDefault(message.nextChannelSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -423,9 +423,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts index 22db0b5cf0..db564a50ef 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts @@ -3,7 +3,7 @@ import { Channel, ChannelSDKType, IdentifiedChannel, IdentifiedChannelSDKType, P import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** QueryChannelRequest is the request type for the Query/Channel RPC method */ export interface QueryChannelRequest { @@ -605,8 +605,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1072,7 +1072,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = omitDefault(message.connection); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1317,8 +1317,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -1582,10 +1582,10 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -1724,7 +1724,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -1848,9 +1848,9 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2096,8 +2096,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2358,9 +2358,9 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2482,7 +2482,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = omitDefault(message.received); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2606,9 +2606,9 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -2885,8 +2885,8 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); @@ -3167,8 +3167,8 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { @@ -3440,8 +3440,8 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { @@ -3682,8 +3682,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { @@ -3807,7 +3807,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = omitDefault(message.nextSequenceReceive); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index 43d1082629..70454ca48a 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), signer: omitDefault(signer) }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), signer: omitDefault(signer) }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), + sequence: omitDefault(packet.sequence)?.toString?.(), source_port: omitDefault(packet.sourcePort), source_channel: omitDefault(packet.sourceChannel), destination_port: omitDefault(packet.destinationPort), @@ -626,7 +626,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, acknowledgement: acknowledgement, proof_acked: proofAcked, diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts index 015e853cc1..94a8e49b45 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts @@ -1,7 +1,7 @@ import { Channel, ChannelSDKType, Packet, PacketSDKType } from "./channel"; import { Height, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** * MsgChannelOpenInit defines an sdk.Msg to initialize a channel handshake. It @@ -352,9 +352,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = omitDefault(message.portId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -607,13 +607,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = omitDefault(message.portId); + obj.previous_channel_id = omitDefault(message.previousChannelId); obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -864,13 +864,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.counterparty_channel_id = omitDefault(message.counterpartyChannelId); + obj.counterparty_version = omitDefault(message.counterpartyVersion); obj.proof_try = message.proofTry; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1093,11 +1093,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1290,9 +1290,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1515,11 +1515,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = omitDefault(message.portId); + obj.channel_id = omitDefault(message.channelId); obj.proof_init = message.proofInit; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1733,7 +1733,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -1963,8 +1963,8 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2209,8 +2209,8 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived; obj.proof_close = message.proofClose; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.next_sequence_recv = omitDefault(message.nextSequenceRecv); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2439,7 +2439,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement; obj.proof_acked = message.proofAcked; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts index ca73922d76..2a950d5085 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -242,7 +242,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -468,7 +468,7 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { @@ -607,10 +607,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); + obj.subject_client_id = omitDefault(message.subjectClientId); + obj.substitute_client_id = omitDefault(message.substituteClientId); return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -748,8 +748,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -861,8 +861,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts index 90578a4ebb..0a979967ad 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -240,8 +240,8 @@ export const GenesisState = { obj.clients_metadata = []; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.create_localhost = omitDefault(message.createLocalhost); + obj.next_client_sequence = omitDefault(message.nextClientSequence); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -462,7 +462,7 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts index 61d8064d6a..c21a2d9f4d 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -332,7 +332,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -811,10 +811,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.client_id = omitDefault(message.clientId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); + obj.latest_height = omitDefault(message.latestHeight); return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1048,7 +1048,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1262,7 +1262,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1354,7 +1354,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = omitDefault(message.status); return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts index 087e3de532..f32121fb22 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** MsgCreateClient defines a message to create an IBC client */ export interface MsgCreateClient { @@ -218,7 +218,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -413,9 +413,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -654,12 +654,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -854,9 +854,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts index 0d1beab57a..1f9c3b0e19 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts @@ -1,6 +1,6 @@ import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * State defines if a connection is in one of the following states: @@ -335,15 +335,15 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -517,16 +517,16 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = omitDefault(message.id); + obj.client_id = omitDefault(message.clientId); if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { obj.versions = []; } - obj.state = message.state; + obj.state = omitDefault(message.state); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -648,8 +648,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = omitDefault(message.clientId); + obj.connection_id = omitDefault(message.connectionId); obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -868,7 +868,7 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); if (message.paths) { obj.paths = message.paths.map(e => e); } else { @@ -987,7 +987,7 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); if (message.features) { obj.features = message.features.map(e => e); } else { @@ -1086,7 +1086,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = omitDefault(message.maxExpectedTimePerBlock); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts index bf7f13df28..bd7127757d 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -156,7 +156,7 @@ export const GenesisState = { } else { obj.client_connection_paths = []; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts index adbee7e5e1..80637c1b39 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts @@ -3,7 +3,7 @@ import { ConnectionEnd, ConnectionEndSDKType, IdentifiedConnection, IdentifiedCo import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType } from "../../client/v1/client"; import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * QueryConnectionRequest is the request type for the Query/Connection RPC @@ -260,7 +260,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -710,7 +710,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -938,7 +938,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1188,9 +1188,9 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.connection_id = omitDefault(message.connectionId); + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { @@ -1329,7 +1329,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.proof = message.proof; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 639aa1ea54..0684a87c34 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: omitDefault(version.identifier), features: version.features }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), signer: omitDefault(signer) }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: omitDefault(el0.identifier), features: el0.features diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts index 52fbb595f0..e429d6640b 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts @@ -2,7 +2,7 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./co import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** * MsgConnectionOpenInit defines the msg sent by an account on Chain A to @@ -288,11 +288,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.delay_period = omitDefault(message.delayPeriod); + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -629,11 +629,11 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = omitDefault(message.clientId); + obj.previous_connection_id = omitDefault(message.previousConnectionId); obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = omitDefault(message.delayPeriod); if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { @@ -644,7 +644,7 @@ export const MsgConnectionOpenTry = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -943,8 +943,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = omitDefault(message.connectionId); + obj.counterparty_connection_id = omitDefault(message.counterpartyConnectionId); obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -952,7 +952,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient; obj.proof_consensus = message.proofConsensus; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1161,10 +1161,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = omitDefault(message.connectionId); obj.proof_ack = message.proofAck; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = omitDefault(message.signer); return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts index a435bbf873..b6353ba6b2 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts @@ -1,6 +1,6 @@ import { Order, OrderSDKType, Counterparty, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.core.port.v1"; /** QueryAppVersionRequest is the request type for the Query/AppVersion RPC method */ export interface QueryAppVersionRequest { @@ -160,11 +160,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = message.ordering; + obj.port_id = omitDefault(message.portId); + obj.connection_id = omitDefault(message.connectionId); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = omitDefault(message.proposedVersion); return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -270,8 +270,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = omitDefault(message.portId); + obj.version = omitDefault(message.version); return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts index 168930bdd4..5be70a64d4 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -103,7 +103,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts index 56cf63c6ce..2441bb5977 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v1"; /** * DataType defines the type of solo machine proof being created. This is done @@ -487,10 +487,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.frozen_sequence = omitDefault(message.frozenSequence); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -615,8 +615,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -770,11 +770,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -914,8 +914,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1054,9 +1054,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1165,7 +1165,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1317,10 +1317,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1430,7 +1430,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2281,7 +2281,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts index afb8325a20..e34281e7f4 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { ConnectionEnd, ConnectionEndSDKType } from "../../../core/connection/v1/connection"; import { Channel, ChannelSDKType } from "../../../core/channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.solomachine.v2"; /** * DataType defines the type of solo machine proof being created. This is done @@ -485,10 +485,10 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.sequence = omitDefault(message.sequence); + obj.is_frozen = omitDefault(message.isFrozen); obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = omitDefault(message.allowUpdateAfterProposal); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -613,8 +613,8 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.diversifier = omitDefault(message.diversifier); + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -768,11 +768,11 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); obj.signature = message.signature; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -912,8 +912,8 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.client_id = omitDefault(message.clientId); + obj.sequence = omitDefault(message.sequence); obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1052,9 +1052,9 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature; - obj.data_type = message.dataType; + obj.data_type = omitDefault(message.dataType); obj.data = message.data; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1163,7 +1163,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = omitDefault(message.timestamp); return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1315,10 +1315,10 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = message.dataType; + obj.sequence = omitDefault(message.sequence); + obj.timestamp = omitDefault(message.timestamp); + obj.diversifier = omitDefault(message.diversifier); + obj.data_type = omitDefault(message.dataType); obj.data = message.data; return obj; }, @@ -1428,7 +1428,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = omitDefault(message.newDiversifier); return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { @@ -2279,7 +2279,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = omitDefault(message.nextSeqRecv); return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts index 813dff4d50..1118cf0fd7 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts @@ -6,7 +6,7 @@ import { MerkleRoot, MerkleRootSDKType } from "../../../core/commitment/v1/commi import { SignedHeader, SignedHeaderSDKType } from "../../../../tendermint/types/types"; import { ValidatorSet, ValidatorSetSDKType } from "../../../../tendermint/types/validator"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.tendermint.v1"; /** * ClientState from Tendermint tracks the current validator set, latest height, @@ -394,7 +394,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -411,8 +411,8 @@ export const ClientState = { } else { obj.upgrade_path = []; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); + obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -527,7 +527,7 @@ export const ConsensusState = { }, fromAmino(object: ConsensusStateAmino): ConsensusState { return { - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, root: object?.root ? MerkleRoot.fromAmino(object.root) : undefined, nextValidatorsHash: object.next_validators_hash }; @@ -660,7 +660,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = omitDefault(message.clientId); obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; @@ -917,8 +917,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = omitDefault(message.numerator); + obj.denominator = omitDefault(message.denominator); return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts index 4fcabce2ef..dfb44b4989 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -183,7 +183,7 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts index a95e941948..e3dd1fb46c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** Params defines the claim module's parameters. */ export interface Params { @@ -123,7 +123,7 @@ export const Params = { }, fromAmino(object: ParamsAmino): Params { return { - airdropStartTime: object.airdrop_start_time, + airdropStartTime: object?.airdrop_start_time ? Timestamp.fromAmino(object.airdrop_start_time) : undefined, durationUntilDecay: object?.duration_until_decay ? Duration.fromAmino(object.duration_until_decay) : undefined, durationOfDecay: object?.duration_of_decay ? Duration.fromAmino(object.duration_of_decay) : undefined, claimDenom: object.claim_denom @@ -134,7 +134,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = omitDefault(message.claimDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts index 2197eba11f..f06c75cfd4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Action, ActionSDKType, ClaimRecord, ClaimRecordSDKType, actionFromJSON, import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryModuleAccountBalanceRequest {} @@ -479,7 +479,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -679,8 +679,8 @@ export const QueryClaimableForActionRequest = { }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = message.action; + obj.address = omitDefault(message.address); + obj.action = omitDefault(message.action); return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -876,7 +876,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts index 1bddf39d58..de396b22e1 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; /** * EpochInfo is a struct that describes the data going into @@ -229,23 +229,23 @@ export const EpochInfo = { fromAmino(object: EpochInfoAmino): EpochInfo { return { identifier: object.identifier, - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, currentEpoch: BigInt(object.current_epoch), - currentEpochStartTime: object.current_epoch_start_time, + currentEpochStartTime: object?.current_epoch_start_time ? Timestamp.fromAmino(object.current_epoch_start_time) : undefined, epochCountingStarted: object.epoch_counting_started, currentEpochStartHeight: BigInt(object.current_epoch_start_height) }; }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); obj.start_time = message.startTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); obj.current_epoch_start_time = message.currentEpochStartTime; - obj.epoch_counting_started = message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.epoch_counting_started = omitDefault(message.epochCountingStarted); + obj.current_epoch_start_height = omitDefault(message.currentEpochStartHeight); return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts index 7544b8421f..1328d8488d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestSDKType {} @@ -266,7 +266,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = omitDefault(message.identifier); return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -360,7 +360,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = omitDefault(message.currentEpoch); return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts index 991c1a49f9..98ae63ee57 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timesta import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -263,7 +263,7 @@ export const SmoothWeightChangeParams = { }, fromAmino(object: SmoothWeightChangeParamsAmino): SmoothWeightChangeParams { return { - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, initialPoolWeights: Array.isArray(object?.initial_pool_weights) ? object.initial_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [], targetPoolWeights: Array.isArray(object?.target_pool_weights) ? object.target_pool_weights.map((e: any) => PoolAsset.fromAmino(e)) : [] @@ -404,8 +404,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -515,7 +515,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -705,17 +705,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts index 04024c7566..66dd75b2db 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial } from "../../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -143,14 +143,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { obj.pool_assets = []; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -244,7 +244,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 739876e6e6..c7d9c3ab7f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -140,8 +140,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -362,10 +362,10 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.address = omitDefault(message.address); + obj.id = omitDefault(message.id); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -377,7 +377,7 @@ export const Pool = { } else { obj.scaling_factors = []; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 6d137e53fb..65a3763636 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -88,7 +88,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts index 8b2975fa90..15faf0519b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -213,7 +213,7 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); @@ -225,8 +225,8 @@ export const MsgCreateStableswapPool = { } else { obj.scaling_factors = []; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.scaling_factor_controller = omitDefault(message.scalingFactorController); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -320,7 +320,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -459,8 +459,8 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts index a94301c669..d7c985a9dd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -240,7 +240,7 @@ export const GenesisState = { } else { obj.pools = []; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = omitDefault(message.nextPoolNumber); obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts index 78455187fd..26bd847a72 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -330,7 +330,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -806,7 +806,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = omitDefault(message.numPools); return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -900,7 +900,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -992,7 +992,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1108,7 +1108,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1227,7 +1227,7 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1340,8 +1340,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1539,7 +1539,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1727,7 +1727,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -1925,7 +1925,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2135,7 +2135,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2259,7 +2259,7 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { } else { obj.tokens_out = []; } - obj.shares_out = message.sharesOut; + obj.shares_out = omitDefault(message.sharesOut); return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2381,9 +2381,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2518,7 +2518,7 @@ export const QueryPoolsWithFilterRequest = { } else { obj.min_liquidity = []; } - obj.pool_type = message.poolType; + obj.pool_type = omitDefault(message.poolType); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2732,7 +2732,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -2876,9 +2876,9 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in = omitDefault(message.tokenIn); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { @@ -2975,7 +2975,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3119,14 +3119,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_out = message.tokenOut; + obj.token_out = omitDefault(message.tokenOut); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3218,7 +3218,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index c86c71d74d..fb977802b3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -112,7 +112,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ denom: omitDefault(el0.denom), @@ -147,7 +147,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ denom: omitDefault(el0.denom), @@ -183,7 +183,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { @@ -224,7 +224,7 @@ export const AminoConverter = { return { sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), + pool_id: omitDefault(el0.poolId)?.toString?.(), token_in_denom: omitDefault(el0.tokenInDenom) })), token_in_max_amount: omitDefault(tokenInMaxAmount), @@ -264,7 +264,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -300,7 +300,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_in_denom: omitDefault(tokenInDenom), share_out_amount: omitDefault(shareOutAmount), token_in_max_amount: omitDefault(tokenInMaxAmount) @@ -332,7 +332,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -368,7 +368,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString(), + pool_id: omitDefault(poolId)?.toString?.(), token_out_denom: omitDefault(tokenOutDenom), share_in_amount: omitDefault(shareInAmount), token_out_min_amount: omitDefault(tokenOutMinAmount) diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts index 5b493c4ad8..12c0998c66 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -315,9 +315,9 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -436,7 +436,7 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -585,9 +585,9 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_in_amount = omitDefault(message.shareInAmount); if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -804,8 +804,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -949,14 +949,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { obj.routes = []; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1048,7 +1048,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1156,8 +1156,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1301,13 +1301,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1400,7 +1400,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1538,10 +1538,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1633,7 +1633,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = omitDefault(message.shareOutAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1783,11 +1783,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -1879,7 +1879,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = omitDefault(message.tokenInAmount); return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2029,11 +2029,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.share_in_amount = omitDefault(message.shareInAmount); + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2125,7 +2125,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = omitDefault(message.tokenOutAmount); return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2263,10 +2263,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2358,7 +2358,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = omitDefault(message.shareInAmount); return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts index 9275aded78..4792beae31 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -131,9 +131,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset_denom = omitDefault(message.baseAssetDenom); + obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -225,7 +225,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = omitDefault(message.spotPrice); return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts index 266e02c5e4..a27446ff59 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -76,7 +76,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = omitDefault(message.contractAddress); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts index b2406fd470..1f06dd5566 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * Gauge is an object that stores and distributes yields to recipients who @@ -249,7 +249,7 @@ export const Gauge = { isPerpetual: object.is_perpetual, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over), filledEpochs: BigInt(object.filled_epochs), distributedCoins: Array.isArray(object?.distributed_coins) ? object.distributed_coins.map((e: any) => Coin.fromAmino(e)) : [] @@ -257,8 +257,8 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.id = omitDefault(message.id); + obj.is_perpetual = omitDefault(message.isPerpetual); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -266,8 +266,8 @@ export const Gauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); + obj.filled_epochs = omitDefault(message.filledEpochs); if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts index d2b1180a99..a3e2cb0440 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -174,7 +174,7 @@ export const GenesisState = { } else { obj.lockable_durations = []; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = omitDefault(message.lastGaugeId); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts index ade86a2fd1..1af74e3227 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -80,7 +80,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = message.distrEpochIdentifier; + obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts index ce32cbbda4..2c74e97583 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestSDKType {} @@ -400,7 +400,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = omitDefault(message.id); return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1032,7 +1032,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1477,7 +1477,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1738,13 +1738,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { obj.lock_ids = []; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = omitDefault(message.endEpoch); return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index 4b6d7884e5..14e12ad639 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -57,7 +57,7 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: isPerpetual, + is_perpetual: omitDefault(isPerpetual), owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, @@ -70,7 +70,7 @@ export const AminoConverter = { amount: omitDefault(el0.amount) })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver.toString() + num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() }; }, fromAmino: ({ @@ -111,7 +111,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner: omitDefault(owner), - gauge_id: gaugeId.toString(), + gauge_id: omitDefault(gaugeId)?.toString?.(), rewards: rewards.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts index b23f6ede0d..6f835224f4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts @@ -2,7 +2,7 @@ import { QueryCondition, QueryConditionSDKType } from "../lockup/lock"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** MsgCreateGauge creates a gague to distribute rewards to users */ export interface MsgCreateGauge { @@ -202,14 +202,14 @@ export const MsgCreateGauge = { owner: object.owner, distributeTo: object?.distribute_to ? QueryCondition.fromAmino(object.distribute_to) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [], - startTime: object.start_time, + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, numEpochsPaidOver: BigInt(object.num_epochs_paid_over) }; }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = omitDefault(message.isPerpetual); + obj.owner = omitDefault(message.owner); obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -217,7 +217,7 @@ export const MsgCreateGauge = { obj.coins = []; } obj.start_time = message.startTime; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = omitDefault(message.numEpochsPaidOver); return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -420,8 +420,8 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.gauge_id = omitDefault(message.gaugeId); if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts index d86bdd3ce9..fc492dcfe2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -127,7 +127,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = omitDefault(message.lastLockId); if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts index 8cef60af6a..33d095e29b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** * LockQueryType defines the type of the lock query that can @@ -289,14 +289,14 @@ export const PeriodLock = { ID: BigInt(object.ID), owner: object.owner, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, coins: Array.isArray(object?.coins) ? object.coins.map((e: any) => Coin.fromAmino(e)) : [] }; }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.ID = omitDefault(message.ID); + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime; if (message.coins) { @@ -434,13 +434,13 @@ export const QueryCondition = { lockQueryType: isSet(object.lock_query_type) ? lockQueryTypeFromJSON(object.lock_query_type) : -1, denom: object.denom, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = message.lockQueryType; - obj.denom = message.denom; + obj.lock_query_type = omitDefault(message.lockQueryType); + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp; return obj; @@ -574,14 +574,14 @@ export const SyntheticLock = { return { underlyingLockId: BigInt(object.underlying_lock_id), synthDenom: object.synth_denom, - endTime: object.end_time, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined, duration: object?.duration ? Duration.fromAmino(object.duration) : undefined }; }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.underlying_lock_id = omitDefault(message.underlyingLockId); + obj.synth_denom = omitDefault(message.synthDenom); obj.end_time = message.endTime; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts index 057c436416..94edaa0077 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts @@ -4,7 +4,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { Params, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, toTimestamp, fromTimestamp } from "../../helpers"; +import { DeepPartial, isSet, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface ModuleBalanceRequest {} export interface ModuleBalanceRequestSDKType {} @@ -641,7 +641,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -837,7 +837,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1033,7 +1033,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1238,12 +1238,12 @@ export const AccountLockedPastTimeRequest = { fromAmino(object: AccountLockedPastTimeRequestAmino): AccountLockedPastTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1449,12 +1449,12 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { fromAmino(object: AccountLockedPastTimeNotUnlockingOnlyRequestAmino): AccountLockedPastTimeNotUnlockingOnlyRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1660,12 +1660,12 @@ export const AccountUnlockedBeforeTimeRequest = { fromAmino(object: AccountUnlockedBeforeTimeRequestAmino): AccountUnlockedBeforeTimeRequest { return { owner: object.owner, - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; return obj; }, @@ -1884,15 +1884,15 @@ export const AccountLockedPastTimeDenomRequest = { fromAmino(object: AccountLockedPastTimeDenomRequestAmino): AccountLockedPastTimeDenomRequest { return { owner: object.owner, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, denom: object.denom }; }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.timestamp = message.timestamp; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2104,7 +2104,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2197,7 +2197,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = omitDefault(message.amount); return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2291,7 +2291,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2479,7 +2479,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { @@ -2691,7 +2691,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2904,7 +2904,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3117,7 +3117,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3344,9 +3344,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index afc07e7e40..9545e07ec2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +178,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner: omitDefault(owner), - ID: ID.toString(), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ denom: omitDefault(el0.denom), amount: omitDefault(el0.amount) diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts index ba0cdd4ed7..e306669e98 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -207,7 +207,7 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -307,7 +307,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -399,7 +399,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -633,8 +633,8 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -731,7 +731,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -855,8 +855,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -949,7 +949,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1079,8 +1079,8 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.owner = omitDefault(message.owner); + obj.ID = omitDefault(message.ID); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1177,7 +1177,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = omitDefault(message.success); return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts index 8e299dc847..58e79f014c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -123,7 +123,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts index f9edc6edb9..bb452f534c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -182,7 +182,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -288,8 +288,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = omitDefault(message.address); + obj.weight = padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -423,10 +423,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -630,18 +630,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.mint_denom = omitDefault(message.mintDenom); + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = omitDefault(message.epochIdentifier); + obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); + obj.reduction_factor = padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { obj.weighted_developer_rewards_receivers = []; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts index 9748386170..68949d45aa 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -161,8 +161,8 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -295,8 +295,8 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts index fe727950df..c02091da27 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -119,7 +119,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = omitDefault(message.mintedDenom); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -337,7 +337,7 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = omitDefault(message.totalWeight); if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { @@ -450,8 +450,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.gauge_id = omitDefault(message.gaugeId); + obj.weight = omitDefault(message.weight); return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -577,8 +577,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts index 62b4e9f664..7181e898ca 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; import { Gauge, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -145,7 +145,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -373,9 +373,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -1085,9 +1085,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts index 5baf1f7daf..49265bd5d6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.store.v1beta1"; export interface Node { children: Child[]; @@ -207,7 +207,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index; - obj.accumulation = message.accumulation; + obj.accumulation = omitDefault(message.accumulation); return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts index 295c1628b2..082b7e1dc7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor; + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts index 72310a1d90..96a5709c74 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts @@ -5,7 +5,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { SyntheticLock, SyntheticLockSDKType } from "../lockup/lock"; import { DelegationResponse, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet } from "../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface QueryParamsRequest {} export interface QueryParamsRequestSDKType {} @@ -454,7 +454,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -546,7 +546,7 @@ export const AssetTypeResponse = { }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = message.assetType; + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -815,7 +815,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1045,10 +1045,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); + obj.address = omitDefault(message.address); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1357,7 +1357,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { @@ -1543,7 +1543,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1767,9 +1767,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = omitDefault(message.valAddr); + obj.amount_sfsd = omitDefault(message.amountSfsd); + obj.osmo_equivalent = omitDefault(message.osmoEquivalent); return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -1934,7 +1934,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = omitDefault(message.totalDelegations); return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2054,9 +2054,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2252,7 +2252,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2506,8 +2506,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2771,8 +2771,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -2982,8 +2982,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = omitDefault(message.validatorAddress); + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3179,7 +3179,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts index 92645c41c2..f194792dca 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -228,8 +228,8 @@ export const SuperfluidAsset = { }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = message.assetType; + obj.denom = omitDefault(message.denom); + obj.asset_type = omitDefault(message.assetType); return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -351,9 +351,9 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.val_addr = omitDefault(message.valAddr); + obj.gauge_id = omitDefault(message.gaugeId); return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -475,9 +475,9 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.epoch_number = omitDefault(message.epochNumber); + obj.denom = omitDefault(message.denom); + obj.multiplier = padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -615,8 +615,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -726,8 +726,8 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.lock_id = omitDefault(message.lockId); + obj.intermediary_account = omitDefault(message.intermediaryAccount); return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 286a368446..06225ca5cd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -53,7 +53,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString(), + lock_id: omitDefault(lockId)?.toString?.(), val_addr: omitDefault(valAddr) }; }, @@ -77,7 +77,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString() + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -98,7 +98,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender: omitDefault(sender), - lock_id: lockId.toString() + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender: omitDefault(sender), - pool_id: poolId.toString() + pool_id: omitDefault(poolId)?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts index a46b7e3432..f3c58bd01c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -191,9 +191,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.val_addr = message.valAddr; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -374,8 +374,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -556,8 +556,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.lock_id = omitDefault(message.lockId); return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -758,13 +758,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.coins = []; } - obj.val_addr = message.valAddr; + obj.val_addr = omitDefault(message.valAddr); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -858,7 +858,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = omitDefault(message.ID); return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -966,8 +966,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts index 30945a4578..9b27884804 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -161,8 +161,8 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { @@ -295,8 +295,8 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { @@ -452,14 +452,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { obj.ids = []; } - obj.is_overwrite = message.isOverwrite; + obj.is_overwrite = omitDefault(message.isOverwrite); return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index 6a314a9adf..2287fee5b2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -85,7 +85,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = omitDefault(message.admin); return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts index 8d99f639fb..7b454451bd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -236,7 +236,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts index b9101f7c9c..e03277cc57 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -306,7 +306,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -492,7 +492,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = message.creator; + obj.creator = omitDefault(message.creator); return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index 817ccf8440..8f2a82e542 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -172,7 +172,7 @@ export const AminoConverter = { description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ denom: omitDefault(el0.denom), - exponent: el0.exponent, + exponent: omitDefault(el0.exponent), aliases: el0.aliases })), base: omitDefault(metadata.base), diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts index 43df9e408f..aa2c715252 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -219,8 +219,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = omitDefault(message.sender); + obj.subdenom = omitDefault(message.subdenom); return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -312,7 +312,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = omitDefault(message.newTokenDenom); return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -420,7 +420,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -602,7 +602,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -796,9 +796,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = omitDefault(message.sender); + obj.denom = omitDefault(message.denom); + obj.new_admin = omitDefault(message.newAdmin); return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -979,7 +979,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts index 7847db88d0..e00f90ca43 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -108,7 +108,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts index 03d0ed23bd..7ac1a125f3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -169,15 +169,15 @@ export const ArithmeticTwapRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time, - endTime: object?.end_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined, + endTime: object?.end_time ? Timestamp.fromAmino(object.end_time) : undefined }; }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; obj.end_time = message.endTime; return obj; @@ -271,7 +271,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -402,14 +402,14 @@ export const ArithmeticTwapToNowRequest = { poolId: BigInt(object.pool_id), baseAsset: object.base_asset, quoteAsset: object.quote_asset, - startTime: object.start_time + startTime: object?.start_time ? Timestamp.fromAmino(object.start_time) : undefined }; }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.pool_id = omitDefault(message.poolId); + obj.base_asset = omitDefault(message.baseAsset); + obj.quote_asset = omitDefault(message.quoteAsset); obj.start_time = message.startTime; return obj; }, @@ -502,7 +502,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts index faf1631c80..c5534dc171 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -248,25 +248,25 @@ export const TwapRecord = { asset0Denom: object.asset0_denom, asset1Denom: object.asset1_denom, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, p0LastSpotPrice: object.p0_last_spot_price, p1LastSpotPrice: object.p1_last_spot_price, p0ArithmeticTwapAccumulator: object.p0_arithmetic_twap_accumulator, p1ArithmeticTwapAccumulator: object.p1_arithmetic_twap_accumulator, - lastErrorTime: object.last_error_time + lastErrorTime: object?.last_error_time ? Timestamp.fromAmino(object.last_error_time) : undefined }; }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.pool_id = omitDefault(message.poolId); + obj.asset0_denom = omitDefault(message.asset0Denom); + obj.asset1_denom = omitDefault(message.asset1Denom); + obj.height = message.height; obj.time = message.time; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts index 0f91172b37..a9a3ae70cd 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -104,8 +104,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.denom = omitDefault(message.denom); + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts index 7d3ec53565..d0487b4b08 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -101,7 +101,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = message.basedenom; + obj.basedenom = omitDefault(message.basedenom); if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts index 4098a25289..06e72812ae 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -123,8 +123,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts index 88f4067677..b7ff9fc537 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -305,7 +305,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -413,8 +413,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; - obj.spot_price = message.spotPrice; + obj.poolID = omitDefault(message.poolID); + obj.spot_price = padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -506,7 +506,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = omitDefault(message.denom); return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -600,7 +600,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = omitDefault(message.poolID); return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -765,7 +765,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = message.baseDenom; + obj.base_denom = omitDefault(message.baseDenom); return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts index 6f3178cdc9..1bcbbd0b9f 100644 --- a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts @@ -4,7 +4,7 @@ import { ProofOps, ProofOpsSDKType } from "../crypto/proof"; import { EvidenceParams, EvidenceParamsSDKType, ValidatorParams, ValidatorParamsSDKType, VersionParams, VersionParamsSDKType } from "../types/params"; import { PublicKey, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.abci"; export enum CheckTxType { NEW = 0, @@ -1134,7 +1134,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1319,9 +1319,9 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.version = omitDefault(message.version); + obj.block_version = omitDefault(message.blockVersion); + obj.p2p_version = omitDefault(message.p2pVersion); return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1421,8 +1421,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = omitDefault(message.key); + obj.value = omitDefault(message.value); return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -1580,7 +1580,7 @@ export const RequestInitChain = { }, fromAmino(object: RequestInitChainAmino): RequestInitChain { return { - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, chainId: object.chain_id, consensusParams: object?.consensus_params ? ConsensusParams.fromAmino(object.consensus_params) : undefined, validators: Array.isArray(object?.validators) ? object.validators.map((e: any) => ValidatorUpdate.fromAmino(e)) : [], @@ -1591,7 +1591,7 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); @@ -1599,7 +1599,7 @@ export const RequestInitChain = { obj.validators = []; } obj.app_state_bytes = message.appStateBytes; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = omitDefault(message.initialHeight); return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -1730,9 +1730,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data; - obj.path = message.path; - obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.path = omitDefault(message.path); + obj.height = omitDefault(message.height); + obj.prove = omitDefault(message.prove); return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -1980,7 +1980,7 @@ export const RequestCheckTx = { toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx; - obj.type = message.type; + obj.type = omitDefault(message.type); return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2154,7 +2154,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -2507,9 +2507,9 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunk = omitDefault(message.chunk); return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -2623,9 +2623,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.chunk = message.chunk; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3054,7 +3054,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = omitDefault(message.error); return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3140,7 +3140,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = omitDefault(message.message); return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3353,10 +3353,10 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.data = omitDefault(message.data); + obj.version = omitDefault(message.version); + obj.app_version = omitDefault(message.appVersion); + obj.last_block_height = omitDefault(message.lastBlockHeight); obj.last_block_app_hash = message.lastBlockAppHash; return obj; }, @@ -3471,9 +3471,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -3807,15 +3807,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.code = omitDefault(message.code); + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.index = omitDefault(message.index); obj.key = message.key; obj.value = message.value; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.height = omitDefault(message.height); + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4109,18 +4109,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4316,18 +4316,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = omitDefault(message.code); obj.data = message.data; - obj.log = message.log; - obj.info = message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.log = omitDefault(message.log); + obj.info = omitDefault(message.info); + obj.gas_wanted = omitDefault(message.gasWanted); + obj.gas_used = omitDefault(message.gasUsed); if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { obj.events = []; } - obj.codespace = message.codespace; + obj.codespace = omitDefault(message.codespace); return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4572,7 +4572,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = omitDefault(message.retainHeight); return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -4756,7 +4756,7 @@ export const ResponseOfferSnapshot = { }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -4981,7 +4981,7 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = message.result; + obj.result = omitDefault(message.result); if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { @@ -5234,8 +5234,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -5343,7 +5343,7 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = omitDefault(message.round); if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { @@ -5456,7 +5456,7 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { @@ -5577,7 +5577,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key; obj.value = message.value; - obj.index = message.index; + obj.index = omitDefault(message.index); return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -5709,8 +5709,8 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.height = omitDefault(message.height); + obj.index = omitDefault(message.index); obj.tx = message.tx; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -5815,7 +5815,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -5920,7 +5920,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = omitDefault(message.power); return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6023,7 +6023,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = omitDefault(message.signedLastBlock); return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6165,17 +6165,17 @@ export const Evidence = { type: isSet(object.type) ? evidenceTypeFromJSON(object.type) : -1, validator: object?.validator ? Validator.fromAmino(object.validator) : undefined, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, totalVotingPower: BigInt(object.total_voting_power) }; }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = omitDefault(message.height); obj.time = message.time; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6319,9 +6319,9 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.height = omitDefault(message.height); + obj.format = omitDefault(message.format); + obj.chunks = omitDefault(message.chunks); obj.hash = message.hash; obj.metadata = message.metadata; return obj; diff --git a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts index f913a62ed6..00d9cf2079 100644 --- a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.crypto"; export interface Proof { total: bigint; @@ -182,8 +182,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = omitDefault(message.total); + obj.index = omitDefault(message.index); obj.leaf_hash = message.leafHash; if (message.aunts) { obj.aunts = message.aunts.map(e => e); @@ -406,9 +406,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = omitDefault(message.key); + obj.input = omitDefault(message.input); + obj.output = omitDefault(message.output); return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -522,7 +522,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = omitDefault(message.type); obj.key = message.key; obj.data = message.data; return obj; diff --git a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts index 46be17af09..6e287f0097 100644 --- a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -109,7 +109,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = omitDefault(message.bits); if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts index 2cd220a9be..7e6fbcf07d 100644 --- a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.p2p"; export interface ProtocolVersion { p2p: bigint; @@ -163,9 +163,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = omitDefault(message.p2p); + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { @@ -354,12 +354,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = omitDefault(message.nodeId); + obj.listen_addr = omitDefault(message.listenAddr); + obj.network = omitDefault(message.network); + obj.version = omitDefault(message.version); obj.channels = message.channels; - obj.moniker = message.moniker; + obj.moniker = omitDefault(message.moniker); obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -460,8 +460,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = omitDefault(message.txIndex); + obj.rpc_address = omitDefault(message.rpcAddress); return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -578,12 +578,12 @@ export const PeerInfo = { return { id: object.id, addressInfo: Array.isArray(object?.address_info) ? object.address_info.map((e: any) => PeerAddressInfo.fromAmino(e)) : [], - lastConnected: object.last_connected + lastConnected: object?.last_connected ? Timestamp.fromAmino(object.last_connected) : undefined }; }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = omitDefault(message.id); if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { @@ -710,17 +710,17 @@ export const PeerAddressInfo = { fromAmino(object: PeerAddressInfoAmino): PeerAddressInfo { return { address: object.address, - lastDialSuccess: object.last_dial_success, - lastDialFailure: object.last_dial_failure, + lastDialSuccess: object?.last_dial_success ? Timestamp.fromAmino(object.last_dial_success) : undefined, + lastDialFailure: object?.last_dial_failure ? Timestamp.fromAmino(object.last_dial_failure) : undefined, dialFailures: object.dial_failures }; }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.last_dial_success = message.lastDialSuccess; obj.last_dial_failure = message.lastDialFailure; - obj.dial_failures = message.dialFailures; + obj.dial_failures = omitDefault(message.dialFailures); return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts index afb4b245d9..87d521fb6e 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts @@ -2,7 +2,7 @@ import { Vote, VoteSDKType, LightBlock, LightBlockSDKType } from "./types"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Validator, ValidatorSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface Evidence { duplicateVoteEvidence?: DuplicateVoteEvidence; @@ -281,15 +281,15 @@ export const DuplicateVoteEvidence = { voteB: object?.vote_b ? Vote.fromAmino(object.vote_b) : undefined, totalVotingPower: BigInt(object.total_voting_power), validatorPower: BigInt(object.validator_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: DuplicateVoteEvidence): DuplicateVoteEvidenceAmino { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.validator_power = omitDefault(message.validatorPower); obj.timestamp = message.timestamp; return obj; }, @@ -441,19 +441,19 @@ export const LightClientAttackEvidence = { commonHeight: BigInt(object.common_height), byzantineValidators: Array.isArray(object?.byzantine_validators) ? object.byzantine_validators.map((e: any) => Validator.fromAmino(e)) : [], totalVotingPower: BigInt(object.total_voting_power), - timestamp: object.timestamp + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined }; }, toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = omitDefault(message.commonHeight); if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = []; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); obj.timestamp = message.timestamp; return obj; }, diff --git a/__fixtures__/v-next/outputv4/tendermint/types/params.ts b/__fixtures__/v-next/outputv4/tendermint/types/params.ts index f4aa8d4035..25d7714b0d 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -358,9 +358,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); + obj.max_gas = omitDefault(message.maxGas); + obj.time_iota_ms = omitDefault(message.timeIotaMs); return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -480,9 +480,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = omitDefault(message.maxBytes); return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -668,7 +668,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = omitDefault(message.appVersion); return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -772,8 +772,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = omitDefault(message.blockMaxBytes); + obj.block_max_gas = omitDefault(message.blockMaxGas); return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/types.ts b/__fixtures__/v-next/outputv4/tendermint/types/types.ts index 8d07b140f7..ac5ffac802 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/types.ts @@ -3,7 +3,7 @@ import { Consensus, ConsensusSDKType } from "../version/types"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { ValidatorSet, ValidatorSetSDKType } from "./validator"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault, toTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** BlockIdFlag indicates which BlcokID the signature is for */ export enum BlockIDFlag { @@ -377,7 +377,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = omitDefault(message.total); obj.hash = message.hash; return obj; }, @@ -494,7 +494,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = omitDefault(message.index); obj.bytes = message.bytes; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -858,7 +858,7 @@ export const Header = { version: object?.version ? Consensus.fromAmino(object.version) : undefined, chainId: object.chain_id, height: BigInt(object.height), - time: object.time, + time: object?.time ? Timestamp.fromAmino(object.time) : undefined, lastBlockId: object?.last_block_id ? BlockID.fromAmino(object.last_block_id) : undefined, lastCommitHash: object.last_commit_hash, dataHash: object.data_hash, @@ -874,8 +874,8 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.chain_id = omitDefault(message.chainId); + obj.height = omitDefault(message.height); obj.time = message.time; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash; @@ -1164,7 +1164,7 @@ export const Vote = { height: BigInt(object.height), round: object.round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, validatorAddress: object.validator_address, validatorIndex: object.validator_index, signature: object.signature @@ -1172,13 +1172,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.validator_address = message.validatorAddress; - obj.validator_index = message.validatorIndex; + obj.validator_index = omitDefault(message.validatorIndex); obj.signature = message.signature; return obj; }, @@ -1319,8 +1319,8 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); @@ -1448,13 +1448,13 @@ export const CommitSig = { return { blockIdFlag: isSet(object.block_id_flag) ? blockIDFlagFromJSON(object.block_id_flag) : -1, validatorAddress: object.validator_address, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = message.blockIdFlag; + obj.block_id_flag = omitDefault(message.blockIdFlag); obj.validator_address = message.validatorAddress; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -1625,16 +1625,16 @@ export const Proposal = { round: object.round, polRound: object.pol_round, blockId: object?.block_id ? BlockID.fromAmino(object.block_id) : undefined, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, signature: object.signature }; }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = message.type; - obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.type = omitDefault(message.type); + obj.height = omitDefault(message.height); + obj.round = omitDefault(message.round); + obj.pol_round = omitDefault(message.polRound); obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp; obj.signature = message.signature; @@ -1984,9 +1984,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = omitDefault(message.blockSize); obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = omitDefault(message.numTxs); return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts index 24fc4d46a9..415c9d1139 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -145,7 +145,7 @@ export const ValidatorSet = { obj.validators = []; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = omitDefault(message.totalVotingPower); return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -281,8 +281,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); + obj.proposer_priority = omitDefault(message.proposerPriority); return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -387,7 +387,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = omitDefault(message.votingPower); return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv4/tendermint/version/types.ts b/__fixtures__/v-next/outputv4/tendermint/version/types.ts index 09e717db11..8e2b562a84 100644 --- a/__fixtures__/v-next/outputv4/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, omitDefault } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -120,8 +120,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; - obj.software = message.software; + obj.protocol = omitDefault(message.protocol); + obj.software = omitDefault(message.software); return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -225,8 +225,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = omitDefault(message.block); + obj.app = omitDefault(message.app); return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap index d86103adce..d1f0725087 100644 --- a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap @@ -9,8 +9,8 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` myEnumField }: MsgDoFunThing): MsgDoFunThingAminoType["value"] => { return { - address, - myEnumField + address: omitDefault(address), + myEnumField: myEnumField }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap index 49eb964f2c..a30520f536 100644 --- a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap @@ -82,9 +82,9 @@ exports[`cosmos/staking/v1beta1 Delegation 1`] = ` }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); + obj.shares = padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -195,7 +195,7 @@ exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptor 1`] = ` const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = omitDefault(message.sequence); return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { @@ -413,9 +413,9 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = message.mode; + obj.mode = omitDefault(message.mode); obj.sig = message.sig; return obj; }, @@ -640,8 +640,8 @@ exports[`cosmwasm/wasm/v1/proposal 1`] = ` }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { @@ -772,8 +772,8 @@ exports[`cosmwasm/wasm/v1/proposal 2`] = ` }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = omitDefault(message.title); + obj.description = omitDefault(message.description); if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { @@ -875,7 +875,7 @@ exports[`cosmwasm/wasm/v1/query 1`] = ` }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = omitDefault(message.address); obj.query_data = message.queryData; return obj; }, @@ -1014,9 +1014,9 @@ exports[`evmos/fees/v1/tx 1`] = ` }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = omitDefault(message.contractAddress); + obj.deployer_address = omitDefault(message.deployerAddress); + obj.withdraw_address = omitDefault(message.withdrawAddress); if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { @@ -1136,10 +1136,10 @@ exports[`google/api/expr/conformance/v1alpha1/conformance_service ParseRequest 1 }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = omitDefault(message.celSource); + obj.syntax_version = omitDefault(message.syntaxVersion); + obj.source_location = omitDefault(message.sourceLocation); + obj.disable_macros = omitDefault(message.disableMacros); return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -1294,7 +1294,7 @@ exports[`google/api/expr/v1alpha1/checked Decl_FunctionDecl_Overload MapType 1`] }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = omitDefault(message.overloadId); if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { @@ -1306,8 +1306,8 @@ exports[`google/api/expr/v1alpha1/checked Decl_FunctionDecl_Overload MapType 1`] obj.type_params = []; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = omitDefault(message.isInstanceFunction); + obj.doc = omitDefault(message.doc); return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -1531,15 +1531,15 @@ exports[`google/api/expr/v1alpha1/checked Type 1`] = ` toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = message.null; - obj.primitive = message.primitive; - obj.wrapper = message.wrapper; - obj.well_known = message.wellKnown; + obj.null = omitDefault(message.null); + obj.primitive = omitDefault(message.primitive); + obj.wrapper = omitDefault(message.wrapper); + obj.well_known = omitDefault(message.wellKnown); obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = omitDefault(message.messageType); + obj.type_param = omitDefault(message.typeParam); obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1850,7 +1850,7 @@ exports[`google/api/expr/v1alpha1/checked typeHash (Long) CheckedExpr 1`] = ` }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = omitDefault(message.exprVersion); obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -2021,17 +2021,17 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` stringValue: object?.string_value, bytesValue: object?.bytes_value, durationValue: object?.duration_value ? Duration.fromAmino(object.duration_value) : undefined, - timestampValue: object?.timestamp_value + timestampValue: object?.timestamp_value ? Timestamp.fromAmino(object.timestamp_value) : undefined }; }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = message.nullValue; - obj.bool_value = message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.null_value = omitDefault(message.nullValue); + obj.bool_value = omitDefault(message.boolValue); + obj.int64_value = omitDefault(message.int64Value); + obj.uint64_value = omitDefault(message.uint64Value); + obj.double_value = omitDefault(message.doubleValue); + obj.string_value = omitDefault(message.stringValue); obj.bytes_value = message.bytesValue; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue; @@ -2379,7 +2379,7 @@ exports[`google/api/expr/v1beta1/source 1`] = ` }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = omitDefault(message.location); if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { @@ -2519,7 +2519,7 @@ exports[`google/api/quota keyType 1`] = ` }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = omitDefault(message.selector); obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -2756,7 +2756,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` fromAmino(object: LogEntryAmino): LogEntry { return { name: object.name, - timestamp: object.timestamp, + timestamp: object?.timestamp ? Timestamp.fromAmino(object.timestamp) : undefined, severity: isSet(object.severity) ? logSeverityFromJSON(object.severity) : -1, httpRequest: object?.http_request ? HttpRequest.fromAmino(object.http_request) : undefined, trace: object.trace, @@ -2776,12 +2776,12 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = omitDefault(message.name); obj.timestamp = message.timestamp; - obj.severity = message.severity; + obj.severity = omitDefault(message.severity); obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = omitDefault(message.trace); + obj.insert_id = omitDefault(message.insertId); obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -2789,7 +2789,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = omitDefault(message.textPayload); obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -3024,11 +3024,11 @@ exports[`ibc/core/port/v1/query 1`] = ` }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = message.ordering; + obj.port_id = omitDefault(message.portId); + obj.connection_id = omitDefault(message.connectionId); + obj.ordering = omitDefault(message.ordering); obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = omitDefault(message.proposedVersion); return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -3659,9 +3659,9 @@ exports[`osmosis/gamm/v1beta1/tx MsgJoinPool 1`] = ` }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.sender = omitDefault(message.sender); + obj.pool_id = omitDefault(message.poolId); + obj.share_out_amount = omitDefault(message.shareOutAmount); if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -3795,14 +3795,14 @@ exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountIn 1`] = ` }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { obj.routes = []; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -3931,13 +3931,13 @@ exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountOut 1`] = ` }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { obj.routes = []; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap index 9e9281bdb4..b0ea6b4009 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap @@ -81,7 +81,7 @@ exports[`cosmos/authz/v1beta1/authz date 2`] = ` fromAmino(object: GrantAmino): Grant { return { authorization: object?.authorization ? Any.fromAmino(object.authorization) : undefined, - expiration: object?.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: Grant): GrantAmino { @@ -140,10 +140,10 @@ exports[`cosmos/authz/v1beta1/authz date 4`] = ` }: Grant): GrantAminoType["value"] => { return { authorization: { - type_url: authorization.typeUrl, + type_url: omitDefault(authorization.typeUrl), value: authorization.value }, - expiration + expiration: expiration }; }, fromAmino: ({ @@ -243,7 +243,7 @@ exports[`cosmos/authz/v1beta1/authz timestamp 2`] = ` fromAmino(object: GrantAmino): Grant { return { authorization: object?.authorization ? Any.fromAmino(object.authorization) : undefined, - expiration: object?.expiration + expiration: object?.expiration ? Timestamp.fromAmino(object.expiration) : undefined }; }, toAmino(message: Grant): GrantAmino { @@ -302,10 +302,10 @@ exports[`cosmos/authz/v1beta1/authz timestamp 4`] = ` }: Grant): GrantAminoType["value"] => { return { authorization: { - type_url: authorization.typeUrl, + type_url: omitDefault(authorization.typeUrl), value: authorization.value }, - expiration + expiration: expiration }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap index 4e411bd7a1..86226f4524 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap @@ -11,12 +11,12 @@ exports[`cosmwasm/wasm/v1/tx MsgExecuteContract 1`] = ` funds }: MsgExecuteContract): MsgExecuteContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -53,14 +53,14 @@ exports[`cosmwasm/wasm/v1/tx MsgInstantiateContract 1`] = ` funds }: MsgInstantiateContract): MsgInstantiateContractAminoType["value"] => { return { - sender, - admin, - code_id: codeId.toString(), - label, + sender: omitDefault(sender), + admin: omitDefault(admin), + code_id: omitDefault(codeId)?.toString?.(), + label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -99,9 +99,9 @@ exports[`cosmwasm/wasm/v1/tx MsgMigrateContract 1`] = ` msg }: MsgMigrateContract): MsgMigrateContractAminoType["value"] => { return { - sender, - contract, - code_id: codeId.toString(), + sender: omitDefault(sender), + contract: omitDefault(contract), + code_id: omitDefault(codeId)?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, @@ -132,11 +132,11 @@ exports[`cosmwasm/wasm/v1/tx MsgStoreCode 1`] = ` instantiatePermission }: MsgStoreCode): MsgStoreCodeAminoType["value"] => { return { - sender, + sender: omitDefault(sender), wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address + address: omitDefault(instantiatePermission.address) } }; }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap index 1f2cc0176b..31d00ea87b 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap @@ -98,7 +98,7 @@ exports[`osmosis/lockup/tx duration 2`] = ` }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -158,11 +158,11 @@ exports[`osmosis/lockup/tx duration 4`] = ` coins }: MsgLockTokens): MsgLockTokensAminoType["value"] => { return { - owner, + owner: omitDefault(owner), duration: (duration * 1_000_000_000).toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -285,7 +285,7 @@ exports[`osmosis/lockup/tx string 2`] = ` }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = omitDefault(message.owner); obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); @@ -342,11 +342,11 @@ exports[`osmosis/lockup/tx string 4`] = ` coins }: MsgLockTokens): MsgLockTokensAminoType["value"] => { return { - owner, + owner: omitDefault(owner), duration: (duration * 1_000_000_000).toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap index a69a6031b9..19dd6738c7 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap @@ -240,7 +240,7 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 2`] = ` }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -257,8 +257,8 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 2`] = ` } else { obj.upgrade_path = []; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); + obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -352,10 +352,10 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` allowUpdateAfterMisbehaviour }: ClientState): ClientStateAminoType["value"] => { return { - chain_id: chainId, + chain_id: omitDefault(chainId), trust_level: { - numerator: trustLevel.numerator.toString(), - denominator: trustLevel.denominator.toString() + numerator: omitDefault(trustLevel.numerator)?.toString?.(), + denominator: omitDefault(trustLevel.denominator)?.toString?.() }, trusting_period: (trustingPeriod * 1_000_000_000).toString(), unbonding_period: (unbondingPeriod * 1_000_000_000).toString(), @@ -378,18 +378,18 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` }, inner_spec: { child_order: el0.innerSpec.childOrder, - child_size: el0.innerSpec.childSize, - min_prefix_length: el0.innerSpec.minPrefixLength, - max_prefix_length: el0.innerSpec.maxPrefixLength, + child_size: omitDefault(el0.innerSpec.childSize), + min_prefix_length: omitDefault(el0.innerSpec.minPrefixLength), + max_prefix_length: omitDefault(el0.innerSpec.maxPrefixLength), empty_child: el0.innerSpec.emptyChild, hash: el0.innerSpec.hash }, - max_depth: el0.maxDepth, - min_depth: el0.minDepth + max_depth: omitDefault(el0.maxDepth), + min_depth: omitDefault(el0.minDepth) })), upgrade_path: upgradePath, - allow_update_after_expiry: allowUpdateAfterExpiry, - allow_update_after_misbehaviour: allowUpdateAfterMisbehaviour + allow_update_after_expiry: omitDefault(allowUpdateAfterExpiry), + allow_update_after_misbehaviour: omitDefault(allowUpdateAfterMisbehaviour) }; }, fromAmino: ({ @@ -699,7 +699,7 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 2`] = ` }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = omitDefault(message.chainId); obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -716,8 +716,8 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 2`] = ` } else { obj.upgrade_path = []; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); + obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -802,10 +802,10 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` allowUpdateAfterMisbehaviour }: ClientState): ClientStateAminoType["value"] => { return { - chain_id: chainId, + chain_id: omitDefault(chainId), trust_level: { - numerator: trustLevel.numerator.toString(), - denominator: trustLevel.denominator.toString() + numerator: omitDefault(trustLevel.numerator)?.toString?.(), + denominator: omitDefault(trustLevel.denominator)?.toString?.() }, trusting_period: (trustingPeriod * 1_000_000_000).toString(), unbonding_period: (unbondingPeriod * 1_000_000_000).toString(), @@ -828,18 +828,18 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` }, inner_spec: { child_order: el0.innerSpec.childOrder, - child_size: el0.innerSpec.childSize, - min_prefix_length: el0.innerSpec.minPrefixLength, - max_prefix_length: el0.innerSpec.maxPrefixLength, + child_size: omitDefault(el0.innerSpec.childSize), + min_prefix_length: omitDefault(el0.innerSpec.minPrefixLength), + max_prefix_length: omitDefault(el0.innerSpec.maxPrefixLength), empty_child: el0.innerSpec.emptyChild, hash: el0.innerSpec.hash }, - max_depth: el0.maxDepth, - min_depth: el0.minDepth + max_depth: omitDefault(el0.maxDepth), + min_depth: omitDefault(el0.minDepth) })), upgrade_path: upgradePath, - allow_update_after_expiry: allowUpdateAfterExpiry, - allow_update_after_misbehaviour: allowUpdateAfterMisbehaviour + allow_update_after_expiry: omitDefault(allowUpdateAfterExpiry), + allow_update_after_misbehaviour: omitDefault(allowUpdateAfterMisbehaviour) }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap index ee241dbade..b9a8f44ac3 100644 --- a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap @@ -15,20 +15,20 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` }: MsgCreateValidator): MsgCreateValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: padDecimal(commission.rate), + max_rate: padDecimal(commission.maxRate), + max_change_rate: padDecimal(commission.maxChangeRate) }, - min_self_delegation: minSelfDelegation, - delegator_address: delegatorAddress, - validator_address: validatorAddress, + min_self_delegation: omitDefault(minSelfDelegation), + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), pubkey: decodePubkey(pubkey)!, value: { denom: value.denom, @@ -79,15 +79,15 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` }: MsgEditValidator): MsgEditValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, - validator_address: validatorAddress, - commission_rate: commissionRate, - min_self_delegation: minSelfDelegation + validator_address: omitDefault(validatorAddress), + commission_rate: padDecimal(commissionRate), + min_self_delegation: omitDefault(minSelfDelegation) }; }, fromAmino: ({ @@ -118,8 +118,8 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` amount }: MsgDelegate): MsgDelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount @@ -150,9 +150,9 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` amount }: MsgBeginRedelegate): MsgBeginRedelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_src_address: validatorSrcAddress, - validator_dst_address: validatorDstAddress, + delegator_address: omitDefault(delegatorAddress), + validator_src_address: omitDefault(validatorSrcAddress), + validator_dst_address: omitDefault(validatorDstAddress), amount: { denom: amount.denom, amount: amount.amount @@ -184,8 +184,8 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` amount }: MsgUndelegate): MsgUndelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount @@ -221,9 +221,9 @@ exports[`evmos/fees/v1/tx AminoConverter 1`] = ` nonces }: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress, + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress), nonces: nonces.map(el0 => el0.toString()) }; }, @@ -248,8 +248,8 @@ exports[`evmos/fees/v1/tx AminoConverter 1`] = ` deployerAddress }: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress) }; }, fromAmino: ({ @@ -270,9 +270,9 @@ exports[`evmos/fees/v1/tx AminoConverter 1`] = ` withdrawAddress }: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ @@ -301,12 +301,12 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` tokenInMaxs }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - share_out_amount: shareOutAmount, + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -336,12 +336,12 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` tokenOutMins }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - share_in_amount: shareInAmount, + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -371,16 +371,16 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` tokenOutMinAmount }: MsgSwapExactAmountIn): MsgSwapExactAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), - token_out_denom: el0.tokenOutDenom + pool_id: omitDefault(el0.poolId)?.toString?.(), + token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - token_out_min_amount: tokenOutMinAmount + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -412,12 +412,12 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` tokenOut }: MsgSwapExactAmountOut): MsgSwapExactAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), - token_in_denom: el0.tokenInDenom + pool_id: omitDefault(el0.poolId)?.toString?.(), + token_in_denom: omitDefault(el0.tokenInDenom) })), - token_in_max_amount: tokenInMaxAmount, + token_in_max_amount: omitDefault(tokenInMaxAmount), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -453,13 +453,13 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` shareOutMinAmount }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - share_out_min_amount: shareOutMinAmount + share_out_min_amount: omitDefault(shareOutMinAmount) }; }, fromAmino: ({ @@ -489,11 +489,11 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` tokenInMaxAmount }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - token_in_denom: tokenInDenom, - share_out_amount: shareOutAmount, - token_in_max_amount: tokenInMaxAmount + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + token_in_denom: omitDefault(tokenInDenom), + share_out_amount: omitDefault(shareOutAmount), + token_in_max_amount: omitDefault(tokenInMaxAmount) }; }, fromAmino: ({ @@ -522,11 +522,11 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` tokenOutMinAmount }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - token_out_denom: tokenOutDenom, - share_in_amount: shareInAmount, - token_out_min_amount: tokenOutMinAmount + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + token_out_denom: omitDefault(tokenOutDenom), + share_in_amount: omitDefault(shareInAmount), + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -554,13 +554,13 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` shareInMaxAmount }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount }, - share_in_max_amount: shareInMaxAmount + share_in_max_amount: omitDefault(shareInMaxAmount) }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap index 4a2c326bce..6d3bed024e 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap @@ -9,9 +9,9 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` awesome }: MsgDoFunThing): MsgDoFunThingAminoType["value"] => { return { - address, + address: omitDefault(address), awesome: { - address: awesome.address, + address: omitDefault(awesome.address), myYolo0: awesome.myYolo0 } }; diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap index dac76dfecc..45e8fb865d 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap @@ -9,13 +9,13 @@ exports[`cosmology/example/c AminoConverter 1`] = ` awesome }: MsgTypePackageC): MsgTypePackageCAminoType["value"] => { return { - address, + address: omitDefault(address), awesome: { - address: awesome.address, + address: omitDefault(awesome.address), myYolo0: awesome.myYolo0, anotherField: { myType: { - address: awesome.anotherField.myType.address, + address: omitDefault(awesome.anotherField.myType.address), someCoolField: awesome.anotherField.myType.someCoolField, otherField: awesome.anotherField.myType.otherField } diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap index 6f7e5ae6b7..f9c57052f9 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap @@ -11,14 +11,14 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer + proposer: omitDefault(proposer) }; }, fromAmino: ({ @@ -47,9 +47,9 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option + proposal_id: omitDefault(proposalId)?.toString?.(), + voter: omitDefault(voter), + option: option }; }, fromAmino: ({ @@ -72,11 +72,11 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, + proposal_id: proposalId?.toString?.(), + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: padDecimal(el0.weight) })) }; }, @@ -103,11 +103,11 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), - depositor, + proposal_id: proposalId?.toString?.(), + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, diff --git a/packages/ast/src/encoding/amino/to-amino-json/index.ts b/packages/ast/src/encoding/amino/to-amino-json/index.ts index f23a997110..d8665abda7 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/index.ts @@ -132,16 +132,19 @@ export const toAminoParseField = ({ } } + let jsonTag = field.options['(gogoproto.jsontag)'] ?? field.options['(cosmos_proto.json_tag)']; + const omitEmpty = jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); + // scalar types... switch (field.type) { case 'string': - return toAmino.string(args, true); + return toAmino.string(args, omitEmpty); case 'int64': case 'sint64': case 'uint64': case 'fixed64': case 'sfixed64': - return toAmino.long(args); + return toAmino.long(args, omitEmpty); case 'double': case 'float': case 'int32': @@ -150,8 +153,9 @@ export const toAminoParseField = ({ case 'fixed32': case 'sfixed32': case 'bool': + return toAmino.defaultType(args, omitEmpty) case 'bytes': - return toAmino.defaultType(args) + return toAmino.defaultType(args, false) default: warningDefaultImplementation(field.name, field); diff --git a/packages/ast/src/encoding/amino/to-amino-json/utils.ts b/packages/ast/src/encoding/amino/to-amino-json/utils.ts index 082a248e81..c59af0af34 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/utils.ts @@ -6,18 +6,26 @@ import { getFieldOptionality, getOneOfs } from '../../proto'; import { ProtoField } from '@cosmology/types'; export const toAmino = { - defaultType(args: ToAminoParseField) { + defaultType(args: ToAminoParseField, omitEmpty?: boolean) { // if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { // return shorthandProperty(args.field.name); // } - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), memberExpressionOrIdentifier(args.scope)) + let valueExpr = omitEmpty ? + this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : + memberExpressionOrIdentifier(args.scope); + + return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), valueExpr) }, - long(args: ToAminoParseField) { + long(args: ToAminoParseField, omitEmpty?: boolean) { + let valueExpr = omitEmpty ? + this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : + memberExpressionOrIdentifier(args.scope); + return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), - t.callExpression( - t.memberExpression(memberExpressionOrIdentifier(args.scope), t.identifier('toString')), - []) + t.optionalCallExpression( + t.optionalMemberExpression(valueExpr, t.identifier('toString'), false, true), + [], true) ) }, diff --git a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap index ddb6f8265f..bb9de355d4 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap @@ -160,8 +160,8 @@ exports[`Height 1`] = ` }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = omitDefault(message.revisionNumber); + obj.revision_height = omitDefault(message.revisionHeight); return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { @@ -320,9 +320,9 @@ exports[`MsgCreateValidator 1`] = ` const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = omitDefault(message.minSelfDelegation); + obj.delegator_address = omitDefault(message.delegatorAddress); + obj.validator_address = omitDefault(message.validatorAddress); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -433,7 +433,7 @@ exports[`MsgStoreCode 1`] = ` }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = omitDefault(message.sender); obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -558,7 +558,7 @@ exports[`MsgSubmitProposal 1`] = ` } else { obj.initial_deposit = []; } - obj.proposer = message.proposer; + obj.proposer = omitDefault(message.proposer); return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -715,13 +715,13 @@ exports[`MsgTransfer 1`] = ` }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = omitDefault(message.sourcePort); + obj.source_channel = omitDefault(message.sourceChannel); obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = omitDefault(message.sender); + obj.receiver = omitDefault(message.receiver); obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap b/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap index 09c29d3346..b949742c17 100644 --- a/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap +++ b/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap @@ -116,8 +116,8 @@ exports[`MsgExecuteContract interface 2`] = ` }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = omitDefault(message.sender); + obj.contract = omitDefault(message.contract); obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); diff --git a/packages/ast/src/encoding/proto/from-amino/utils.ts b/packages/ast/src/encoding/proto/from-amino/utils.ts index 2b3fd4246b..47ed0b7d06 100644 --- a/packages/ast/src/encoding/proto/from-amino/utils.ts +++ b/packages/ast/src/encoding/proto/from-amino/utils.ts @@ -327,7 +327,7 @@ export const fromAminoJSON = { }, timestamp(args: FromAminoJSONMethod) { - return fromAminoJSON.scalar(args); + return fromAminoJSON.type(args); }, // labels: isObject(object.labels) ? Object.entries(object.labels).reduce<{ @@ -864,4 +864,4 @@ export const fromAminoMessages = { ]; } } -} \ No newline at end of file +} diff --git a/packages/ast/src/encoding/proto/to-amino/index.ts b/packages/ast/src/encoding/proto/to-amino/index.ts index 71f06fe649..528efc898a 100644 --- a/packages/ast/src/encoding/proto/to-amino/index.ts +++ b/packages/ast/src/encoding/proto/to-amino/index.ts @@ -120,38 +120,42 @@ export const toAminoJSONMethodFields = (context: ProtoParseContext, name: string } + + let jsonTag = field.options?.['(gogoproto.jsontag)'] ?? field.options?.['(cosmos_proto.json_tag)']; + const omitEmpty = jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); + // default types switch (field.type) { case 'string': - return [...m, toAminoJSON.string(args)]; + return [...m, toAminoJSON.string(args, omitEmpty)]; case 'double': - return [...m, toAminoJSON.double(args)]; + return [...m, toAminoJSON.double(args, omitEmpty)]; case 'float': - return [...m, toAminoJSON.float(args)]; + return [...m, toAminoJSON.float(args, omitEmpty)]; case 'bytes': return [...m, toAminoJSON.bytes(args)]; case 'bool': - return [...m, toAminoJSON.bool(args)]; + return [...m, toAminoJSON.bool(args, omitEmpty)]; case 'int32': - return [...m, toAminoJSON.int32(args)]; + return [...m, toAminoJSON.int32(args, omitEmpty)]; case 'sint32': - return [...m, toAminoJSON.sint32(args)]; + return [...m, toAminoJSON.sint32(args, omitEmpty)]; case 'uint32': - return [...m, toAminoJSON.uint32(args)]; + return [...m, toAminoJSON.uint32(args, omitEmpty)]; case 'fixed32': - return [...m, toAminoJSON.fixed32(args)]; + return [...m, toAminoJSON.fixed32(args, omitEmpty)]; case 'sfixed32': - return [...m, toAminoJSON.sfixed32(args)]; + return [...m, toAminoJSON.sfixed32(args, omitEmpty)]; case 'int64': - return [...m, toAminoJSON.int64(args)]; + return [...m, toAminoJSON.int64(args, omitEmpty)]; case 'sint64': - return [...m, toAminoJSON.sint64(args)]; + return [...m, toAminoJSON.sint64(args, omitEmpty)]; case 'uint64': - return [...m, toAminoJSON.uint64(args)]; + return [...m, toAminoJSON.uint64(args, omitEmpty)]; case 'fixed64': - return [...m, toAminoJSON.fixed64(args)]; + return [...m, toAminoJSON.fixed64(args, omitEmpty)]; case 'sfixed64': - return [...m, toAminoJSON.sfixed64(args)]; + return [...m, toAminoJSON.sfixed64(args, omitEmpty)]; case 'google.protobuf.Duration': case 'Duration': return [...m, toAminoJSON.duration(args)]; @@ -161,7 +165,7 @@ export const toAminoJSONMethodFields = (context: ProtoParseContext, name: string default: switch (field.parsedType.type) { case 'Enum': - return [...m, toAminoJSON.enum(args)]; + return [...m, toAminoJSON.enum(args, omitEmpty)]; case 'Type': return [...m, toAminoJSON.type(args)]; } diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 21d5d7a20e..44da505835 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoType } from '@cosmology/types'; -import { BILLION, TypeLong, identifier } from '../../../utils'; +import { BILLION, identifier, TypeLong } from '../../../utils'; import { ProtoParseContext } from '../../context'; import { getFieldNames } from '../../types'; import { getInterfaceToAminoName } from '../implements'; @@ -32,9 +32,18 @@ const notUndefinedSetValue = (sdkName: string, msgName: string, expr: t.Expressi export const toAminoJSON = { - scalar(args: ToAminoJSONMethod) { + scalar(args: ToAminoJSONMethod, omitEmpty: boolean) + { const { propName, origName } = getFieldNames(args.field); + let expr = t.memberExpression( + t.identifier('message'), + t.identifier(propName) + ); + let valueExpr = omitEmpty ? + this.omitDefaultExpr(args, expr) : + expr; + return t.expressionStatement( t.assignmentExpression( '=', @@ -42,52 +51,109 @@ export const toAminoJSON = { t.identifier('obj'), t.identifier(origName) ), - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ) + valueExpr ) ); }, - string(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + omitDefaultExpr(args: ToAminoJSONMethod, expr) + { + args.context.addUtil('omitDefault'); + return t.callExpression( + t.identifier('omitDefault'), + [ + expr + ] + ); }, - double(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + + string(args: ToAminoJSONMethod, omitEmpty) + { + const isCosmosSDKDec = + (args.field.options?.['(gogoproto.customtype)'] == + 'github.com/cosmos/cosmos-sdk/types.Dec') || + (args.field.options?.['(gogoproto.customtype)'] == + 'cosmossdk.io/math.LegacyDec'); + + if (isCosmosSDKDec) { + args.context.addUtil('padDecimal'); + const { propName, origName } = getFieldNames(args.field); + return t.expressionStatement( + t.assignmentExpression( + '=', + t.memberExpression( + t.identifier('obj'), + t.identifier(origName) + ), + t.callExpression( + t.identifier('padDecimal'), + [ + t.memberExpression( + t.identifier('message'), + t.identifier(propName) + ) + ] + ) + ) + ); + } + + return toAminoJSON.scalar(args, omitEmpty); }, - float(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + + double(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); + }, + float(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - bool(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + bool(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - number(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + number(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - int32(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + int32(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - uint32(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + uint32(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - sint32(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + sint32(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - fixed32(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + fixed32(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - sfixed32(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + sfixed32(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, - long(args: ToAminoJSONMethod) { + long(args: ToAminoJSONMethod, omitEmpty: boolean) + { const { propName, origName } = getFieldNames(args.field); + let expr = t.memberExpression( + t.identifier('message'), + t.identifier(propName) + ); + let valueExpr = omitEmpty ? + this.omitDefaultExpr(args, expr) : + expr; + return t.expressionStatement( t.assignmentExpression( '=', @@ -95,41 +161,25 @@ export const toAminoJSON = { t.identifier('obj'), t.identifier(origName) ), - t.conditionalExpression( - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ), - t.callExpression( - t.memberExpression( - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ), - t.identifier('toString') - ), - [] - ), - t.identifier('undefined') - ) + valueExpr ) ); }, - int64(args: ToAminoJSONMethod) { - return toAminoJSON.long(args); + int64(args: ToAminoJSONMethod, omitEmpty: boolean) { + return toAminoJSON.long(args, omitEmpty); }, - uint64(args: ToAminoJSONMethod) { - return toAminoJSON.long(args); + uint64(args: ToAminoJSONMethod, omitEmpty: boolean) { + return toAminoJSON.long(args, omitEmpty); }, - sint64(args: ToAminoJSONMethod) { - return toAminoJSON.long(args); + sint64(args: ToAminoJSONMethod, omitEmpty: boolean) { + return toAminoJSON.long(args, omitEmpty); }, - fixed64(args: ToAminoJSONMethod) { - return toAminoJSON.long(args); + fixed64(args: ToAminoJSONMethod, omitEmpty: boolean) { + return toAminoJSON.long(args, omitEmpty); }, - sfixed64(args: ToAminoJSONMethod) { - return toAminoJSON.long(args); + sfixed64(args: ToAminoJSONMethod, omitEmpty: boolean) { + return toAminoJSON.long(args, omitEmpty); }, protoType(args: ToAminoJSONMethod) { @@ -225,12 +275,13 @@ export const toAminoJSON = { return toAminoJSON.protoType(args); }, - enum(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + enum(args: ToAminoJSONMethod, omitEmpty: boolean) + { + return toAminoJSON.scalar(args, omitEmpty); }, bytes(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + return toAminoJSON.scalar(args, false); }, duration(args: ToAminoJSONMethod) { @@ -238,7 +289,7 @@ export const toAminoJSON = { }, timestamp(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + return toAminoJSON.scalar(args, false); }, pubkey(args: ToAminoJSONMethod) { @@ -770,4 +821,4 @@ export const toAminoMessages = { } } -} \ No newline at end of file +} diff --git a/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts b/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts index 33da9f6f6c..2384261fd4 100644 --- a/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts +++ b/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts @@ -1,8 +1,8 @@ import * as t from '@babel/types'; import { ToAminoParseField } from './index'; export declare const toAmino: { - defaultType(args: ToAminoParseField): t.ObjectProperty; - long(args: ToAminoParseField): t.ObjectProperty; + defaultType(args: ToAminoParseField, omitEmpty?: boolean): t.ObjectProperty; + long(args: ToAminoParseField, omitEmpty?: boolean): t.ObjectProperty; string(args: ToAminoParseField, omitEmpty?: boolean): t.ObjectProperty; omitDefaultMemberExpressionOrIdentifier(args: ToAminoParseField, names: any): t.CallExpression; rawBytes(args: ToAminoParseField): t.ObjectProperty; diff --git a/packages/ast/types/encoding/proto/to-amino/utils.d.ts b/packages/ast/types/encoding/proto/to-amino/utils.d.ts index 5a2ffc0c10..5234a5d1cd 100644 --- a/packages/ast/types/encoding/proto/to-amino/utils.d.ts +++ b/packages/ast/types/encoding/proto/to-amino/utils.d.ts @@ -3,27 +3,28 @@ import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; import { ToAminoJSONMethod } from './index'; export declare const toAminoJSON: { - scalar(args: ToAminoJSONMethod): t.ExpressionStatement; - string(args: ToAminoJSONMethod): t.ExpressionStatement; - double(args: ToAminoJSONMethod): t.ExpressionStatement; - float(args: ToAminoJSONMethod): t.ExpressionStatement; - bool(args: ToAminoJSONMethod): t.ExpressionStatement; - number(args: ToAminoJSONMethod): t.ExpressionStatement; - int32(args: ToAminoJSONMethod): t.ExpressionStatement; - uint32(args: ToAminoJSONMethod): t.ExpressionStatement; - sint32(args: ToAminoJSONMethod): t.ExpressionStatement; - fixed32(args: ToAminoJSONMethod): t.ExpressionStatement; - sfixed32(args: ToAminoJSONMethod): t.ExpressionStatement; - long(args: ToAminoJSONMethod): t.ExpressionStatement; - int64(args: ToAminoJSONMethod): t.ExpressionStatement; - uint64(args: ToAminoJSONMethod): t.ExpressionStatement; - sint64(args: ToAminoJSONMethod): t.ExpressionStatement; - fixed64(args: ToAminoJSONMethod): t.ExpressionStatement; - sfixed64(args: ToAminoJSONMethod): t.ExpressionStatement; + scalar(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + omitDefaultExpr(args: ToAminoJSONMethod, expr: any): t.CallExpression; + string(args: ToAminoJSONMethod, omitEmpty: any): t.ExpressionStatement; + double(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + float(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + bool(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + number(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + int32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + uint32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + sint32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + fixed32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + sfixed32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + long(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + int64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + uint64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + sint64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + fixed64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + sfixed64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; protoType(args: ToAminoJSONMethod): t.ExpressionStatement; anyType(args: ToAminoJSONMethod): t.ExpressionStatement; type(args: ToAminoJSONMethod): t.ExpressionStatement; - enum(args: ToAminoJSONMethod): t.ExpressionStatement; + enum(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; bytes(args: ToAminoJSONMethod): t.ExpressionStatement; duration(args: ToAminoJSONMethod): t.ExpressionStatement; timestamp(args: ToAminoJSONMethod): t.ExpressionStatement; diff --git a/packages/telescope/src/helpers/internal.ts b/packages/telescope/src/helpers/internal.ts index abb54701a9..1ececf2589 100644 --- a/packages/telescope/src/helpers/internal.ts +++ b/packages/telescope/src/helpers/internal.ts @@ -50,7 +50,7 @@ export interface AminoHeight { readonly revision_height?: string; }; -export function omitDefault(input: T): T | undefined { +export function omitDefault(input: T): T | undefined { if (typeof input === "string") { return input === "" ? undefined : input; } @@ -59,6 +59,10 @@ export function omitDefault(input: T): T | und return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (Long.isLong(input)) { return (input as Long).isZero() ? undefined : input; } diff --git a/packages/telescope/src/helpers/internalForBigInt.ts b/packages/telescope/src/helpers/internalForBigInt.ts index 7c357b3ac7..941fbad37e 100644 --- a/packages/telescope/src/helpers/internalForBigInt.ts +++ b/packages/telescope/src/helpers/internalForBigInt.ts @@ -1,4 +1,6 @@ export const internalForBigInt = ` +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -40,7 +42,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -51,6 +53,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -249,4 +255,8 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(number); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} `; diff --git a/packages/telescope/types/helpers/internal.d.ts b/packages/telescope/types/helpers/internal.d.ts index 8665027f03..f1ca8c3003 100644 --- a/packages/telescope/types/helpers/internal.d.ts +++ b/packages/telescope/types/helpers/internal.d.ts @@ -1 +1 @@ -export declare const internal = "import * as _m0 from \"protobufjs/minimal\";\nimport Long from 'long';\nimport { Dec } from \"@keplr-wallet/unit\";\n\n// @ts-ignore\nif (_m0.util.Long !== Long) {\n _m0.util.Long = (Long as any);\n\n _m0.configure();\n}\n\nexport { Long };\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n};\n\nexport function omitDefault(input: T): T | undefined {\n if (typeof input === \"string\") {\n return input === \"\" ? undefined : input;\n }\n\n if (typeof input === \"number\") {\n return input === 0 ? undefined : input;\n }\n\n if (Long.isLong(input)) {\n return (input as Long).isZero() ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n};\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: Long;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n};\n\nexport function fromDuration(duration: Duration): string {\n return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();\n};\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n};\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n};\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: Long;\n limit: Long;\n countTotal: boolean;\n reverse: boolean;\n};\n\nexport interface PageRequestParams {\n \"pagination.key\"?: string;\n \"pagination.offset\"?: string;\n \"pagination.limit\"?: string;\n \"pagination.count_total\"?: boolean;\n \"pagination.reverse\"?: boolean;\n};\n\nexport interface Params {\n params: PageRequestParams;\n};\n\nexport const setPaginationParams = (options: Params, pagination?: PageRequest) => {\n\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== \"undefined\") {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== \"undefined\") {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');\n }\n if (typeof pagination?.limit !== \"undefined\") {\n options.params[\"pagination.limit\"] = pagination.limit.toString()\n }\n if (typeof pagination?.offset !== \"undefined\") {\n options.params[\"pagination.offset\"] = pagination.offset.toString()\n }\n if (typeof pagination?.reverse !== \"undefined\") {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record>, never>;\n\nexport interface Rpc {\n request(service: string, method: string, data: Uint8Array): Promise;\n};\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: Long;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = date.getTime() % 1000 * 1000000;\n return {\n seconds,\n nanos\n };\n};\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n};\n\nconst fromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromString(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n}\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === \"string\") {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nexport function padDecimal(decStr: string): string{\n return decStr ? new Dec(decStr).toString() : decStr;\n}\n"; +export declare const internal = "import * as _m0 from \"protobufjs/minimal\";\nimport Long from 'long';\nimport { Dec } from \"@keplr-wallet/unit\";\n\n// @ts-ignore\nif (_m0.util.Long !== Long) {\n _m0.util.Long = (Long as any);\n\n _m0.configure();\n}\n\nexport { Long };\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n};\n\nexport function omitDefault(input: T): T | undefined {\n if (typeof input === \"string\") {\n return input === \"\" ? undefined : input;\n }\n\n if (typeof input === \"number\") {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === \"boolean\"){\n return input === false ? undefined : input;\n }\n\n if (Long.isLong(input)) {\n return (input as Long).isZero() ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n};\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: Long;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n};\n\nexport function fromDuration(duration: Duration): string {\n return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();\n};\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n};\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n};\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: Long;\n limit: Long;\n countTotal: boolean;\n reverse: boolean;\n};\n\nexport interface PageRequestParams {\n \"pagination.key\"?: string;\n \"pagination.offset\"?: string;\n \"pagination.limit\"?: string;\n \"pagination.count_total\"?: boolean;\n \"pagination.reverse\"?: boolean;\n};\n\nexport interface Params {\n params: PageRequestParams;\n};\n\nexport const setPaginationParams = (options: Params, pagination?: PageRequest) => {\n\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== \"undefined\") {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== \"undefined\") {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');\n }\n if (typeof pagination?.limit !== \"undefined\") {\n options.params[\"pagination.limit\"] = pagination.limit.toString()\n }\n if (typeof pagination?.offset !== \"undefined\") {\n options.params[\"pagination.offset\"] = pagination.offset.toString()\n }\n if (typeof pagination?.reverse !== \"undefined\") {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record>, never>;\n\nexport interface Rpc {\n request(service: string, method: string, data: Uint8Array): Promise;\n};\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: Long;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = date.getTime() % 1000 * 1000000;\n return {\n seconds,\n nanos\n };\n};\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n};\n\nconst fromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromString(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n}\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === \"string\") {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nexport function padDecimal(decStr: string): string{\n return decStr ? new Dec(decStr).toString() : decStr;\n}\n"; diff --git a/packages/telescope/types/helpers/internalForBigInt.d.ts b/packages/telescope/types/helpers/internalForBigInt.d.ts index 89fe1d2245..17c997ba6f 100644 --- a/packages/telescope/types/helpers/internalForBigInt.d.ts +++ b/packages/telescope/types/helpers/internalForBigInt.d.ts @@ -1 +1 @@ -export declare const internalForBigInt = "\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob ||\n ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa ||\n ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record<\n Exclude>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst fromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? BigInt(object.seconds) : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(number);\n}\n"; +export declare const internalForBigInt = "\nimport { Dec } from \"@keplr-wallet/unit\";\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob ||\n ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa ||\n ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === \"boolean\"){\n return input === false ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record<\n Exclude>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst fromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? BigInt(object.seconds) : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(number);\n}\n\nexport function padDecimal(decStr: string): string{\n return decStr ? new Dec(decStr).toString() : decStr;\n}\n"; From 9595e4bc75f58076584a86dcc299205aa4fae3b8 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Thu, 28 Dec 2023 11:50:46 +0330 Subject: [PATCH 03/24] fix: amino from-amino null handling --- .../encoding/amino/from-amino-json/index.ts | 5 +- .../encoding/amino/from-amino-json/utils.ts | 133 ++++++++++-------- .../src/encoding/amino/to-amino-json/index.ts | 10 +- .../ast/src/encoding/proto/to-amino/index.ts | 7 +- packages/ast/src/utils/amino.ts | 15 ++ packages/ast/src/utils/index.ts | 3 +- packages/ast/src/utils/utils.ts | 6 +- 7 files changed, 103 insertions(+), 76 deletions(-) create mode 100644 packages/ast/src/utils/amino.ts diff --git a/packages/ast/src/encoding/amino/from-amino-json/index.ts b/packages/ast/src/encoding/amino/from-amino-json/index.ts index 7fe288c5b7..25c992a707 100644 --- a/packages/ast/src/encoding/amino/from-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/from-amino-json/index.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField, ProtoType } from '@cosmology/types'; import { arrowFunctionExpression } from '../../../utils'; import { AminoParseContext } from '../../context'; import { protoFieldsToArray } from '../utils'; @@ -18,7 +18,7 @@ export interface FromAminoParseField { fieldPath: ProtoField[]; nested: number; isOptional: boolean; -}; +} export const fromAminoParseField = ({ context, @@ -146,6 +146,7 @@ export const fromAminoParseField = ({ case 'fixed32': case 'sfixed32': case 'bool': + return fromAmino.defaultType(args) case 'bytes': return fromAmino.defaultType(args) diff --git a/packages/ast/src/encoding/amino/from-amino-json/utils.ts b/packages/ast/src/encoding/amino/from-amino-json/utils.ts index 3ef30e9e0b..d148293f1c 100644 --- a/packages/ast/src/encoding/amino/from-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/from-amino-json/utils.ts @@ -1,13 +1,8 @@ import * as t from '@babel/types'; -import { - BILLION, - memberExpressionOrIdentifierAminoCaseField, - shorthandProperty, - TypeLong -} from '../../../utils'; +import { BILLION, memberExpressionOrIdentifierAminoCaseField, shorthandProperty, TypeLong } from '../../../utils'; import { FromAminoParseField, fromAminoParseField } from './index' import { protoFieldsToArray } from '../utils'; -import { getOneOfs, getFieldOptionality } from '../../proto'; +import { getFieldOptionality, getOneOfs } from '../../proto'; import { ProtoField } from '@cosmology/types'; import { GenericParseContext } from '../../context'; @@ -35,48 +30,49 @@ export const fromAmino = { rawBytes(args: FromAminoParseField) { args.context.addUtil('toUtf8'); + let prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); + let value = t.callExpression( + t.identifier('toUtf8'), + [ + t.callExpression( + t.memberExpression( + t.identifier('JSON'), + t.identifier('stringify') + ), + [ + prop + ] + ) + ] + ); return t.objectProperty( t.identifier(args.field.name), - t.callExpression( - t.identifier('toUtf8'), - [ - t.callExpression( - t.memberExpression( - t.identifier('JSON'), - t.identifier('stringify') - ), - [ - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) - ] - ) - ] - ) + this.nullCheckCondition(prop, prop, value) ); }, wasmByteCode(args: FromAminoParseField) { args.context.addUtil('fromBase64'); + let prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); + let value = t.callExpression( + t.identifier('fromBase64'), + [ + prop + ] + ); return t.objectProperty( t.identifier(args.field.name), - t.callExpression( - t.identifier('fromBase64'), - [ - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) - ] - ) + this.nullCheckCondition(prop, prop, value) ); }, long(args: FromAminoParseField) { TypeLong.addUtil(args.context); + const prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); return t.objectProperty(t.identifier(args.field.name), - t.callExpression( - TypeLong.getFromString(args.context), - [ - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) - ] - )); + this.nullCheckCondition(prop, prop, t.callExpression(TypeLong.getFromString(args.context), [prop])) + ); }, duration(args: FromAminoParseField) { @@ -93,6 +89,7 @@ export const fromAmino = { durationString(args: FromAminoParseField) { TypeLong.addUtil(args.context); + let property = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); const value = t.objectExpression( [ t.objectProperty(t.identifier('seconds'), t.callExpression( @@ -107,7 +104,7 @@ export const fromAmino = { t.callExpression( t.identifier('parseInt'), [ - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) + property ] ), BILLION @@ -122,7 +119,7 @@ export const fromAmino = { t.callExpression( t.identifier('parseInt'), [ - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) + property ] ), BILLION @@ -130,7 +127,7 @@ export const fromAmino = { ) ] ); - return t.objectProperty(t.identifier(args.field.name), value); + return t.objectProperty(t.identifier(args.field.name), this.nullCheckCondition(property, property, value)); }, height(args: FromAminoParseField) { @@ -143,6 +140,7 @@ export const fromAmino = { t.memberExpression( memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField), t.identifier(args.context.aminoCasingFn('revision_height')) + , false, true ), t.stringLiteral('0') ) @@ -154,6 +152,7 @@ export const fromAmino = { t.memberExpression( memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField), t.identifier(args.context.aminoCasingFn('revision_number')) + , false, true ), t.stringLiteral('0') ) @@ -189,19 +188,21 @@ export const fromAmino = { enum({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { const enumFunction = context.lookupEnumFromJson(field, currentProtoPath); + let prop = memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField); const value = t.callExpression( t.identifier(enumFunction), [ - memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField) + prop ]); - return t.objectProperty(t.identifier(field.name), value); + return t.objectProperty(t.identifier(field.name), this.nullCheckCondition(prop, prop, value)); }, enumArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { const enumFunction = context.lookupEnumFromJson(field, currentProtoPath); - const value = t.callExpression( + const value = t.optionalCallExpression( t.memberExpression( memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField), - t.identifier('map') + t.identifier('map'), + false, true ), [ t.arrowFunctionExpression( @@ -215,7 +216,7 @@ export const fromAmino = { ] ) ) - ] + ], true ); return t.objectProperty(t.identifier(field.name), value); }, @@ -239,24 +240,27 @@ export const fromAmino = { isOptional // TODO how to handle nested optionality? }) }); + let prop = memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField); + return t.objectProperty(t.identifier(field.name), - t.objectExpression( + this.nullCheckCondition(prop, prop, t.objectExpression( properties - ) + )) ); }, arrayFrom(args: FromAminoParseField) { - return t.objectProperty(t.identifier(args.field.name), - t.callExpression( - t.memberExpression( - t.identifier('Array'), - t.identifier('from') - ), - [ - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) - ] - )); + let prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); + let value = t.callExpression( + t.memberExpression( + t.identifier('Array'), + t.identifier('from') + ), + [ + prop + ] + ); + return t.objectProperty(t.identifier(args.field.name), this.nullCheckCondition(prop, prop, value)); }, typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { @@ -292,10 +296,10 @@ export const fromAmino = { }) }); - const expr = t.callExpression( + const expr = t.optionalCallExpression( t.memberExpression( memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField), - t.identifier('map') + t.identifier('map'), false, true ), [ t.arrowFunctionExpression( @@ -306,7 +310,7 @@ export const fromAmino = { properties ) ) - ] + ], true ); return t.objectProperty(t.identifier(field.name), @@ -318,10 +322,10 @@ export const fromAmino = { scalarArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField, arrayTypeAstFunc: Function) { const variable = 'el' + nested; - const expr = t.callExpression( + const expr = t.optionalCallExpression( t.memberExpression( memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField), - t.identifier('map') + t.identifier('map'), false, true, ), [ t.arrowFunctionExpression( @@ -330,7 +334,7 @@ export const fromAmino = { ], arrayTypeAstFunc(variable, context) ) - ] + ], true ); return t.objectProperty(t.identifier(field.name), @@ -350,6 +354,17 @@ export const fromAmino = { ] ) ) + }, + + /** + * value == null ? nullExpr : nonNullExpr + */ + nullCheckCondition(value: t.Expression, nullExpr: t.Expression, nonNullExpr: t.Expression) + { + return t.conditionalExpression(t.binaryExpression("==", value, t.nullLiteral()), + nullExpr, + nonNullExpr + ); } }; diff --git a/packages/ast/src/encoding/amino/to-amino-json/index.ts b/packages/ast/src/encoding/amino/to-amino-json/index.ts index d8665abda7..548da2dfaa 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/index.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { arrowFunctionExpression } from '../../../utils'; +import { AminoUtils, arrowFunctionExpression } from '../../../utils'; import { AminoParseContext } from '../../context'; import { ProtoType, ProtoField } from '@cosmology/types'; import { protoFieldsToArray } from '../utils'; @@ -22,7 +22,7 @@ export interface ToAminoParseField { fieldPath: ProtoField[]; nested: number; isOptional: boolean; -}; +} export const toAminoParseField = ({ context, @@ -70,9 +70,6 @@ export const toAminoParseField = ({ case 'bool': case 'bytes': return toAmino.defaultType(args); - - case 'string': - return toAmino.string(args); } switch (field.parsedType.type) { @@ -132,8 +129,7 @@ export const toAminoParseField = ({ } } - let jsonTag = field.options['(gogoproto.jsontag)'] ?? field.options['(cosmos_proto.json_tag)']; - const omitEmpty = jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); + let omitEmpty = AminoUtils.shouldOmitEmpty(field); // scalar types... switch (field.type) { diff --git a/packages/ast/src/encoding/proto/to-amino/index.ts b/packages/ast/src/encoding/proto/to-amino/index.ts index 528efc898a..eff8508477 100644 --- a/packages/ast/src/encoding/proto/to-amino/index.ts +++ b/packages/ast/src/encoding/proto/to-amino/index.ts @@ -1,10 +1,9 @@ import * as t from '@babel/types'; import { getFieldOptionality, getOneOfs } from '..'; -import { identifier, objectMethod } from '../../../utils'; +import { AminoUtils, identifier, objectMethod } from '../../../utils'; import { ProtoParseContext } from '../../context'; import { ProtoField, ProtoType } from '@cosmology/types'; import { arrayTypes, toAminoJSON, toAminoMessages } from './utils'; -import { pascal } from 'case'; import { SymbolNames } from '../../types'; import { getAminoTypeName } from '../../amino'; @@ -120,9 +119,7 @@ export const toAminoJSONMethodFields = (context: ProtoParseContext, name: string } - - let jsonTag = field.options?.['(gogoproto.jsontag)'] ?? field.options?.['(cosmos_proto.json_tag)']; - const omitEmpty = jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); + const omitEmpty = AminoUtils.shouldOmitEmpty(field); // default types switch (field.type) { diff --git a/packages/ast/src/utils/amino.ts b/packages/ast/src/utils/amino.ts new file mode 100644 index 0000000000..e97acd78d4 --- /dev/null +++ b/packages/ast/src/utils/amino.ts @@ -0,0 +1,15 @@ +export const AminoUtils = { + shouldOmitEmpty(field: { + options: { + [p: string]: any; + }; + }): boolean + { + if (field?.options?.['(gogoproto.nullable)']) { + return false; + } + let jsonTag = field.options?.['(gogoproto.jsontag)'] ?? field.options?.['(cosmos_proto.json_tag)']; + return jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); + } + +} diff --git a/packages/ast/src/utils/index.ts b/packages/ast/src/utils/index.ts index 4753f3d6f0..75c37953c2 100644 --- a/packages/ast/src/utils/index.ts +++ b/packages/ast/src/utils/index.ts @@ -1,4 +1,5 @@ export * from './babel'; export * from './utils'; export * from './scoped-bundle-builder'; -export * from './type-long-expression'; \ No newline at end of file +export * from './type-long-expression'; +export * from './amino'; diff --git a/packages/ast/src/utils/utils.ts b/packages/ast/src/utils/utils.ts index c4bd02a609..543df4d875 100644 --- a/packages/ast/src/utils/utils.ts +++ b/packages/ast/src/utils/utils.ts @@ -154,14 +154,16 @@ export const memberExpressionOrIdentifierAminoCaseField = ( const [b, a] = fields; return t.memberExpression( t.identifier(aminoCaseFunc(a)), - t.identifier(aminoCaseFunc(b)) + t.identifier(aminoCaseFunc(b)), + false, true ); } const [field, ...rest] = fields; return t.memberExpression( memberExpressionOrIdentifierAminoCaseField(rest, aminoCaseFunc), - t.identifier(aminoCaseFunc(field)) + t.identifier(aminoCaseFunc(field)), + false, true ) }; From fdcae94742e2a82a76fb0206b2357efc7a24a8c7 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Thu, 28 Dec 2023 13:59:25 +0330 Subject: [PATCH 04/24] fix: pubkey from amino functions --- .../encoding/proto/implements/from-amino.ts | 39 +++++++++---------- 1 file changed, 19 insertions(+), 20 deletions(-) diff --git a/packages/ast/src/encoding/proto/implements/from-amino.ts b/packages/ast/src/encoding/proto/implements/from-amino.ts index 729141638b..792bd7cca6 100644 --- a/packages/ast/src/encoding/proto/implements/from-amino.ts +++ b/packages/ast/src/encoding/proto/implements/from-amino.ts @@ -13,28 +13,27 @@ export const getInterfaceFromAminoName = (str: string) => { const makeFunctionWrapper = (functionName: string, stmt: t.Statement) => { return t.exportNamedDeclaration( - t.variableDeclaration( - 'const', + t.functionDeclaration( + identifier(functionName, + t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Any') + ) + ) + ), [ - t.variableDeclarator( - t.identifier(functionName), - t.arrowFunctionExpression( - [ - identifier( - 'content', - t.tsTypeAnnotation( - t.tsTypeReference( - t.identifier('AnyAmino') - ) - ) - ) - ], - t.blockStatement([ - stmt - ]) + identifier( + 'content', + t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('AnyAmino') + ) ) ) - ] + ], + t.blockStatement([ + stmt + ]) ) ); }; @@ -189,4 +188,4 @@ export const createInterfaceFromAminoHelper = ( } return makeFunctionWrapper(functionName, ast); -}; \ No newline at end of file +}; From 94608ed3024776b1e9d3a44839218572f32887a7 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Thu, 28 Dec 2023 14:54:48 +0330 Subject: [PATCH 05/24] feat: add return type to arrow-functions --- .../encoding/proto/implements/from-amino.ts | 39 +++++++++++-------- .../src/encoding/proto/implements/to-amino.ts | 39 +++++++++++-------- .../encoding/amino/from-amino-json/index.d.ts | 2 +- .../encoding/amino/from-amino-json/utils.d.ts | 4 ++ packages/ast/types/utils/amino.d.ts | 7 ++++ packages/ast/types/utils/index.d.ts | 1 + 6 files changed, 58 insertions(+), 34 deletions(-) create mode 100644 packages/ast/types/utils/amino.d.ts diff --git a/packages/ast/src/encoding/proto/implements/from-amino.ts b/packages/ast/src/encoding/proto/implements/from-amino.ts index 792bd7cca6..c13bea43d6 100644 --- a/packages/ast/src/encoding/proto/implements/from-amino.ts +++ b/packages/ast/src/encoding/proto/implements/from-amino.ts @@ -12,28 +12,35 @@ export const getInterfaceFromAminoName = (str: string) => { }; const makeFunctionWrapper = (functionName: string, stmt: t.Statement) => { - return t.exportNamedDeclaration( - t.functionDeclaration( - identifier(functionName, + let arrowFunction = t.arrowFunctionExpression( + [ + identifier( + 'content', t.tsTypeAnnotation( t.tsTypeReference( - t.identifier('Any') + t.identifier('AnyAmino') ) ) - ), + ) + ], + t.blockStatement([ + stmt + ]) + ); + arrowFunction.returnType = t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Any') + ) + ); + return t.exportNamedDeclaration( + t.variableDeclaration( + 'const', [ - identifier( - 'content', - t.tsTypeAnnotation( - t.tsTypeReference( - t.identifier('AnyAmino') - ) - ) + t.variableDeclarator( + t.identifier(functionName), + arrowFunction ) - ], - t.blockStatement([ - stmt - ]) + ] ) ); }; diff --git a/packages/ast/src/encoding/proto/implements/to-amino.ts b/packages/ast/src/encoding/proto/implements/to-amino.ts index 0338f3d4a8..81c9da7847 100644 --- a/packages/ast/src/encoding/proto/implements/to-amino.ts +++ b/packages/ast/src/encoding/proto/implements/to-amino.ts @@ -41,28 +41,33 @@ export const createInterfaceToAmino = ( }; const makeFunctionWrapper = (functionName: string, stmt: t.Statement) => { + let arrowFunction = t.arrowFunctionExpression( + [ + identifier( + 'content', + t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('Any') + ) + ) + ) + ], + t.blockStatement([ + stmt + ]) + ); + arrowFunction.returnType = t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier('AnyAmino') + ) + ); return t.exportNamedDeclaration( t.variableDeclaration( 'const', [ t.variableDeclarator( t.identifier(functionName), - t.arrowFunctionExpression( - [ - identifier( - 'content', - t.tsTypeAnnotation( - t.tsTypeReference( - t.identifier('Any') - ) - ) - ) - ], - t.blockStatement([ - stmt - ]) - ) - + arrowFunction ) ] ) @@ -164,4 +169,4 @@ export const createInterfaceToAminoHelper = ( } return makeFunctionWrapper(functionName, ast); -}; \ No newline at end of file +}; diff --git a/packages/ast/types/encoding/amino/from-amino-json/index.d.ts b/packages/ast/types/encoding/amino/from-amino-json/index.d.ts index 26afc0a66a..e00df8c8dc 100644 --- a/packages/ast/types/encoding/amino/from-amino-json/index.d.ts +++ b/packages/ast/types/encoding/amino/from-amino-json/index.d.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { ProtoType, ProtoField } from '@cosmology/types'; +import { ProtoField, ProtoType } from '@cosmology/types'; import { AminoParseContext } from '../../context'; export interface FromAminoParseField { context: AminoParseContext; diff --git a/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts b/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts index 945c3dd5b8..0d4c541a2b 100644 --- a/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts +++ b/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts @@ -17,6 +17,10 @@ export declare const fromAmino: { typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField): t.ObjectProperty; scalarArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField, arrayTypeAstFunc: Function): t.ObjectProperty; pubkey(args: FromAminoParseField): t.ObjectProperty; + /** + * value == null ? nullExpr : nonNullExpr + */ + nullCheckCondition(value: t.Expression, nullExpr: t.Expression, nonNullExpr: t.Expression): t.ConditionalExpression; }; export declare const arrayTypes: { long(varname: string, ctx: GenericParseContext): t.CallExpression; diff --git a/packages/ast/types/utils/amino.d.ts b/packages/ast/types/utils/amino.d.ts new file mode 100644 index 0000000000..c3102c60b0 --- /dev/null +++ b/packages/ast/types/utils/amino.d.ts @@ -0,0 +1,7 @@ +export declare const AminoUtils: { + shouldOmitEmpty(field: { + options: { + [p: string]: any; + }; + }): boolean; +}; diff --git a/packages/ast/types/utils/index.d.ts b/packages/ast/types/utils/index.d.ts index ba68e90ab6..75c37953c2 100644 --- a/packages/ast/types/utils/index.d.ts +++ b/packages/ast/types/utils/index.d.ts @@ -2,3 +2,4 @@ export * from './babel'; export * from './utils'; export * from './scoped-bundle-builder'; export * from './type-long-expression'; +export * from './amino'; From 3a8e76ba6a402cec7a64e4ec98e58133acf19f09 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Mon, 1 Jan 2024 12:45:32 +0330 Subject: [PATCH 06/24] feat: fix omit empty handling --- .../ast/src/encoding/proto/to-amino/index.ts | 2 - .../ast/src/encoding/proto/to-amino/utils.ts | 41 +++++++++++-------- packages/ast/src/utils/amino.ts | 6 +-- .../types/encoding/proto/to-amino/utils.d.ts | 37 ++++++++--------- .../types/helpers/internal-for-bigint.d.ts | 2 +- .../telescope/types/helpers/internal.d.ts | 2 +- 6 files changed, 48 insertions(+), 42 deletions(-) diff --git a/packages/ast/src/encoding/proto/to-amino/index.ts b/packages/ast/src/encoding/proto/to-amino/index.ts index 5ab7764bb0..9ccaef3240 100644 --- a/packages/ast/src/encoding/proto/to-amino/index.ts +++ b/packages/ast/src/encoding/proto/to-amino/index.ts @@ -1,6 +1,4 @@ import * as t from '@babel/types'; -import { getFieldOptionality, getOneOfs } from '..'; -import { AminoUtils, identifier, objectMethod } from '../../../utils'; import { getFieldOptionalityForAmino, getOneOfs } from '..'; import { identifier, objectMethod } from '../../../utils'; import { ProtoParseContext } from '../../context'; diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 27a897d49e..0501e359fc 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -1,24 +1,33 @@ - import * as t from '@babel/types'; - import { ProtoType } from '@cosmology/types'; - import { BILLION, TypeLong, identifier } from '../../../utils'; - import { ProtoParseContext } from '../../context'; - import { getDefaultTSTypeFromProtoType, getFieldNames } from '../../types'; - import { getInterfaceToAminoName } from '../implements'; - import { ToAminoJSONMethod } from './index'; - - const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { +import * as t from '@babel/types'; +import { ProtoType } from '@cosmology/types'; +import { AminoUtils, BILLION, identifier, TypeLong } from '../../../utils'; +import { ProtoParseContext } from '../../context'; +import { getDefaultTSTypeFromProtoType, getFieldNames } from '../../types'; +import { getInterfaceToAminoName } from '../implements'; +import { ToAminoJSONMethod } from './index'; + +const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // currently the "(amino.dont_omitempty)" does not work on cosmos sdk + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const omitEmpty = AminoUtils.shouldOmitEmpty(args.field); + valExpr = t.memberExpression(t.identifier("message"), t.identifier(propName)); - if (dontOmitempty) { - valExpr = t.logicalExpression( - "??", - valExpr, - getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) - ); + if (omitEmpty) { + valExpr = t.conditionalExpression(t.binaryExpression( + "===", + valExpr, + getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) + ), t.identifier('undefined'), valExpr); + } else { + valExpr = t.logicalExpression( + "??", + valExpr, + getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) + ); } return t.expressionStatement( diff --git a/packages/ast/src/utils/amino.ts b/packages/ast/src/utils/amino.ts index e97acd78d4..8e02a05d69 100644 --- a/packages/ast/src/utils/amino.ts +++ b/packages/ast/src/utils/amino.ts @@ -5,9 +5,9 @@ export const AminoUtils = { }; }): boolean { - if (field?.options?.['(gogoproto.nullable)']) { - return false; - } + // if (field?.options?.['(gogoproto.nullable)']) { + // return false; + // } let jsonTag = field.options?.['(gogoproto.jsontag)'] ?? field.options?.['(cosmos_proto.json_tag)']; return jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); } diff --git a/packages/ast/types/encoding/proto/to-amino/utils.d.ts b/packages/ast/types/encoding/proto/to-amino/utils.d.ts index 7f291f1bb2..caf45b83ca 100644 --- a/packages/ast/types/encoding/proto/to-amino/utils.d.ts +++ b/packages/ast/types/encoding/proto/to-amino/utils.d.ts @@ -3,28 +3,27 @@ import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; import { ToAminoJSONMethod } from './index'; export declare const toAminoJSON: { - scalar(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - omitDefaultExpr(args: ToAminoJSONMethod, expr: any): t.CallExpression; - string(args: ToAminoJSONMethod, omitEmpty: any): t.ExpressionStatement; - double(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - float(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - bool(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - number(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - int32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - uint32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - sint32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - fixed32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - sfixed32(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - long(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - int64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - uint64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - sint64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - fixed64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; - sfixed64(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + scalar(args: ToAminoJSONMethod): t.ExpressionStatement; + string(args: ToAminoJSONMethod): t.ExpressionStatement; + double(args: ToAminoJSONMethod): t.ExpressionStatement; + float(args: ToAminoJSONMethod): t.ExpressionStatement; + bool(args: ToAminoJSONMethod): t.ExpressionStatement; + number(args: ToAminoJSONMethod): t.ExpressionStatement; + int32(args: ToAminoJSONMethod): t.ExpressionStatement; + uint32(args: ToAminoJSONMethod): t.ExpressionStatement; + sint32(args: ToAminoJSONMethod): t.ExpressionStatement; + fixed32(args: ToAminoJSONMethod): t.ExpressionStatement; + sfixed32(args: ToAminoJSONMethod): t.ExpressionStatement; + long(args: ToAminoJSONMethod): t.ExpressionStatement; + int64(args: ToAminoJSONMethod): t.ExpressionStatement; + uint64(args: ToAminoJSONMethod): t.ExpressionStatement; + sint64(args: ToAminoJSONMethod): t.ExpressionStatement; + fixed64(args: ToAminoJSONMethod): t.ExpressionStatement; + sfixed64(args: ToAminoJSONMethod): t.ExpressionStatement; protoType(args: ToAminoJSONMethod): t.ExpressionStatement; anyType(args: ToAminoJSONMethod): t.ExpressionStatement; type(args: ToAminoJSONMethod): t.ExpressionStatement; - enum(args: ToAminoJSONMethod, omitEmpty: boolean): t.ExpressionStatement; + enum(args: ToAminoJSONMethod): t.ExpressionStatement; bytes(args: ToAminoJSONMethod): t.ExpressionStatement; duration(args: ToAminoJSONMethod): t.ExpressionStatement; timestamp(args: ToAminoJSONMethod): t.ExpressionStatement; diff --git a/packages/telescope/types/helpers/internal-for-bigint.d.ts b/packages/telescope/types/helpers/internal-for-bigint.d.ts index 3eecb7a9eb..bb03f5b333 100644 --- a/packages/telescope/types/helpers/internal-for-bigint.d.ts +++ b/packages/telescope/types/helpers/internal-for-bigint.d.ts @@ -1 +1 @@ -export declare const internalForBigInt = "\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob ||\n ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa ||\n ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record<\n Exclude>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(Math.trunc(number));\n}\n"; +export declare const internalForBigInt = "\nimport { Dec } from \"@keplr-wallet/unit\";\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob ||\n ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa ||\n ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n}\n\nexport function omitDefault(\n input: T\n): T | undefined {\n if (typeof input === 'string') {\n return input === '' ? undefined : input;\n }\n\n if (typeof input === 'number') {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === \"boolean\"){\n return input === false ? undefined : input;\n }\n\n if (typeof input === 'bigint') {\n return input === BigInt(0) ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n}\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: bigint;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n}\n\nexport function fromDuration(duration: Duration): string {\n return (\n parseInt(duration.seconds.toString()) * 1000000000 +\n duration.nanos\n ).toString();\n}\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n}\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n}\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: bigint;\n limit: bigint;\n countTotal: boolean;\n reverse: boolean;\n}\n\nexport interface PageRequestParams {\n 'pagination.key'?: string;\n 'pagination.offset'?: string;\n 'pagination.limit'?: string;\n 'pagination.count_total'?: boolean;\n 'pagination.reverse'?: boolean;\n}\n\nexport interface Params {\n params: PageRequestParams;\n}\n\nexport const setPaginationParams = (\n options: Params,\n pagination?: PageRequest\n) => {\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== 'undefined') {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== 'undefined') {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString(\n 'base64'\n );\n }\n if (typeof pagination?.limit !== 'undefined') {\n options.params['pagination.limit'] = pagination.limit.toString();\n }\n if (typeof pagination?.offset !== 'undefined') {\n options.params['pagination.offset'] = pagination.offset.toString();\n }\n if (typeof pagination?.reverse !== 'undefined') {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin =\n | Date\n | Function\n | Uint8Array\n | string\n | number\n | bigint\n | boolean\n | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record<\n Exclude>,\n never\n >;\n\nexport interface Rpc {\n request(\n service: string,\n method: string,\n data: Uint8Array\n ): Promise;\n}\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: bigint;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = (date.getTime() % 1000) * 1000000;\n return {\n seconds,\n nanos\n };\n}\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = Number(t.seconds) * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n}\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds)\n ? BigInt(object.seconds.toString())\n : BigInt(0),\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0\n };\n};\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === 'string') {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return BigInt(Math.trunc(number));\n}\n\nexport function padDecimal(decStr: string): string{\n return decStr ? new Dec(decStr).toString() : decStr;\n}\n"; diff --git a/packages/telescope/types/helpers/internal.d.ts b/packages/telescope/types/helpers/internal.d.ts index f2e6f243ae..03150e06dd 100644 --- a/packages/telescope/types/helpers/internal.d.ts +++ b/packages/telescope/types/helpers/internal.d.ts @@ -1 +1 @@ -export declare const internal = "import * as _m0 from \"protobufjs/minimal\";\nimport Long from 'long';\n\n// @ts-ignore\nif (_m0.util.Long !== Long) {\n _m0.util.Long = (Long as any);\n\n _m0.configure();\n}\n\nexport { Long };\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n};\n\nexport function omitDefault(input: T): T | undefined {\n if (typeof input === \"string\") {\n return input === \"\" ? undefined : input;\n }\n\n if (typeof input === \"number\") {\n return input === 0 ? undefined : input;\n }\n\n if (Long.isLong(input)) {\n return input.isZero() ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n};\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: Long;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n};\n\nexport function fromDuration(duration: Duration): string {\n return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();\n};\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n};\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n};\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: Long;\n limit: Long;\n countTotal: boolean;\n reverse: boolean;\n};\n\nexport interface PageRequestParams {\n \"pagination.key\"?: string;\n \"pagination.offset\"?: string;\n \"pagination.limit\"?: string;\n \"pagination.count_total\"?: boolean;\n \"pagination.reverse\"?: boolean;\n};\n\nexport interface Params {\n params: PageRequestParams;\n};\n\nexport const setPaginationParams = (options: Params, pagination?: PageRequest) => {\n\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== \"undefined\") {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== \"undefined\") {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');\n }\n if (typeof pagination?.limit !== \"undefined\") {\n options.params[\"pagination.limit\"] = pagination.limit.toString()\n }\n if (typeof pagination?.offset !== \"undefined\") {\n options.params[\"pagination.offset\"] = pagination.offset.toString()\n }\n if (typeof pagination?.reverse !== \"undefined\") {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record>, never>;\n\nexport interface Rpc {\n request(service: string, method: string, data: Uint8Array): Promise;\n};\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: Long;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = date.getTime() % 1000 * 1000000;\n return {\n seconds,\n nanos\n };\n};\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n}\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === \"string\") {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n"; +export declare const internal = "import * as _m0 from \"protobufjs/minimal\";\nimport Long from 'long';\nimport { Dec } from \"@keplr-wallet/unit\";\n\n// @ts-ignore\nif (_m0.util.Long !== Long) {\n _m0.util.Long = (Long as any);\n\n _m0.configure();\n}\n\nexport { Long };\n\ndeclare var self: any | undefined;\ndeclare var window: any | undefined;\ndeclare var global: any | undefined;\nvar globalThis: any = (() => {\n if (typeof globalThis !== 'undefined') return globalThis;\n if (typeof self !== 'undefined') return self;\n if (typeof window !== 'undefined') return window;\n if (typeof global !== 'undefined') return global;\n throw 'Unable to locate global object';\n})();\n\nconst atob: (b64: string) => string =\n globalThis.atob || ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary'));\n\nexport function bytesFromBase64(b64: string): Uint8Array {\n const bin = atob(b64);\n const arr = new Uint8Array(bin.length);\n for (let i = 0; i < bin.length; ++i) {\n arr[i] = bin.charCodeAt(i);\n }\n return arr;\n}\n\nconst btoa: (bin: string) => string =\n globalThis.btoa || ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64'));\n\nexport function base64FromBytes(arr: Uint8Array): string {\n const bin: string[] = [];\n arr.forEach((byte) => {\n bin.push(String.fromCharCode(byte));\n });\n return btoa(bin.join(''));\n}\n\nexport interface AminoHeight {\n readonly revision_number?: string;\n readonly revision_height?: string;\n};\n\nexport function omitDefault(input: T): T | undefined {\n if (typeof input === \"string\") {\n return input === \"\" ? undefined : input;\n }\n\n if (typeof input === \"number\") {\n return input === 0 ? undefined : input;\n }\n\n if (typeof input === \"boolean\"){\n return input === false ? undefined : input;\n }\n\n if (Long.isLong(input)) {\n return (input as Long).isZero() ? undefined : input;\n }\n\n throw new Error(`Got unsupported type ${typeof input}`);\n};\n\ninterface Duration {\n /**\n * Signed seconds of the span of time. Must be from -315,576,000,000\n * to +315,576,000,000 inclusive. Note: these bounds are computed from:\n * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years\n */\n seconds: Long;\n /**\n * Signed fractions of a second at nanosecond resolution of the span\n * of time. Durations less than one second are represented with a 0\n * `seconds` field and a positive or negative `nanos` field. For durations\n * of one second or more, a non-zero value for the `nanos` field must be\n * of the same sign as the `seconds` field. Must be from -999,999,999\n * to +999,999,999 inclusive.\n */\n\n nanos: number;\n}\n\nexport function toDuration(duration: string): Duration {\n return {\n seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1000000000)),\n nanos: parseInt(duration) % 1000000000\n };\n};\n\nexport function fromDuration(duration: Duration): string {\n return (parseInt(duration.seconds.toString()) * 1000000000 + duration.nanos).toString();\n};\n\nexport function isSet(value: any): boolean {\n return value !== null && value !== undefined;\n};\n\nexport function isObject(value: any): boolean {\n return typeof value === 'object' && value !== null;\n};\n\nexport interface PageRequest {\n key: Uint8Array;\n offset: Long;\n limit: Long;\n countTotal: boolean;\n reverse: boolean;\n};\n\nexport interface PageRequestParams {\n \"pagination.key\"?: string;\n \"pagination.offset\"?: string;\n \"pagination.limit\"?: string;\n \"pagination.count_total\"?: boolean;\n \"pagination.reverse\"?: boolean;\n};\n\nexport interface Params {\n params: PageRequestParams;\n};\n\nexport const setPaginationParams = (options: Params, pagination?: PageRequest) => {\n\n if (!pagination) {\n return options;\n }\n\n if (typeof pagination?.countTotal !== \"undefined\") {\n options.params['pagination.count_total'] = pagination.countTotal;\n }\n if (typeof pagination?.key !== \"undefined\") {\n // String to Uint8Array\n // let uint8arr = new Uint8Array(Buffer.from(data,'base64'));\n\n // Uint8Array to String\n options.params['pagination.key'] = Buffer.from(pagination.key).toString('base64');\n }\n if (typeof pagination?.limit !== \"undefined\") {\n options.params[\"pagination.limit\"] = pagination.limit.toString()\n }\n if (typeof pagination?.offset !== \"undefined\") {\n options.params[\"pagination.offset\"] = pagination.offset.toString()\n }\n if (typeof pagination?.reverse !== \"undefined\") {\n options.params['pagination.reverse'] = pagination.reverse;\n }\n\n return options;\n};\n\ntype Builtin = Date | Function | Uint8Array | string | number | boolean | undefined;\n\nexport type DeepPartial = T extends Builtin\n ? T\n : T extends Long\n ? string | number | Long\n : T extends Array\n ? Array>\n : T extends ReadonlyArray\n ? ReadonlyArray>\n : T extends {}\n ? { [K in keyof T]?: DeepPartial }\n : Partial;\n\ntype KeysOfUnion = T extends T ? keyof T : never;\nexport type Exact = P extends Builtin\n ? P\n : P & { [K in keyof P]: Exact } & Record>, never>;\n\nexport interface Rpc {\n request(service: string, method: string, data: Uint8Array): Promise;\n};\n\ninterface Timestamp {\n /**\n * Represents seconds of UTC time since Unix epoch\n * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to\n * 9999-12-31T23:59:59Z inclusive.\n */\n seconds: Long;\n /**\n * Non-negative fractions of a second at nanosecond resolution. Negative\n * second values with fractions must still have non-negative nanos values\n * that count forward in time. Must be from 0 to 999,999,999\n * inclusive.\n */\n\n nanos: number;\n}\n\nexport function toTimestamp(date: Date): Timestamp {\n const seconds = numberToLong(date.getTime() / 1_000);\n const nanos = date.getTime() % 1000 * 1000000;\n return {\n seconds,\n nanos\n };\n};\n\nexport function fromTimestamp(t: Timestamp): Date {\n let millis = t.seconds.toNumber() * 1000;\n millis += t.nanos / 1000000;\n return new Date(millis);\n};\n\nconst timestampFromJSON = (object: any): Timestamp => {\n return {\n seconds: isSet(object.seconds) ? Long.fromValue(object.seconds) : Long.ZERO,\n nanos: isSet(object.nanos) ? Number(object.nanos) : 0,\n };\n}\n\nexport function fromJsonTimestamp(o: any): Timestamp {\n if (o instanceof Date) {\n return toTimestamp(o);\n } else if (typeof o === \"string\") {\n return toTimestamp(new Date(o));\n } else {\n return timestampFromJSON(o);\n }\n}\n\nfunction numberToLong(number: number) {\n return Long.fromNumber(number);\n}\n\nexport function padDecimal(decStr: string): string{\n return decStr ? new Dec(decStr).toString() : decStr;\n}\n"; From 331f35d8fea0fcdb2c0fea243c923ec60faf3d27 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Mon, 1 Jan 2024 16:34:07 +0330 Subject: [PATCH 07/24] feat: handle decimal paddings --- .../ast/src/encoding/proto/to-amino/utils.ts | 27 ++++++++++++++++--- 1 file changed, 24 insertions(+), 3 deletions(-) diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 0501e359fc..a7851cae1f 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -41,12 +41,33 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { export const toAminoJSON = { - scalar(args: ToAminoJSONMethod) { - return setValue(args) + scalar(args: ToAminoJSONMethod, valExpr?: t.Expression) { + return setValue(args, valExpr) }, string(args: ToAminoJSONMethod) { - return toAminoJSON.scalar(args); + const isCosmosSDKDec = + (args.field.options?.['(gogoproto.customtype)'] == + 'github.com/cosmos/cosmos-sdk/types.Dec') || + (args.field.options?.['(gogoproto.customtype)'] == + 'cosmossdk.io/math.LegacyDec'); + + let valueExpr: t.Expression; + if (isCosmosSDKDec) { + args.context.addUtil('padDecimal'); + const { propName } = getFieldNames(args.field); + valueExpr = t.callExpression( + t.identifier('padDecimal'), + [ + t.memberExpression( + t.identifier('message'), + t.identifier(propName) + ) + ] + ) + } + + return toAminoJSON.scalar(args, valueExpr); }, double(args: ToAminoJSONMethod) { return toAminoJSON.scalar(args); From 36f37c3fe9f2e5d1428d48d6ffc08f2487ad837c Mon Sep 17 00:00:00 2001 From: Rasoul Date: Mon, 1 Jan 2024 16:53:43 +0330 Subject: [PATCH 08/24] fix: decimal handling in amino --- packages/ast/src/encoding/proto/to-amino/utils.ts | 2 +- packages/ast/types/encoding/proto/to-amino/utils.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index a7851cae1f..c364a74a1b 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -14,7 +14,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const omitEmpty = AminoUtils.shouldOmitEmpty(args.field); - valExpr = t.memberExpression(t.identifier("message"), t.identifier(propName)); + valExpr = valExpr ?? t.memberExpression(t.identifier("message"), t.identifier(propName)); if (omitEmpty) { valExpr = t.conditionalExpression(t.binaryExpression( diff --git a/packages/ast/types/encoding/proto/to-amino/utils.d.ts b/packages/ast/types/encoding/proto/to-amino/utils.d.ts index caf45b83ca..b99e5f4719 100644 --- a/packages/ast/types/encoding/proto/to-amino/utils.d.ts +++ b/packages/ast/types/encoding/proto/to-amino/utils.d.ts @@ -3,7 +3,7 @@ import { ProtoType } from '@cosmology/types'; import { ProtoParseContext } from '../../context'; import { ToAminoJSONMethod } from './index'; export declare const toAminoJSON: { - scalar(args: ToAminoJSONMethod): t.ExpressionStatement; + scalar(args: ToAminoJSONMethod, valExpr?: t.Expression): t.ExpressionStatement; string(args: ToAminoJSONMethod): t.ExpressionStatement; double(args: ToAminoJSONMethod): t.ExpressionStatement; float(args: ToAminoJSONMethod): t.ExpressionStatement; From 0afc37b63a75cbb626602db2089de16325a300b1 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Tue, 2 Jan 2024 12:06:09 +0330 Subject: [PATCH 09/24] fix: amino enum handling --- .../src/encoding/proto/from-amino/index.ts | 2 +- .../src/encoding/proto/from-amino/utils.ts | 18 ++-------- .../ast/src/encoding/proto/to-amino/index.ts | 2 +- .../ast/src/encoding/proto/to-amino/utils.ts | 33 ++----------------- .../encoding/proto/from-amino/utils.d.ts | 2 +- .../types/encoding/proto/to-amino/utils.d.ts | 2 +- 6 files changed, 10 insertions(+), 49 deletions(-) diff --git a/packages/ast/src/encoding/proto/from-amino/index.ts b/packages/ast/src/encoding/proto/from-amino/index.ts index 034b00a99a..ba46e1d109 100644 --- a/packages/ast/src/encoding/proto/from-amino/index.ts +++ b/packages/ast/src/encoding/proto/from-amino/index.ts @@ -80,7 +80,7 @@ export const fromAminoMethodFields = ( default: switch (field.parsedType.type) { case "Enum": - return fromAminoJSON.array(args, arrayTypes.enum(args)); + return fromAminoJSON.array(args, arrayTypes.enum()); case "Type": return fromAminoJSON.array(args, arrayTypes.type(args)); } diff --git a/packages/ast/src/encoding/proto/from-amino/utils.ts b/packages/ast/src/encoding/proto/from-amino/utils.ts index 9bf53001db..b9fe2ca012 100644 --- a/packages/ast/src/encoding/proto/from-amino/utils.ts +++ b/packages/ast/src/encoding/proto/from-amino/utils.ts @@ -162,16 +162,7 @@ export const fromAmino = { }, enum(args: fromAminoMethod) { - const { origName } = getFieldNames(args.field); - - const fromAminoJSONFuncName = args.context.getFromEnum(args.field); - - return setNotUndefinedAndNotNull( - args, - t.callExpression(t.identifier(fromAminoJSONFuncName), [ - t.memberExpression(t.identifier("object"), t.identifier(origName)), - ]) - ); + return setNotUndefinedAndNotNull(args); }, bytes(args: fromAminoMethod) { @@ -535,11 +526,8 @@ export const arrayTypes = { sfixed32() { return arrayTypes.identity(); }, - enum(args: fromAminoMethod) { - const fromAminoJSONFuncName = args.context.getFromEnum(args.field); - return t.callExpression(t.identifier(fromAminoJSONFuncName), [ - t.identifier("e"), - ]); + enum() { + return arrayTypes.identity(); }, // message.codeIds = object.codeIds?.map(e => Long.fromValue(e)) || []; diff --git a/packages/ast/src/encoding/proto/to-amino/index.ts b/packages/ast/src/encoding/proto/to-amino/index.ts index 9ccaef3240..e047484408 100644 --- a/packages/ast/src/encoding/proto/to-amino/index.ts +++ b/packages/ast/src/encoding/proto/to-amino/index.ts @@ -72,7 +72,7 @@ export const toAminoJSONMethodFields = (context: ProtoParseContext, name: string default: switch (field.parsedType.type) { case 'Enum': - return [...m, toAminoJSON.array(args, arrayTypes.enum(args))]; + return [...m, toAminoJSON.array(args, arrayTypes.enum())]; case 'Type': return [...m, toAminoJSON.array(args, arrayTypes.type(args))]; } diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index c364a74a1b..c3e7ee248b 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -274,28 +274,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { }, enum(args: ToAminoJSONMethod) { - const { propName, origName } = getFieldNames(args.field); - const enumFuncName = args.context.getToEnum(args.field); - const expr = t.callExpression( - t.identifier(enumFuncName), - [ - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ) - ] - ); - - return t.expressionStatement( - t.assignmentExpression( - '=', - t.memberExpression( - t.identifier('obj'), - t.identifier(origName) - ), - expr - ) - ); + return toAminoJSON.scalar(args); }, bytes(args: ToAminoJSONMethod) { @@ -774,14 +753,8 @@ export const arrayTypes = { t.identifier("e"), ]); }, - enum(args: ToAminoJSONMethod) { - const enumFuncName = args.context.getToEnum(args.field); - return t.callExpression( - t.identifier(enumFuncName), - [ - t.identifier('e') - ] - ); + enum() { + return arrayTypes.scalar() }, anyType(args: ToAminoJSONMethod) { const { propName, origName } = getFieldNames(args.field); diff --git a/packages/ast/types/encoding/proto/from-amino/utils.d.ts b/packages/ast/types/encoding/proto/from-amino/utils.d.ts index d0cec6aa2e..a0d646d8c5 100644 --- a/packages/ast/types/encoding/proto/from-amino/utils.d.ts +++ b/packages/ast/types/encoding/proto/from-amino/utils.d.ts @@ -48,7 +48,7 @@ export declare const arrayTypes: { sint32(): t.Identifier; fixed32(): t.Identifier; sfixed32(): t.Identifier; - enum(args: fromAminoMethod): t.CallExpression; + enum(): t.Identifier; long(args: fromAminoMethod): t.Expression; int64(args: fromAminoMethod): t.Expression; uint64(args: fromAminoMethod): t.Expression; diff --git a/packages/ast/types/encoding/proto/to-amino/utils.d.ts b/packages/ast/types/encoding/proto/to-amino/utils.d.ts index b99e5f4719..a2885704bd 100644 --- a/packages/ast/types/encoding/proto/to-amino/utils.d.ts +++ b/packages/ast/types/encoding/proto/to-amino/utils.d.ts @@ -55,7 +55,7 @@ export declare const arrayTypes: { rawBytes(args: ToAminoJSONMethod): t.CallExpression; wasmByteCode(args: ToAminoJSONMethod): t.CallExpression; bytes(args: ToAminoJSONMethod): t.CallExpression; - enum(args: ToAminoJSONMethod): t.CallExpression; + enum(): t.Identifier; anyType(args: ToAminoJSONMethod): t.ConditionalExpression; protoType(args: ToAminoJSONMethod): t.ConditionalExpression; type(args: ToAminoJSONMethod): t.ConditionalExpression; From d38a5c81e014238461847bb95ca90477f4727170 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Tue, 2 Jan 2024 15:05:35 +0330 Subject: [PATCH 10/24] fix: amino omit empty --- .../ast/src/encoding/proto/to-amino/utils.ts | 45 ++++++++++++------- 1 file changed, 30 insertions(+), 15 deletions(-) diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index c3e7ee248b..0ac0572d37 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -104,7 +104,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { long(args: ToAminoJSONMethod) { const { propName, origName } = getFieldNames(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const omitEmpty = AminoUtils.shouldOmitEmpty(args.field); return t.expressionStatement( t.assignmentExpression( @@ -128,7 +129,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { ), [] ), - dontOmitempty ? t.stringLiteral("0") : t.identifier('undefined') + omitEmpty ? t.identifier('undefined') : t.stringLiteral("0") ) ) ); @@ -154,10 +155,13 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); const name = args.context.getTypeName(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) : t.identifier('undefined'); + let defaultValue = getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf); + let emptyValue: t.Expression = dontOmitempty ? defaultValue : t.identifier('undefined'); if (args.field.type === 'ibc.core.client.v1.Height') { + emptyValue = t.objectExpression([]) defaultValue = t.objectExpression([]) } @@ -169,9 +173,13 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { t.identifier(origName) ), t.conditionalExpression( - t.memberExpression( - t.identifier('message'), - t.identifier(propName) + t.binaryExpression( + "===", + t.memberExpression( + t.identifier('message'), + t.identifier(propName) + ), + defaultValue ), t.callExpression( t.memberExpression( @@ -188,7 +196,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { ] : []), ] ), - defaultValue + emptyValue ) ) ); @@ -201,7 +209,9 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { args.context.getTypeName(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); + let defaultValue: t.Expression = dontOmitempty ? t.objectExpression([ t.objectProperty(t.identifier("type"), t.stringLiteral("")), @@ -281,7 +291,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { args.context.addUtil('base64FromBytes'); const { propName, origName } = getFieldNames(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); let defaultValue: t.Expression = dontOmitempty ? t.stringLiteral("") : t.identifier('undefined'); @@ -335,7 +346,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); args.context.addUtil('toTimestamp'); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) : t.identifier('undefined'); @@ -379,7 +391,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) : t.identifier('undefined'); @@ -417,7 +430,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); let defaultValue: t.Expression = dontOmitempty ? t.objectExpression([]) : t.identifier('undefined'); @@ -463,7 +477,8 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; + const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); let defaultValue: t.Expression = dontOmitempty ? t.stringLiteral("") : t.identifier('undefined'); @@ -658,7 +673,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { t.identifier('obj'), t.identifier(origName) ), - t.arrayExpression([]) + t.nullLiteral() ) ) ]) From f7206f07d87a6da646435cf3244dfd8e731fa8d8 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Tue, 2 Jan 2024 15:41:11 +0330 Subject: [PATCH 11/24] fix: object empty check --- packages/ast/src/encoding/proto/to-amino/utils.ts | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 0ac0572d37..048cb284f7 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -173,13 +173,9 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { t.identifier(origName) ), t.conditionalExpression( - t.binaryExpression( - "===", - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ), - defaultValue + t.memberExpression( + t.identifier('message'), + t.identifier(propName) ), t.callExpression( t.memberExpression( From efc0dc738e4df5fed65e8317acdaecef3906b746 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Tue, 2 Jan 2024 16:12:57 +0330 Subject: [PATCH 12/24] fix: optional field default value --- packages/ast/src/encoding/types.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/ast/src/encoding/types.ts b/packages/ast/src/encoding/types.ts index 21fa71225c..335e536ce8 100644 --- a/packages/ast/src/encoding/types.ts +++ b/packages/ast/src/encoding/types.ts @@ -421,7 +421,7 @@ export const getDefaultTSTypeFromProtoType = ( } if (isOptional) { - return t.identifier('undefined'); + return t.nullLiteral(); } if (field.parsedType?.type === 'Enum') { @@ -528,4 +528,4 @@ function getDefaultTSTypeFromProtoTypeDefault(context: ProtoParseContext,field: ), [t.objectExpression([])] ) -} \ No newline at end of file +} From 1590b18a6d81fc2e767869ed366f6d0deaabad02 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Tue, 2 Jan 2024 16:42:53 +0330 Subject: [PATCH 13/24] fix: optional field default value --- packages/ast/src/encoding/proto/to-amino/utils.ts | 10 +++++----- packages/ast/src/encoding/types.ts | 7 ++++--- packages/ast/types/encoding/types.d.ts | 2 +- packages/telescope/types/cmds.d.ts | 6 +++--- 4 files changed, 13 insertions(+), 12 deletions(-) diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 048cb284f7..787aeb049d 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -20,13 +20,13 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { valExpr = t.conditionalExpression(t.binaryExpression( "===", valExpr, - getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) + getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) ), t.identifier('undefined'), valExpr); } else { valExpr = t.logicalExpression( "??", valExpr, - getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) + getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) ); } @@ -158,7 +158,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue = getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf); + let defaultValue = getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true); let emptyValue: t.Expression = dontOmitempty ? defaultValue : t.identifier('undefined'); if (args.field.type === 'ibc.core.client.v1.Height') { emptyValue = t.objectExpression([]) @@ -345,7 +345,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) : t.identifier('undefined'); + let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) : t.identifier('undefined'); return t.expressionStatement( t.assignmentExpression( @@ -390,7 +390,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf) : t.identifier('undefined'); + let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) : t.identifier('undefined'); return t.expressionStatement( t.assignmentExpression( diff --git a/packages/ast/src/encoding/types.ts b/packages/ast/src/encoding/types.ts index 335e536ce8..c52d45e907 100644 --- a/packages/ast/src/encoding/types.ts +++ b/packages/ast/src/encoding/types.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { TraversalSymbol, ProtoField, TelescopeLogLevel } from '@cosmology/types'; +import { ProtoField, TelescopeLogLevel, TraversalSymbol } from '@cosmology/types'; import { getProtoFieldTypeName, TypeLong } from '../utils'; import { GenericParseContext, ProtoParseContext } from './context'; import { getFieldOptionalityForDefaults, GOOGLE_TYPES, SCALAR_TYPES } from './proto'; @@ -405,7 +405,8 @@ export const getTSTypeForProto = ( export const getDefaultTSTypeFromProtoType = ( context: ProtoParseContext, field: ProtoField, - isOneOf: boolean + isOneOf: boolean, + useNullForOptionals: boolean = false ) => { const isOptional = getFieldOptionalityForDefaults(context, field, isOneOf); @@ -421,7 +422,7 @@ export const getDefaultTSTypeFromProtoType = ( } if (isOptional) { - return t.nullLiteral(); + return useNullForOptionals ? t.nullLiteral() : t.identifier('undefined'); } if (field.parsedType?.type === 'Enum') { diff --git a/packages/ast/types/encoding/types.d.ts b/packages/ast/types/encoding/types.d.ts index 7cfadb641e..80377b5339 100644 --- a/packages/ast/types/encoding/types.d.ts +++ b/packages/ast/types/encoding/types.d.ts @@ -27,4 +27,4 @@ export declare const getTSAminoType: (context: GenericParseContext, type: string export declare const getTSTypeFromGoogleType: (context: GenericParseContext, type: string, options?: TelescopeBaseTypes) => t.TSStringKeyword | t.TSTypeReference; export declare const getTSTypeForAmino: (context: GenericParseContext, field: ProtoField) => t.TSAnyKeyword | t.TSBooleanKeyword | t.TSNumberKeyword | t.TSStringKeyword | t.TSTypeReference; export declare const getTSTypeForProto: (context: GenericParseContext, field: ProtoField) => t.TSBooleanKeyword | t.TSNumberKeyword | t.TSStringKeyword | t.TSTypeReference; -export declare const getDefaultTSTypeFromProtoType: (context: ProtoParseContext, field: ProtoField, isOneOf: boolean) => t.Expression; +export declare const getDefaultTSTypeFromProtoType: (context: ProtoParseContext, field: ProtoField, isOneOf: boolean, useNullForOptionals?: boolean) => t.Expression; diff --git a/packages/telescope/types/cmds.d.ts b/packages/telescope/types/cmds.d.ts index de787190d0..18db70bcd0 100644 --- a/packages/telescope/types/cmds.d.ts +++ b/packages/telescope/types/cmds.d.ts @@ -4,6 +4,6 @@ export namespace Commands { export { _commands_transpile as transpile }; } export const Contracts: typeof Contracts; -import _commands_generate from './commands/generate'; -import _commands_install from './commands/install'; -import _commands_transpile from './commands/transpile'; +import _commands_generate from "./commands/generate"; +import _commands_install from "./commands/install"; +import _commands_transpile from "./commands/transpile"; From 45a61606446381215666e5bb19a290a5d793c7c3 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Wed, 3 Jan 2024 11:05:44 +0330 Subject: [PATCH 14/24] fix: array fields --- packages/ast/src/encoding/proto/to-amino/utils.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 787aeb049d..bcf84d0fe6 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -669,7 +669,10 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { t.identifier('obj'), t.identifier(origName) ), - t.nullLiteral() + t.memberExpression( + t.identifier('message'), + t.identifier(propName) + ) ) ) ]) From ced5e4313ff29a7e268dd0aee7aa2f492ac176a3 Mon Sep 17 00:00:00 2001 From: Rasoul Date: Wed, 3 Jan 2024 11:14:15 +0330 Subject: [PATCH 15/24] feat: re-run tests and update snapshots --- .../akash/deployment/v1beta1/authz.ts | 2 +- .../cosmos/authz/v1beta1/authz.ts | 16 +- .../cosmos/bank/v1beta1/authz.ts | 2 +- .../cosmos/bank/v1beta1/tx.ts | 10 +- .../cosmos/base/v1beta1/coin.ts | 12 +- .../cosmos_proto/cosmos.ts | 14 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../output-impl-interfaces-gen/helpers.ts | 12 +- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../helpers.ts | 12 +- .../misc/eval_request.ts | 105 ++++---- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../amino-interface/helpers.ts | 12 +- .../amino-interface/misc/eval_request.ts | 105 ++++---- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../amino-msg-no-func/helpers.ts | 12 +- .../amino-msg-no-func/misc/eval_request.ts | 102 ++++---- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../amino-msg-with-func/helpers.ts | 12 +- .../amino-msg-with-func/misc/eval_request.ts | 102 ++++---- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../amino-no-msg-with-func/helpers.ts | 12 +- .../misc/eval_request.ts | 102 ++++---- .../no-amino-legacy-no-proto/helpers.ts | 12 +- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../no-amino-legacy/helpers.ts | 12 +- .../no-amino-legacy/misc/eval_request.ts | 102 ++++---- .../no-amino-no-proto/helpers.ts | 12 +- .../no-amino/google/api/expr/v1alpha1/eval.ts | 4 +- .../no-amino/google/protobuf/descriptor.ts | 234 +++++++++--------- .../output-proto-amino/no-amino/helpers.ts | 12 +- .../no-amino/misc/eval_request.ts | 102 ++++---- .../proto-only-legacy/helpers.ts | 12 +- .../output-proto-amino/proto-only/helpers.ts | 12 +- .../output/google/api/expr/v1alpha1/eval.ts | 6 +- .../misc/output/google/protobuf/descriptor.ts | 234 +++++++++--------- __fixtures__/misc/output/misc/eval_request.ts | 102 ++++---- .../akash/audit/v1beta1/audit.amino.ts | 2 +- .../akash/audit/v1beta2/audit.amino.ts | 2 +- .../output1/akash/cert/v1beta2/cert.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 68 ++--- .../akash/market/v1beta2/service.amino.ts | 24 +- .../akash/provider/v1beta1/provider.amino.ts | 8 +- .../akash/provider/v1beta2/provider.amino.ts | 8 +- .../output1/cosmos/authz/v1beta1/tx.amino.ts | 23 +- .../output1/cosmos/bank/v1beta1/tx.amino.ts | 10 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 2 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 2 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 2 +- .../output1/cosmos/gov/v1/tx.amino.ts | 20 +- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 18 +- .../output1/cosmos/group/v1/tx.amino.ts | 144 +++++------ .../cosmos/staking/v1beta1/tx.amino.ts | 14 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 20 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 14 +- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 20 +- .../output1/evmos/erc20/v1/tx.amino.ts | 2 +- .../output1/evmos/fees/v1/tx.amino.ts | 2 +- .../output1/evmos/vesting/v1/tx.amino.ts | 12 +- .../ibc/applications/transfer/v1/tx.amino.ts | 4 +- .../output1/ibc/core/channel/v1/tx.amino.ts | 44 ++-- .../output1/ibc/core/client/v1/tx.amino.ts | 12 +- .../ibc/core/connection/v1/tx.amino.ts | 22 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 34 +-- .../gamm/pool-models/stableswap/tx.amino.ts | 10 +- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 32 +-- .../output1/osmosis/incentives/tx.amino.ts | 14 +- .../output1/osmosis/lockup/tx.amino.ts | 16 +- .../output1/osmosis/superfluid/tx.amino.ts | 10 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 8 +- .../akash/audit/v1beta1/audit.amino.ts | 17 +- .../akash/audit/v1beta1/audit.ts | 30 +-- .../akash/audit/v1beta2/audit.amino.ts | 17 +- .../akash/audit/v1beta2/audit.ts | 30 +-- .../akash/audit/v1beta2/genesis.ts | 2 +- .../akash/audit/v1beta2/query.ts | 14 +- .../akash/base/v1beta1/attribute.ts | 12 +- .../akash/base/v1beta1/endpoint.ts | 4 +- .../akash/base/v1beta1/resource.ts | 12 +- .../akash/base/v1beta2/attribute.ts | 12 +- .../akash/base/v1beta2/endpoint.ts | 6 +- .../akash/base/v1beta2/resource.ts | 12 +- .../akash/base/v1beta2/resourceunits.ts | 4 +- .../akash/cert/v1beta2/cert.amino.ts | 8 +- .../akash/cert/v1beta2/cert.ts | 26 +- .../akash/cert/v1beta2/genesis.ts | 6 +- .../akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 38 +-- .../akash/deployment/v1beta1/genesis.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 32 +-- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 18 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 22 +- .../akash/deployment/v1beta2/genesis.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 8 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 6 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 6 +- .../akash/deployment/v1beta2/service.amino.ts | 111 +++++---- .../akash/escrow/v1beta1/genesis.ts | 4 +- .../akash/escrow/v1beta1/query.ts | 22 +- .../akash/escrow/v1beta1/types.ts | 34 +-- .../akash/escrow/v1beta2/genesis.ts | 4 +- .../akash/escrow/v1beta2/query.ts | 22 +- .../akash/escrow/v1beta2/types.ts | 38 +-- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 8 +- .../akash/market/v1beta2/bid.ts | 40 +-- .../akash/market/v1beta2/genesis.ts | 6 +- .../akash/market/v1beta2/lease.ts | 36 +-- .../akash/market/v1beta2/order.ts | 26 +- .../akash/market/v1beta2/params.ts | 4 +- .../akash/market/v1beta2/query.ts | 6 +- .../akash/market/v1beta2/service.amino.ts | 41 +-- .../akash/provider/v1beta1/provider.amino.ts | 23 +- .../akash/provider/v1beta1/provider.ts | 30 +-- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.amino.ts | 23 +- .../akash/provider/v1beta2/provider.ts | 30 +-- .../akash/provider/v1beta2/query.ts | 4 +- .../v-next/outputinstantrpc/confio/proofs.ts | 46 ++-- .../cosmos/app/v1alpha1/config.ts | 4 +- .../cosmos/app/v1alpha1/module.ts | 12 +- .../cosmos/auth/v1beta1/auth.ts | 6 +- .../cosmos/auth/v1beta1/genesis.ts | 2 +- .../cosmos/auth/v1beta1/query.ts | 12 +- .../cosmos/authz/v1beta1/authz.ts | 8 +- .../cosmos/authz/v1beta1/genesis.ts | 2 +- .../cosmos/authz/v1beta1/query.ts | 16 +- .../cosmos/authz/v1beta1/tx.amino.ts | 23 +- .../cosmos/authz/v1beta1/tx.ts | 16 +- .../cosmos/bank/v1beta1/authz.ts | 2 +- .../cosmos/bank/v1beta1/bank.ts | 40 +-- .../cosmos/bank/v1beta1/genesis.ts | 10 +- .../cosmos/bank/v1beta1/query.ts | 26 +- .../cosmos/bank/v1beta1/tx.amino.ts | 31 +-- .../cosmos/bank/v1beta1/tx.ts | 10 +- .../cosmos/base/abci/v1beta1/abci.ts | 46 ++-- .../cosmos/base/kv/v1beta1/kv.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.ts | 4 +- .../base/reflection/v1beta1/reflection.ts | 6 +- .../base/reflection/v2alpha1/reflection.ts | 46 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 16 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/store/v1beta1/listening.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 30 +-- .../cosmos/base/v1beta1/coin.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 6 +- .../cosmos/capability/v1beta1/genesis.ts | 2 +- .../cosmos/crisis/v1beta1/tx.amino.ts | 7 +- .../cosmos/crisis/v1beta1/tx.ts | 6 +- .../cosmos/crypto/hd/v1/hd.ts | 10 +- .../cosmos/crypto/keyring/v1/record.ts | 4 +- .../cosmos/crypto/multisig/keys.ts | 4 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 52 ++-- .../cosmos/distribution/v1beta1/genesis.ts | 36 +-- .../cosmos/distribution/v1beta1/query.ts | 30 +-- .../cosmos/distribution/v1beta1/tx.amino.ts | 19 +- .../cosmos/distribution/v1beta1/tx.ts | 18 +- .../cosmos/evidence/v1beta1/evidence.ts | 2 +- .../cosmos/evidence/v1beta1/genesis.ts | 2 +- .../cosmos/evidence/v1beta1/query.ts | 2 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 7 +- .../cosmos/evidence/v1beta1/tx.ts | 2 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 12 +- .../cosmos/feegrant/v1beta1/genesis.ts | 2 +- .../cosmos/feegrant/v1beta1/query.ts | 12 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 13 +- .../cosmos/feegrant/v1beta1/tx.ts | 8 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../outputinstantrpc/cosmos/gov/v1/genesis.ts | 6 +- .../outputinstantrpc/cosmos/gov/v1/gov.ts | 42 ++-- .../outputinstantrpc/cosmos/gov/v1/query.ts | 20 +- .../cosmos/gov/v1/tx.amino.ts | 59 ++--- .../outputinstantrpc/cosmos/gov/v1/tx.ts | 34 +-- .../cosmos/gov/v1beta1/genesis.ts | 6 +- .../cosmos/gov/v1beta1/gov.ts | 42 ++-- .../cosmos/gov/v1beta1/query.ts | 20 +- .../cosmos/gov/v1beta1/tx.amino.ts | 47 ++-- .../outputinstantrpc/cosmos/gov/v1beta1/tx.ts | 24 +- .../cosmos/group/v1/events.ts | 10 +- .../cosmos/group/v1/genesis.ts | 10 +- .../outputinstantrpc/cosmos/group/v1/query.ts | 30 +-- .../cosmos/group/v1/tx.amino.ts | 143 +++++------ .../outputinstantrpc/cosmos/group/v1/tx.ts | 82 +++--- .../outputinstantrpc/cosmos/group/v1/types.ts | 60 ++--- .../cosmos/mint/v1beta1/mint.ts | 16 +- .../cosmos/nft/v1beta1/event.ts | 20 +- .../cosmos/nft/v1beta1/genesis.ts | 8 +- .../cosmos/nft/v1beta1/nft.ts | 20 +- .../cosmos/nft/v1beta1/query.ts | 26 +- .../cosmos/nft/v1beta1/tx.amino.ts | 9 +- .../outputinstantrpc/cosmos/nft/v1beta1/tx.ts | 8 +- .../outputinstantrpc/cosmos/orm/v1/orm.ts | 16 +- .../cosmos/orm/v1alpha1/schema.ts | 10 +- .../cosmos/params/v1beta1/params.ts | 12 +- .../cosmos/params/v1beta1/query.ts | 10 +- .../cosmos/slashing/v1beta1/genesis.ts | 12 +- .../cosmos/slashing/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/slashing.ts | 4 +- .../cosmos/slashing/v1beta1/tx.ts | 2 +- .../cosmos/staking/v1beta1/authz.ts | 6 +- .../cosmos/staking/v1beta1/genesis.ts | 14 +- .../cosmos/staking/v1beta1/query.ts | 46 ++-- .../cosmos/staking/v1beta1/staking.ts | 96 +++---- .../cosmos/staking/v1beta1/tx.amino.ts | 67 ++--- .../cosmos/staking/v1beta1/tx.ts | 28 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 8 +- .../cosmos/tx/v1beta1/service.ts | 18 +- .../outputinstantrpc/cosmos/tx/v1beta1/tx.ts | 40 +-- .../cosmos/upgrade/v1beta1/query.ts | 8 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 19 +- .../cosmos/upgrade/v1beta1/tx.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 14 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 47 ++-- .../cosmos/vesting/v1beta1/tx.ts | 20 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../outputinstantrpc/cosmos_proto/cosmos.ts | 14 +- .../cosmwasm/wasm/v1/genesis.ts | 14 +- .../outputinstantrpc/cosmwasm/wasm/v1/ibc.ts | 4 +- .../cosmwasm/wasm/v1/proposal.ts | 66 ++--- .../cosmwasm/wasm/v1/query.ts | 28 +-- .../cosmwasm/wasm/v1/tx.amino.ts | 61 ++--- .../outputinstantrpc/cosmwasm/wasm/v1/tx.ts | 32 +-- .../cosmwasm/wasm/v1/types.ts | 28 +-- .../evmos/claims/v1/claims.ts | 18 +- .../evmos/claims/v1/genesis.ts | 10 +- .../outputinstantrpc/evmos/claims/v1/query.ts | 10 +- .../evmos/epochs/v1/genesis.ts | 6 +- .../outputinstantrpc/evmos/epochs/v1/query.ts | 4 +- .../outputinstantrpc/evmos/erc20/v1/erc20.ts | 26 +- .../evmos/erc20/v1/genesis.ts | 6 +- .../outputinstantrpc/evmos/erc20/v1/query.ts | 4 +- .../evmos/erc20/v1/tx.amino.ts | 15 +- .../outputinstantrpc/evmos/erc20/v1/tx.ts | 12 +- .../outputinstantrpc/evmos/fees/v1/fees.ts | 6 +- .../outputinstantrpc/evmos/fees/v1/genesis.ts | 12 +- .../outputinstantrpc/evmos/fees/v1/query.ts | 8 +- .../evmos/fees/v1/tx.amino.ts | 19 +- .../outputinstantrpc/evmos/fees/v1/tx.ts | 18 +- .../evmos/incentives/v1/genesis.ts | 14 +- .../evmos/incentives/v1/incentives.ts | 26 +- .../evmos/incentives/v1/query.ts | 16 +- .../evmos/inflation/v1/genesis.ts | 6 +- .../evmos/inflation/v1/inflation.ts | 18 +- .../evmos/inflation/v1/query.ts | 4 +- .../evmos/recovery/v1/genesis.ts | 2 +- .../evmos/vesting/v1/query.ts | 8 +- .../evmos/vesting/v1/tx.amino.ts | 37 +-- .../outputinstantrpc/evmos/vesting/v1/tx.ts | 16 +- .../evmos/vesting/v1/vesting.ts | 6 +- .../outputinstantrpc/google/api/auth.ts | 34 +-- .../outputinstantrpc/google/api/backend.ts | 22 +- .../outputinstantrpc/google/api/billing.ts | 6 +- .../google/api/config_change.ts | 14 +- .../outputinstantrpc/google/api/consumer.ts | 10 +- .../outputinstantrpc/google/api/context.ts | 12 +- .../outputinstantrpc/google/api/control.ts | 2 +- .../google/api/distribution.ts | 30 +-- .../google/api/documentation.ts | 24 +- .../outputinstantrpc/google/api/endpoint.ts | 8 +- .../v1alpha1/conformance_service.ts | 28 +-- .../google/api/expr/v1alpha1/checked.ts | 48 ++-- .../google/api/expr/v1alpha1/eval.ts | 8 +- .../google/api/expr/v1alpha1/explain.ts | 6 +- .../google/api/expr/v1alpha1/syntax.ts | 48 ++-- .../google/api/expr/v1alpha1/value.ts | 20 +- .../google/api/expr/v1beta1/decl.ts | 16 +- .../google/api/expr/v1beta1/eval.ts | 12 +- .../google/api/expr/v1beta1/expr.ts | 38 +-- .../google/api/expr/v1beta1/source.ts | 16 +- .../google/api/expr/v1beta1/value.ts | 20 +- .../outputinstantrpc/google/api/http.ts | 26 +- .../outputinstantrpc/google/api/httpbody.ts | 4 +- .../outputinstantrpc/google/api/label.ts | 8 +- .../v-next/outputinstantrpc/google/api/log.ts | 8 +- .../outputinstantrpc/google/api/logging.ts | 8 +- .../outputinstantrpc/google/api/metric.ts | 36 +-- .../google/api/monitored_resource.ts | 24 +- .../outputinstantrpc/google/api/monitoring.ts | 8 +- .../outputinstantrpc/google/api/quota.ts | 22 +- .../outputinstantrpc/google/api/resource.ts | 24 +- .../outputinstantrpc/google/api/routing.ts | 6 +- .../outputinstantrpc/google/api/service.ts | 22 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 26 +- .../api/servicecontrol/v1/http_request.ts | 22 +- .../google/api/servicecontrol/v1/log_entry.ts | 28 +-- .../api/servicecontrol/v1/metric_value.ts | 14 +- .../google/api/servicecontrol/v1/operation.ts | 20 +- .../api/servicecontrol/v1/quota_controller.ts | 36 +-- .../servicecontrol/v1/service_controller.ts | 32 +-- .../servicecontrol/v2/service_controller.ts | 28 +-- .../api/servicemanagement/v1/resources.ts | 52 ++-- .../servicemanagement/v1/servicemanager.ts | 68 ++--- .../google/api/serviceusage/v1/resources.ts | 20 +- .../api/serviceusage/v1/serviceusage.ts | 42 ++-- .../api/serviceusage/v1beta1/resources.ts | 78 +++--- .../api/serviceusage/v1beta1/serviceusage.ts | 164 ++++++------ .../google/api/source_info.ts | 2 +- .../google/api/system_parameter.ts | 12 +- .../outputinstantrpc/google/api/usage.ts | 12 +- .../outputinstantrpc/google/api/visibility.ts | 6 +- .../google/logging/type/http_request.ts | 22 +- .../google/logging/v2/log_entry.ts | 38 +-- .../google/logging/v2/logging.ts | 64 ++--- .../google/logging/v2/logging_config.ts | 174 ++++++------- .../google/logging/v2/logging_metrics.ts | 36 +-- .../google/longrunning/operations.ts | 28 +-- .../outputinstantrpc/google/protobuf/api.ts | 34 +-- .../google/protobuf/compiler/plugin.ts | 24 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../google/protobuf/field_mask.ts | 2 +- .../google/protobuf/source_context.ts | 2 +- .../google/protobuf/struct.ts | 14 +- .../outputinstantrpc/google/protobuf/type.ts | 54 ++-- .../google/protobuf/wrappers.ts | 12 +- .../google/rpc/context/attribute_context.ts | 74 +++--- .../google/rpc/error_details.ts | 54 ++-- .../outputinstantrpc/google/rpc/status.ts | 6 +- .../v-next/outputinstantrpc/helpers.ts | 12 +- .../ibc/applications/transfer/v1/genesis.ts | 4 +- .../ibc/applications/transfer/v1/query.ts | 4 +- .../ibc/applications/transfer/v1/transfer.ts | 8 +- .../ibc/applications/transfer/v1/tx.amino.ts | 14 +- .../ibc/applications/transfer/v1/tx.ts | 8 +- .../ibc/applications/transfer/v2/packet.ts | 8 +- .../ibc/core/channel/v1/channel.ts | 46 ++-- .../ibc/core/channel/v1/genesis.ts | 18 +- .../ibc/core/channel/v1/query.ts | 68 ++--- .../ibc/core/channel/v1/tx.amino.ts | 158 ++++++------ .../ibc/core/channel/v1/tx.ts | 48 ++-- .../ibc/core/client/v1/client.ts | 20 +- .../ibc/core/client/v1/genesis.ts | 12 +- .../ibc/core/client/v1/query.ts | 16 +- .../ibc/core/client/v1/tx.amino.ts | 39 +-- .../outputinstantrpc/ibc/core/client/v1/tx.ts | 14 +- .../ibc/core/commitment/v1/commitment.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 32 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../ibc/core/connection/v1/query.ts | 14 +- .../ibc/core/connection/v1/tx.amino.ts | 64 ++--- .../ibc/core/connection/v1/tx.ts | 22 +- .../ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 2 +- .../solomachine/v1/solomachine.ts | 20 +- .../solomachine/v2/solomachine.ts | 22 +- .../lightclients/tendermint/v1/tendermint.ts | 12 +- .../osmosis/claim/v1beta1/claim.ts | 6 +- .../osmosis/claim/v1beta1/genesis.ts | 2 +- .../osmosis/claim/v1beta1/params.ts | 2 +- .../osmosis/claim/v1beta1/query.ts | 16 +- .../osmosis/epochs/genesis.ts | 6 +- .../outputinstantrpc/osmosis/epochs/query.ts | 4 +- .../gamm/pool-models/balancer/balancerPool.ts | 20 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 33 +-- .../gamm/pool-models/balancer/tx/tx.ts | 6 +- .../pool-models/stableswap/stableswap_pool.ts | 16 +- .../gamm/pool-models/stableswap/tx.amino.ts | 29 +-- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../osmosis/gamm/v1beta1/genesis.ts | 4 +- .../osmosis/gamm/v1beta1/query.ts | 52 ++-- .../osmosis/gamm/v1beta1/tx.amino.ts | 101 ++++---- .../osmosis/gamm/v1beta1/tx.ts | 70 +++--- .../outputinstantrpc/osmosis/gamm/v2/query.ts | 6 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 2 +- .../osmosis/incentives/gauge.ts | 8 +- .../osmosis/incentives/genesis.ts | 4 +- .../osmosis/incentives/params.ts | 2 +- .../osmosis/incentives/query.ts | 24 +- .../osmosis/incentives/tx.amino.ts | 35 +-- .../outputinstantrpc/osmosis/incentives/tx.ts | 10 +- .../osmosis/lockup/genesis.ts | 4 +- .../outputinstantrpc/osmosis/lockup/lock.ts | 12 +- .../outputinstantrpc/osmosis/lockup/params.ts | 2 +- .../outputinstantrpc/osmosis/lockup/query.ts | 58 ++--- .../osmosis/lockup/tx.amino.ts | 45 ++-- .../outputinstantrpc/osmosis/lockup/tx.ts | 24 +- .../osmosis/mint/v1beta1/mint.ts | 26 +- .../pool-incentives/v1beta1/genesis.ts | 2 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 12 +- .../pool-incentives/v1beta1/incentives.ts | 12 +- .../osmosis/pool-incentives/v1beta1/query.ts | 10 +- .../osmosis/sumtree/v1beta1/tree.ts | 4 +- .../osmosis/superfluid/genesis.ts | 8 +- .../osmosis/superfluid/params.ts | 4 +- .../osmosis/superfluid/query.ts | 76 +++--- .../osmosis/superfluid/superfluid.ts | 24 +- .../osmosis/superfluid/tx.amino.ts | 37 +-- .../outputinstantrpc/osmosis/superfluid/tx.ts | 18 +- .../osmosis/superfluid/v1beta1/gov.ts | 20 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 2 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/params.ts | 2 +- .../osmosis/tokenfactory/v1beta1/query.ts | 6 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 43 ++-- .../osmosis/tokenfactory/v1beta1/tx.ts | 18 +- .../osmosis/twap/v1beta1/genesis.ts | 4 +- .../osmosis/twap/v1beta1/query.ts | 14 +- .../osmosis/twap/v1beta1/twap_record.ts | 16 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../osmosis/txfees/v1beta1/genesis.ts | 4 +- .../osmosis/txfees/v1beta1/gov.ts | 4 +- .../osmosis/txfees/v1beta1/query.ts | 12 +- .../outputinstantrpc/tendermint/abci/types.ts | 116 ++++----- .../tendermint/crypto/proof.ts | 12 +- .../tendermint/libs/bits/types.ts | 2 +- .../outputinstantrpc/tendermint/p2p/types.ts | 22 +- .../tendermint/types/evidence.ts | 4 +- .../tendermint/types/params.ts | 2 +- .../tendermint/types/types.ts | 32 +-- .../tendermint/types/validator.ts | 2 +- .../tendermint/version/types.ts | 2 +- .../akash/audit/v1beta1/audit.amino.ts | 2 +- .../outputosmojs/akash/audit/v1beta1/audit.ts | 30 +-- .../akash/audit/v1beta2/audit.amino.ts | 2 +- .../outputosmojs/akash/audit/v1beta2/audit.ts | 30 +-- .../akash/audit/v1beta2/genesis.ts | 2 +- .../outputosmojs/akash/audit/v1beta2/query.ts | 16 +- .../akash/base/v1beta1/attribute.ts | 14 +- .../akash/base/v1beta1/endpoint.ts | 4 +- .../akash/base/v1beta1/resource.ts | 12 +- .../akash/base/v1beta2/attribute.ts | 14 +- .../akash/base/v1beta2/endpoint.ts | 6 +- .../akash/base/v1beta2/resource.ts | 12 +- .../akash/base/v1beta2/resourceunits.ts | 4 +- .../akash/cert/v1beta2/cert.amino.ts | 2 +- .../outputosmojs/akash/cert/v1beta2/cert.ts | 26 +- .../akash/cert/v1beta2/genesis.ts | 6 +- .../outputosmojs/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 38 +-- .../akash/deployment/v1beta1/genesis.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 36 +-- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 18 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 22 +- .../akash/deployment/v1beta2/genesis.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 12 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 6 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 6 +- .../akash/deployment/v1beta2/service.amino.ts | 68 ++--- .../akash/escrow/v1beta1/genesis.ts | 4 +- .../akash/escrow/v1beta1/query.ts | 24 +- .../akash/escrow/v1beta1/types.ts | 34 +-- .../akash/escrow/v1beta2/genesis.ts | 4 +- .../akash/escrow/v1beta2/query.ts | 24 +- .../akash/escrow/v1beta2/types.ts | 38 +-- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputosmojs/akash/market/v1beta2/bid.ts | 44 ++-- .../akash/market/v1beta2/genesis.ts | 6 +- .../akash/market/v1beta2/lease.ts | 42 ++-- .../akash/market/v1beta2/order.ts | 30 +-- .../akash/market/v1beta2/params.ts | 4 +- .../akash/market/v1beta2/query.ts | 6 +- .../akash/market/v1beta2/service.amino.ts | 24 +- .../akash/provider/v1beta1/provider.amino.ts | 8 +- .../akash/provider/v1beta1/provider.ts | 30 +-- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.amino.ts | 8 +- .../akash/provider/v1beta2/provider.ts | 30 +-- .../akash/provider/v1beta2/query.ts | 6 +- .../outputosmojs/capability/v1/capability.ts | 10 +- .../outputosmojs/capability/v1/genesis.ts | 4 +- .../v-next/outputosmojs/confio/proofs.ts | 46 ++-- .../cosmos/app/v1alpha1/config.ts | 6 +- .../cosmos/app/v1alpha1/module.ts | 14 +- .../outputosmojs/cosmos/auth/v1beta1/auth.ts | 22 +- .../cosmos/auth/v1beta1/genesis.ts | 2 +- .../outputosmojs/cosmos/auth/v1beta1/query.ts | 14 +- .../cosmos/authz/v1beta1/authz.ts | 8 +- .../cosmos/authz/v1beta1/genesis.ts | 2 +- .../cosmos/authz/v1beta1/query.ts | 18 +- .../cosmos/authz/v1beta1/tx.amino.ts | 23 +- .../outputosmojs/cosmos/authz/v1beta1/tx.ts | 18 +- .../outputosmojs/cosmos/bank/v1beta1/authz.ts | 2 +- .../outputosmojs/cosmos/bank/v1beta1/bank.ts | 42 ++-- .../cosmos/bank/v1beta1/genesis.ts | 12 +- .../outputosmojs/cosmos/bank/v1beta1/query.ts | 28 +-- .../cosmos/bank/v1beta1/tx.amino.ts | 10 +- .../outputosmojs/cosmos/bank/v1beta1/tx.ts | 12 +- .../cosmos/base/abci/v1beta1/abci.ts | 46 ++-- .../outputosmojs/cosmos/base/kv/v1beta1/kv.ts | 2 +- .../cosmos/base/node/v1beta1/query.ts | 4 +- .../cosmos/base/query/v1beta1/pagination.ts | 4 +- .../base/reflection/v1beta1/reflection.ts | 8 +- .../base/reflection/v2alpha1/reflection.ts | 48 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 16 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/store/v1beta1/listening.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 44 ++-- .../outputosmojs/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 10 +- .../cosmos/capability/v1beta1/genesis.ts | 8 +- .../outputosmojs/cosmos/crisis/v1beta1/tx.ts | 8 +- .../outputosmojs/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../cosmos/crypto/multisig/keys.ts | 6 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 58 ++--- .../cosmos/distribution/v1beta1/genesis.ts | 44 ++-- .../cosmos/distribution/v1beta1/query.ts | 36 +-- .../cosmos/distribution/v1beta1/tx.amino.ts | 2 +- .../cosmos/distribution/v1beta1/tx.ts | 20 +- .../cosmos/evidence/v1beta1/evidence.ts | 2 +- .../cosmos/evidence/v1beta1/genesis.ts | 2 +- .../cosmos/evidence/v1beta1/query.ts | 2 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 2 +- .../cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 12 +- .../cosmos/feegrant/v1beta1/genesis.ts | 2 +- .../cosmos/feegrant/v1beta1/query.ts | 14 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 2 +- .../cosmos/feegrant/v1beta1/tx.ts | 10 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../outputosmojs/cosmos/gov/v1/genesis.ts | 10 +- .../v-next/outputosmojs/cosmos/gov/v1/gov.ts | 42 ++-- .../outputosmojs/cosmos/gov/v1/query.ts | 20 +- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 20 +- .../v-next/outputosmojs/cosmos/gov/v1/tx.ts | 34 +-- .../cosmos/gov/v1beta1/genesis.ts | 10 +- .../outputosmojs/cosmos/gov/v1beta1/gov.ts | 42 ++-- .../outputosmojs/cosmos/gov/v1beta1/query.ts | 20 +- .../cosmos/gov/v1beta1/tx.amino.ts | 18 +- .../outputosmojs/cosmos/gov/v1beta1/tx.ts | 24 +- .../outputosmojs/cosmos/group/v1/events.ts | 10 +- .../outputosmojs/cosmos/group/v1/genesis.ts | 18 +- .../outputosmojs/cosmos/group/v1/query.ts | 46 ++-- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 143 +++++------ .../v-next/outputosmojs/cosmos/group/v1/tx.ts | 82 +++--- .../outputosmojs/cosmos/group/v1/types.ts | 60 ++--- .../outputosmojs/cosmos/ics23/v1/proofs.ts | 46 ++-- .../outputosmojs/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputosmojs/cosmos/nft/v1beta1/event.ts | 22 +- .../cosmos/nft/v1beta1/genesis.ts | 10 +- .../outputosmojs/cosmos/nft/v1beta1/nft.ts | 22 +- .../outputosmojs/cosmos/nft/v1beta1/query.ts | 32 +-- .../outputosmojs/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputosmojs/cosmos/orm/v1/orm.ts | 18 +- .../cosmos/orm/v1alpha1/schema.ts | 10 +- .../cosmos/params/v1beta1/params.ts | 14 +- .../cosmos/params/v1beta1/query.ts | 12 +- .../cosmos/slashing/v1beta1/genesis.ts | 16 +- .../cosmos/slashing/v1beta1/query.ts | 6 +- .../cosmos/slashing/v1beta1/slashing.ts | 4 +- .../cosmos/slashing/v1beta1/tx.ts | 2 +- .../cosmos/staking/v1beta1/authz.ts | 6 +- .../cosmos/staking/v1beta1/genesis.ts | 18 +- .../cosmos/staking/v1beta1/query.ts | 50 ++-- .../cosmos/staking/v1beta1/staking.ts | 96 +++---- .../cosmos/staking/v1beta1/tx.amino.ts | 14 +- .../outputosmojs/cosmos/staking/v1beta1/tx.ts | 28 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 8 +- .../outputosmojs/cosmos/tx/v1beta1/service.ts | 18 +- .../outputosmojs/cosmos/tx/v1beta1/tx.ts | 40 +-- .../cosmos/upgrade/v1beta1/query.ts | 14 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 19 +- .../outputosmojs/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 14 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 14 +- .../outputosmojs/cosmos/vesting/v1beta1/tx.ts | 26 +- .../cosmos/vesting/v1beta1/vesting.ts | 20 +- .../outputosmojs/cosmos_proto/cosmos.ts | 16 +- .../outputosmojs/cosmwasm/wasm/v1/authz.ts | 14 +- .../outputosmojs/cosmwasm/wasm/v1/genesis.ts | 14 +- .../outputosmojs/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/proposal.ts | 72 +++--- .../outputosmojs/cosmwasm/wasm/v1/query.ts | 28 +-- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 20 +- .../outputosmojs/cosmwasm/wasm/v1/tx.ts | 32 +-- .../outputosmojs/cosmwasm/wasm/v1/types.ts | 28 +-- .../outputosmojs/evmos/claims/v1/claims.ts | 18 +- .../outputosmojs/evmos/claims/v1/genesis.ts | 10 +- .../outputosmojs/evmos/claims/v1/query.ts | 12 +- .../outputosmojs/evmos/epochs/v1/genesis.ts | 6 +- .../outputosmojs/evmos/epochs/v1/query.ts | 8 +- .../outputosmojs/evmos/erc20/v1/erc20.ts | 26 +- .../outputosmojs/evmos/erc20/v1/genesis.ts | 8 +- .../outputosmojs/evmos/erc20/v1/query.ts | 6 +- .../outputosmojs/evmos/erc20/v1/tx.amino.ts | 2 +- .../v-next/outputosmojs/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputosmojs/evmos/fees/v1/fees.ts | 8 +- .../outputosmojs/evmos/fees/v1/genesis.ts | 14 +- .../outputosmojs/evmos/fees/v1/query.ts | 10 +- .../outputosmojs/evmos/fees/v1/tx.amino.ts | 2 +- .../v-next/outputosmojs/evmos/fees/v1/tx.ts | 20 +- .../evmos/incentives/v1/genesis.ts | 14 +- .../evmos/incentives/v1/incentives.ts | 26 +- .../outputosmojs/evmos/incentives/v1/query.ts | 20 +- .../evmos/inflation/v1/genesis.ts | 14 +- .../evmos/inflation/v1/inflation.ts | 16 +- .../outputosmojs/evmos/inflation/v1/query.ts | 8 +- .../outputosmojs/evmos/recovery/v1/genesis.ts | 4 +- .../outputosmojs/evmos/vesting/v1/query.ts | 10 +- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 12 +- .../outputosmojs/evmos/vesting/v1/tx.ts | 16 +- .../outputosmojs/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputosmojs/google/api/auth.ts | 36 +-- .../v-next/outputosmojs/google/api/backend.ts | 22 +- .../v-next/outputosmojs/google/api/billing.ts | 8 +- .../outputosmojs/google/api/config_change.ts | 14 +- .../outputosmojs/google/api/consumer.ts | 10 +- .../v-next/outputosmojs/google/api/context.ts | 14 +- .../v-next/outputosmojs/google/api/control.ts | 4 +- .../outputosmojs/google/api/distribution.ts | 30 +-- .../outputosmojs/google/api/documentation.ts | 26 +- .../outputosmojs/google/api/endpoint.ts | 10 +- .../v1alpha1/conformance_service.ts | 28 +-- .../google/api/expr/v1alpha1/checked.ts | 48 ++-- .../google/api/expr/v1alpha1/eval.ts | 14 +- .../google/api/expr/v1alpha1/explain.ts | 10 +- .../google/api/expr/v1alpha1/syntax.ts | 48 ++-- .../google/api/expr/v1alpha1/value.ts | 20 +- .../google/api/expr/v1beta1/decl.ts | 18 +- .../google/api/expr/v1beta1/eval.ts | 14 +- .../google/api/expr/v1beta1/expr.ts | 38 +-- .../google/api/expr/v1beta1/source.ts | 18 +- .../google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputosmojs/google/api/http.ts | 28 +-- .../outputosmojs/google/api/httpbody.ts | 4 +- .../v-next/outputosmojs/google/api/label.ts | 8 +- .../v-next/outputosmojs/google/api/log.ts | 10 +- .../v-next/outputosmojs/google/api/logging.ts | 10 +- .../v-next/outputosmojs/google/api/metric.ts | 36 +-- .../google/api/monitored_resource.ts | 24 +- .../outputosmojs/google/api/monitoring.ts | 10 +- .../v-next/outputosmojs/google/api/quota.ts | 34 +-- .../outputosmojs/google/api/resource.ts | 24 +- .../v-next/outputosmojs/google/api/routing.ts | 8 +- .../v-next/outputosmojs/google/api/service.ts | 24 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 30 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 28 +-- .../api/servicecontrol/v1/metric_value.ts | 14 +- .../google/api/servicecontrol/v1/operation.ts | 20 +- .../api/servicecontrol/v1/quota_controller.ts | 36 +-- .../servicecontrol/v1/service_controller.ts | 32 +-- .../servicecontrol/v2/service_controller.ts | 30 +-- .../api/servicemanagement/v1/resources.ts | 52 ++-- .../servicemanagement/v1/servicemanager.ts | 68 ++--- .../google/api/serviceusage/v1/resources.ts | 20 +- .../api/serviceusage/v1/serviceusage.ts | 42 ++-- .../api/serviceusage/v1beta1/resources.ts | 78 +++--- .../api/serviceusage/v1beta1/serviceusage.ts | 164 ++++++------ .../outputosmojs/google/api/source_info.ts | 2 +- .../google/api/system_parameter.ts | 14 +- .../v-next/outputosmojs/google/api/usage.ts | 14 +- .../outputosmojs/google/api/visibility.ts | 8 +- .../google/logging/type/http_request.ts | 30 +-- .../google/logging/v2/log_entry.ts | 38 +-- .../outputosmojs/google/logging/v2/logging.ts | 64 ++--- .../google/logging/v2/logging_config.ts | 174 ++++++------- .../google/logging/v2/logging_metrics.ts | 36 +-- .../google/longrunning/operations.ts | 30 +-- .../outputosmojs/google/protobuf/any.ts | 2 +- .../outputosmojs/google/protobuf/api.ts | 34 +-- .../google/protobuf/compiler/plugin.ts | 26 +- .../google/protobuf/descriptor.ts | 234 +++++++++--------- .../outputosmojs/google/protobuf/duration.ts | 2 +- .../google/protobuf/field_mask.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../outputosmojs/google/protobuf/struct.ts | 14 +- .../outputosmojs/google/protobuf/timestamp.ts | 2 +- .../outputosmojs/google/protobuf/type.ts | 54 ++-- .../outputosmojs/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 74 +++--- .../outputosmojs/google/rpc/error_details.ts | 56 ++--- .../v-next/outputosmojs/google/rpc/status.ts | 8 +- .../ibc/applications/fee/v1/ack.ts | 4 +- .../ibc/applications/fee/v1/fee.ts | 16 +- .../ibc/applications/fee/v1/genesis.ts | 30 +-- .../ibc/applications/fee/v1/metadata.ts | 6 +- .../ibc/applications/fee/v1/query.ts | 44 ++-- .../ibc/applications/fee/v1/tx.amino.ts | 18 +- .../ibc/applications/fee/v1/tx.ts | 26 +- .../controller/v1/controller.ts | 4 +- .../controller/v1/query.ts | 8 +- .../controller/v1/tx.amino.ts | 6 +- .../interchain_accounts/controller/v1/tx.ts | 20 +- .../interchain_accounts/genesis/v1/genesis.ts | 28 +-- .../interchain_accounts/host/v1/host.ts | 6 +- .../interchain_accounts/v1/account.ts | 4 +- .../interchain_accounts/v1/metadata.ts | 14 +- .../interchain_accounts/v1/packet.ts | 8 +- .../ibc/applications/transfer/v1/authz.ts | 12 +- .../ibc/applications/transfer/v1/genesis.ts | 6 +- .../ibc/applications/transfer/v1/query.ts | 6 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.amino.ts | 4 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../ibc/core/channel/v1/channel.ts | 46 ++-- .../ibc/core/channel/v1/genesis.ts | 24 +- .../outputosmojs/ibc/core/channel/v1/query.ts | 68 ++--- .../ibc/core/channel/v1/tx.amino.ts | 44 ++-- .../outputosmojs/ibc/core/channel/v1/tx.ts | 48 ++-- .../outputosmojs/ibc/core/client/v1/client.ts | 26 +- .../ibc/core/client/v1/genesis.ts | 16 +- .../outputosmojs/ibc/core/client/v1/query.ts | 22 +- .../ibc/core/client/v1/tx.amino.ts | 12 +- .../outputosmojs/ibc/core/client/v1/tx.ts | 14 +- .../ibc/core/commitment/v1/commitment.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 32 +-- .../ibc/core/connection/v1/genesis.ts | 8 +- .../ibc/core/connection/v1/query.ts | 14 +- .../ibc/core/connection/v1/tx.amino.ts | 22 +- .../outputosmojs/ibc/core/connection/v1/tx.ts | 22 +- .../outputosmojs/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 20 +- .../solomachine/v2/solomachine.ts | 22 +- .../solomachine/v3/solomachine.ts | 10 +- .../lightclients/tendermint/v1/tendermint.ts | 12 +- .../osmosis/accum/v1beta1/accum.ts | 10 +- .../osmosis/claim/v1beta1/claim.ts | 8 +- .../osmosis/claim/v1beta1/genesis.ts | 2 +- .../osmosis/claim/v1beta1/params.ts | 2 +- .../osmosis/claim/v1beta1/query.ts | 16 +- .../osmosis/concentrated-liquidity/genesis.ts | 20 +- .../incentive_record.ts | 10 +- .../osmosis/concentrated-liquidity/params.ts | 4 +- .../pool-model/query.ts | 44 ++-- .../concentrated-liquidity/pool-model/tx.ts | 16 +- .../osmosis/concentrated-liquidity/pool.ts | 20 +- .../concentrated-liquidity/position.ts | 6 +- .../concentrated-liquidity/tickInfo.ts | 10 +- .../concentrated-liquidity/tx.amino.ts | 18 +- .../osmosis/concentrated-liquidity/tx.ts | 52 ++-- .../cosmwasmpool/v1beta1/model/pool.ts | 10 +- .../osmosis/cosmwasmpool/v1beta1/model/tx.ts | 2 +- .../downtime-detector/v1beta1/genesis.ts | 6 +- .../downtime-detector/v1beta1/query.ts | 6 +- .../outputosmojs/osmosis/epochs/genesis.ts | 6 +- .../outputosmojs/osmosis/epochs/query.ts | 8 +- .../gamm/pool-models/balancer/balancerPool.ts | 20 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 33 +-- .../gamm/pool-models/balancer/tx/tx.ts | 10 +- .../pool-models/stableswap/stableswap_pool.ts | 18 +- .../gamm/pool-models/stableswap/tx.amino.ts | 10 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 20 +- .../osmosis/gamm/v1beta1/genesis.ts | 8 +- .../outputosmojs/osmosis/gamm/v1beta1/gov.ts | 10 +- .../osmosis/gamm/v1beta1/query.ts | 78 +++--- .../osmosis/gamm/v1beta1/tx.amino.ts | 32 +-- .../outputosmojs/osmosis/gamm/v1beta1/tx.ts | 88 +++---- .../outputosmojs/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputosmojs/osmosis/incentives/gauge.ts | 8 +- .../osmosis/incentives/genesis.ts | 8 +- .../outputosmojs/osmosis/incentives/params.ts | 4 +- .../outputosmojs/osmosis/incentives/query.ts | 30 +-- .../osmosis/incentives/tx.amino.ts | 14 +- .../outputosmojs/osmosis/incentives/tx.ts | 10 +- .../outputosmojs/osmosis/lockup/genesis.ts | 8 +- .../outputosmojs/osmosis/lockup/lock.ts | 12 +- .../outputosmojs/osmosis/lockup/params.ts | 2 +- .../outputosmojs/osmosis/lockup/query.ts | 58 ++--- .../outputosmojs/osmosis/lockup/tx.amino.ts | 16 +- .../v-next/outputosmojs/osmosis/lockup/tx.ts | 34 +-- .../osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputosmojs/osmosis/mint/v1beta1/mint.ts | 30 +-- .../pool-incentives/v1beta1/genesis.ts | 2 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 14 +- .../pool-incentives/v1beta1/incentives.ts | 20 +- .../osmosis/pool-incentives/v1beta1/query.ts | 20 +- .../osmosis/poolmanager/v1beta1/genesis.ts | 8 +- .../poolmanager/v1beta1/module_route.ts | 4 +- .../osmosis/poolmanager/v1beta1/query.ts | 46 ++-- .../osmosis/poolmanager/v1beta1/swap_route.ts | 10 +- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 12 +- .../osmosis/poolmanager/v1beta1/tx.ts | 18 +- .../osmosis/protorev/v1beta1/genesis.ts | 20 +- .../osmosis/protorev/v1beta1/gov.ts | 14 +- .../osmosis/protorev/v1beta1/params.ts | 6 +- .../osmosis/protorev/v1beta1/protorev.ts | 34 +-- .../osmosis/protorev/v1beta1/query.ts | 26 +- .../osmosis/protorev/v1beta1/tx.amino.ts | 22 +- .../osmosis/protorev/v1beta1/tx.ts | 24 +- .../osmosis/sumtree/v1beta1/tree.ts | 4 +- .../osmosis/superfluid/genesis.ts | 8 +- .../outputosmojs/osmosis/superfluid/params.ts | 2 +- .../outputosmojs/osmosis/superfluid/query.ts | 76 +++--- .../osmosis/superfluid/superfluid.ts | 24 +- .../osmosis/superfluid/tx.amino.ts | 10 +- .../outputosmojs/osmosis/superfluid/tx.ts | 30 +-- .../osmosis/superfluid/v1beta1/gov.ts | 22 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 6 +- .../osmosis/tokenfactory/v1beta1/params.ts | 2 +- .../osmosis/tokenfactory/v1beta1/query.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../osmosis/twap/v1beta1/genesis.ts | 6 +- .../osmosis/twap/v1beta1/query.ts | 14 +- .../osmosis/twap/v1beta1/twap_record.ts | 16 +- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 6 +- .../osmosis/txfees/v1beta1/gov.ts | 6 +- .../osmosis/txfees/v1beta1/query.ts | 16 +- .../osmosis/valset-pref/v1beta1/query.ts | 6 +- .../osmosis/valset-pref/v1beta1/state.ts | 8 +- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 10 +- .../osmosis/valset-pref/v1beta1/tx.ts | 20 +- .../outputosmojs/tendermint/abci/types.ts | 116 ++++----- .../outputosmojs/tendermint/crypto/proof.ts | 12 +- .../tendermint/libs/bits/types.ts | 6 +- .../outputosmojs/tendermint/p2p/types.ts | 22 +- .../outputosmojs/tendermint/types/evidence.ts | 4 +- .../outputosmojs/tendermint/types/params.ts | 20 +- .../outputosmojs/tendermint/types/types.ts | 32 +-- .../tendermint/types/validator.ts | 12 +- .../outputosmojs/tendermint/version/types.ts | 10 +- .../outputsign/akash/audit/v1beta1/audit.ts | 30 +-- .../outputsign/akash/audit/v1beta2/audit.ts | 30 +-- .../outputsign/akash/audit/v1beta2/genesis.ts | 2 +- .../outputsign/akash/audit/v1beta2/query.ts | 14 +- .../akash/base/v1beta1/attribute.ts | 12 +- .../outputsign/akash/base/v1beta1/endpoint.ts | 4 +- .../outputsign/akash/base/v1beta1/resource.ts | 12 +- .../akash/base/v1beta2/attribute.ts | 12 +- .../outputsign/akash/base/v1beta2/endpoint.ts | 6 +- .../outputsign/akash/base/v1beta2/resource.ts | 12 +- .../akash/base/v1beta2/resourceunits.ts | 4 +- .../outputsign/akash/cert/v1beta2/cert.ts | 26 +- .../outputsign/akash/cert/v1beta2/genesis.ts | 6 +- .../outputsign/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 18 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 22 +- .../akash/deployment/v1beta2/genesis.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 8 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 6 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 6 +- .../akash/escrow/v1beta1/genesis.ts | 4 +- .../outputsign/akash/escrow/v1beta1/query.ts | 22 +- .../outputsign/akash/escrow/v1beta1/types.ts | 34 +-- .../akash/escrow/v1beta2/genesis.ts | 4 +- .../outputsign/akash/escrow/v1beta2/query.ts | 22 +- .../outputsign/akash/escrow/v1beta2/types.ts | 38 +-- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 8 +- .../outputsign/akash/market/v1beta2/bid.ts | 40 +-- .../akash/market/v1beta2/genesis.ts | 6 +- .../outputsign/akash/market/v1beta2/lease.ts | 36 +-- .../outputsign/akash/market/v1beta2/order.ts | 26 +- .../outputsign/akash/market/v1beta2/params.ts | 4 +- .../outputsign/akash/market/v1beta2/query.ts | 6 +- .../akash/provider/v1beta1/provider.ts | 30 +-- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.ts | 30 +-- .../akash/provider/v1beta2/query.ts | 4 +- .../v-next/outputsign/confio/proofs.ts | 46 ++-- .../outputsign/cosmos/app/v1alpha1/config.ts | 4 +- .../outputsign/cosmos/app/v1alpha1/module.ts | 12 +- .../outputsign/cosmos/auth/v1beta1/auth.ts | 6 +- .../outputsign/cosmos/auth/v1beta1/genesis.ts | 2 +- .../outputsign/cosmos/auth/v1beta1/query.ts | 12 +- .../outputsign/cosmos/authz/v1beta1/authz.ts | 8 +- .../cosmos/authz/v1beta1/genesis.ts | 2 +- .../outputsign/cosmos/authz/v1beta1/query.ts | 16 +- .../outputsign/cosmos/authz/v1beta1/tx.ts | 16 +- .../outputsign/cosmos/bank/v1beta1/authz.ts | 2 +- .../outputsign/cosmos/bank/v1beta1/bank.ts | 42 ++-- .../outputsign/cosmos/bank/v1beta1/genesis.ts | 10 +- .../outputsign/cosmos/bank/v1beta1/query.ts | 26 +- .../outputsign/cosmos/bank/v1beta1/tx.ts | 10 +- .../cosmos/base/abci/v1beta1/abci.ts | 46 ++-- .../outputsign/cosmos/base/kv/v1beta1/kv.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.ts | 4 +- .../base/reflection/v1beta1/reflection.ts | 6 +- .../base/reflection/v2alpha1/reflection.ts | 46 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 16 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/store/v1beta1/listening.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 30 +-- .../outputsign/cosmos/base/v1beta1/coin.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 6 +- .../cosmos/capability/v1beta1/genesis.ts | 2 +- .../outputsign/cosmos/crisis/v1beta1/tx.ts | 6 +- .../outputsign/cosmos/crypto/hd/v1/hd.ts | 10 +- .../cosmos/crypto/keyring/v1/record.ts | 4 +- .../outputsign/cosmos/crypto/multisig/keys.ts | 4 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 52 ++-- .../cosmos/distribution/v1beta1/genesis.ts | 36 +-- .../cosmos/distribution/v1beta1/query.ts | 30 +-- .../cosmos/distribution/v1beta1/tx.ts | 18 +- .../cosmos/evidence/v1beta1/evidence.ts | 2 +- .../cosmos/evidence/v1beta1/genesis.ts | 2 +- .../cosmos/evidence/v1beta1/query.ts | 2 +- .../outputsign/cosmos/evidence/v1beta1/tx.ts | 2 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 12 +- .../cosmos/feegrant/v1beta1/genesis.ts | 2 +- .../cosmos/feegrant/v1beta1/query.ts | 12 +- .../outputsign/cosmos/feegrant/v1beta1/tx.ts | 8 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../outputsign/cosmos/gov/v1/genesis.ts | 6 +- .../v-next/outputsign/cosmos/gov/v1/gov.ts | 42 ++-- .../v-next/outputsign/cosmos/gov/v1/query.ts | 22 +- .../v-next/outputsign/cosmos/gov/v1/tx.ts | 36 +-- .../outputsign/cosmos/gov/v1beta1/genesis.ts | 6 +- .../outputsign/cosmos/gov/v1beta1/gov.ts | 42 ++-- .../outputsign/cosmos/gov/v1beta1/query.ts | 22 +- .../outputsign/cosmos/gov/v1beta1/tx.ts | 26 +- .../outputsign/cosmos/group/v1/events.ts | 12 +- .../outputsign/cosmos/group/v1/genesis.ts | 10 +- .../outputsign/cosmos/group/v1/query.ts | 30 +-- .../v-next/outputsign/cosmos/group/v1/tx.ts | 84 +++---- .../outputsign/cosmos/group/v1/types.ts | 60 ++--- .../outputsign/cosmos/mint/v1beta1/mint.ts | 16 +- .../outputsign/cosmos/nft/v1beta1/event.ts | 20 +- .../outputsign/cosmos/nft/v1beta1/genesis.ts | 8 +- .../outputsign/cosmos/nft/v1beta1/nft.ts | 20 +- .../outputsign/cosmos/nft/v1beta1/query.ts | 26 +- .../outputsign/cosmos/nft/v1beta1/tx.ts | 8 +- .../v-next/outputsign/cosmos/orm/v1/orm.ts | 16 +- .../outputsign/cosmos/orm/v1alpha1/schema.ts | 10 +- .../cosmos/params/v1beta1/params.ts | 12 +- .../outputsign/cosmos/params/v1beta1/query.ts | 10 +- .../cosmos/slashing/v1beta1/genesis.ts | 12 +- .../cosmos/slashing/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/slashing.ts | 4 +- .../outputsign/cosmos/slashing/v1beta1/tx.ts | 2 +- .../cosmos/staking/v1beta1/authz.ts | 6 +- .../cosmos/staking/v1beta1/genesis.ts | 14 +- .../cosmos/staking/v1beta1/query.ts | 46 ++-- .../cosmos/staking/v1beta1/staking.ts | 96 +++---- .../outputsign/cosmos/staking/v1beta1/tx.ts | 28 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 8 +- .../outputsign/cosmos/tx/v1beta1/service.ts | 18 +- .../v-next/outputsign/cosmos/tx/v1beta1/tx.ts | 42 ++-- .../cosmos/upgrade/v1beta1/query.ts | 8 +- .../outputsign/cosmos/upgrade/v1beta1/tx.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 14 +- .../outputsign/cosmos/vesting/v1beta1/tx.ts | 20 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../v-next/outputsign/cosmos_proto/cosmos.ts | 14 +- .../outputsign/cosmwasm/wasm/v1/genesis.ts | 14 +- .../v-next/outputsign/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputsign/cosmwasm/wasm/v1/proposal.ts | 66 ++--- .../outputsign/cosmwasm/wasm/v1/query.ts | 28 +-- .../v-next/outputsign/cosmwasm/wasm/v1/tx.ts | 32 +-- .../outputsign/cosmwasm/wasm/v1/types.ts | 28 +-- .../outputsign/evmos/claims/v1/claims.ts | 18 +- .../outputsign/evmos/claims/v1/genesis.ts | 10 +- .../outputsign/evmos/claims/v1/query.ts | 10 +- .../outputsign/evmos/epochs/v1/genesis.ts | 6 +- .../outputsign/evmos/epochs/v1/query.ts | 4 +- .../v-next/outputsign/evmos/erc20/v1/erc20.ts | 26 +- .../outputsign/evmos/erc20/v1/genesis.ts | 6 +- .../v-next/outputsign/evmos/erc20/v1/query.ts | 4 +- .../v-next/outputsign/evmos/erc20/v1/tx.ts | 12 +- .../v-next/outputsign/evmos/fees/v1/fees.ts | 6 +- .../outputsign/evmos/fees/v1/genesis.ts | 12 +- .../v-next/outputsign/evmos/fees/v1/query.ts | 8 +- .../v-next/outputsign/evmos/fees/v1/tx.ts | 18 +- .../outputsign/evmos/incentives/v1/genesis.ts | 14 +- .../evmos/incentives/v1/incentives.ts | 26 +- .../outputsign/evmos/incentives/v1/query.ts | 16 +- .../outputsign/evmos/inflation/v1/genesis.ts | 6 +- .../evmos/inflation/v1/inflation.ts | 18 +- .../outputsign/evmos/inflation/v1/query.ts | 4 +- .../outputsign/evmos/recovery/v1/genesis.ts | 2 +- .../outputsign/evmos/vesting/v1/query.ts | 8 +- .../v-next/outputsign/evmos/vesting/v1/tx.ts | 16 +- .../outputsign/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputsign/google/api/auth.ts | 34 +-- .../v-next/outputsign/google/api/backend.ts | 22 +- .../v-next/outputsign/google/api/billing.ts | 6 +- .../outputsign/google/api/config_change.ts | 14 +- .../v-next/outputsign/google/api/consumer.ts | 10 +- .../v-next/outputsign/google/api/context.ts | 12 +- .../v-next/outputsign/google/api/control.ts | 2 +- .../outputsign/google/api/distribution.ts | 30 +-- .../outputsign/google/api/documentation.ts | 24 +- .../v-next/outputsign/google/api/endpoint.ts | 8 +- .../v1alpha1/conformance_service.ts | 28 +-- .../google/api/expr/v1alpha1/checked.ts | 50 ++-- .../google/api/expr/v1alpha1/eval.ts | 8 +- .../google/api/expr/v1alpha1/explain.ts | 6 +- .../google/api/expr/v1alpha1/syntax.ts | 50 ++-- .../google/api/expr/v1alpha1/value.ts | 22 +- .../google/api/expr/v1beta1/decl.ts | 16 +- .../google/api/expr/v1beta1/eval.ts | 12 +- .../google/api/expr/v1beta1/expr.ts | 40 +-- .../google/api/expr/v1beta1/source.ts | 16 +- .../google/api/expr/v1beta1/value.ts | 22 +- .../v-next/outputsign/google/api/http.ts | 26 +- .../v-next/outputsign/google/api/httpbody.ts | 4 +- .../v-next/outputsign/google/api/label.ts | 8 +- .../v-next/outputsign/google/api/log.ts | 8 +- .../v-next/outputsign/google/api/logging.ts | 8 +- .../v-next/outputsign/google/api/metric.ts | 38 +-- .../google/api/monitored_resource.ts | 26 +- .../outputsign/google/api/monitoring.ts | 8 +- .../v-next/outputsign/google/api/quota.ts | 22 +- .../v-next/outputsign/google/api/resource.ts | 24 +- .../v-next/outputsign/google/api/routing.ts | 6 +- .../v-next/outputsign/google/api/service.ts | 22 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 26 +- .../api/servicecontrol/v1/http_request.ts | 22 +- .../google/api/servicecontrol/v1/log_entry.ts | 30 +-- .../api/servicecontrol/v1/metric_value.ts | 14 +- .../google/api/servicecontrol/v1/operation.ts | 20 +- .../api/servicecontrol/v1/quota_controller.ts | 36 +-- .../servicecontrol/v1/service_controller.ts | 32 +-- .../servicecontrol/v2/service_controller.ts | 28 +-- .../api/servicemanagement/v1/resources.ts | 52 ++-- .../servicemanagement/v1/servicemanager.ts | 68 ++--- .../google/api/serviceusage/v1/resources.ts | 20 +- .../api/serviceusage/v1/serviceusage.ts | 42 ++-- .../api/serviceusage/v1beta1/resources.ts | 78 +++--- .../api/serviceusage/v1beta1/serviceusage.ts | 166 ++++++------- .../outputsign/google/api/source_info.ts | 2 +- .../outputsign/google/api/system_parameter.ts | 12 +- .../v-next/outputsign/google/api/usage.ts | 12 +- .../outputsign/google/api/visibility.ts | 6 +- .../google/logging/type/http_request.ts | 22 +- .../outputsign/google/logging/v2/log_entry.ts | 40 +-- .../outputsign/google/logging/v2/logging.ts | 64 ++--- .../google/logging/v2/logging_config.ts | 174 ++++++------- .../google/logging/v2/logging_metrics.ts | 36 +-- .../google/longrunning/operations.ts | 28 +-- .../v-next/outputsign/google/protobuf/api.ts | 36 +-- .../google/protobuf/compiler/plugin.ts | 24 +- .../outputsign/google/protobuf/descriptor.ts | 234 +++++++++--------- .../outputsign/google/protobuf/field_mask.ts | 2 +- .../google/protobuf/source_context.ts | 2 +- .../outputsign/google/protobuf/struct.ts | 14 +- .../v-next/outputsign/google/protobuf/type.ts | 54 ++-- .../outputsign/google/protobuf/wrappers.ts | 12 +- .../google/rpc/context/attribute_context.ts | 74 +++--- .../outputsign/google/rpc/error_details.ts | 54 ++-- .../v-next/outputsign/google/rpc/status.ts | 6 +- __fixtures__/v-next/outputsign/helpers.ts | 12 +- .../ibc/applications/transfer/v1/genesis.ts | 4 +- .../ibc/applications/transfer/v1/query.ts | 4 +- .../ibc/applications/transfer/v1/transfer.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 8 +- .../ibc/applications/transfer/v2/packet.ts | 8 +- .../outputsign/ibc/core/channel/v1/channel.ts | 46 ++-- .../outputsign/ibc/core/channel/v1/genesis.ts | 18 +- .../outputsign/ibc/core/channel/v1/query.ts | 68 ++--- .../outputsign/ibc/core/channel/v1/tx.ts | 48 ++-- .../outputsign/ibc/core/client/v1/client.ts | 20 +- .../outputsign/ibc/core/client/v1/genesis.ts | 12 +- .../outputsign/ibc/core/client/v1/query.ts | 16 +- .../outputsign/ibc/core/client/v1/tx.ts | 14 +- .../ibc/core/commitment/v1/commitment.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 32 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../ibc/core/connection/v1/query.ts | 14 +- .../outputsign/ibc/core/connection/v1/tx.ts | 22 +- .../outputsign/ibc/core/port/v1/query.ts | 16 +- .../lightclients/localhost/v1/localhost.ts | 2 +- .../solomachine/v1/solomachine.ts | 20 +- .../solomachine/v2/solomachine.ts | 22 +- .../lightclients/tendermint/v1/tendermint.ts | 12 +- .../outputsign/osmosis/claim/v1beta1/claim.ts | 6 +- .../osmosis/claim/v1beta1/genesis.ts | 2 +- .../osmosis/claim/v1beta1/params.ts | 2 +- .../outputsign/osmosis/claim/v1beta1/query.ts | 18 +- .../outputsign/osmosis/epochs/genesis.ts | 6 +- .../v-next/outputsign/osmosis/epochs/query.ts | 4 +- .../gamm/pool-models/balancer/balancerPool.ts | 20 +- .../gamm/pool-models/balancer/tx/tx.ts | 6 +- .../pool-models/stableswap/stableswap_pool.ts | 16 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../osmosis/gamm/v1beta1/genesis.ts | 4 +- .../outputsign/osmosis/gamm/v1beta1/query.ts | 52 ++-- .../outputsign/osmosis/gamm/v1beta1/tx.ts | 70 +++--- .../outputsign/osmosis/gamm/v2/query.ts | 6 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 2 +- .../outputsign/osmosis/incentives/gauge.ts | 8 +- .../outputsign/osmosis/incentives/genesis.ts | 4 +- .../outputsign/osmosis/incentives/params.ts | 2 +- .../outputsign/osmosis/incentives/query.ts | 24 +- .../outputsign/osmosis/incentives/tx.ts | 10 +- .../outputsign/osmosis/lockup/genesis.ts | 4 +- .../v-next/outputsign/osmosis/lockup/lock.ts | 12 +- .../outputsign/osmosis/lockup/params.ts | 2 +- .../v-next/outputsign/osmosis/lockup/query.ts | 58 ++--- .../v-next/outputsign/osmosis/lockup/tx.ts | 24 +- .../outputsign/osmosis/mint/v1beta1/mint.ts | 26 +- .../pool-incentives/v1beta1/genesis.ts | 2 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 12 +- .../pool-incentives/v1beta1/incentives.ts | 12 +- .../osmosis/pool-incentives/v1beta1/query.ts | 10 +- .../osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputsign/osmosis/superfluid/genesis.ts | 8 +- .../outputsign/osmosis/superfluid/params.ts | 4 +- .../outputsign/osmosis/superfluid/query.ts | 78 +++--- .../osmosis/superfluid/superfluid.ts | 24 +- .../outputsign/osmosis/superfluid/tx.ts | 18 +- .../osmosis/superfluid/v1beta1/gov.ts | 20 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 2 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/params.ts | 2 +- .../osmosis/tokenfactory/v1beta1/query.ts | 6 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 18 +- .../osmosis/twap/v1beta1/genesis.ts | 4 +- .../outputsign/osmosis/twap/v1beta1/query.ts | 14 +- .../osmosis/twap/v1beta1/twap_record.ts | 16 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../osmosis/txfees/v1beta1/genesis.ts | 4 +- .../outputsign/osmosis/txfees/v1beta1/gov.ts | 4 +- .../osmosis/txfees/v1beta1/query.ts | 12 +- .../outputsign/tendermint/abci/types.ts | 116 ++++----- .../outputsign/tendermint/crypto/proof.ts | 12 +- .../outputsign/tendermint/libs/bits/types.ts | 2 +- .../v-next/outputsign/tendermint/p2p/types.ts | 22 +- .../outputsign/tendermint/types/evidence.ts | 4 +- .../outputsign/tendermint/types/params.ts | 2 +- .../outputsign/tendermint/types/types.ts | 32 +-- .../outputsign/tendermint/types/validator.ts | 2 +- .../outputsign/tendermint/version/types.ts | 2 +- .../outputv2/akash/audit/v1beta1/audit.ts | 30 +-- .../outputv2/akash/audit/v1beta2/audit.ts | 30 +-- .../outputv2/akash/audit/v1beta2/genesis.ts | 2 +- .../outputv2/akash/audit/v1beta2/query.ts | 16 +- .../outputv2/akash/base/v1beta1/attribute.ts | 14 +- .../outputv2/akash/base/v1beta1/endpoint.ts | 4 +- .../outputv2/akash/base/v1beta1/resource.ts | 12 +- .../outputv2/akash/base/v1beta2/attribute.ts | 14 +- .../outputv2/akash/base/v1beta2/endpoint.ts | 6 +- .../outputv2/akash/base/v1beta2/resource.ts | 12 +- .../akash/base/v1beta2/resourceunits.ts | 4 +- .../outputv2/akash/cert/v1beta2/cert.ts | 26 +- .../outputv2/akash/cert/v1beta2/genesis.ts | 6 +- .../outputv2/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 38 +-- .../akash/deployment/v1beta1/genesis.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 36 +-- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 18 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 22 +- .../akash/deployment/v1beta2/genesis.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 12 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 6 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 6 +- .../outputv2/akash/escrow/v1beta1/genesis.ts | 4 +- .../outputv2/akash/escrow/v1beta1/query.ts | 24 +- .../outputv2/akash/escrow/v1beta1/types.ts | 34 +-- .../outputv2/akash/escrow/v1beta2/genesis.ts | 4 +- .../outputv2/akash/escrow/v1beta2/query.ts | 24 +- .../outputv2/akash/escrow/v1beta2/types.ts | 38 +-- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputv2/akash/market/v1beta2/bid.ts | 44 ++-- .../outputv2/akash/market/v1beta2/genesis.ts | 6 +- .../outputv2/akash/market/v1beta2/lease.ts | 42 ++-- .../outputv2/akash/market/v1beta2/order.ts | 30 +-- .../outputv2/akash/market/v1beta2/params.ts | 4 +- .../outputv2/akash/market/v1beta2/query.ts | 6 +- .../akash/provider/v1beta1/provider.ts | 30 +-- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.ts | 30 +-- .../outputv2/akash/provider/v1beta2/query.ts | 6 +- __fixtures__/v-next/outputv2/confio/proofs.ts | 46 ++-- .../outputv2/cosmos/app/v1alpha1/config.ts | 6 +- .../outputv2/cosmos/app/v1alpha1/module.ts | 14 +- .../outputv2/cosmos/auth/v1beta1/auth.ts | 22 +- .../outputv2/cosmos/auth/v1beta1/genesis.ts | 2 +- .../outputv2/cosmos/auth/v1beta1/query.ts | 18 +- .../outputv2/cosmos/authz/v1beta1/authz.ts | 10 +- .../outputv2/cosmos/authz/v1beta1/genesis.ts | 2 +- .../outputv2/cosmos/authz/v1beta1/query.ts | 18 +- .../outputv2/cosmos/authz/v1beta1/tx.ts | 22 +- .../outputv2/cosmos/bank/v1beta1/authz.ts | 2 +- .../outputv2/cosmos/bank/v1beta1/bank.ts | 42 ++-- .../outputv2/cosmos/bank/v1beta1/genesis.ts | 12 +- .../outputv2/cosmos/bank/v1beta1/query.ts | 28 +-- .../v-next/outputv2/cosmos/bank/v1beta1/tx.ts | 12 +- .../outputv2/cosmos/base/abci/v1beta1/abci.ts | 46 ++-- .../outputv2/cosmos/base/kv/v1beta1/kv.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.ts | 4 +- .../base/reflection/v1beta1/reflection.ts | 8 +- .../base/reflection/v2alpha1/reflection.ts | 48 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 16 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/store/v1beta1/listening.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 44 ++-- .../outputv2/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 10 +- .../cosmos/capability/v1beta1/genesis.ts | 8 +- .../outputv2/cosmos/crisis/v1beta1/tx.ts | 8 +- .../v-next/outputv2/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../outputv2/cosmos/crypto/multisig/keys.ts | 6 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 58 ++--- .../cosmos/distribution/v1beta1/genesis.ts | 44 ++-- .../cosmos/distribution/v1beta1/query.ts | 36 +-- .../cosmos/distribution/v1beta1/tx.ts | 20 +- .../cosmos/evidence/v1beta1/evidence.ts | 2 +- .../cosmos/evidence/v1beta1/genesis.ts | 2 +- .../outputv2/cosmos/evidence/v1beta1/query.ts | 2 +- .../outputv2/cosmos/evidence/v1beta1/tx.ts | 6 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 14 +- .../cosmos/feegrant/v1beta1/genesis.ts | 2 +- .../outputv2/cosmos/feegrant/v1beta1/query.ts | 14 +- .../outputv2/cosmos/feegrant/v1beta1/tx.ts | 12 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../v-next/outputv2/cosmos/gov/v1/genesis.ts | 10 +- .../v-next/outputv2/cosmos/gov/v1/gov.ts | 42 ++-- .../v-next/outputv2/cosmos/gov/v1/query.ts | 20 +- .../v-next/outputv2/cosmos/gov/v1/tx.ts | 36 +-- .../outputv2/cosmos/gov/v1beta1/genesis.ts | 10 +- .../v-next/outputv2/cosmos/gov/v1beta1/gov.ts | 44 ++-- .../outputv2/cosmos/gov/v1beta1/query.ts | 20 +- .../v-next/outputv2/cosmos/gov/v1beta1/tx.ts | 26 +- .../v-next/outputv2/cosmos/group/v1/events.ts | 10 +- .../outputv2/cosmos/group/v1/genesis.ts | 18 +- .../v-next/outputv2/cosmos/group/v1/query.ts | 46 ++-- .../v-next/outputv2/cosmos/group/v1/tx.ts | 84 +++---- .../v-next/outputv2/cosmos/group/v1/types.ts | 62 ++--- .../outputv2/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputv2/cosmos/nft/v1beta1/event.ts | 22 +- .../outputv2/cosmos/nft/v1beta1/genesis.ts | 10 +- .../v-next/outputv2/cosmos/nft/v1beta1/nft.ts | 22 +- .../outputv2/cosmos/nft/v1beta1/query.ts | 32 +-- .../v-next/outputv2/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputv2/cosmos/orm/v1/orm.ts | 18 +- .../outputv2/cosmos/orm/v1alpha1/schema.ts | 10 +- .../outputv2/cosmos/params/v1beta1/params.ts | 14 +- .../outputv2/cosmos/params/v1beta1/query.ts | 12 +- .../cosmos/slashing/v1beta1/genesis.ts | 16 +- .../outputv2/cosmos/slashing/v1beta1/query.ts | 6 +- .../cosmos/slashing/v1beta1/slashing.ts | 4 +- .../outputv2/cosmos/slashing/v1beta1/tx.ts | 2 +- .../outputv2/cosmos/staking/v1beta1/authz.ts | 6 +- .../cosmos/staking/v1beta1/genesis.ts | 18 +- .../outputv2/cosmos/staking/v1beta1/query.ts | 50 ++-- .../cosmos/staking/v1beta1/staking.ts | 98 ++++---- .../outputv2/cosmos/staking/v1beta1/tx.ts | 30 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 8 +- .../outputv2/cosmos/tx/v1beta1/service.ts | 18 +- .../v-next/outputv2/cosmos/tx/v1beta1/tx.ts | 40 +-- .../outputv2/cosmos/upgrade/v1beta1/query.ts | 14 +- .../outputv2/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 14 +- .../outputv2/cosmos/vesting/v1beta1/tx.ts | 26 +- .../cosmos/vesting/v1beta1/vesting.ts | 20 +- .../v-next/outputv2/cosmos_proto/cosmos.ts | 16 +- .../outputv2/cosmwasm/wasm/v1/genesis.ts | 14 +- .../v-next/outputv2/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputv2/cosmwasm/wasm/v1/proposal.ts | 72 +++--- .../v-next/outputv2/cosmwasm/wasm/v1/query.ts | 28 +-- .../v-next/outputv2/cosmwasm/wasm/v1/tx.ts | 32 +-- .../v-next/outputv2/cosmwasm/wasm/v1/types.ts | 30 +-- .../v-next/outputv2/evmos/claims/v1/claims.ts | 18 +- .../outputv2/evmos/claims/v1/genesis.ts | 10 +- .../v-next/outputv2/evmos/claims/v1/query.ts | 12 +- .../outputv2/evmos/epochs/v1/genesis.ts | 6 +- .../v-next/outputv2/evmos/epochs/v1/query.ts | 8 +- .../v-next/outputv2/evmos/erc20/v1/erc20.ts | 26 +- .../v-next/outputv2/evmos/erc20/v1/genesis.ts | 8 +- .../v-next/outputv2/evmos/erc20/v1/query.ts | 6 +- .../v-next/outputv2/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputv2/evmos/fees/v1/fees.ts | 8 +- .../v-next/outputv2/evmos/fees/v1/genesis.ts | 14 +- .../v-next/outputv2/evmos/fees/v1/query.ts | 10 +- .../v-next/outputv2/evmos/fees/v1/tx.ts | 20 +- .../outputv2/evmos/incentives/v1/genesis.ts | 14 +- .../evmos/incentives/v1/incentives.ts | 26 +- .../outputv2/evmos/incentives/v1/query.ts | 20 +- .../outputv2/evmos/inflation/v1/genesis.ts | 14 +- .../outputv2/evmos/inflation/v1/inflation.ts | 16 +- .../outputv2/evmos/inflation/v1/query.ts | 8 +- .../outputv2/evmos/recovery/v1/genesis.ts | 4 +- .../v-next/outputv2/evmos/vesting/v1/query.ts | 10 +- .../v-next/outputv2/evmos/vesting/v1/tx.ts | 16 +- .../outputv2/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputv2/google/api/auth.ts | 36 +-- .../v-next/outputv2/google/api/backend.ts | 22 +- .../v-next/outputv2/google/api/billing.ts | 8 +- .../outputv2/google/api/config_change.ts | 14 +- .../v-next/outputv2/google/api/consumer.ts | 10 +- .../v-next/outputv2/google/api/context.ts | 14 +- .../v-next/outputv2/google/api/control.ts | 4 +- .../outputv2/google/api/distribution.ts | 30 +-- .../outputv2/google/api/documentation.ts | 26 +- .../v-next/outputv2/google/api/endpoint.ts | 10 +- .../v1alpha1/conformance_service.ts | 28 +-- .../google/api/expr/v1alpha1/checked.ts | 48 ++-- .../outputv2/google/api/expr/v1alpha1/eval.ts | 14 +- .../google/api/expr/v1alpha1/explain.ts | 10 +- .../google/api/expr/v1alpha1/syntax.ts | 48 ++-- .../google/api/expr/v1alpha1/value.ts | 20 +- .../outputv2/google/api/expr/v1beta1/decl.ts | 18 +- .../outputv2/google/api/expr/v1beta1/eval.ts | 14 +- .../outputv2/google/api/expr/v1beta1/expr.ts | 38 +-- .../google/api/expr/v1beta1/source.ts | 18 +- .../outputv2/google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputv2/google/api/http.ts | 28 +-- .../v-next/outputv2/google/api/httpbody.ts | 4 +- .../v-next/outputv2/google/api/label.ts | 8 +- .../v-next/outputv2/google/api/log.ts | 10 +- .../v-next/outputv2/google/api/logging.ts | 10 +- .../v-next/outputv2/google/api/metric.ts | 36 +-- .../outputv2/google/api/monitored_resource.ts | 24 +- .../v-next/outputv2/google/api/monitoring.ts | 10 +- .../v-next/outputv2/google/api/quota.ts | 34 +-- .../v-next/outputv2/google/api/resource.ts | 24 +- .../v-next/outputv2/google/api/routing.ts | 8 +- .../v-next/outputv2/google/api/service.ts | 24 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 30 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 28 +-- .../api/servicecontrol/v1/metric_value.ts | 14 +- .../google/api/servicecontrol/v1/operation.ts | 20 +- .../api/servicecontrol/v1/quota_controller.ts | 36 +-- .../servicecontrol/v1/service_controller.ts | 32 +-- .../servicecontrol/v2/service_controller.ts | 30 +-- .../api/servicemanagement/v1/resources.ts | 52 ++-- .../servicemanagement/v1/servicemanager.ts | 68 ++--- .../google/api/serviceusage/v1/resources.ts | 20 +- .../api/serviceusage/v1/serviceusage.ts | 42 ++-- .../api/serviceusage/v1beta1/resources.ts | 78 +++--- .../api/serviceusage/v1beta1/serviceusage.ts | 164 ++++++------ .../v-next/outputv2/google/api/source_info.ts | 2 +- .../outputv2/google/api/system_parameter.ts | 14 +- .../v-next/outputv2/google/api/usage.ts | 14 +- .../v-next/outputv2/google/api/visibility.ts | 8 +- .../google/logging/type/http_request.ts | 30 +-- .../outputv2/google/logging/v2/log_entry.ts | 38 +-- .../outputv2/google/logging/v2/logging.ts | 64 ++--- .../google/logging/v2/logging_config.ts | 174 ++++++------- .../google/logging/v2/logging_metrics.ts | 36 +-- .../outputv2/google/longrunning/operations.ts | 30 +-- .../v-next/outputv2/google/protobuf/api.ts | 34 +-- .../google/protobuf/compiler/plugin.ts | 26 +- .../outputv2/google/protobuf/descriptor.ts | 234 +++++++++--------- .../outputv2/google/protobuf/field_mask.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../v-next/outputv2/google/protobuf/struct.ts | 14 +- .../v-next/outputv2/google/protobuf/type.ts | 54 ++-- .../outputv2/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 74 +++--- .../outputv2/google/rpc/error_details.ts | 56 ++--- .../v-next/outputv2/google/rpc/status.ts | 8 +- .../ibc/applications/transfer/v1/genesis.ts | 6 +- .../ibc/applications/transfer/v1/query.ts | 6 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../outputv2/ibc/core/channel/v1/channel.ts | 46 ++-- .../outputv2/ibc/core/channel/v1/genesis.ts | 24 +- .../outputv2/ibc/core/channel/v1/query.ts | 68 ++--- .../v-next/outputv2/ibc/core/channel/v1/tx.ts | 48 ++-- .../outputv2/ibc/core/client/v1/client.ts | 26 +- .../outputv2/ibc/core/client/v1/genesis.ts | 16 +- .../outputv2/ibc/core/client/v1/query.ts | 22 +- .../v-next/outputv2/ibc/core/client/v1/tx.ts | 14 +- .../ibc/core/commitment/v1/commitment.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 32 +-- .../ibc/core/connection/v1/genesis.ts | 8 +- .../outputv2/ibc/core/connection/v1/query.ts | 14 +- .../outputv2/ibc/core/connection/v1/tx.ts | 22 +- .../v-next/outputv2/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 20 +- .../solomachine/v2/solomachine.ts | 22 +- .../lightclients/tendermint/v1/tendermint.ts | 12 +- .../outputv2/osmosis/claim/v1beta1/claim.ts | 8 +- .../outputv2/osmosis/claim/v1beta1/genesis.ts | 2 +- .../outputv2/osmosis/claim/v1beta1/params.ts | 2 +- .../outputv2/osmosis/claim/v1beta1/query.ts | 16 +- .../v-next/outputv2/osmosis/epochs/genesis.ts | 6 +- .../v-next/outputv2/osmosis/epochs/query.ts | 8 +- .../gamm/pool-models/balancer/balancerPool.ts | 20 +- .../gamm/pool-models/balancer/tx/tx.ts | 10 +- .../pool-models/stableswap/stableswap_pool.ts | 18 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 20 +- .../outputv2/osmosis/gamm/v1beta1/genesis.ts | 10 +- .../outputv2/osmosis/gamm/v1beta1/query.ts | 80 +++--- .../outputv2/osmosis/gamm/v1beta1/tx.ts | 88 +++---- .../v-next/outputv2/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputv2/osmosis/incentives/gauge.ts | 8 +- .../outputv2/osmosis/incentives/genesis.ts | 8 +- .../outputv2/osmosis/incentives/params.ts | 4 +- .../outputv2/osmosis/incentives/query.ts | 30 +-- .../v-next/outputv2/osmosis/incentives/tx.ts | 10 +- .../v-next/outputv2/osmosis/lockup/genesis.ts | 8 +- .../v-next/outputv2/osmosis/lockup/lock.ts | 12 +- .../v-next/outputv2/osmosis/lockup/params.ts | 2 +- .../v-next/outputv2/osmosis/lockup/query.ts | 58 ++--- .../v-next/outputv2/osmosis/lockup/tx.ts | 34 +-- .../outputv2/osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputv2/osmosis/mint/v1beta1/mint.ts | 30 +-- .../pool-incentives/v1beta1/genesis.ts | 2 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 14 +- .../pool-incentives/v1beta1/incentives.ts | 20 +- .../osmosis/pool-incentives/v1beta1/query.ts | 20 +- .../outputv2/osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputv2/osmosis/superfluid/genesis.ts | 8 +- .../outputv2/osmosis/superfluid/params.ts | 2 +- .../outputv2/osmosis/superfluid/query.ts | 76 +++--- .../outputv2/osmosis/superfluid/superfluid.ts | 24 +- .../v-next/outputv2/osmosis/superfluid/tx.ts | 30 +-- .../osmosis/superfluid/v1beta1/gov.ts | 22 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 6 +- .../osmosis/tokenfactory/v1beta1/params.ts | 2 +- .../osmosis/tokenfactory/v1beta1/query.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../outputv2/osmosis/twap/v1beta1/genesis.ts | 6 +- .../outputv2/osmosis/twap/v1beta1/query.ts | 14 +- .../osmosis/twap/v1beta1/twap_record.ts | 16 +- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 6 +- .../outputv2/osmosis/txfees/v1beta1/gov.ts | 6 +- .../outputv2/osmosis/txfees/v1beta1/query.ts | 16 +- .../v-next/outputv2/tendermint/abci/types.ts | 116 ++++----- .../outputv2/tendermint/crypto/proof.ts | 12 +- .../outputv2/tendermint/libs/bits/types.ts | 6 +- .../v-next/outputv2/tendermint/p2p/types.ts | 22 +- .../outputv2/tendermint/types/evidence.ts | 4 +- .../outputv2/tendermint/types/params.ts | 20 +- .../v-next/outputv2/tendermint/types/types.ts | 32 +-- .../outputv2/tendermint/types/validator.ts | 12 +- .../outputv2/tendermint/version/types.ts | 10 +- .../outputv3/akash/audit/v1beta1/audit.ts | 30 +-- .../outputv3/akash/audit/v1beta2/audit.ts | 30 +-- .../outputv3/akash/audit/v1beta2/genesis.ts | 2 +- .../outputv3/akash/audit/v1beta2/query.ts | 14 +- .../outputv3/akash/base/v1beta1/attribute.ts | 14 +- .../outputv3/akash/base/v1beta1/endpoint.ts | 4 +- .../outputv3/akash/base/v1beta1/resource.ts | 12 +- .../outputv3/akash/base/v1beta2/attribute.ts | 14 +- .../outputv3/akash/base/v1beta2/endpoint.ts | 6 +- .../outputv3/akash/base/v1beta2/resource.ts | 12 +- .../akash/base/v1beta2/resourceunits.ts | 4 +- .../outputv3/akash/cert/v1beta2/cert.ts | 26 +- .../outputv3/akash/cert/v1beta2/genesis.ts | 6 +- .../outputv3/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 38 +-- .../akash/deployment/v1beta1/genesis.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 32 +-- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 18 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 22 +- .../akash/deployment/v1beta2/genesis.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 8 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 6 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 6 +- .../outputv3/akash/escrow/v1beta1/genesis.ts | 4 +- .../outputv3/akash/escrow/v1beta1/query.ts | 22 +- .../outputv3/akash/escrow/v1beta1/types.ts | 34 +-- .../outputv3/akash/escrow/v1beta2/genesis.ts | 4 +- .../outputv3/akash/escrow/v1beta2/query.ts | 22 +- .../outputv3/akash/escrow/v1beta2/types.ts | 38 +-- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputv3/akash/market/v1beta2/bid.ts | 40 +-- .../outputv3/akash/market/v1beta2/genesis.ts | 6 +- .../outputv3/akash/market/v1beta2/lease.ts | 36 +-- .../outputv3/akash/market/v1beta2/order.ts | 26 +- .../outputv3/akash/market/v1beta2/params.ts | 4 +- .../outputv3/akash/market/v1beta2/query.ts | 6 +- .../akash/provider/v1beta1/provider.ts | 30 +-- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.ts | 30 +-- .../outputv3/akash/provider/v1beta2/query.ts | 6 +- __fixtures__/v-next/outputv3/confio/proofs.ts | 46 ++-- .../outputv3/cosmos/app/v1alpha1/config.ts | 4 +- .../outputv3/cosmos/app/v1alpha1/module.ts | 14 +- .../outputv3/cosmos/auth/v1beta1/auth.ts | 6 +- .../outputv3/cosmos/auth/v1beta1/genesis.ts | 2 +- .../outputv3/cosmos/auth/v1beta1/query.ts | 18 +- .../outputv3/cosmos/authz/v1beta1/authz.ts | 10 +- .../outputv3/cosmos/authz/v1beta1/genesis.ts | 2 +- .../outputv3/cosmos/authz/v1beta1/query.ts | 16 +- .../outputv3/cosmos/authz/v1beta1/tx.ts | 20 +- .../outputv3/cosmos/bank/v1beta1/authz.ts | 2 +- .../outputv3/cosmos/bank/v1beta1/bank.ts | 42 ++-- .../outputv3/cosmos/bank/v1beta1/genesis.ts | 12 +- .../outputv3/cosmos/bank/v1beta1/query.ts | 26 +- .../v-next/outputv3/cosmos/bank/v1beta1/tx.ts | 12 +- .../outputv3/cosmos/base/abci/v1beta1/abci.ts | 46 ++-- .../outputv3/cosmos/base/kv/v1beta1/kv.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.ts | 4 +- .../base/reflection/v1beta1/reflection.ts | 8 +- .../base/reflection/v2alpha1/reflection.ts | 48 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 16 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/store/v1beta1/listening.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 30 +-- .../outputv3/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 10 +- .../cosmos/capability/v1beta1/genesis.ts | 2 +- .../outputv3/cosmos/crisis/v1beta1/tx.ts | 8 +- .../v-next/outputv3/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 4 +- .../outputv3/cosmos/crypto/multisig/keys.ts | 6 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 58 ++--- .../cosmos/distribution/v1beta1/genesis.ts | 36 +-- .../cosmos/distribution/v1beta1/query.ts | 30 +-- .../cosmos/distribution/v1beta1/tx.ts | 20 +- .../cosmos/evidence/v1beta1/evidence.ts | 2 +- .../cosmos/evidence/v1beta1/genesis.ts | 2 +- .../outputv3/cosmos/evidence/v1beta1/query.ts | 2 +- .../outputv3/cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 14 +- .../cosmos/feegrant/v1beta1/genesis.ts | 2 +- .../outputv3/cosmos/feegrant/v1beta1/query.ts | 12 +- .../outputv3/cosmos/feegrant/v1beta1/tx.ts | 10 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../v-next/outputv3/cosmos/gov/v1/genesis.ts | 10 +- .../v-next/outputv3/cosmos/gov/v1/gov.ts | 42 ++-- .../v-next/outputv3/cosmos/gov/v1/query.ts | 20 +- .../v-next/outputv3/cosmos/gov/v1/tx.ts | 36 +-- .../outputv3/cosmos/gov/v1beta1/genesis.ts | 10 +- .../v-next/outputv3/cosmos/gov/v1beta1/gov.ts | 44 ++-- .../outputv3/cosmos/gov/v1beta1/query.ts | 20 +- .../v-next/outputv3/cosmos/gov/v1beta1/tx.ts | 26 +- .../v-next/outputv3/cosmos/group/v1/events.ts | 10 +- .../outputv3/cosmos/group/v1/genesis.ts | 18 +- .../v-next/outputv3/cosmos/group/v1/query.ts | 30 +-- .../v-next/outputv3/cosmos/group/v1/tx.ts | 84 +++---- .../v-next/outputv3/cosmos/group/v1/types.ts | 62 ++--- .../outputv3/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputv3/cosmos/nft/v1beta1/event.ts | 22 +- .../outputv3/cosmos/nft/v1beta1/genesis.ts | 10 +- .../v-next/outputv3/cosmos/nft/v1beta1/nft.ts | 20 +- .../outputv3/cosmos/nft/v1beta1/query.ts | 26 +- .../v-next/outputv3/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputv3/cosmos/orm/v1/orm.ts | 18 +- .../outputv3/cosmos/orm/v1alpha1/schema.ts | 10 +- .../outputv3/cosmos/params/v1beta1/params.ts | 14 +- .../outputv3/cosmos/params/v1beta1/query.ts | 12 +- .../cosmos/slashing/v1beta1/genesis.ts | 12 +- .../outputv3/cosmos/slashing/v1beta1/query.ts | 6 +- .../cosmos/slashing/v1beta1/slashing.ts | 4 +- .../outputv3/cosmos/slashing/v1beta1/tx.ts | 2 +- .../outputv3/cosmos/staking/v1beta1/authz.ts | 6 +- .../cosmos/staking/v1beta1/genesis.ts | 18 +- .../outputv3/cosmos/staking/v1beta1/query.ts | 46 ++-- .../cosmos/staking/v1beta1/staking.ts | 98 ++++---- .../outputv3/cosmos/staking/v1beta1/tx.ts | 30 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 8 +- .../outputv3/cosmos/tx/v1beta1/service.ts | 18 +- .../v-next/outputv3/cosmos/tx/v1beta1/tx.ts | 40 +-- .../outputv3/cosmos/upgrade/v1beta1/query.ts | 14 +- .../outputv3/cosmos/upgrade/v1beta1/tx.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 14 +- .../outputv3/cosmos/vesting/v1beta1/tx.ts | 26 +- .../cosmos/vesting/v1beta1/vesting.ts | 10 +- .../v-next/outputv3/cosmos_proto/cosmos.ts | 16 +- .../outputv3/cosmwasm/wasm/v1/genesis.ts | 14 +- .../v-next/outputv3/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputv3/cosmwasm/wasm/v1/proposal.ts | 72 +++--- .../v-next/outputv3/cosmwasm/wasm/v1/query.ts | 28 +-- .../v-next/outputv3/cosmwasm/wasm/v1/tx.ts | 32 +-- .../v-next/outputv3/cosmwasm/wasm/v1/types.ts | 30 +-- .../v-next/outputv3/evmos/claims/v1/claims.ts | 18 +- .../outputv3/evmos/claims/v1/genesis.ts | 10 +- .../v-next/outputv3/evmos/claims/v1/query.ts | 12 +- .../outputv3/evmos/epochs/v1/genesis.ts | 6 +- .../v-next/outputv3/evmos/epochs/v1/query.ts | 8 +- .../v-next/outputv3/evmos/erc20/v1/erc20.ts | 26 +- .../v-next/outputv3/evmos/erc20/v1/genesis.ts | 8 +- .../v-next/outputv3/evmos/erc20/v1/query.ts | 6 +- .../v-next/outputv3/evmos/erc20/v1/tx.ts | 12 +- .../v-next/outputv3/evmos/fees/v1/fees.ts | 8 +- .../v-next/outputv3/evmos/fees/v1/genesis.ts | 14 +- .../v-next/outputv3/evmos/fees/v1/query.ts | 8 +- .../v-next/outputv3/evmos/fees/v1/tx.ts | 20 +- .../outputv3/evmos/incentives/v1/genesis.ts | 14 +- .../evmos/incentives/v1/incentives.ts | 26 +- .../outputv3/evmos/incentives/v1/query.ts | 16 +- .../outputv3/evmos/inflation/v1/genesis.ts | 6 +- .../outputv3/evmos/inflation/v1/inflation.ts | 16 +- .../outputv3/evmos/inflation/v1/query.ts | 8 +- .../outputv3/evmos/recovery/v1/genesis.ts | 2 +- .../v-next/outputv3/evmos/vesting/v1/query.ts | 10 +- .../v-next/outputv3/evmos/vesting/v1/tx.ts | 16 +- .../outputv3/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputv3/google/api/auth.ts | 34 +-- .../v-next/outputv3/google/api/backend.ts | 22 +- .../v-next/outputv3/google/api/billing.ts | 8 +- .../outputv3/google/api/config_change.ts | 14 +- .../v-next/outputv3/google/api/consumer.ts | 10 +- .../v-next/outputv3/google/api/context.ts | 14 +- .../v-next/outputv3/google/api/control.ts | 4 +- .../outputv3/google/api/distribution.ts | 30 +-- .../outputv3/google/api/documentation.ts | 26 +- .../v-next/outputv3/google/api/endpoint.ts | 10 +- .../v1alpha1/conformance_service.ts | 28 +-- .../google/api/expr/v1alpha1/checked.ts | 48 ++-- .../outputv3/google/api/expr/v1alpha1/eval.ts | 14 +- .../google/api/expr/v1alpha1/explain.ts | 10 +- .../google/api/expr/v1alpha1/syntax.ts | 48 ++-- .../google/api/expr/v1alpha1/value.ts | 20 +- .../outputv3/google/api/expr/v1beta1/decl.ts | 16 +- .../outputv3/google/api/expr/v1beta1/eval.ts | 12 +- .../outputv3/google/api/expr/v1beta1/expr.ts | 38 +-- .../google/api/expr/v1beta1/source.ts | 18 +- .../outputv3/google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputv3/google/api/http.ts | 26 +- .../v-next/outputv3/google/api/httpbody.ts | 4 +- .../v-next/outputv3/google/api/label.ts | 8 +- .../v-next/outputv3/google/api/log.ts | 10 +- .../v-next/outputv3/google/api/logging.ts | 10 +- .../v-next/outputv3/google/api/metric.ts | 36 +-- .../outputv3/google/api/monitored_resource.ts | 24 +- .../v-next/outputv3/google/api/monitoring.ts | 10 +- .../v-next/outputv3/google/api/quota.ts | 34 +-- .../v-next/outputv3/google/api/resource.ts | 24 +- .../v-next/outputv3/google/api/routing.ts | 8 +- .../v-next/outputv3/google/api/service.ts | 24 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 30 +-- .../api/servicecontrol/v1/http_request.ts | 22 +- .../google/api/servicecontrol/v1/log_entry.ts | 28 +-- .../api/servicecontrol/v1/metric_value.ts | 14 +- .../google/api/servicecontrol/v1/operation.ts | 20 +- .../api/servicecontrol/v1/quota_controller.ts | 36 +-- .../servicecontrol/v1/service_controller.ts | 32 +-- .../servicecontrol/v2/service_controller.ts | 28 +-- .../api/servicemanagement/v1/resources.ts | 52 ++-- .../servicemanagement/v1/servicemanager.ts | 68 ++--- .../google/api/serviceusage/v1/resources.ts | 20 +- .../api/serviceusage/v1/serviceusage.ts | 42 ++-- .../api/serviceusage/v1beta1/resources.ts | 78 +++--- .../api/serviceusage/v1beta1/serviceusage.ts | 164 ++++++------ .../v-next/outputv3/google/api/source_info.ts | 2 +- .../outputv3/google/api/system_parameter.ts | 14 +- .../v-next/outputv3/google/api/usage.ts | 14 +- .../v-next/outputv3/google/api/visibility.ts | 8 +- .../google/logging/type/http_request.ts | 22 +- .../outputv3/google/logging/v2/log_entry.ts | 38 +-- .../outputv3/google/logging/v2/logging.ts | 64 ++--- .../google/logging/v2/logging_config.ts | 174 ++++++------- .../google/logging/v2/logging_metrics.ts | 36 +-- .../outputv3/google/longrunning/operations.ts | 28 +-- .../v-next/outputv3/google/protobuf/any.ts | 2 +- .../v-next/outputv3/google/protobuf/api.ts | 34 +-- .../google/protobuf/compiler/plugin.ts | 26 +- .../outputv3/google/protobuf/descriptor.ts | 234 +++++++++--------- .../outputv3/google/protobuf/duration.ts | 2 +- .../outputv3/google/protobuf/field_mask.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../v-next/outputv3/google/protobuf/struct.ts | 14 +- .../outputv3/google/protobuf/timestamp.ts | 2 +- .../v-next/outputv3/google/protobuf/type.ts | 54 ++-- .../outputv3/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 74 +++--- .../outputv3/google/rpc/error_details.ts | 56 ++--- .../v-next/outputv3/google/rpc/status.ts | 8 +- .../ibc/applications/transfer/v1/genesis.ts | 6 +- .../ibc/applications/transfer/v1/query.ts | 6 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.ts | 8 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../outputv3/ibc/core/channel/v1/channel.ts | 46 ++-- .../outputv3/ibc/core/channel/v1/genesis.ts | 24 +- .../outputv3/ibc/core/channel/v1/query.ts | 68 ++--- .../v-next/outputv3/ibc/core/channel/v1/tx.ts | 48 ++-- .../outputv3/ibc/core/client/v1/client.ts | 20 +- .../outputv3/ibc/core/client/v1/genesis.ts | 12 +- .../outputv3/ibc/core/client/v1/query.ts | 16 +- .../v-next/outputv3/ibc/core/client/v1/tx.ts | 14 +- .../ibc/core/commitment/v1/commitment.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 32 +-- .../ibc/core/connection/v1/genesis.ts | 4 +- .../outputv3/ibc/core/connection/v1/query.ts | 14 +- .../outputv3/ibc/core/connection/v1/tx.ts | 22 +- .../v-next/outputv3/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 2 +- .../solomachine/v1/solomachine.ts | 20 +- .../solomachine/v2/solomachine.ts | 22 +- .../lightclients/tendermint/v1/tendermint.ts | 12 +- .../outputv3/osmosis/claim/v1beta1/claim.ts | 8 +- .../outputv3/osmosis/claim/v1beta1/genesis.ts | 2 +- .../outputv3/osmosis/claim/v1beta1/params.ts | 2 +- .../outputv3/osmosis/claim/v1beta1/query.ts | 16 +- .../v-next/outputv3/osmosis/epochs/genesis.ts | 6 +- .../v-next/outputv3/osmosis/epochs/query.ts | 8 +- .../gamm/pool-models/balancer/balancerPool.ts | 20 +- .../gamm/pool-models/balancer/tx/tx.ts | 6 +- .../pool-models/stableswap/stableswap_pool.ts | 16 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 14 +- .../outputv3/osmosis/gamm/v1beta1/genesis.ts | 6 +- .../outputv3/osmosis/gamm/v1beta1/query.ts | 54 ++-- .../outputv3/osmosis/gamm/v1beta1/tx.ts | 70 +++--- .../v-next/outputv3/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputv3/osmosis/incentives/gauge.ts | 8 +- .../outputv3/osmosis/incentives/genesis.ts | 8 +- .../outputv3/osmosis/incentives/params.ts | 4 +- .../outputv3/osmosis/incentives/query.ts | 24 +- .../v-next/outputv3/osmosis/incentives/tx.ts | 10 +- .../v-next/outputv3/osmosis/lockup/genesis.ts | 8 +- .../v-next/outputv3/osmosis/lockup/lock.ts | 12 +- .../v-next/outputv3/osmosis/lockup/params.ts | 2 +- .../v-next/outputv3/osmosis/lockup/query.ts | 58 ++--- .../v-next/outputv3/osmosis/lockup/tx.ts | 24 +- .../outputv3/osmosis/mint/v1beta1/mint.ts | 26 +- .../pool-incentives/v1beta1/genesis.ts | 2 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 14 +- .../pool-incentives/v1beta1/incentives.ts | 12 +- .../osmosis/pool-incentives/v1beta1/query.ts | 10 +- .../outputv3/osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputv3/osmosis/superfluid/genesis.ts | 8 +- .../outputv3/osmosis/superfluid/params.ts | 2 +- .../outputv3/osmosis/superfluid/query.ts | 76 +++--- .../outputv3/osmosis/superfluid/superfluid.ts | 24 +- .../v-next/outputv3/osmosis/superfluid/tx.ts | 30 +-- .../osmosis/superfluid/v1beta1/gov.ts | 22 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 4 +- .../osmosis/tokenfactory/v1beta1/params.ts | 2 +- .../osmosis/tokenfactory/v1beta1/query.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 18 +- .../outputv3/osmosis/twap/v1beta1/genesis.ts | 4 +- .../outputv3/osmosis/twap/v1beta1/query.ts | 14 +- .../osmosis/twap/v1beta1/twap_record.ts | 16 +- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 6 +- .../outputv3/osmosis/txfees/v1beta1/gov.ts | 4 +- .../outputv3/osmosis/txfees/v1beta1/query.ts | 16 +- .../v-next/outputv3/tendermint/abci/types.ts | 116 ++++----- .../outputv3/tendermint/crypto/proof.ts | 12 +- .../outputv3/tendermint/libs/bits/types.ts | 6 +- .../v-next/outputv3/tendermint/p2p/types.ts | 22 +- .../outputv3/tendermint/types/evidence.ts | 4 +- .../outputv3/tendermint/types/params.ts | 2 +- .../v-next/outputv3/tendermint/types/types.ts | 32 +-- .../outputv3/tendermint/types/validator.ts | 2 +- .../outputv3/tendermint/version/types.ts | 10 +- .../akash/audit/v1beta1/audit.amino.ts | 2 +- .../outputv4/akash/audit/v1beta1/audit.ts | 30 +-- .../akash/audit/v1beta2/audit.amino.ts | 2 +- .../outputv4/akash/audit/v1beta2/audit.ts | 30 +-- .../outputv4/akash/audit/v1beta2/genesis.ts | 2 +- .../outputv4/akash/audit/v1beta2/query.ts | 16 +- .../outputv4/akash/base/v1beta1/attribute.ts | 14 +- .../outputv4/akash/base/v1beta1/endpoint.ts | 4 +- .../outputv4/akash/base/v1beta1/resource.ts | 12 +- .../outputv4/akash/base/v1beta2/attribute.ts | 14 +- .../outputv4/akash/base/v1beta2/endpoint.ts | 6 +- .../outputv4/akash/base/v1beta2/resource.ts | 12 +- .../akash/base/v1beta2/resourceunits.ts | 4 +- .../outputv4/akash/cert/v1beta2/cert.amino.ts | 2 +- .../outputv4/akash/cert/v1beta2/cert.ts | 26 +- .../outputv4/akash/cert/v1beta2/genesis.ts | 6 +- .../outputv4/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 38 +-- .../akash/deployment/v1beta1/genesis.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 36 +-- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 18 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 22 +- .../akash/deployment/v1beta2/genesis.ts | 8 +- .../akash/deployment/v1beta2/group.ts | 12 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 6 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 6 +- .../akash/deployment/v1beta2/service.amino.ts | 68 ++--- .../outputv4/akash/escrow/v1beta1/genesis.ts | 4 +- .../outputv4/akash/escrow/v1beta1/query.ts | 24 +- .../outputv4/akash/escrow/v1beta1/types.ts | 34 +-- .../outputv4/akash/escrow/v1beta2/genesis.ts | 4 +- .../outputv4/akash/escrow/v1beta2/query.ts | 24 +- .../outputv4/akash/escrow/v1beta2/types.ts | 38 +-- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputv4/akash/market/v1beta2/bid.ts | 44 ++-- .../outputv4/akash/market/v1beta2/genesis.ts | 6 +- .../outputv4/akash/market/v1beta2/lease.ts | 42 ++-- .../outputv4/akash/market/v1beta2/order.ts | 30 +-- .../outputv4/akash/market/v1beta2/params.ts | 4 +- .../outputv4/akash/market/v1beta2/query.ts | 6 +- .../akash/market/v1beta2/service.amino.ts | 24 +- .../akash/provider/v1beta1/provider.amino.ts | 8 +- .../akash/provider/v1beta1/provider.ts | 30 +-- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.amino.ts | 8 +- .../akash/provider/v1beta2/provider.ts | 30 +-- .../outputv4/akash/provider/v1beta2/query.ts | 6 +- __fixtures__/v-next/outputv4/confio/proofs.ts | 46 ++-- .../outputv4/cosmos/app/v1alpha1/config.ts | 6 +- .../outputv4/cosmos/app/v1alpha1/module.ts | 14 +- .../outputv4/cosmos/auth/v1beta1/auth.ts | 22 +- .../outputv4/cosmos/auth/v1beta1/genesis.ts | 2 +- .../outputv4/cosmos/auth/v1beta1/query.ts | 14 +- .../outputv4/cosmos/authz/v1beta1/authz.ts | 8 +- .../outputv4/cosmos/authz/v1beta1/genesis.ts | 2 +- .../outputv4/cosmos/authz/v1beta1/query.ts | 18 +- .../outputv4/cosmos/authz/v1beta1/tx.amino.ts | 23 +- .../outputv4/cosmos/authz/v1beta1/tx.ts | 18 +- .../outputv4/cosmos/bank/v1beta1/authz.ts | 2 +- .../outputv4/cosmos/bank/v1beta1/bank.ts | 42 ++-- .../outputv4/cosmos/bank/v1beta1/genesis.ts | 12 +- .../outputv4/cosmos/bank/v1beta1/query.ts | 28 +-- .../outputv4/cosmos/bank/v1beta1/tx.amino.ts | 10 +- .../v-next/outputv4/cosmos/bank/v1beta1/tx.ts | 12 +- .../outputv4/cosmos/base/abci/v1beta1/abci.ts | 46 ++-- .../outputv4/cosmos/base/kv/v1beta1/kv.ts | 2 +- .../cosmos/base/query/v1beta1/pagination.ts | 4 +- .../base/reflection/v1beta1/reflection.ts | 8 +- .../base/reflection/v2alpha1/reflection.ts | 48 ++-- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 16 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/store/v1beta1/listening.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 44 ++-- .../outputv4/cosmos/base/v1beta1/coin.ts | 14 +- .../cosmos/capability/v1beta1/capability.ts | 10 +- .../cosmos/capability/v1beta1/genesis.ts | 8 +- .../outputv4/cosmos/crisis/v1beta1/tx.ts | 8 +- .../v-next/outputv4/cosmos/crypto/hd/v1/hd.ts | 12 +- .../cosmos/crypto/keyring/v1/record.ts | 6 +- .../outputv4/cosmos/crypto/multisig/keys.ts | 6 +- .../crypto/multisig/v1beta1/multisig.ts | 4 +- .../distribution/v1beta1/distribution.ts | 58 ++--- .../cosmos/distribution/v1beta1/genesis.ts | 44 ++-- .../cosmos/distribution/v1beta1/query.ts | 36 +-- .../cosmos/distribution/v1beta1/tx.amino.ts | 2 +- .../cosmos/distribution/v1beta1/tx.ts | 20 +- .../cosmos/evidence/v1beta1/evidence.ts | 2 +- .../cosmos/evidence/v1beta1/genesis.ts | 2 +- .../outputv4/cosmos/evidence/v1beta1/query.ts | 2 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 2 +- .../outputv4/cosmos/evidence/v1beta1/tx.ts | 4 +- .../cosmos/feegrant/v1beta1/feegrant.ts | 12 +- .../cosmos/feegrant/v1beta1/genesis.ts | 2 +- .../outputv4/cosmos/feegrant/v1beta1/query.ts | 14 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 2 +- .../outputv4/cosmos/feegrant/v1beta1/tx.ts | 10 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../v-next/outputv4/cosmos/gov/v1/genesis.ts | 10 +- .../v-next/outputv4/cosmos/gov/v1/gov.ts | 42 ++-- .../v-next/outputv4/cosmos/gov/v1/query.ts | 20 +- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 20 +- .../v-next/outputv4/cosmos/gov/v1/tx.ts | 34 +-- .../outputv4/cosmos/gov/v1beta1/genesis.ts | 10 +- .../v-next/outputv4/cosmos/gov/v1beta1/gov.ts | 42 ++-- .../outputv4/cosmos/gov/v1beta1/query.ts | 20 +- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 18 +- .../v-next/outputv4/cosmos/gov/v1beta1/tx.ts | 24 +- .../v-next/outputv4/cosmos/group/v1/events.ts | 10 +- .../outputv4/cosmos/group/v1/genesis.ts | 18 +- .../v-next/outputv4/cosmos/group/v1/query.ts | 46 ++-- .../outputv4/cosmos/group/v1/tx.amino.ts | 143 +++++------ .../v-next/outputv4/cosmos/group/v1/tx.ts | 82 +++--- .../v-next/outputv4/cosmos/group/v1/types.ts | 60 ++--- .../outputv4/cosmos/mint/v1beta1/mint.ts | 18 +- .../outputv4/cosmos/nft/v1beta1/event.ts | 22 +- .../outputv4/cosmos/nft/v1beta1/genesis.ts | 10 +- .../v-next/outputv4/cosmos/nft/v1beta1/nft.ts | 22 +- .../outputv4/cosmos/nft/v1beta1/query.ts | 32 +-- .../v-next/outputv4/cosmos/nft/v1beta1/tx.ts | 10 +- .../v-next/outputv4/cosmos/orm/v1/orm.ts | 18 +- .../outputv4/cosmos/orm/v1alpha1/schema.ts | 10 +- .../outputv4/cosmos/params/v1beta1/params.ts | 14 +- .../outputv4/cosmos/params/v1beta1/query.ts | 12 +- .../cosmos/slashing/v1beta1/genesis.ts | 16 +- .../outputv4/cosmos/slashing/v1beta1/query.ts | 6 +- .../cosmos/slashing/v1beta1/slashing.ts | 4 +- .../outputv4/cosmos/slashing/v1beta1/tx.ts | 2 +- .../outputv4/cosmos/staking/v1beta1/authz.ts | 6 +- .../cosmos/staking/v1beta1/genesis.ts | 18 +- .../outputv4/cosmos/staking/v1beta1/query.ts | 50 ++-- .../cosmos/staking/v1beta1/staking.ts | 96 +++---- .../cosmos/staking/v1beta1/tx.amino.ts | 14 +- .../outputv4/cosmos/staking/v1beta1/tx.ts | 28 +-- .../cosmos/tx/signing/v1beta1/signing.ts | 8 +- .../outputv4/cosmos/tx/v1beta1/service.ts | 18 +- .../v-next/outputv4/cosmos/tx/v1beta1/tx.ts | 40 +-- .../outputv4/cosmos/upgrade/v1beta1/query.ts | 14 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 19 +- .../outputv4/cosmos/upgrade/v1beta1/tx.ts | 6 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 14 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 14 +- .../outputv4/cosmos/vesting/v1beta1/tx.ts | 26 +- .../cosmos/vesting/v1beta1/vesting.ts | 20 +- .../v-next/outputv4/cosmos_proto/cosmos.ts | 16 +- .../outputv4/cosmwasm/wasm/v1/genesis.ts | 14 +- .../v-next/outputv4/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputv4/cosmwasm/wasm/v1/proposal.ts | 72 +++--- .../v-next/outputv4/cosmwasm/wasm/v1/query.ts | 28 +-- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 20 +- .../v-next/outputv4/cosmwasm/wasm/v1/tx.ts | 32 +-- .../v-next/outputv4/cosmwasm/wasm/v1/types.ts | 28 +-- .../v-next/outputv4/evmos/claims/v1/claims.ts | 18 +- .../outputv4/evmos/claims/v1/genesis.ts | 10 +- .../v-next/outputv4/evmos/claims/v1/query.ts | 12 +- .../outputv4/evmos/epochs/v1/genesis.ts | 6 +- .../v-next/outputv4/evmos/epochs/v1/query.ts | 8 +- .../v-next/outputv4/evmos/erc20/v1/erc20.ts | 26 +- .../v-next/outputv4/evmos/erc20/v1/genesis.ts | 8 +- .../v-next/outputv4/evmos/erc20/v1/query.ts | 6 +- .../outputv4/evmos/erc20/v1/tx.amino.ts | 2 +- .../v-next/outputv4/evmos/erc20/v1/tx.ts | 14 +- .../v-next/outputv4/evmos/fees/v1/fees.ts | 8 +- .../v-next/outputv4/evmos/fees/v1/genesis.ts | 14 +- .../v-next/outputv4/evmos/fees/v1/query.ts | 10 +- .../v-next/outputv4/evmos/fees/v1/tx.amino.ts | 2 +- .../v-next/outputv4/evmos/fees/v1/tx.ts | 20 +- .../outputv4/evmos/incentives/v1/genesis.ts | 14 +- .../evmos/incentives/v1/incentives.ts | 26 +- .../outputv4/evmos/incentives/v1/query.ts | 20 +- .../outputv4/evmos/inflation/v1/genesis.ts | 14 +- .../outputv4/evmos/inflation/v1/inflation.ts | 16 +- .../outputv4/evmos/inflation/v1/query.ts | 8 +- .../outputv4/evmos/recovery/v1/genesis.ts | 4 +- .../v-next/outputv4/evmos/vesting/v1/query.ts | 10 +- .../outputv4/evmos/vesting/v1/tx.amino.ts | 12 +- .../v-next/outputv4/evmos/vesting/v1/tx.ts | 16 +- .../outputv4/evmos/vesting/v1/vesting.ts | 6 +- .../v-next/outputv4/google/api/auth.ts | 36 +-- .../v-next/outputv4/google/api/backend.ts | 22 +- .../v-next/outputv4/google/api/billing.ts | 8 +- .../outputv4/google/api/config_change.ts | 14 +- .../v-next/outputv4/google/api/consumer.ts | 10 +- .../v-next/outputv4/google/api/context.ts | 14 +- .../v-next/outputv4/google/api/control.ts | 4 +- .../outputv4/google/api/distribution.ts | 30 +-- .../outputv4/google/api/documentation.ts | 26 +- .../v-next/outputv4/google/api/endpoint.ts | 10 +- .../v1alpha1/conformance_service.ts | 28 +-- .../google/api/expr/v1alpha1/checked.ts | 48 ++-- .../outputv4/google/api/expr/v1alpha1/eval.ts | 14 +- .../google/api/expr/v1alpha1/explain.ts | 10 +- .../google/api/expr/v1alpha1/syntax.ts | 48 ++-- .../google/api/expr/v1alpha1/value.ts | 20 +- .../outputv4/google/api/expr/v1beta1/decl.ts | 18 +- .../outputv4/google/api/expr/v1beta1/eval.ts | 14 +- .../outputv4/google/api/expr/v1beta1/expr.ts | 38 +-- .../google/api/expr/v1beta1/source.ts | 18 +- .../outputv4/google/api/expr/v1beta1/value.ts | 20 +- .../v-next/outputv4/google/api/http.ts | 28 +-- .../v-next/outputv4/google/api/httpbody.ts | 4 +- .../v-next/outputv4/google/api/label.ts | 8 +- .../v-next/outputv4/google/api/log.ts | 10 +- .../v-next/outputv4/google/api/logging.ts | 10 +- .../v-next/outputv4/google/api/metric.ts | 36 +-- .../outputv4/google/api/monitored_resource.ts | 24 +- .../v-next/outputv4/google/api/monitoring.ts | 10 +- .../v-next/outputv4/google/api/quota.ts | 34 +-- .../v-next/outputv4/google/api/resource.ts | 24 +- .../v-next/outputv4/google/api/routing.ts | 8 +- .../v-next/outputv4/google/api/service.ts | 24 +- .../api/servicecontrol/v1/check_error.ts | 8 +- .../api/servicecontrol/v1/distribution.ts | 30 +-- .../api/servicecontrol/v1/http_request.ts | 30 +-- .../google/api/servicecontrol/v1/log_entry.ts | 28 +-- .../api/servicecontrol/v1/metric_value.ts | 14 +- .../google/api/servicecontrol/v1/operation.ts | 20 +- .../api/servicecontrol/v1/quota_controller.ts | 36 +-- .../servicecontrol/v1/service_controller.ts | 32 +-- .../servicecontrol/v2/service_controller.ts | 30 +-- .../api/servicemanagement/v1/resources.ts | 52 ++-- .../servicemanagement/v1/servicemanager.ts | 68 ++--- .../google/api/serviceusage/v1/resources.ts | 20 +- .../api/serviceusage/v1/serviceusage.ts | 42 ++-- .../api/serviceusage/v1beta1/resources.ts | 78 +++--- .../api/serviceusage/v1beta1/serviceusage.ts | 164 ++++++------ .../v-next/outputv4/google/api/source_info.ts | 2 +- .../outputv4/google/api/system_parameter.ts | 14 +- .../v-next/outputv4/google/api/usage.ts | 14 +- .../v-next/outputv4/google/api/visibility.ts | 8 +- .../google/logging/type/http_request.ts | 30 +-- .../outputv4/google/logging/v2/log_entry.ts | 38 +-- .../outputv4/google/logging/v2/logging.ts | 64 ++--- .../google/logging/v2/logging_config.ts | 174 ++++++------- .../google/logging/v2/logging_metrics.ts | 36 +-- .../outputv4/google/longrunning/operations.ts | 30 +-- .../v-next/outputv4/google/protobuf/any.ts | 2 +- .../v-next/outputv4/google/protobuf/api.ts | 34 +-- .../google/protobuf/compiler/plugin.ts | 26 +- .../outputv4/google/protobuf/descriptor.ts | 234 +++++++++--------- .../outputv4/google/protobuf/duration.ts | 2 +- .../outputv4/google/protobuf/field_mask.ts | 2 +- .../google/protobuf/source_context.ts | 4 +- .../v-next/outputv4/google/protobuf/struct.ts | 14 +- .../outputv4/google/protobuf/timestamp.ts | 2 +- .../v-next/outputv4/google/protobuf/type.ts | 54 ++-- .../outputv4/google/protobuf/wrappers.ts | 18 +- .../google/rpc/context/attribute_context.ts | 74 +++--- .../outputv4/google/rpc/error_details.ts | 56 ++--- .../v-next/outputv4/google/rpc/status.ts | 8 +- .../ibc/applications/transfer/v1/genesis.ts | 6 +- .../ibc/applications/transfer/v1/query.ts | 6 +- .../ibc/applications/transfer/v1/transfer.ts | 10 +- .../ibc/applications/transfer/v1/tx.amino.ts | 4 +- .../ibc/applications/transfer/v1/tx.ts | 12 +- .../ibc/applications/transfer/v2/packet.ts | 10 +- .../outputv4/ibc/core/channel/v1/channel.ts | 46 ++-- .../outputv4/ibc/core/channel/v1/genesis.ts | 24 +- .../outputv4/ibc/core/channel/v1/query.ts | 68 ++--- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 44 ++-- .../v-next/outputv4/ibc/core/channel/v1/tx.ts | 48 ++-- .../outputv4/ibc/core/client/v1/client.ts | 26 +- .../outputv4/ibc/core/client/v1/genesis.ts | 16 +- .../outputv4/ibc/core/client/v1/query.ts | 22 +- .../outputv4/ibc/core/client/v1/tx.amino.ts | 12 +- .../v-next/outputv4/ibc/core/client/v1/tx.ts | 14 +- .../ibc/core/commitment/v1/commitment.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 32 +-- .../ibc/core/connection/v1/genesis.ts | 8 +- .../outputv4/ibc/core/connection/v1/query.ts | 14 +- .../ibc/core/connection/v1/tx.amino.ts | 22 +- .../outputv4/ibc/core/connection/v1/tx.ts | 22 +- .../v-next/outputv4/ibc/core/port/v1/query.ts | 14 +- .../lightclients/localhost/v1/localhost.ts | 4 +- .../solomachine/v1/solomachine.ts | 20 +- .../solomachine/v2/solomachine.ts | 22 +- .../lightclients/tendermint/v1/tendermint.ts | 12 +- .../outputv4/osmosis/claim/v1beta1/claim.ts | 8 +- .../outputv4/osmosis/claim/v1beta1/genesis.ts | 2 +- .../outputv4/osmosis/claim/v1beta1/params.ts | 2 +- .../outputv4/osmosis/claim/v1beta1/query.ts | 16 +- .../v-next/outputv4/osmosis/epochs/genesis.ts | 6 +- .../v-next/outputv4/osmosis/epochs/query.ts | 8 +- .../gamm/pool-models/balancer/balancerPool.ts | 20 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 33 +-- .../gamm/pool-models/balancer/tx/tx.ts | 10 +- .../pool-models/stableswap/stableswap_pool.ts | 18 +- .../gamm/pool-models/stableswap/tx.amino.ts | 10 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 20 +- .../outputv4/osmosis/gamm/v1beta1/genesis.ts | 8 +- .../outputv4/osmosis/gamm/v1beta1/query.ts | 78 +++--- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 32 +-- .../outputv4/osmosis/gamm/v1beta1/tx.ts | 88 +++---- .../v-next/outputv4/osmosis/gamm/v2/query.ts | 10 +- .../osmosis/ibc-rate-limit/v1beta1/params.ts | 4 +- .../outputv4/osmosis/incentives/gauge.ts | 8 +- .../outputv4/osmosis/incentives/genesis.ts | 8 +- .../outputv4/osmosis/incentives/params.ts | 4 +- .../outputv4/osmosis/incentives/query.ts | 30 +-- .../outputv4/osmosis/incentives/tx.amino.ts | 14 +- .../v-next/outputv4/osmosis/incentives/tx.ts | 10 +- .../v-next/outputv4/osmosis/lockup/genesis.ts | 8 +- .../v-next/outputv4/osmosis/lockup/lock.ts | 12 +- .../v-next/outputv4/osmosis/lockup/params.ts | 2 +- .../v-next/outputv4/osmosis/lockup/query.ts | 58 ++--- .../outputv4/osmosis/lockup/tx.amino.ts | 16 +- .../v-next/outputv4/osmosis/lockup/tx.ts | 34 +-- .../outputv4/osmosis/mint/v1beta1/genesis.ts | 4 +- .../outputv4/osmosis/mint/v1beta1/mint.ts | 30 +-- .../pool-incentives/v1beta1/genesis.ts | 2 +- .../osmosis/pool-incentives/v1beta1/gov.ts | 14 +- .../pool-incentives/v1beta1/incentives.ts | 20 +- .../osmosis/pool-incentives/v1beta1/query.ts | 20 +- .../outputv4/osmosis/sumtree/v1beta1/tree.ts | 4 +- .../outputv4/osmosis/superfluid/genesis.ts | 8 +- .../outputv4/osmosis/superfluid/params.ts | 2 +- .../outputv4/osmosis/superfluid/query.ts | 76 +++--- .../outputv4/osmosis/superfluid/superfluid.ts | 24 +- .../outputv4/osmosis/superfluid/tx.amino.ts | 10 +- .../v-next/outputv4/osmosis/superfluid/tx.ts | 30 +-- .../osmosis/superfluid/v1beta1/gov.ts | 22 +- .../tokenfactory/v1beta1/authorityMetadata.ts | 4 +- .../osmosis/tokenfactory/v1beta1/genesis.ts | 6 +- .../osmosis/tokenfactory/v1beta1/params.ts | 2 +- .../osmosis/tokenfactory/v1beta1/query.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 8 +- .../osmosis/tokenfactory/v1beta1/tx.ts | 20 +- .../outputv4/osmosis/twap/v1beta1/genesis.ts | 6 +- .../outputv4/osmosis/twap/v1beta1/query.ts | 14 +- .../osmosis/twap/v1beta1/twap_record.ts | 16 +- .../osmosis/txfees/v1beta1/feetoken.ts | 6 +- .../osmosis/txfees/v1beta1/genesis.ts | 6 +- .../outputv4/osmosis/txfees/v1beta1/gov.ts | 6 +- .../outputv4/osmosis/txfees/v1beta1/query.ts | 16 +- .../v-next/outputv4/tendermint/abci/types.ts | 116 ++++----- .../outputv4/tendermint/crypto/proof.ts | 12 +- .../outputv4/tendermint/libs/bits/types.ts | 6 +- .../v-next/outputv4/tendermint/p2p/types.ts | 22 +- .../outputv4/tendermint/types/evidence.ts | 4 +- .../outputv4/tendermint/types/params.ts | 20 +- .../v-next/outputv4/tendermint/types/types.ts | 32 +-- .../outputv4/tendermint/types/validator.ts | 12 +- .../outputv4/tendermint/version/types.ts | 10 +- .../__snapshots__/encode.test.ts.snap | 2 +- .../__snapshots__/object.spec.ts.snap | 166 +++++++------ .../authz.timestamp.test.ts.snap | 12 +- .../__snapshots__/cosmwasm.test.ts.snap | 20 +- .../__snapshots__/duration.gov.test.ts.snap | 4 +- .../__snapshots__/lockup.test.ts.snap | 16 +- .../__snapshots__/misc.overall.test.ts.snap | 24 +- .../__snapshots__/tendermint.test.ts.snap | 76 +++--- .../amino-converter.spec.ts.snap | 48 ++-- .../__snapshots__/nested-enums.test.ts.snap | 4 +- .../super-nested-enums.test.ts.snap | 14 +- .../__tests__/__snapshots__/vote.test.ts.snap | 18 +- .../interfaces-amino.test.ts.snap | 26 +- .../__snapshots__/contracts.test.ts.snap | 6 +- .../interface-decoder.test.ts.snap | 2 +- .../interface-from-amino.test.ts.snap | 6 +- packages/telescope/types/cmds.d.ts | 6 +- 2142 files changed, 23162 insertions(+), 22980 deletions(-) diff --git a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts index fd817b11f3..700d622d0f 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts @@ -120,7 +120,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts index 6a9799f3a3..3870f51660 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/authz.ts @@ -312,7 +312,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -482,7 +482,7 @@ export const Grant = { message.expiration = fromTimestamp(Timestamp.fromAmino(object.expiration)); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.single_msg !== undefined && object.single_msg !== null) { message.singleMsg = Any.fromAmino(object.single_msg); @@ -494,12 +494,12 @@ export const Grant = { const obj: any = {}; obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; - obj.opt = voteOptionToJSON(message.opt); + obj.opt = message.opt === 0 ? undefined : message.opt; obj.single_msg = message.singleMsg ? Any.toAmino(message.singleMsg) : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -656,8 +656,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? GlobalDecoderRegistry.toAminoMsg(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -774,7 +774,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, @@ -890,7 +890,7 @@ export const Grants = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts index 1222b7ea17..5f5006af35 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/authz.ts @@ -126,7 +126,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts index 01664a6a69..685f4711d7 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts @@ -256,19 +256,19 @@ export const MsgInstantiateContract2 = { toAmino(message: MsgInstantiateContract2): MsgInstantiateContract2Amino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.fix_msg = message.fixMsg; - obj.dont_omitempty_fix_msg = message.dontOmitemptyFixMsg ?? false; + obj.fix_msg = message.fixMsg === false ? undefined : message.fixMsg; + obj.dont_omitempty_fix_msg = message.dontOmitemptyFixMsg === false ? undefined : message.dontOmitemptyFixMsg; if (message.aListOfBytes) { obj.a_list_of_bytes = message.aListOfBytes.map(e => base64FromBytes(e)); } else { - obj.a_list_of_bytes = []; + obj.a_list_of_bytes = message.aListOfBytes; } return obj; }, diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts index 5b7c368a3c..ea32198f46 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/base/v1beta1/coin.ts @@ -213,8 +213,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -336,8 +336,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -443,7 +443,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -549,7 +549,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts index 9bc03201f1..dcef5229e6 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos_proto/cosmos.ts @@ -270,8 +270,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -411,17 +411,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts index de66a2bd1b..0506edbebc 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts @@ -2285,7 +2285,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2624,46 +2624,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2955,47 +2955,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3128,8 +3128,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3244,8 +3244,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3352,7 +3352,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3570,10 +3570,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3597,15 +3597,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3722,7 +3722,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3905,22 +3905,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -4035,8 +4035,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -4168,8 +4168,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4308,11 +4308,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4494,12 +4494,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4874,7 +4874,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4923,30 +4923,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5115,14 +5115,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5301,13 +5301,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5323,16 +5323,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5440,7 +5440,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5577,12 +5577,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5703,11 +5703,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5828,11 +5828,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5962,19 +5962,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -6182,14 +6182,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -6303,8 +6303,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -6411,7 +6411,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6613,19 +6613,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6733,7 +6733,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6898,11 +6898,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts b/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts index 09715db4dc..eb9d77b6fa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/api/expr/v1alpha1/eval.ts @@ -127,7 +127,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -226,7 +226,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts index 22f19ae85f..31c34d0cb8 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts @@ -2285,7 +2285,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2624,46 +2624,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2955,47 +2955,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3128,8 +3128,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3244,8 +3244,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3352,7 +3352,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3570,10 +3570,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3597,15 +3597,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3722,7 +3722,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3905,22 +3905,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -4035,8 +4035,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -4168,8 +4168,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4308,11 +4308,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4494,12 +4494,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4874,7 +4874,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4923,30 +4923,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5115,14 +5115,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5301,13 +5301,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5323,16 +5323,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5440,7 +5440,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5577,12 +5577,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5703,11 +5703,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5828,11 +5828,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5962,19 +5962,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -6182,14 +6182,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -6303,8 +6303,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -6411,7 +6411,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6613,19 +6613,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6733,7 +6733,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6898,11 +6898,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts index ee761ba99c..429296cd37 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts @@ -485,7 +485,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -585,7 +585,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -911,16 +911,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -1019,7 +1019,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -1118,7 +1118,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -2041,10 +2041,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -2074,8 +2074,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -2086,124 +2086,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : { - type: "", - value: {} - }; + obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts index 397ad917fc..4a1a836a78 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/api/expr/v1alpha1/eval.ts @@ -127,7 +127,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -226,7 +226,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts index de66a2bd1b..0506edbebc 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts @@ -2285,7 +2285,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2624,46 +2624,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2955,47 +2955,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3128,8 +3128,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3244,8 +3244,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3352,7 +3352,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3570,10 +3570,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3597,15 +3597,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3722,7 +3722,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3905,22 +3905,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -4035,8 +4035,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -4168,8 +4168,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4308,11 +4308,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4494,12 +4494,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4874,7 +4874,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4923,30 +4923,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5115,14 +5115,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5301,13 +5301,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5323,16 +5323,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5440,7 +5440,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5577,12 +5577,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5703,11 +5703,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5828,11 +5828,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5962,19 +5962,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -6182,14 +6182,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -6303,8 +6303,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -6411,7 +6411,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6613,19 +6613,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6733,7 +6733,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6898,11 +6898,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts index fb3b4d40b5..ea254726b2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts @@ -485,7 +485,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -585,7 +585,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -911,16 +911,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -1019,7 +1019,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -1118,7 +1118,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -2041,10 +2041,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -2074,8 +2074,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -2086,124 +2086,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : { - type: "", - value: {} - }; + obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts index 45afde766e..6902943167 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/api/expr/v1alpha1/eval.ts @@ -117,7 +117,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -206,7 +206,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts index e5dcec163d..951a8fee11 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts @@ -2275,7 +2275,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2604,46 +2604,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2925,47 +2925,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3088,8 +3088,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3194,8 +3194,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3292,7 +3292,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3500,10 +3500,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3527,15 +3527,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3642,7 +3642,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3815,22 +3815,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3935,8 +3935,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -4058,8 +4058,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4188,11 +4188,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4364,12 +4364,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4734,7 +4734,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4783,30 +4783,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4965,14 +4965,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5141,13 +5141,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5163,16 +5163,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5270,7 +5270,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5397,12 +5397,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5513,11 +5513,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5628,11 +5628,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5752,19 +5752,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5962,14 +5962,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -6073,8 +6073,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -6171,7 +6171,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6363,19 +6363,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6473,7 +6473,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6628,11 +6628,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts index 8ada712b56..ff2ca6fed1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts @@ -474,7 +474,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -574,7 +574,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -891,16 +891,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -989,7 +989,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -1077,7 +1077,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -1990,10 +1990,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -2023,8 +2023,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -2035,121 +2035,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.fromPartial({}); + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts index 45afde766e..6902943167 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/api/expr/v1alpha1/eval.ts @@ -117,7 +117,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -206,7 +206,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts index e5dcec163d..951a8fee11 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts @@ -2275,7 +2275,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2604,46 +2604,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2925,47 +2925,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3088,8 +3088,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3194,8 +3194,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3292,7 +3292,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3500,10 +3500,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3527,15 +3527,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3642,7 +3642,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3815,22 +3815,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3935,8 +3935,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -4058,8 +4058,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4188,11 +4188,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4364,12 +4364,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4734,7 +4734,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4783,30 +4783,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4965,14 +4965,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5141,13 +5141,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5163,16 +5163,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5270,7 +5270,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5397,12 +5397,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5513,11 +5513,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5628,11 +5628,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5752,19 +5752,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5962,14 +5962,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -6073,8 +6073,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -6171,7 +6171,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6363,19 +6363,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6473,7 +6473,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6628,11 +6628,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts index 8ada712b56..ff2ca6fed1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts @@ -474,7 +474,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -574,7 +574,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -891,16 +891,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -989,7 +989,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -1077,7 +1077,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -1990,10 +1990,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -2023,8 +2023,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -2035,121 +2035,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.fromPartial({}); + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts index f5355ec6be..2ac91133b4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/api/expr/v1alpha1/eval.ts @@ -109,7 +109,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -195,7 +195,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromProtoMsg(message: IdRefProtoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts index 57582beaf0..ffe9d1ccee 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts @@ -2167,7 +2167,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2493,46 +2493,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromProtoMsg(message: FileDescriptorProtoProtoMsg): FileDescriptorProto { @@ -2811,47 +2811,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2971,8 +2971,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3074,8 +3074,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromProtoMsg(message: DescriptorProto_ReservedRangeProtoMsg): DescriptorProto_ReservedRange { @@ -3169,7 +3169,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3374,10 +3374,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3401,15 +3401,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3513,7 +3513,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3683,22 +3683,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3800,8 +3800,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromProtoMsg(message: EnumDescriptorProto_EnumReservedRangeProtoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3920,8 +3920,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4047,11 +4047,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4220,12 +4220,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromProtoMsg(message: MethodDescriptorProtoProtoMsg): MethodDescriptorProto { @@ -4587,7 +4587,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4636,30 +4636,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4815,14 +4815,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4988,13 +4988,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5010,16 +5010,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5114,7 +5114,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5238,12 +5238,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5351,11 +5351,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5463,11 +5463,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5584,19 +5584,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5791,14 +5791,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromProtoMsg(message: UninterpretedOptionProtoMsg): UninterpretedOption { @@ -5899,8 +5899,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromProtoMsg(message: UninterpretedOption_NamePartProtoMsg): UninterpretedOption_NamePart { @@ -5994,7 +5994,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6183,19 +6183,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6290,7 +6290,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6442,11 +6442,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromProtoMsg(message: GeneratedCodeInfo_AnnotationProtoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts index e6b5c8db3e..2ccc57254c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts @@ -450,7 +450,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -547,7 +547,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -861,16 +861,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -956,7 +956,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromProtoMsg(message: AccessConfigProtoMsg): AccessConfig { @@ -1041,7 +1041,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromProtoMsg(message: GenericAuthorizationProtoMsg): GenericAuthorization { @@ -1951,10 +1951,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -1984,8 +1984,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -1996,121 +1996,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.fromPartial({}); + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts index 23b7e7ea73..50b92187a5 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/api/expr/v1alpha1/eval.ts @@ -101,7 +101,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -190,7 +190,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts index f02444ccbc..69375952f9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts @@ -1464,7 +1464,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -1793,46 +1793,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2114,47 +2114,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2277,8 +2277,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2383,8 +2383,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2481,7 +2481,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -2689,10 +2689,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -2716,15 +2716,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2831,7 +2831,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3004,22 +3004,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3124,8 +3124,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3247,8 +3247,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3377,11 +3377,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -3553,12 +3553,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3923,7 +3923,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -3972,30 +3972,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4154,14 +4154,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4330,13 +4330,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4352,16 +4352,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4459,7 +4459,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4586,12 +4586,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4702,11 +4702,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4817,11 +4817,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4941,19 +4941,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5151,14 +5151,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5262,8 +5262,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5360,7 +5360,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -5552,19 +5552,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -5662,7 +5662,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -5817,11 +5817,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts index a66642176d..a65efe04e9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts @@ -348,7 +348,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -448,7 +448,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -765,16 +765,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -863,7 +863,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -951,7 +951,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -1864,10 +1864,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -1897,8 +1897,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -1909,121 +1909,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.fromPartial({}); + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts index 23b7e7ea73..50b92187a5 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/api/expr/v1alpha1/eval.ts @@ -101,7 +101,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -190,7 +190,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts index f02444ccbc..69375952f9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts @@ -1464,7 +1464,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -1793,46 +1793,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2114,47 +2114,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2277,8 +2277,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2383,8 +2383,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2481,7 +2481,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -2689,10 +2689,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -2716,15 +2716,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2831,7 +2831,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3004,22 +3004,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3124,8 +3124,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3247,8 +3247,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3377,11 +3377,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -3553,12 +3553,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3923,7 +3923,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -3972,30 +3972,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4154,14 +4154,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4330,13 +4330,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4352,16 +4352,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4459,7 +4459,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4586,12 +4586,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4702,11 +4702,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4817,11 +4817,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4941,19 +4941,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5151,14 +5151,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5262,8 +5262,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5360,7 +5360,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -5552,19 +5552,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -5662,7 +5662,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -5817,11 +5817,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts b/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts index a66642176d..a65efe04e9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts @@ -348,7 +348,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -448,7 +448,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -765,16 +765,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -863,7 +863,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -951,7 +951,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -1864,10 +1864,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -1897,8 +1897,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -1909,121 +1909,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.fromPartial({}); + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts b/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts index f543940f26..6902943167 100644 --- a/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/misc/output/google/api/expr/v1alpha1/eval.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; export interface ExprValue { /** The ids of the expressions with unknown values. */ @@ -117,7 +117,7 @@ export const ExprValue = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -206,7 +206,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/misc/output/google/protobuf/descriptor.ts b/__fixtures__/misc/output/google/protobuf/descriptor.ts index e5dcec163d..951a8fee11 100644 --- a/__fixtures__/misc/output/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output/google/protobuf/descriptor.ts @@ -2275,7 +2275,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2604,46 +2604,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2925,47 +2925,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3088,8 +3088,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3194,8 +3194,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3292,7 +3292,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3500,10 +3500,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3527,15 +3527,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3642,7 +3642,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3815,22 +3815,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3935,8 +3935,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -4058,8 +4058,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4188,11 +4188,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4364,12 +4364,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4734,7 +4734,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4783,30 +4783,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4965,14 +4965,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5141,13 +5141,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5163,16 +5163,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5270,7 +5270,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5397,12 +5397,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5513,11 +5513,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5628,11 +5628,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5752,19 +5752,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5962,14 +5962,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -6073,8 +6073,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -6171,7 +6171,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6363,19 +6363,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6473,7 +6473,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6628,11 +6628,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/misc/output/misc/eval_request.ts b/__fixtures__/misc/output/misc/eval_request.ts index 8ada712b56..ff2ca6fed1 100644 --- a/__fixtures__/misc/output/misc/eval_request.ts +++ b/__fixtures__/misc/output/misc/eval_request.ts @@ -474,7 +474,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -574,7 +574,7 @@ export const EvalRequest_RefsEntry = { }, toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? IdRef.toAmino(message.value) : undefined; return obj; }, @@ -891,16 +891,16 @@ export const EvalRequest = { obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -989,7 +989,7 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -1077,7 +1077,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -1990,10 +1990,10 @@ export const AminoEncodingTest = { message.dOWasm = fromBase64(object.d_o_wasm); } if (object.opt !== undefined && object.opt !== null) { - message.opt = voteOptionFromJSON(object.opt); + message.opt = object.opt; } if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = voteOptionFromJSON(object.d_o_opt); + message.dOOpt = object.d_o_opt; } if (object.period !== undefined && object.period !== null) { message.period = Duration.fromAmino(object.period); @@ -2023,8 +2023,8 @@ export const AminoEncodingTest = { message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; message.wasms = object.wasms?.map(e => fromBase64(e)) || []; message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => voteOptionFromJSON(e)) || []; - message.dOOpts = object.d_o_opts?.map(e => voteOptionFromJSON(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; @@ -2035,121 +2035,121 @@ export const AminoEncodingTest = { }, toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr ?? ""; - obj.b = message.b; - obj.d_o_b = message.dOB ?? false; - obj.num = message.num; - obj.d_o_num = message.dONum ?? 0; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.fromPartial({}); + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.fromPartial({}); + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; - obj.opt = voteOptionToJSON(message.opt); - obj.d_o_opt = voteOptionToJSON(message.dOOpt); + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.fromPartial({}); + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); } else { - obj.nums = []; + obj.nums = message.nums; } if (message.dONums) { obj.d_o_nums = message.dONums.map(e => e); } else { - obj.d_o_nums = []; + obj.d_o_nums = message.dONums; } if (message.bigs) { obj.bigs = message.bigs.map(e => e.toString()); } else { - obj.bigs = []; + obj.bigs = message.bigs; } if (message.dOBigs) { obj.d_o_bigs = message.dOBigs.map(e => e.toString()); } else { - obj.d_o_bigs = []; + obj.d_o_bigs = message.dOBigs; } if (message.salts) { obj.salts = message.salts.map(e => base64FromBytes(e)); } else { - obj.salts = []; + obj.salts = message.salts; } if (message.dOSalts) { obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); } else { - obj.d_o_salts = []; + obj.d_o_salts = message.dOSalts; } if (message.raws) { obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.raws = []; + obj.raws = message.raws; } if (message.dORaws) { obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); } else { - obj.d_o_raws = []; + obj.d_o_raws = message.dORaws; } if (message.wasms) { obj.wasms = message.wasms.map(e => toBase64(e)); } else { - obj.wasms = []; + obj.wasms = message.wasms; } if (message.dOWasms) { obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); } else { - obj.d_o_wasms = []; + obj.d_o_wasms = message.dOWasms; } if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); + obj.opts = message.opts.map(e => e); } else { - obj.opts = []; + obj.opts = message.opts; } if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + obj.d_o_opts = message.dOOpts.map(e => e); } else { - obj.d_o_opts = []; + obj.d_o_opts = message.dOOpts; } if (message.periods) { obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.periods = []; + obj.periods = message.periods; } if (message.dOPeriods) { obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.d_o_periods = []; + obj.d_o_periods = message.dOPeriods; } if (message.protos) { obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.protos = []; + obj.protos = message.protos; } if (message.dOProtos) { obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); } else { - obj.d_o_protos = []; + obj.d_o_protos = message.dOProtos; } if (message.auths) { obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.auths = []; + obj.auths = message.auths; } if (message.dOAuths) { obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.d_o_auths = []; + obj.d_o_auths = message.dOAuths; } return obj; }, diff --git a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts index 533d7261bf..1672cbeb5a 100644 --- a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts @@ -47,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts index e6f7269391..b2d09362e5 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts @@ -47,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts index 3d90abcb1e..97a159b755 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: { + id: id == null ? id : { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index f4bd20ab61..516a2bdcb8 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -230,66 +230,66 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq) + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) }, - groups: groups.map(el0 => ({ + groups: groups.map?.(el0 => ({ name: el0.name, - requirements: { - signedBy: { + requirements: el0.requirements == null ? el0.requirements : { + signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map(el2 => ({ + attributes: el0.requirements.attributes.map?.(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map(el1 => ({ - resources: { - cpu: { - units: { + resources: el0.resources.map?.(el1 => ({ + resources: el1.resources == null ? el1.resources : { + cpu: el1.resources.cpu == null ? el1.resources.cpu : { + units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map(el4 => ({ + attributes: el1.resources.cpu.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - memory: { - quantity: { + memory: el1.resources.memory == null ? el1.resources.memory : { + quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map(el4 => ({ + attributes: el1.resources.memory.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map(el3 => ({ + storage: el1.resources.storage.map?.(el3 => ({ name: el3.name, - quantity: { + quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map(el4 => ({ + attributes: el3.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map(el3 => ({ - kind: endpoint_KindFromJSON(el3.kind), + endpoints: el1.resources.endpoints.map?.(el3 => ({ + kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: { + price: el1.price == null ? el1.price : { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount }, @@ -322,11 +322,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq) + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) }, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount }, @@ -353,9 +353,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq) + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) }, version }; @@ -377,9 +377,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq) + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) } }; } @@ -401,9 +401,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq), + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq), gseq: id.gseq } }; @@ -426,9 +426,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq), + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq), gseq: id.gseq } }; @@ -451,9 +451,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: Long.fromString(id.dseq), + dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts index eb9e615abf..5e862bbd0e 100644 --- a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts @@ -107,18 +107,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: { + order: order == null ? order : { owner: order.owner, - dseq: Long.fromString(order.dseq), + dseq: order.dseq == null ? order.dseq : Long.fromString(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: { + price: price == null ? price : { denom: price.denom, amount: price.amount }, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount } @@ -144,9 +144,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: Long.fromString(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : Long.fromString(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -173,9 +173,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: Long.fromString(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : Long.fromString(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -202,9 +202,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: Long.fromString(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : Long.fromString(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -231,9 +231,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: { + leaseId: lease_id == null ? lease_id : { owner: lease_id.owner, - dseq: Long.fromString(lease_id.dseq), + dseq: lease_id.dseq == null ? lease_id.dseq : Long.fromString(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts index 831b4eea3c..3ee12d22c8 100644 --- a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts @@ -70,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -111,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } diff --git a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts index d90c974036..8a038a1507 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts @@ -70,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -111,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts index b035d8f4ff..9653f58093 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrant"; @@ -43,11 +44,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -62,8 +63,8 @@ export const AminoConverter = { return { granter, grantee, - grant: { - authorization: { + grant: grant == null ? grant : { + authorization: grant.authorization == null ? grant.authorization : { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, @@ -79,9 +80,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -92,7 +93,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map(el0 => ({ + msgs: msgs.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })) @@ -107,9 +108,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts index 91e06445ec..a675254230 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -93,16 +93,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map(el0 => ({ + inputs: inputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map(el0 => ({ + outputs: outputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts index 05a4e031f8..86be0e8941 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts @@ -111,7 +111,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts index 4abb8bc814..6d45f73942 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts @@ -33,7 +33,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: { + evidence: evidence == null ? evidence : { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts index 08792b032d..ae2e63181f 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: { + allowance: allowance == null ? allowance : { typeUrl: allowance.type_url, value: allowance.value } diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index 53691f39c9..4f3065eeea 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -90,11 +90,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -122,7 +122,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, @@ -152,9 +152,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata }; } @@ -184,10 +184,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -216,9 +216,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index e6a1cde8ff..83c716487c 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -74,11 +74,11 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -105,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - option: voteOptionFromJSON(option) + option: option == null ? option : voteOptionFromJSON(option) }; } }, @@ -133,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -164,9 +164,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index 7bdef57235..f6958c5b76 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -156,14 +156,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -173,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -191,12 +191,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, - group_id: groupId.toString(), + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -208,8 +208,8 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: Long.fromString(group_id), - memberUpdates: member_updates.map(el0 => ({ + groupId: group_id == null ? group_id : Long.fromString(group_id), + memberUpdates: member_updates.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -226,9 +226,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - new_admin: newAdmin + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -238,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: Long.fromString(group_id), + groupId: group_id == null ? group_id : Long.fromString(group_id), newAdmin: new_admin }; } @@ -251,9 +251,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -263,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: Long.fromString(group_id), + groupId: group_id == null ? group_id : Long.fromString(group_id), metadata }; } @@ -277,11 +277,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata, + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -294,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: Long.fromString(group_id), + groupId: group_id == null ? group_id : Long.fromString(group_id), metadata, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -314,18 +314,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: groupPolicyAsAdmin, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -340,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -349,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -364,9 +364,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -389,10 +389,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -405,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -420,9 +420,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -447,14 +447,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -468,11 +468,11 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -483,8 +483,8 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), - address + proposal_id: omitDefault(proposalId)?.toString?.(), + address: omitDefault(address) }; }, fromAmino: ({ @@ -492,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), address }; } @@ -507,11 +507,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + proposal_id: omitDefault(proposalId)?.toString?.(), + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -522,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata, - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -537,8 +537,8 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), - signer + proposal_id: omitDefault(proposalId)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -546,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: Long.fromString(proposal_id), + proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), signer }; } @@ -558,8 +558,8 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, - group_id: groupId.toString() + address: omitDefault(address), + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ @@ -568,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: Long.fromString(group_id) + groupId: group_id == null ? group_id : Long.fromString(group_id) }; } } diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts index edd80d3420..77f0bcd023 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts @@ -125,14 +125,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: { + commission: commission == null ? commission : { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -141,7 +141,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: { + value: value == null ? value : { denom: value.denom, amount: value.amount } @@ -176,7 +176,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, @@ -213,7 +213,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -248,7 +248,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -279,7 +279,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts index 9363380b44..dd3acacff8 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../helpers"; +import { omitDefault, Long } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -33,14 +33,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), - info: plan.info, + height: omitDefault(plan.height)?.toString?.(), + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -52,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: { + plan: plan == null ? plan : { name: plan.name, time: plan.time, - height: Long.fromString(plan.height), + height: plan.height == null ? plan.height : Long.fromString(plan.height), info: plan.info, - upgradedClientState: { + upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } @@ -71,7 +71,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index 889a5b5ded..b3bef4083c 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -73,11 +73,11 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - endTime: Long.fromString(end_time), + endTime: end_time == null ? end_time : Long.fromString(end_time), delayed }; } @@ -106,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -143,10 +143,10 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: Long.fromString(start_time), - vestingPeriods: vesting_periods.map(el0 => ({ - length: Long.fromString(el0.length), - amount: el0.amount.map(el1 => ({ + startTime: start_time == null ? start_time : Long.fromString(start_time), + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : Long.fromString(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index 276bc6855b..79a0aad873 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -89,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: fromBase64(wasm_byte_code), - instantiatePermission: { - permission: accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), + instantiatePermission: instantiate_permission == null ? instantiate_permission : { + permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -130,10 +130,10 @@ export const AminoConverter = { return { sender, admin, - codeId: Long.fromString(code_id), + codeId: code_id == null ? code_id : Long.fromString(code_id), label, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -167,8 +167,8 @@ export const AminoConverter = { return { sender, contract, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -199,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: Long.fromString(code_id), - msg: toUtf8(JSON.stringify(msg)) + codeId: code_id == null ? code_id : Long.fromString(code_id), + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) }; } }, diff --git a/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts b/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts index 9b58b680fa..e29194fea7 100644 --- a/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: { + coin: coin == null ? coin : { denom: coin.denom, amount: coin.amount }, diff --git a/__fixtures__/output1/evmos/fees/v1/tx.amino.ts b/__fixtures__/output1/evmos/fees/v1/tx.amino.ts index d40d07e084..450c453d75 100644 --- a/__fixtures__/output1/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/fees/v1/tx.amino.ts @@ -51,7 +51,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map(el0 => Long.fromString(el0)) + nonces: nonces.map?.(el0 => Long.fromString(el0)) }; } }, diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index 0ad2b5459d..ce4cd167ce 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -79,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map(el0 => ({ - length: Long.fromString(el0.length), - amount: el0.amount.map(el1 => ({ + lockupPeriods: lockup_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : Long.fromString(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map(el0 => ({ - length: Long.fromString(el0.length), - amount: el0.amount.map(el1 => ({ + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : Long.fromString(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts index b1fd375e8f..48ce4f675a 100644 --- a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: { + token: token == null ? token : { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: Long.fromString(timeout_timestamp) + timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : Long.fromString(timeout_timestamp) }; } } diff --git a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts index 442611c6e7..7a5f5b8fd9 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: { - sequence: Long.fromString(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: { - sequence: Long.fromString(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: Long.fromString(proof_height.revision_height || "0", true), revisionNumber: Long.fromString(proof_height.revision_number || "0", true) } : undefined, - nextSequenceRecv: Long.fromString(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : Long.fromString(next_sequence_recv), signer }; } @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: { - sequence: Long.fromString(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(proof_height.revision_height || "0", true), revisionNumber: Long.fromString(proof_height.revision_number || "0", true) } : undefined, - nextSequenceRecv: Long.fromString(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : Long.fromString(next_sequence_recv), signer }; } @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: { - sequence: Long.fromString(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts index da58249ba9..4d5ea3aac3 100644 --- a/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts @@ -81,11 +81,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -116,7 +116,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: { + header: header == null ? header : { typeUrl: header.type_url, value: header.value }, @@ -159,11 +159,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -196,7 +196,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: { + misbehaviour: misbehaviour == null ? misbehaviour : { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index 65ba7ea8bd..306b26e97b 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - delayPeriod: Long.fromString(delay_period), + delayPeriod: delay_period == null ? delay_period : Long.fromString(delay_period), signer }; } @@ -201,19 +201,19 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: Long.fromString(delay_period), - counterpartyVersions: counterparty_versions.map(el0 => ({ + delayPeriod: delay_period == null ? delay_period : Long.fromString(delay_period), + counterpartyVersions: counterparty_versions.map?.(el0 => ({ identifier: el0.identifier, features: el0.features })), @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index 5cf1ac60c7..6fb767213e 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; -import { Long } from "../../../../../helpers"; +import { omitDefault, padDecimal, Long } from "../../../../../helpers"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; @@ -54,10 +54,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -66,14 +66,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: Long.fromValue(el0.token.amount).toString() }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: Long.fromValue(el0.token.amount).toString() }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -82,9 +82,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: Long.fromValue(el0.token.amount).toString() }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ @@ -95,24 +95,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: { + smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { startTime: pool_params.smooth_weight_change_params.start_time, - duration: { + duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { seconds: Long.fromNumber(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: { + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: { + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, @@ -120,8 +120,8 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map(el0 => ({ - token: { + poolAssets: pool_assets.map?.(el0 => ({ + token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 5d2e5f0eb3..e0dd2917f3 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -65,15 +65,15 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map(el0 => Long.fromString(el0)), + scalingFactors: scaling_factors.map?.(el0 => Long.fromString(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -99,8 +99,8 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: Long.fromString(pool_id), - scalingFactors: scaling_factors.map(el0 => Long.fromString(el0)) + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + scalingFactors: scaling_factors.map?.(el0 => Long.fromString(el0)) }; } } diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index 5eac4ac14f..150ac9bf86 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -128,9 +128,9 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: Long.fromString(pool_id), + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map(el0 => ({ + tokenInMaxs: token_in_maxs.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -163,9 +163,9 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: Long.fromString(pool_id), + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map(el0 => ({ + tokenOutMins: token_out_mins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -201,11 +201,11 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map(el0 => ({ - poolId: Long.fromString(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : Long.fromString(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: { + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -242,12 +242,12 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map(el0 => ({ - poolId: Long.fromString(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : Long.fromString(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: { + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount } @@ -280,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: Long.fromString(pool_id), - tokenIn: { + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -315,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: Long.fromString(pool_id), + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -348,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: Long.fromString(pool_id), - tokenOut: { + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount }, @@ -383,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: Long.fromString(pool_id), + poolId: pool_id == null ? pool_id : Long.fromString(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 4701e7d61e..53b4a6ba4b 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -78,21 +78,21 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: { - lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: distribute_to == null ? distribute_to : { + lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: { + duration: distribute_to.duration == null ? distribute_to.duration : { seconds: Long.fromNumber(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, timestamp: distribute_to.timestamp }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: Long.fromString(num_epochs_paid_over) + numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : Long.fromString(num_epochs_paid_over) }; } }, @@ -119,8 +119,8 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: Long.fromString(gauge_id), - rewards: rewards.map(el0 => ({ + gaugeId: gauge_id == null ? gauge_id : Long.fromString(gauge_id), + rewards: rewards.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index da28c4becb..1e9c76350a 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -82,11 +82,11 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: { + duration: duration == null ? duration : { seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -133,8 +133,8 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: Long.fromString(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : Long.fromString(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -161,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: Long.fromString(ID), - duration: { + ID: ID == null ? ID : Long.fromString(ID), + duration: duration == null ? duration : { seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -192,8 +192,8 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: Long.fromString(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : Long.fromString(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index 1e716851ae..3a813bf074 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: Long.fromString(lock_id), + lockId: lock_id == null ? lock_id : Long.fromString(lock_id), valAddr: val_addr }; } @@ -86,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: Long.fromString(lock_id) + lockId: lock_id == null ? lock_id : Long.fromString(lock_id) }; } }, @@ -107,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: Long.fromString(lock_id) + lockId: lock_id == null ? lock_id : Long.fromString(lock_id) }; } }, @@ -134,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: Long.fromString(pool_id) + poolId: pool_id == null ? pool_id : Long.fromString(pool_id) }; } } diff --git a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts index c548ae85a1..810c066b4c 100644 --- a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -101,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -190,9 +190,9 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: { + metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map(el1 => ({ + denomUnits: metadata.denom_units.map?.(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.amino.ts index b3c5e0e145..1672cbeb5a 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "akash/audit/testonly-sign-provider-attributes"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -46,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: owner, + auditor: auditor, + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.ts index 1c1512c55d..a78962bcef 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta1/audit.ts @@ -215,12 +215,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -353,12 +353,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -588,12 +588,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -726,12 +726,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -938,12 +938,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.amino.ts index de83b12abd..b2d09362e5 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSignProviderAttributes, MsgSignProviderAttributesSDKType, MsgDeleteProviderAttributes, MsgDeleteProviderAttributesSDKType } from "./audit"; export interface MsgSignProviderAttributesAminoType extends AminoMsg { type: "mymessage-testonly"; @@ -30,11 +31,11 @@ export const AminoConverter = { attributes }: MsgSignProviderAttributes): MsgSignProviderAttributesAminoType["value"] => { return { - owner, - auditor, + owner: owner, + auditor: auditor, attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })) }; }, @@ -46,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) @@ -61,9 +62,9 @@ export const AminoConverter = { keys }: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAminoType["value"] => { return { - owner, - auditor, - keys + owner: owner, + auditor: auditor, + keys: keys }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.ts index a1c4702b94..e37bc5f8cd 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/audit.ts @@ -215,12 +215,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -353,12 +353,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -588,12 +588,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -726,12 +726,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -938,12 +938,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/genesis.ts index bac1aa7625..f377052406 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.ts index a463b96d2d..128754e4c6 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/audit/v1beta2/query.ts @@ -181,7 +181,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -293,8 +293,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -502,7 +502,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -613,8 +613,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -726,7 +726,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = message.auditor === "" ? undefined : message.auditor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts index deab917c14..447d3f8556 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts @@ -142,8 +142,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -268,12 +268,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -392,11 +392,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/endpoint.ts index 424d9bb086..76b6f51da2 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/endpoint.ts @@ -110,13 +110,13 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } return message; }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); + obj.kind = message.kind === 0 ? undefined : message.kind; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts index 555673d4b9..2e5716a6cb 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts @@ -167,7 +167,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -286,11 +286,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -409,11 +409,11 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -574,7 +574,7 @@ export const ResourceUnits = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts index 30e3551719..193b3ae103 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts @@ -142,8 +142,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -268,12 +268,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -392,11 +392,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/endpoint.ts index a34dca88e4..0df46f4e5b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/endpoint.ts @@ -132,7 +132,7 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.sequence_number !== undefined && object.sequence_number !== null) { message.sequenceNumber = object.sequence_number; @@ -141,8 +141,8 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); - obj.sequence_number = message.sequenceNumber; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.sequence_number = message.sequenceNumber ?? 0; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts index 09bed02fe5..19df53bad2 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts @@ -144,7 +144,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -263,11 +263,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -402,12 +402,12 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.name = message.name; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.name = message.name ?? ""; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resourceunits.ts index e36ed32bd8..0eaa02e508 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resourceunits.ts @@ -165,12 +165,12 @@ export const ResourceUnits = { if (message.storage) { obj.storage = message.storage.map(e => e ? Storage.toAmino(e) : undefined); } else { - obj.storage = []; + obj.storage = message.storage; } if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts index 97e535cbe2..97a159b755 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts @@ -27,9 +27,9 @@ export const AminoConverter = { pubkey }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { - owner, - cert, - pubkey + owner: owner, + cert: cert, + pubkey: pubkey }; }, fromAmino: ({ @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: { + id: id == null ? id : { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts index e721efb876..bfb3981741 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts @@ -217,8 +217,8 @@ export const CertificateID = { }, toAmino(message: CertificateID): CertificateIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateIDAminoMsg): CertificateID { @@ -332,7 +332,7 @@ export const Certificate = { fromAmino(object: CertificateAmino): Certificate { const message = createBaseCertificate(); if (object.state !== undefined && object.state !== null) { - message.state = certificate_StateFromJSON(object.state); + message.state = object.state; } if (object.cert !== undefined && object.cert !== null) { message.cert = bytesFromBase64(object.cert); @@ -344,9 +344,9 @@ export const Certificate = { }, toAmino(message: Certificate): CertificateAmino { const obj: any = {}; - obj.state = certificate_StateToJSON(message.state); - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.state = message.state ?? 0; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: CertificateAminoMsg): Certificate { @@ -472,9 +472,9 @@ export const CertificateFilter = { }, toAmino(message: CertificateFilter): CertificateFilterAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: CertificateFilterAminoMsg): CertificateFilter { @@ -600,9 +600,9 @@ export const MsgCreateCertificate = { }, toAmino(message: MsgCreateCertificate): MsgCreateCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.owner = message.owner ?? ""; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: MsgCreateCertificateAminoMsg): MsgCreateCertificate { @@ -772,7 +772,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : undefined; + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts index 32eb7b74a9..3cb6a37102 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts @@ -115,8 +115,8 @@ export const GenesisCertificate = { }, toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; + obj.owner = message.owner ?? ""; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { @@ -219,7 +219,7 @@ export const GenesisState = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts index 675f8ba362..c3cd752c70 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts @@ -132,8 +132,8 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; - obj.serial = message.serial; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateResponseAminoMsg): CertificateResponse { @@ -369,7 +369,7 @@ export const QueryCertificatesResponse = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts index d33d12c97e..136c503512 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts index 72c696c8a4..5646d8b982 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts @@ -314,14 +314,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -509,8 +509,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -718,13 +718,13 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -894,7 +894,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1080,8 +1080,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1215,7 +1215,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -1227,9 +1227,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1358,9 +1358,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts index c56045ac36..21ac8f466c 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts @@ -125,11 +125,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -251,9 +251,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts index 716ec6d383..18926deffa 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts @@ -256,7 +256,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -426,7 +426,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -596,7 +596,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -798,9 +798,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { @@ -934,12 +934,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, @@ -1076,7 +1076,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -1088,9 +1088,9 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1221,9 +1221,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? Coin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts index 6d736b7daf..54dd585a27 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts index 71c1e5ca19..85d4cab9da 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts @@ -297,7 +297,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -531,11 +531,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts index 480cd225a2..0174ebbd77 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts index 5361066f2e..ede028f38f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts @@ -177,8 +177,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -312,7 +312,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -324,9 +324,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -455,9 +455,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts index ebde71e394..6f620bcc9e 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts @@ -243,15 +243,15 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; - obj.depositor = message.depositor; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -455,9 +455,9 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; - obj.depositor = message.depositor; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -643,8 +643,8 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -814,7 +814,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts index 21be410cc5..7853419e04 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts @@ -125,11 +125,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -251,9 +251,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts index a0acac91cd..3d95c54aa7 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts @@ -187,7 +187,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -199,9 +199,9 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupid.ts index 2526a0f69d..56c8fe5f40 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupid.ts @@ -120,9 +120,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts index 7678473a12..1df98da044 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts @@ -133,7 +133,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -303,7 +303,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -473,7 +473,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts index a01a9cf5c4..88ade8bf5a 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts @@ -128,12 +128,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts index 272b065f4a..65b3ab2e8d 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts index fa4b778be8..1e1a51a14f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts @@ -297,7 +297,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -531,11 +531,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts index e56479dc78..3ad5531a6f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts @@ -124,9 +124,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts index 29301829da..d50522d305 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts @@ -4,6 +4,7 @@ import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { Coin, CoinSDKType, DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { GroupID, GroupIDSDKType } from "./groupid"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { PlacementRequirements, PlacementRequirementsSDKType, SignedBy, SignedBySDKType, Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { Resource, ResourceSDKType } from "./resource"; import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta2/resourceunits"; @@ -157,7 +158,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString() + dseq: id.dseq?.toString?.() }, groups: groups.map(el0 => ({ name: el0.name, @@ -167,8 +168,8 @@ export const AminoConverter = { any_of: el0.requirements.signedBy.anyOf }, attributes: el0.requirements.attributes.map(el1 => ({ - key: el1.key, - value: el1.value + key: omitDefault(el1.key), + value: omitDefault(el1.value) })) }, resources: el0.resources.map(el1 => ({ @@ -178,8 +179,8 @@ export const AminoConverter = { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, memory: { @@ -187,8 +188,8 @@ export const AminoConverter = { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el2 => ({ - key: el2.key, - value: el2.value + key: omitDefault(el2.key), + value: omitDefault(el2.value) })) }, storage: el1.resources.storage.map(el2 => ({ @@ -197,8 +198,8 @@ export const AminoConverter = { val: el2.quantity.val }, attributes: el2.attributes.map(el3 => ({ - key: el3.key, - value: el3.value + key: omitDefault(el3.key), + value: omitDefault(el3.value) })) })), endpoints: el1.resources.endpoints.map(el2 => ({ @@ -208,17 +209,17 @@ export const AminoConverter = { }, count: el1.count, price: { - denom: el1.price.denom, - amount: el1.price.amount + denom: omitDefault(el1.price.denom), + amount: omitDefault(el1.price.amount) } })) })), - version, + version: version, deposit: { denom: deposit.denom, amount: deposit.amount }, - depositor + depositor: depositor }; }, fromAmino: ({ @@ -229,66 +230,66 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - groups: groups.map(el0 => ({ + groups: groups.map?.(el0 => ({ name: el0.name, - requirements: { - signedBy: { + requirements: el0.requirements == null ? el0.requirements : { + signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map(el2 => ({ + attributes: el0.requirements.attributes.map?.(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map(el1 => ({ - resources: { - cpu: { - units: { + resources: el0.resources.map?.(el1 => ({ + resources: el1.resources == null ? el1.resources : { + cpu: el1.resources.cpu == null ? el1.resources.cpu : { + units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map(el4 => ({ + attributes: el1.resources.cpu.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - memory: { - quantity: { + memory: el1.resources.memory == null ? el1.resources.memory : { + quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map(el4 => ({ + attributes: el1.resources.memory.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map(el3 => ({ + storage: el1.resources.storage.map?.(el3 => ({ name: el3.name, - quantity: { + quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map(el4 => ({ + attributes: el3.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map(el3 => ({ - kind: endpoint_KindFromJSON(el3.kind), + endpoints: el1.resources.endpoints.map?.(el3 => ({ + kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: { + price: el1.price == null ? el1.price : { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount }, @@ -306,13 +307,13 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString() + dseq: id.dseq?.toString?.() }, amount: { denom: amount.denom, amount: amount.amount }, - depositor + depositor: depositor }; }, fromAmino: ({ @@ -321,11 +322,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount }, @@ -342,9 +343,9 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString() + dseq: id.dseq?.toString?.() }, - version + version: version }; }, fromAmino: ({ @@ -352,9 +353,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, version }; @@ -368,7 +369,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString() + dseq: id.dseq?.toString?.() } }; }, @@ -376,9 +377,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) } }; } @@ -391,7 +392,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString(), + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -400,9 +401,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; @@ -416,7 +417,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString(), + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -425,9 +426,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; @@ -441,7 +442,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq.toString(), + dseq: id.dseq?.toString?.(), gseq: id.gseq } }; @@ -450,9 +451,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/genesis.ts index 27ded574e3..12210d6d28 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/genesis.ts @@ -116,12 +116,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.ts index ff58e714ed..e6672a7903 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/query.ts @@ -208,10 +208,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -333,7 +333,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -511,11 +511,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -637,7 +637,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts index b41fa027a1..a6a3f865f3 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts @@ -249,8 +249,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -417,7 +417,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = Coin.fromAmino(object.balance); @@ -432,12 +432,12 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -620,7 +620,7 @@ export const Payment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = payment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = Coin.fromAmino(object.rate); @@ -635,13 +635,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = payment_StateToJSON(message.state); - obj.rate = message.rate ? Coin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/genesis.ts index 868fa25cc5..04bb97ec14 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/genesis.ts @@ -116,12 +116,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.ts index 8df954b7c3..f70db8abc6 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/query.ts @@ -208,10 +208,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -333,7 +333,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -511,11 +511,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -637,7 +637,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts index 21b20394d3..a007accce1 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts @@ -262,8 +262,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -458,7 +458,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = DecCoin.fromAmino(object.balance); @@ -479,14 +479,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; - obj.depositor = message.depositor; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; + obj.depositor = message.depositor ?? ""; + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -669,7 +669,7 @@ export const FractionalPayment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = fractionalPayment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = DecCoin.fromAmino(object.rate); @@ -684,13 +684,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = fractionalPayment_StateToJSON(message.state); - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts index 29b268e4f4..c1830d787a 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts @@ -85,7 +85,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts index 7ef62c405d..0bdc3e86c1 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, Exact } from "../../../helpers"; +import { isSet, DeepPartial, Exact, padDecimal } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -128,9 +128,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor; - obj.initial_inflation = message.initialInflation; - obj.variance = message.variance; + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor) ?? ""; + obj.initial_inflation = padDecimal(message.initialInflation) ?? ""; + obj.variance = padDecimal(message.variance) ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts index 959937c9ce..4d7f7d6e7c 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts @@ -293,10 +293,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : undefined; - obj.provider = message.provider; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.provider = message.provider ?? ""; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -466,7 +466,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -700,11 +700,11 @@ export const BidID = { }, toAmino(message: BidID): BidIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: BidIDAminoMsg): BidID { @@ -840,7 +840,7 @@ export const Bid = { message.bidId = BidID.fromAmino(object.bid_id); } if (object.state !== undefined && object.state !== null) { - message.state = bid_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -852,9 +852,9 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; - obj.state = bid_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1031,12 +1031,12 @@ export const BidFilters = { }, toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: BidFiltersAminoMsg): BidFilters { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts index 5279f1243f..83cac6aee6 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts @@ -138,14 +138,14 @@ export const GenesisState = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } if (message.leases) { obj.leases = message.leases.map(e => e ? Lease.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts index 8078ae6eaa..da39230d92 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts @@ -308,11 +308,11 @@ export const LeaseID = { }, toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: LeaseIDAminoMsg): LeaseID { @@ -463,7 +463,7 @@ export const Lease = { message.leaseId = LeaseID.fromAmino(object.lease_id); } if (object.state !== undefined && object.state !== null) { - message.state = lease_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -478,9 +478,9 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; - obj.state = lease_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; return obj; @@ -658,12 +658,12 @@ export const LeaseFilters = { }, toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: LeaseFiltersAminoMsg): LeaseFilters { @@ -759,7 +759,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -929,7 +929,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1099,7 +1099,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts index 304c35e913..9e91c39142 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts @@ -225,10 +225,10 @@ export const OrderID = { }, toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; return obj; }, fromAminoMsg(object: OrderIDAminoMsg): OrderID { @@ -364,7 +364,7 @@ export const Order = { message.orderId = OrderID.fromAmino(object.order_id); } if (object.state !== undefined && object.state !== null) { - message.state = order_StateFromJSON(object.state); + message.state = object.state; } if (object.spec !== undefined && object.spec !== null) { message.spec = GroupSpec.fromAmino(object.spec); @@ -376,9 +376,9 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; - obj.state = order_StateToJSON(message.state); - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.state = message.state ?? 0; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -539,11 +539,11 @@ export const OrderFilters = { }, toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: OrderFiltersAminoMsg): OrderFilters { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts index 99d881bfee..eaf1756342 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts @@ -103,8 +103,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : undefined; - obj.order_max_bids = message.orderMaxBids; + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.ts index 7d81ae5eb0..22ec60f703 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/query.ts @@ -377,7 +377,7 @@ export const QueryOrdersResponse = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -807,7 +807,7 @@ export const QueryBidsResponse = { if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toAmino(e) : undefined); } else { - obj.bids = []; + obj.bids = message.bids; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1256,7 +1256,7 @@ export const QueryLeasesResponse = { if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.amino.ts index 0e47f2ffe8..0fc7ee0a5d 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/service.amino.ts @@ -4,6 +4,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base import { BidID, BidIDSDKType, MsgCreateBid, MsgCreateBidSDKType, MsgCloseBid, MsgCloseBidSDKType } from "./bid"; import { LeaseID, LeaseIDSDKType, MsgWithdrawLease, MsgWithdrawLeaseSDKType, MsgCreateLease, MsgCreateLeaseSDKType, MsgCloseLease, MsgCloseLeaseSDKType } from "./lease"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; export interface MsgCreateBidAminoType extends AminoMsg { type: "akash/market/v1beta2/testonly-create-bid"; value: { @@ -84,14 +85,14 @@ export const AminoConverter = { return { order: { owner: order.owner, - dseq: order.dseq.toString(), + dseq: order.dseq?.toString?.(), gseq: order.gseq, oseq: order.oseq }, - provider, + provider: provider, price: { - denom: price.denom, - amount: price.amount + denom: omitDefault(price.denom), + amount: omitDefault(price.amount) }, deposit: { denom: deposit.denom, @@ -106,18 +107,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: { + order: order == null ? order : { owner: order.owner, - dseq: BigInt(order.dseq), + dseq: order.dseq == null ? order.dseq : BigInt(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: { + price: price == null ? price : { denom: price.denom, amount: price.amount }, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount } @@ -132,7 +133,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq.toString(), + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -143,9 +144,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -161,7 +162,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq.toString(), + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -172,9 +173,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -190,7 +191,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq.toString(), + dseq: bidId.dseq?.toString?.(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -201,9 +202,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -219,7 +220,7 @@ export const AminoConverter = { return { lease_id: { owner: leaseId.owner, - dseq: leaseId.dseq.toString(), + dseq: leaseId.dseq?.toString?.(), gseq: leaseId.gseq, oseq: leaseId.oseq, provider: leaseId.provider @@ -230,9 +231,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: { + leaseId: lease_id == null ? lease_id : { owner: lease_id.owner, - dseq: BigInt(lease_id.dseq), + dseq: lease_id.dseq == null ? lease_id.dseq : BigInt(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.amino.ts index 09f69f6e0b..3ee12d22c8 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta1/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/testonly-create-provider"; @@ -48,11 +49,11 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, + owner: owner, host_uri: hostUri, attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { email: info.email, @@ -69,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -89,11 +90,11 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, + owner: owner, host_uri: hostUri, attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { email: info.email, @@ -110,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts index 2f08ae04ab..86ade67186 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts @@ -191,8 +191,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -342,14 +342,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -573,14 +573,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -748,7 +748,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -972,14 +972,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/genesis.ts index e106ac8e50..62e3969d1f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.amino.ts index de1a53399d..8a038a1507 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.amino.ts @@ -1,6 +1,7 @@ /* eslint-disable */ import { Attribute, AttributeSDKType } from "../../base/v1beta2/attribute"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { ProviderInfo, ProviderInfoSDKType, MsgCreateProvider, MsgCreateProviderSDKType, MsgUpdateProvider, MsgUpdateProviderSDKType, MsgDeleteProvider, MsgDeleteProviderSDKType } from "./provider"; export interface MsgCreateProviderAminoType extends AminoMsg { type: "akash/provider/v1beta2/testonly-create-provider"; @@ -48,11 +49,11 @@ export const AminoConverter = { info }: MsgCreateProvider): MsgCreateProviderAminoType["value"] => { return { - owner, + owner: owner, host_uri: hostUri, attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { email: info.email, @@ -69,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -89,11 +90,11 @@ export const AminoConverter = { info }: MsgUpdateProvider): MsgUpdateProviderAminoType["value"] => { return { - owner, + owner: owner, host_uri: hostUri, attributes: attributes.map(el0 => ({ - key: el0.key, - value: el0.value + key: omitDefault(el0.key), + value: omitDefault(el0.value) })), info: { email: info.email, @@ -110,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -127,7 +128,7 @@ export const AminoConverter = { owner }: MsgDeleteProvider): MsgDeleteProviderAminoType["value"] => { return { - owner + owner: owner }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts index 509e5db2b8..c3ebfde66f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts @@ -191,8 +191,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -342,14 +342,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -573,14 +573,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -748,7 +748,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -972,14 +972,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.ts index feb3db5ee9..a53f2eb074 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/query.ts @@ -245,7 +245,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -341,7 +341,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/confio/proofs.ts b/__fixtures__/v-next/outputinstantrpc/confio/proofs.ts index 66a0a731b6..4536cfdf0c 100644 --- a/__fixtures__/v-next/outputinstantrpc/confio/proofs.ts +++ b/__fixtures__/v-next/outputinstantrpc/confio/proofs.ts @@ -657,7 +657,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1065,16 +1065,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1083,10 +1083,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1195,7 +1195,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1207,7 +1207,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1351,8 +1351,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1529,7 +1529,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1538,13 +1538,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { @@ -1641,7 +1641,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1870,12 +1870,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -2144,7 +2144,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/config.ts index 52767eede2..4abd348190 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/config.ts @@ -139,7 +139,7 @@ export const Config = { if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e) : undefined); } else { - obj.modules = []; + obj.modules = message.modules; } return obj; }, @@ -252,7 +252,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/module.ts index 6a3fbea4b5..58090c2f19 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/app/v1alpha1/module.ts @@ -226,16 +226,16 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = message.goImport; + obj.go_import = message.goImport === "" ? undefined : message.goImport; if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { - obj.use_package = []; + obj.use_package = message.usePackage; } if (message.canMigrateFrom) { obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); } else { - obj.can_migrate_from = []; + obj.can_migrate_from = message.canMigrateFrom; } return obj; }, @@ -346,8 +346,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = message.name; - obj.revision = message.revision; + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -441,7 +441,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = message.module; + obj.module = message.module === "" ? undefined : message.module; return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts index 60d2939ffd..a2e543f322 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts @@ -187,7 +187,7 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; @@ -325,11 +325,11 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { - obj.permissions = []; + obj.permissions = message.permissions; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/genesis.ts index 17b02061a7..0df5f48e20 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/genesis.ts @@ -116,7 +116,7 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.ts index 82cc5fe4f0..043f287cf7 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/query.ts @@ -376,7 +376,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -472,7 +472,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -915,7 +915,7 @@ export const QueryModuleAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, @@ -1084,7 +1084,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = message.bech32Prefix; + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1272,7 +1272,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1366,7 +1366,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/authz.ts index 1b7078d9c8..6a77a18d87 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/authz.ts @@ -153,7 +153,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -410,8 +410,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -516,7 +516,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/genesis.ts index e77fd05933..b54632ef7d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.ts index dfdf4f6386..a270d32b76 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/query.ts @@ -220,9 +220,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -344,7 +344,7 @@ export const QueryGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -458,7 +458,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -580,7 +580,7 @@ export const QueryGranterGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -694,7 +694,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -816,7 +816,7 @@ export const QueryGranteeGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.amino.ts index b035d8f4ff..9653f58093 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrant"; @@ -43,11 +44,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -62,8 +63,8 @@ export const AminoConverter = { return { granter, grantee, - grant: { - authorization: { + grant: grant == null ? grant : { + authorization: grant.authorization == null ? grant.authorization : { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, @@ -79,9 +80,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -92,7 +93,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map(el0 => ({ + msgs: msgs.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })) @@ -107,9 +108,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.ts index 4a4d43b34c..563831e79c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/authz/v1beta1/tx.ts @@ -205,8 +205,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -310,7 +310,7 @@ export const MsgExecResponse = { if (message.results) { obj.results = message.results.map(e => base64FromBytes(e)); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -427,11 +427,11 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -632,9 +632,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/authz.ts index 1c0c2865db..e8630c19dc 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/authz.ts @@ -102,7 +102,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/bank.ts index 0d4f5b9963..f20a349c30 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/bank.ts @@ -271,9 +271,9 @@ export const Params = { if (message.sendEnabled) { obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); } else { - obj.send_enabled = []; + obj.send_enabled = message.sendEnabled; } - obj.default_send_enabled = message.defaultSendEnabled; + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -383,8 +383,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = message.denom; - obj.enabled = message.enabled; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -500,11 +500,11 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -621,11 +621,11 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -729,7 +729,7 @@ export const Supply = { if (message.total) { obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -862,12 +862,12 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = message.denom; - obj.exponent = message.exponent; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } return obj; }, @@ -1080,18 +1080,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { - obj.denom_units = []; + obj.denom_units = message.denomUnits; } - obj.base = message.base; - obj.display = message.display; - obj.name = message.name; - obj.symbol = message.symbol; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/genesis.ts index 87161084ad..cf1165ab68 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/genesis.ts @@ -191,17 +191,17 @@ export const GenesisState = { if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } if (message.denomMetadata) { obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.denom_metadata = []; + obj.denom_metadata = message.denomMetadata; } return obj; }, @@ -318,11 +318,11 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.ts index bed9cc5a18..e81e9b0747 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/query.ts @@ -425,8 +425,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -634,7 +634,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -756,7 +756,7 @@ export const QueryAllBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -870,7 +870,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -992,7 +992,7 @@ export const QuerySpendableBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1211,7 +1211,7 @@ export const QueryTotalSupplyResponse = { if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1307,7 +1307,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1790,7 +1790,7 @@ export const QueryDenomsMetadataResponse = { if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.metadatas = []; + obj.metadatas = message.metadatas; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1886,7 +1886,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -2094,7 +2094,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2207,7 +2207,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, @@ -2329,7 +2329,7 @@ export const QueryDenomOwnersResponse = { if (message.denomOwners) { obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); } else { - obj.denom_owners = []; + obj.denom_owners = message.denomOwners; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.amino.ts index 5352659e14..a675254230 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType, MsgMultiSend, MsgMultiSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgSend"; @@ -41,11 +42,11 @@ export const AminoConverter = { amount }: MsgSend): MsgSendAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -57,7 +58,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -72,17 +73,17 @@ export const AminoConverter = { }: MsgMultiSend): MsgMultiSendAminoType["value"] => { return { inputs: inputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), outputs: outputs.map(el0 => ({ - address: el0.address, + address: omitDefault(el0.address), coins: el0.coins.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; @@ -92,16 +93,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map(el0 => ({ + inputs: inputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map(el0 => ({ + outputs: outputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.ts index c50d24abbb..72455f3624 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/bank/v1beta1/tx.ts @@ -156,12 +156,12 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -361,12 +361,12 @@ export const MsgMultiSend = { if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); } else { - obj.inputs = []; + obj.inputs = message.inputs; } if (message.outputs) { obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); } else { - obj.outputs = []; + obj.outputs = message.outputs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts index 34e78a549e..17bb26fd6f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts @@ -564,25 +564,25 @@ export const TxResponse = { toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -715,12 +715,12 @@ export const ABCIMessageLog = { }, toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; - obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -837,11 +837,11 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -952,8 +952,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1223,16 +1223,16 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1458,7 +1458,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1584,12 +1584,12 @@ export const TxMsgData = { if (message.data) { obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1788,7 +1788,7 @@ export const SearchTxsResult = { if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/kv/v1beta1/kv.ts index 466ecd439a..e591fb3961 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/kv/v1beta1/kv.ts @@ -105,7 +105,7 @@ export const Pairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts index 8aa1c12d87..7a03f47a54 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts @@ -241,8 +241,8 @@ export const PageRequest = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.offset = message.offset ? message.offset.toString() : undefined; obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.ts index de50b0a90b..baa1eb275a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v1beta1/reflection.ts @@ -211,7 +211,7 @@ export const ListAllInterfacesResponse = { if (message.interfaceNames) { obj.interface_names = message.interfaceNames.map(e => e); } else { - obj.interface_names = []; + obj.interface_names = message.interfaceNames; } return obj; }, @@ -306,7 +306,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = message.interfaceName; + obj.interface_name = message.interfaceName === "" ? undefined : message.interfaceName; return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { @@ -409,7 +409,7 @@ export const ListImplementationsResponse = { if (message.implementationMessageNames) { obj.implementation_message_names = message.implementationMessageNames.map(e => e); } else { - obj.implementation_message_names = []; + obj.implementation_message_names = message.implementationMessageNames; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.ts index d417225690..997c34dde8 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/reflection/v2alpha1/reflection.ts @@ -694,11 +694,11 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -802,7 +802,7 @@ export const AuthnDescriptor = { if (message.signModes) { obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); } else { - obj.sign_modes = []; + obj.sign_modes = message.signModes; } return obj; }, @@ -929,9 +929,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1025,7 +1025,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1128,7 +1128,7 @@ export const CodecDescriptor = { if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); } else { - obj.interfaces = []; + obj.interfaces = message.interfaces; } return obj; }, @@ -1267,16 +1267,16 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { - obj.interface_accepting_messages = []; + obj.interface_accepting_messages = message.interfaceAcceptingMessages; } if (message.interfaceImplementers) { obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); } else { - obj.interface_implementers = []; + obj.interface_implementers = message.interfaceImplementers; } return obj; }, @@ -1387,8 +1387,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.type_url = message.typeUrl; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1504,11 +1504,11 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { - obj.field_descriptor_names = []; + obj.field_descriptor_names = message.fieldDescriptorNames; } return obj; }, @@ -1603,7 +1603,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1697,7 +1697,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = message.msgTypeUrl; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -2820,7 +2820,7 @@ export const QueryServicesDescriptor = { if (message.queryServices) { obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); } else { - obj.query_services = []; + obj.query_services = message.queryServices; } return obj; }, @@ -2953,12 +2953,12 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.is_module = message.isModule; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } return obj; }, @@ -3069,8 +3069,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.full_query_path = message.fullQueryPath; + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts index fa28d3445a..6a2bfd1322 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -278,8 +278,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -384,7 +384,7 @@ export const Metadata = { if (message.chunkHashes) { obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); } else { - obj.chunk_hashes = []; + obj.chunk_hashes = message.chunkHashes; } return obj; }, @@ -670,7 +670,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -817,7 +817,7 @@ export const SnapshotIAVLItem = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.height = message.height === 0 ? undefined : message.height; return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -927,8 +927,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { @@ -1236,7 +1236,7 @@ export const SnapshotSchema = { if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e)); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts index deff71edfe..189b44abe3 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts @@ -158,7 +158,7 @@ export const CommitInfo = { if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { - obj.store_infos = []; + obj.store_infos = message.storeInfos; } return obj; }, @@ -271,7 +271,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/listening.ts index b656b5422b..23924bf152 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/listening.ts @@ -150,8 +150,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts index f3630c25cf..5ce8b2c682 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts @@ -452,7 +452,7 @@ export const GetValidatorSetByHeightResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -690,7 +690,7 @@ export const GetLatestValidatorSetResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -840,7 +840,7 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; @@ -1411,7 +1411,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = message.syncing === false ? undefined : message.syncing; return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1812,18 +1812,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = message.name === "" ? undefined : message.name; + obj.app_name = message.appName === "" ? undefined : message.appName; + obj.version = message.version === "" ? undefined : message.version; + obj.git_commit = message.gitCommit === "" ? undefined : message.gitCommit; + obj.build_tags = message.buildTags === "" ? undefined : message.buildTags; + obj.go_version = message.goVersion === "" ? undefined : message.goVersion; if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { - obj.build_deps = []; + obj.build_deps = message.buildDeps; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = message.cosmosSdkVersion === "" ? undefined : message.cosmosSdkVersion; return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1949,9 +1949,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = message.path === "" ? undefined : message.path; + obj.version = message.version === "" ? undefined : message.version; + obj.sum = message.sum === "" ? undefined : message.sum; return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts index 9f3ca4c968..4ff5ee250a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/v1beta1/coin.ts @@ -158,8 +158,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -269,8 +269,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -364,7 +364,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -458,7 +458,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts index 2e46e5e4a5..560e36c210 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts @@ -238,8 +238,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { @@ -342,7 +342,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts index 0d27dc8b08..babd51f927 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts @@ -249,7 +249,7 @@ export const GenesisState = { if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.amino.ts index dfa3c954cc..35ffefde90 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgVerifyInvariant, MsgVerifyInvariantSDKType } from "./tx"; export interface MsgVerifyInvariantAminoType extends AminoMsg { type: "cosmos-sdk/MsgVerifyInvariant"; @@ -17,9 +18,9 @@ export const AminoConverter = { invariantRoute }: MsgVerifyInvariant): MsgVerifyInvariantAminoType["value"] => { return { - sender, - invariant_module_name: invariantModuleName, - invariant_route: invariantRoute + sender: omitDefault(sender), + invariant_module_name: omitDefault(invariantModuleName), + invariant_route: omitDefault(invariantRoute) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.ts index 24773ba8c6..d7d8a0d9f6 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crisis/v1beta1/tx.ts @@ -126,9 +126,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = message.sender; - obj.invariant_module_name = message.invariantModuleName; - obj.invariant_route = message.invariantRoute; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.invariant_module_name = message.invariantModuleName === "" ? undefined : message.invariantModuleName; + obj.invariant_route = message.invariantRoute === "" ? undefined : message.invariantRoute; return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/hd/v1/hd.ts index cacd6c2bf9..e6b9131273 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/hd/v1/hd.ts @@ -162,11 +162,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = message.purpose; - obj.coin_type = message.coinType; - obj.account = message.account; - obj.change = message.change; - obj.address_index = message.addressIndex; + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/keyring/v1/record.ts index fbe16f825d..0afcc743c5 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/keyring/v1/record.ts @@ -238,7 +238,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -356,7 +356,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = message.privKeyType === "" ? undefined : message.privKeyType; return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/keys.ts index c44dff19a6..aabd5a7261 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/keys.ts @@ -115,11 +115,11 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === 0 ? undefined : message.threshold; if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.public_keys = []; + obj.public_keys = message.publicKeys; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/v1beta1/multisig.ts index f14d457ff2..2066e7f759 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -123,7 +123,7 @@ export const MultiSignature = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -234,7 +234,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts index bacce079b9..0589e6403e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -386,10 +386,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax; - obj.base_proposer_reward = message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward; - obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + obj.community_tax = padDecimal(message.communityTax) === "" ? undefined : padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward) === "" ? undefined : padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward) === "" ? undefined : padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -508,9 +508,9 @@ export const ValidatorHistoricalRewards = { if (message.cumulativeRewardRatio) { obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.cumulative_reward_ratio = []; + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; } - obj.reference_count = message.referenceCount; + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -631,7 +631,7 @@ export const ValidatorCurrentRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } obj.period = message.period ? message.period.toString() : undefined; return obj; @@ -736,7 +736,7 @@ export const ValidatorAccumulatedCommission = { if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.commission = []; + obj.commission = message.commission; } return obj; }, @@ -840,7 +840,7 @@ export const ValidatorOutstandingRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -954,7 +954,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; - obj.fraction = message.fraction; + obj.fraction = padDecimal(message.fraction) === "" ? undefined : padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1057,7 +1057,7 @@ export const ValidatorSlashEvents = { if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, @@ -1161,7 +1161,7 @@ export const FeePool = { if (message.communityPool) { obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.community_pool = []; + obj.community_pool = message.communityPool; } return obj; }, @@ -1310,13 +1310,13 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1448,8 +1448,8 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; - obj.stake = message.stake; - obj.height = message.height ? message.height.toString() : undefined; + obj.stake = padDecimal(message.stake) === "" ? undefined : padDecimal(message.stake); + obj.height = message.height ? message.height.toString() : "0"; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1565,11 +1565,11 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.reward = []; + obj.reward = message.reward; } return obj; }, @@ -1728,11 +1728,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; - obj.amount = message.amount; - obj.deposit = message.deposit; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts index 889c9cd594..770aac4ff1 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts @@ -272,8 +272,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -389,11 +389,11 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } return obj; }, @@ -506,7 +506,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -637,7 +637,7 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.period = message.period ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; @@ -751,7 +751,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -880,8 +880,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -1030,7 +1030,7 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.height = message.height ? message.height.toString() : undefined; obj.period = message.period ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; @@ -1322,38 +1322,38 @@ export const GenesisState = { if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); } else { - obj.delegator_withdraw_infos = []; + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } if (message.validatorAccumulatedCommissions) { obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); } else { - obj.validator_accumulated_commissions = []; + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; } if (message.validatorHistoricalRewards) { obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_historical_rewards = []; + obj.validator_historical_rewards = message.validatorHistoricalRewards; } if (message.validatorCurrentRewards) { obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_current_rewards = []; + obj.validator_current_rewards = message.validatorCurrentRewards; } if (message.delegatorStartingInfos) { obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); } else { - obj.delegator_starting_infos = []; + obj.delegator_starting_infos = message.delegatorStartingInfos; } if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts index 8730a7d871..09b6b4786c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts @@ -580,7 +580,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -770,7 +770,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1014,7 +1014,7 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; @@ -1138,7 +1138,7 @@ export const QueryValidatorSlashesResponse = { if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.slashes = []; + obj.slashes = message.slashes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1250,8 +1250,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1354,7 +1354,7 @@ export const QueryDelegationRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1449,7 +1449,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1574,12 +1574,12 @@ export const QueryDelegationTotalRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } if (message.total) { obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -1674,7 +1674,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1777,7 +1777,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e); } else { - obj.validators = []; + obj.validators = message.validators; } return obj; }, @@ -1872,7 +1872,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -1966,7 +1966,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { @@ -2143,7 +2143,7 @@ export const QueryCommunityPoolResponse = { if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.pool = []; + obj.pool = message.pool; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.amino.ts index c7d34e047d..86be0e8941 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSetWithdrawAddress, MsgSetWithdrawAddressSDKType, MsgWithdrawDelegatorReward, MsgWithdrawDelegatorRewardSDKType, MsgWithdrawValidatorCommission, MsgWithdrawValidatorCommissionSDKType, MsgFundCommunityPool, MsgFundCommunityPoolSDKType } from "./tx"; export interface MsgSetWithdrawAddressAminoType extends AminoMsg { type: "cosmos-sdk/MsgModifyWithdrawAddress"; @@ -39,8 +40,8 @@ export const AminoConverter = { withdrawAddress }: MsgSetWithdrawAddress): MsgSetWithdrawAddressAminoType["value"] => { return { - delegator_address: delegatorAddress, - withdraw_address: withdrawAddress + delegator_address: omitDefault(delegatorAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ @@ -60,8 +61,8 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -80,7 +81,7 @@ export const AminoConverter = { validatorAddress }: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAminoType["value"] => { return { - validator_address: validatorAddress + validator_address: omitDefault(validatorAddress) }; }, fromAmino: ({ @@ -99,10 +100,10 @@ export const AminoConverter = { }: MsgFundCommunityPool): MsgFundCommunityPoolAminoType["value"] => { return { amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - depositor + depositor: omitDefault(depositor) }; }, fromAmino: ({ @@ -110,7 +111,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.ts index e65e001e9c..4c4e7aab5e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/tx.ts @@ -205,8 +205,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -390,8 +390,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -494,7 +494,7 @@ export const MsgWithdrawDelegatorRewardResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -589,7 +589,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -692,7 +692,7 @@ export const MsgWithdrawValidatorCommissionResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -812,9 +812,9 @@ export const MsgFundCommunityPool = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts index 52251debe1..177cc55a60 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts @@ -150,7 +150,7 @@ export const Equivocation = { obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/genesis.ts index 36f4ac6267..0f9af10194 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/genesis.ts @@ -93,7 +93,7 @@ export const GenesisState = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.ts index 10fdce2c79..ff8e98afc0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/query.ts @@ -452,7 +452,7 @@ export const QueryAllEvidenceResponse = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.amino.ts index 8cf0ca70d6..6d45f73942 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitEvidence, MsgSubmitEvidenceSDKType } from "./tx"; export interface MsgSubmitEvidenceAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitEvidence"; @@ -19,9 +20,9 @@ export const AminoConverter = { evidence }: MsgSubmitEvidence): MsgSubmitEvidenceAminoType["value"] => { return { - submitter, + submitter: omitDefault(submitter), evidence: { - type_url: evidence.typeUrl, + type_url: omitDefault(evidence.typeUrl), value: evidence.value } }; @@ -32,7 +33,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: { + evidence: evidence == null ? evidence : { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.ts index 69828a460d..dad536bebf 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/tx.ts @@ -122,7 +122,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = message.submitter === "" ? undefined : message.submitter; obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/feegrant.ts index 19615801a1..a6646039c5 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/feegrant.ts @@ -201,7 +201,7 @@ export const BasicAllowance = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -382,12 +382,12 @@ export const PeriodicAllowance = { if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_spend_limit = []; + obj.period_spend_limit = message.periodSpendLimit; } if (message.periodCanSpend) { obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_can_spend = []; + obj.period_can_spend = message.periodCanSpend; } obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; return obj; @@ -511,7 +511,7 @@ export const AllowedMsgAllowance = { if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { - obj.allowed_messages = []; + obj.allowed_messages = message.allowedMessages; } return obj; }, @@ -640,8 +640,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/genesis.ts index 824ca6b8c0..fcf07fd608 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.ts index 5358ca37bc..98978433d2 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/query.ts @@ -179,8 +179,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -388,7 +388,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -510,7 +510,7 @@ export const QueryAllowancesResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -624,7 +624,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -746,7 +746,7 @@ export const QueryAllowancesByGranterResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.amino.ts index c376a3917b..ae2e63181f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrantAllowance, MsgGrantAllowanceSDKType, MsgRevokeAllowance, MsgRevokeAllowanceSDKType } from "./tx"; export interface MsgGrantAllowanceAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrantAllowance"; @@ -28,10 +29,10 @@ export const AminoConverter = { allowance }: MsgGrantAllowance): MsgGrantAllowanceAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), allowance: { - type_url: allowance.typeUrl, + type_url: omitDefault(allowance.typeUrl), value: allowance.value } }; @@ -44,7 +45,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: { + allowance: allowance == null ? allowance : { typeUrl: allowance.type_url, value: allowance.value } @@ -58,8 +59,8 @@ export const AminoConverter = { grantee }: MsgRevokeAllowance): MsgRevokeAllowanceAminoType["value"] => { return { - granter, - grantee + granter: omitDefault(granter), + grantee: omitDefault(grantee) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.ts index 591229f21b..0dcc83f50e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/feegrant/v1beta1/tx.ts @@ -162,8 +162,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, @@ -348,8 +348,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/genutil/v1beta1/genesis.ts index 338baea52b..5bedc0a94f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/genutil/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.genTxs) { obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); } else { - obj.gen_txs = []; + obj.gen_txs = message.genTxs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts index e47bb162c4..ca340c46b4 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts @@ -228,17 +228,17 @@ export const GenesisState = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts index ec47d12fda..2d1a4fad72 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts @@ -385,7 +385,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -394,8 +394,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -530,11 +530,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -764,7 +764,7 @@ export const Proposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -793,20 +793,20 @@ export const Proposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -948,10 +948,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1102,13 +1102,13 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1229,7 +1229,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -1453,9 +1453,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts index 62971f184a..d62ff97658 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts @@ -549,7 +549,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -564,9 +564,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -688,7 +688,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -803,7 +803,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1135,7 +1135,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1231,7 +1231,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1478,7 +1478,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1810,7 +1810,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts index 7c0115740a..c8dd2d001c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgExecLegacyContent, MsgExecLegacyContentSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/v1/MsgSubmitProposal"; @@ -71,15 +72,15 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer, - metadata + proposer: omitDefault(proposer), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -89,11 +90,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -110,10 +111,10 @@ export const AminoConverter = { }: MsgExecLegacyContent): MsgExecLegacyContentAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, - authority + authority: omitDefault(authority) }; }, fromAmino: ({ @@ -121,7 +122,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, @@ -138,10 +139,10 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option, - metadata + proposal_id: proposalId?.toString?.(), + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -151,9 +152,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata }; } @@ -167,13 +168,13 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, + proposal_id: proposalId?.toString?.(), + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: omitDefault(el0.weight) })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -183,10 +184,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -201,11 +202,11 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), - depositor, + proposal_id: proposalId?.toString?.(), + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -215,9 +216,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts index 280aabcbf9..e373ff2c21 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts @@ -279,15 +279,15 @@ export const MsgSubmitProposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -496,7 +496,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -705,7 +705,7 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -714,10 +714,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -941,14 +941,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1156,12 +1156,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts index 64a7502011..86d0f07abe 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts @@ -228,17 +228,17 @@ export const GenesisState = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts index a7c45ac114..576665471a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts @@ -4,7 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -418,7 +418,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -427,8 +427,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -538,8 +538,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -674,11 +674,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -891,7 +891,7 @@ export const Proposal = { message.content = Any.fromAmino(object.content); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -915,14 +915,14 @@ export const Proposal = { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; @@ -1067,10 +1067,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1213,20 +1213,20 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; return message; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1348,7 +1348,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts index 0994ffd094..9424d83417 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts @@ -549,7 +549,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -564,9 +564,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -688,7 +688,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -803,7 +803,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1135,7 +1135,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1231,7 +1231,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1478,7 +1478,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1810,7 +1810,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts index fad45eaf42..db9b98121a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -57,14 +58,14 @@ export const AminoConverter = { }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { content: { - type_url: content.typeUrl, + type_url: omitDefault(content.typeUrl), value: content.value }, initial_deposit: initialDeposit.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - proposer + proposer: omitDefault(proposer) }; }, fromAmino: ({ @@ -73,11 +74,11 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -93,9 +94,9 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option + proposal_id: omitDefault(proposalId)?.toString?.(), + voter: omitDefault(voter), + option: option }; }, fromAmino: ({ @@ -104,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option) + option: option == null ? option : voteOptionFromJSON(option) }; } }, @@ -118,11 +119,11 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, + proposal_id: proposalId?.toString?.(), + voter: omitDefault(voter), options: options.map(el0 => ({ option: el0.option, - weight: el0.weight + weight: padDecimal(el0.weight) })) }; }, @@ -132,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -149,11 +150,11 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId.toString(), - depositor, + proposal_id: proposalId?.toString?.(), + depositor: omitDefault(depositor), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -163,9 +164,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts index 34cd0eb781..c51f6d9e71 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts @@ -239,9 +239,9 @@ export const MsgSubmitProposal = { if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -337,7 +337,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -459,15 +459,15 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -675,12 +675,12 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -889,12 +889,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts index 04fa045c5d..dcea2fb135 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts @@ -386,7 +386,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -480,7 +480,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -874,14 +874,14 @@ export const EventExec = { message.proposalId = BigInt(object.proposal_id); } if (object.result !== undefined && object.result !== null) { - message.result = proposalExecutorResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = proposalExecutorResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -994,7 +994,7 @@ export const EventLeaveGroup = { toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts index 19b463797a..8f63f57201 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts @@ -266,29 +266,29 @@ export const GenesisState = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } if (message.groupMembers) { obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.group_members = []; + obj.group_members = message.groupMembers; } obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts index 25052fa7db..e28bd59ec0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts @@ -653,7 +653,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -985,7 +985,7 @@ export const QueryGroupMembersResponse = { if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1099,7 +1099,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1221,7 +1221,7 @@ export const QueryGroupsByAdminResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1459,7 +1459,7 @@ export const QueryGroupPoliciesByGroupResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1573,7 +1573,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1695,7 +1695,7 @@ export const QueryGroupPoliciesByAdminResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2001,7 +2001,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2123,7 +2123,7 @@ export const QueryProposalsByGroupPolicyResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2238,7 +2238,7 @@ export const QueryVoteByProposalVoterRequest = { toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2570,7 +2570,7 @@ export const QueryVotesByProposalResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2684,7 +2684,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2806,7 +2806,7 @@ export const QueryVotesByVoterResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2920,7 +2920,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3042,7 +3042,7 @@ export const QueryGroupsByMemberResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts index e44a0f0c10..26b8514f79 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -155,14 +156,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -172,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -190,12 +191,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, - group_id: groupId.toString(), + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -207,8 +208,8 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: BigInt(group_id), - memberUpdates: member_updates.map(el0 => ({ + groupId: group_id == null ? group_id : BigInt(group_id), + memberUpdates: member_updates.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -225,9 +226,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - new_admin: newAdmin + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -237,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), newAdmin: new_admin }; } @@ -250,9 +251,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -262,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), metadata }; } @@ -276,11 +277,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata, + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -293,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), metadata, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -313,18 +314,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: groupPolicyAsAdmin, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -339,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -348,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -363,9 +364,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -388,10 +389,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -404,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -419,9 +420,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -446,14 +447,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -467,11 +468,11 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -482,8 +483,8 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), - address + proposal_id: omitDefault(proposalId)?.toString?.(), + address: omitDefault(address) }; }, fromAmino: ({ @@ -491,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), address }; } @@ -506,11 +507,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + proposal_id: omitDefault(proposalId)?.toString?.(), + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -521,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata, - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -536,8 +537,8 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), - signer + proposal_id: omitDefault(proposalId)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -545,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), signer }; } @@ -557,8 +558,8 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, - group_id: groupId.toString() + address: omitDefault(address), + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ @@ -567,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: BigInt(group_id) + groupId: group_id == null ? group_id : BigInt(group_id) }; } } diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts index b89ad98892..9978c185d0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts @@ -581,13 +581,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -817,12 +817,12 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.member_updates = []; + obj.member_updates = message.memberUpdates; } return obj; }, @@ -1025,9 +1025,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1229,9 +1229,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1451,9 +1451,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1548,7 +1548,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1674,9 +1674,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -1858,15 +1858,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1980,7 +1980,7 @@ export const MsgCreateGroupWithPolicyResponse = { toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2182,8 +2182,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -2384,9 +2384,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2624,25 +2624,25 @@ export const MsgSubmitProposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.exec = execToJSON(message.exec); + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2851,7 +2851,7 @@ export const MsgWithdrawProposal = { toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -3073,23 +3073,23 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; - obj.exec = execToJSON(message.exec); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3276,7 +3276,7 @@ export const MsgExec = { toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3462,7 +3462,7 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts index 6f9c46019a..0f7746a3b5 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts @@ -643,9 +643,9 @@ export const Member = { }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; return obj; }, @@ -749,7 +749,7 @@ export const Members = { if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } return obj; }, @@ -862,7 +862,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === "" ? undefined : message.threshold; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -975,7 +975,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = message.percentage === "" ? undefined : message.percentage; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1270,10 +1270,10 @@ export const GroupInfo = { toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1585,10 +1585,10 @@ export const GroupPolicyInfo = { }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; @@ -1878,10 +1878,10 @@ export const Proposal = { message.groupPolicyVersion = BigInt(object.group_policy_version); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.result !== undefined && object.result !== null) { - message.result = proposalResultFromJSON(object.result); + message.result = object.result; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -1890,7 +1890,7 @@ export const Proposal = { message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); } if (object.executor_result !== undefined && object.executor_result !== null) { - message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; return message; @@ -1898,25 +1898,25 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = proposalStatusToJSON(message.status); - obj.result = proposalResultToJSON(message.result); + obj.status = message.status === 0 ? undefined : message.status; + obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; - obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -2059,10 +2059,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2210,7 +2210,7 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -2223,9 +2223,9 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts index 5527a7d541..964c7c4954 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -131,8 +131,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation; - obj.annual_provisions = message.annualProvisions; + obj.inflation = padDecimal(message.inflation) === "" ? undefined : padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions) === "" ? undefined : padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -308,11 +308,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange; - obj.inflation_max = message.inflationMax; - obj.inflation_min = message.inflationMin; - obj.goal_bonded = message.goalBonded; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = padDecimal(message.inflationRateChange) === "" ? undefined : padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax) === "" ? undefined : padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin) === "" ? undefined : padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded) === "" ? undefined : padDecimal(message.goalBonded); obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/event.ts index b267dbd9ae..87da093e56 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/event.ts @@ -168,10 +168,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -297,9 +297,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -425,9 +425,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/genesis.ts index 7c2d6e70bc..b29ffad4c9 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/genesis.ts @@ -133,12 +133,12 @@ export const GenesisState = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } if (message.entries) { obj.entries = message.entries.map(e => e ? Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -255,11 +255,11 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/nft.ts index e02d6d51a0..5dd51cf4aa 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/nft.ts @@ -225,12 +225,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = message.id === "" ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.description = message.description === "" ? undefined : message.description; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -391,10 +391,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts index 6ea94ad1d9..31c7ee24a1 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts @@ -271,8 +271,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -478,8 +478,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -573,7 +573,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -667,7 +667,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -891,8 +891,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1014,7 +1014,7 @@ export const QueryNFTsResponse = { if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1126,8 +1126,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1317,7 +1317,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { @@ -1630,7 +1630,7 @@ export const QueryClassesResponse = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.amino.ts index c244a7789d..f43ed3e82e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgSend, MsgSendSDKType } from "./tx"; export interface MsgSendAminoType extends AminoMsg { type: "cosmos-sdk/MsgNFTSend"; @@ -19,10 +20,10 @@ export const AminoConverter = { receiver }: MsgSend): MsgSendAminoType["value"] => { return { - class_id: classId, - id, - sender, - receiver + class_id: omitDefault(classId), + id: omitDefault(id), + sender: omitDefault(sender), + receiver: omitDefault(receiver) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.ts index 186e9a0201..ab63449137 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/tx.ts @@ -148,10 +148,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1/orm.ts index 2d809b43d0..eb484d838c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1/orm.ts @@ -238,9 +238,9 @@ export const TableDescriptor = { if (message.index) { obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e) : undefined); } else { - obj.index = []; + obj.index = message.index; } - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -350,8 +350,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.auto_increment = message.autoIncrement; + obj.fields = message.fields === "" ? undefined : message.fields; + obj.auto_increment = message.autoIncrement === false ? undefined : message.autoIncrement; return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -477,9 +477,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.id = message.id; - obj.unique = message.unique; + obj.fields = message.fields === "" ? undefined : message.fields; + obj.id = message.id === 0 ? undefined : message.id; + obj.unique = message.unique === false ? undefined : message.unique; return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -573,7 +573,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1alpha1/schema.ts index 64df2df94a..d84ff52617 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/orm/v1alpha1/schema.ts @@ -227,7 +227,7 @@ export const ModuleSchemaDescriptor = { if (message.schemaFile) { obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); } else { - obj.schema_file = []; + obj.schema_file = message.schemaFile; } obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; @@ -349,15 +349,15 @@ export const ModuleSchemaDescriptor_FileEntry = { message.protoFileName = object.proto_file_name; } if (object.storage_type !== undefined && object.storage_type !== null) { - message.storageType = storageTypeFromJSON(object.storage_type); + message.storageType = object.storage_type; } return message; }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = storageTypeToJSON(message.storageType); + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/params.ts index c9f0c8cefc..031eba73c0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/params.ts @@ -146,12 +146,12 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { - obj.changes = []; + obj.changes = message.changes; } return obj; }, @@ -278,9 +278,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; - obj.value = message.value; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.ts index 7da530343e..84d9c1302f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/params/v1beta1/query.ts @@ -168,8 +168,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -442,7 +442,7 @@ export const QuerySubspacesResponse = { if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); } else { - obj.subspaces = []; + obj.subspaces = message.subspaces; } return obj; }, @@ -559,11 +559,11 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = message.subspace; + obj.subspace = message.subspace === "" ? undefined : message.subspace; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts index 224bcbaf3b..ade24fdab1 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts @@ -200,12 +200,12 @@ export const GenesisState = { if (message.signingInfos) { obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e) : undefined); } else { - obj.signing_infos = []; + obj.signing_infos = message.signingInfos; } if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -318,7 +318,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -435,11 +435,11 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -553,7 +553,7 @@ export const MissedBlock = { toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.missed = message.missed === false ? undefined : message.missed; return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.ts index 9ef7b4337a..45dac2b073 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/query.ts @@ -339,7 +339,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = message.consAddress; + obj.cons_address = message.consAddress === "" ? undefined : message.consAddress; return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { @@ -652,7 +652,7 @@ export const QuerySigningInfosResponse = { if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e) : undefined); } else { - obj.info = []; + obj.info = message.info; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts index cf19b468a1..a82bd224c5 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts @@ -221,11 +221,11 @@ export const ValidatorSigningInfo = { }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; - obj.tombstoned = message.tombstoned; + obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.ts index 9a9294f90e..95d3b99a07 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/tx.ts @@ -90,7 +90,7 @@ export const MsgUnjail = { }, toAmino(message: MsgUnjail): MsgUnjailAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr ?? ""; return obj; }, fromAminoMsg(object: MsgUnjailAminoMsg): MsgUnjail { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/authz.ts index 7b88f8f2a9..c068fd6167 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/authz.ts @@ -219,7 +219,7 @@ export const StakeAuthorization = { message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); } if (object.authorization_type !== undefined && object.authorization_type !== null) { - message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + message.authorizationType = object.authorization_type; } return message; }, @@ -228,7 +228,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { @@ -331,7 +331,7 @@ export const StakeAuthorization_Validators = { if (message.address) { obj.address = message.address.map(e => e); } else { - obj.address = []; + obj.address = message.address; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts index 0fad7d8290..7f2b0792a3 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts @@ -275,29 +275,29 @@ export const GenesisState = { if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); } else { - obj.last_validator_powers = []; + obj.last_validator_powers = message.lastValidatorPowers; } if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } if (message.delegations) { obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); } else { - obj.delegations = []; + obj.delegations = message.delegations; } if (message.unbondingDelegations) { obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_delegations = []; + obj.unbonding_delegations = message.unbondingDelegations; } if (message.redelegations) { obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); } else { - obj.redelegations = []; + obj.redelegations = message.redelegations; } - obj.exported = message.exported; + obj.exported = message.exported === false ? undefined : message.exported; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -409,7 +409,7 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.power = message.power ? message.power.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts index ad35bdb607..cf5479ff8b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts @@ -605,7 +605,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = message.status === "" ? undefined : message.status; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -727,7 +727,7 @@ export const QueryValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -823,7 +823,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1031,7 +1031,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1153,7 +1153,7 @@ export const QueryValidatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1267,7 +1267,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1389,7 +1389,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1501,8 +1501,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1708,8 +1708,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -1917,7 +1917,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2039,7 +2039,7 @@ export const QueryDelegatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2153,7 +2153,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2275,7 +2275,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2421,9 +2421,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2545,7 +2545,7 @@ export const QueryRedelegationsResponse = { if (message.redelegationResponses) { obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); } else { - obj.redelegation_responses = []; + obj.redelegation_responses = message.redelegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2659,7 +2659,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2781,7 +2781,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2893,8 +2893,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts index 08190929e0..cacb6e18c3 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -624,7 +624,7 @@ export const HistoricalInfo = { if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.valset = []; + obj.valset = message.valset; } return obj; }, @@ -751,9 +751,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate) === "" ? undefined : padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate) === "" ? undefined : padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate) === "" ? undefined : padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1024,11 +1024,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1263,7 +1263,7 @@ export const Validator = { message.jailed = object.jailed; } if (object.status !== undefined && object.status !== null) { - message.status = bondStatusFromJSON(object.status); + message.status = object.status; } if (object.tokens !== undefined && object.tokens !== null) { message.tokens = object.tokens; @@ -1290,17 +1290,17 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = bondStatusToJSON(message.status); - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = padDecimal(message.delegatorShares) === "" ? undefined : padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1403,7 +1403,7 @@ export const ValAddresses = { if (message.addresses) { obj.addresses = message.addresses.map(e => e); } else { - obj.addresses = []; + obj.addresses = message.addresses; } return obj; }, @@ -1514,8 +1514,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1618,7 +1618,7 @@ export const DVPairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, @@ -1745,9 +1745,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -1850,7 +1850,7 @@ export const DVVTriplets = { if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); } else { - obj.triplets = []; + obj.triplets = message.triplets; } return obj; }, @@ -1977,9 +1977,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2111,12 +2111,12 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2263,8 +2263,8 @@ export const UnbondingDelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2410,8 +2410,8 @@ export const RedelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = padDecimal(message.sharesDst) === "" ? undefined : padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2559,13 +2559,13 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2743,11 +2743,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = padDecimal(message.minCommissionRate) === "" ? undefined : padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2975,7 +2975,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { @@ -3097,7 +3097,7 @@ export const RedelegationResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -3208,8 +3208,8 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.not_bonded_tokens = message.notBondedTokens; - obj.bonded_tokens = message.bondedTokens; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts index 86e67cabcd..7d5f289a9b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.amino.ts @@ -3,6 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../helpers"; import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; import { MsgCreateValidator, MsgCreateValidatorSDKType, MsgEditValidator, MsgEditValidatorSDKType, MsgDelegate, MsgDelegateSDKType, MsgBeginRedelegate, MsgBeginRedelegateSDKType, MsgUndelegate, MsgUndelegateSDKType } from "./tx"; export interface MsgCreateValidatorAminoType extends AminoMsg { @@ -93,20 +94,20 @@ export const AminoConverter = { }: MsgCreateValidator): MsgCreateValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, commission: { - rate: commission.rate, - max_rate: commission.maxRate, - max_change_rate: commission.maxChangeRate + rate: padDecimal(commission.rate), + max_rate: padDecimal(commission.maxRate), + max_change_rate: padDecimal(commission.maxChangeRate) }, - min_self_delegation: minSelfDelegation, - delegator_address: delegatorAddress, - validator_address: validatorAddress, + min_self_delegation: omitDefault(minSelfDelegation), + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), pubkey: decodePubkey(pubkey)!, value: { denom: value.denom, @@ -124,14 +125,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: { + commission: commission == null ? commission : { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -140,7 +141,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: { + value: value == null ? value : { denom: value.denom, amount: value.amount } @@ -157,15 +158,15 @@ export const AminoConverter = { }: MsgEditValidator): MsgEditValidatorAminoType["value"] => { return { description: { - moniker: description.moniker, - identity: description.identity, - website: description.website, - security_contact: description.securityContact, - details: description.details + moniker: omitDefault(description.moniker), + identity: omitDefault(description.identity), + website: omitDefault(description.website), + security_contact: omitDefault(description.securityContact), + details: omitDefault(description.details) }, - validator_address: validatorAddress, - commission_rate: commissionRate, - min_self_delegation: minSelfDelegation + validator_address: omitDefault(validatorAddress), + commission_rate: padDecimal(commissionRate), + min_self_delegation: omitDefault(minSelfDelegation) }; }, fromAmino: ({ @@ -175,7 +176,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, @@ -196,8 +197,8 @@ export const AminoConverter = { amount }: MsgDelegate): MsgDelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount @@ -212,7 +213,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -228,9 +229,9 @@ export const AminoConverter = { amount }: MsgBeginRedelegate): MsgBeginRedelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_src_address: validatorSrcAddress, - validator_dst_address: validatorDstAddress, + delegator_address: omitDefault(delegatorAddress), + validator_src_address: omitDefault(validatorSrcAddress), + validator_dst_address: omitDefault(validatorDstAddress), amount: { denom: amount.denom, amount: amount.amount @@ -247,7 +248,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -262,8 +263,8 @@ export const AminoConverter = { amount }: MsgUndelegate): MsgUndelegateAminoType["value"] => { return { - delegator_address: delegatorAddress, - validator_address: validatorAddress, + delegator_address: omitDefault(delegatorAddress), + validator_address: omitDefault(validatorAddress), amount: { denom: amount.denom, amount: amount.amount @@ -278,7 +279,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts index ba705910f9..63fb425425 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -346,9 +346,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -569,9 +569,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = padDecimal(message.commissionRate) === "" ? undefined : padDecimal(message.commissionRate); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -773,8 +773,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -993,9 +993,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1218,8 +1218,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts index 1ee7dd167d..f014120f56 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts @@ -258,7 +258,7 @@ export const SignatureDescriptors = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -609,7 +609,7 @@ export const SignatureDescriptor_Data_Single = { fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); @@ -618,7 +618,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -741,7 +741,7 @@ export const SignatureDescriptor_Data_Multi = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts index 01b863d948..854df5e397 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts @@ -438,7 +438,7 @@ export const GetTxsEventRequest = { message.pagination = PageRequest.fromAmino(object.pagination); } if (object.order_by !== undefined && object.order_by !== null) { - message.orderBy = orderByFromJSON(object.order_by); + message.orderBy = object.order_by; } return message; }, @@ -447,10 +447,10 @@ export const GetTxsEventRequest = { if (message.events) { obj.events = message.events.map(e => e); } else { - obj.events = []; + obj.events = message.events; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = orderByToJSON(message.orderBy); + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -593,12 +593,12 @@ export const GetTxsEventResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } if (message.txResponses) { obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.tx_responses = []; + obj.tx_responses = message.txResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -704,14 +704,14 @@ export const BroadcastTxRequest = { message.txBytes = bytesFromBase64(object.tx_bytes); } if (object.mode !== undefined && object.mode !== null) { - message.mode = broadcastModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; - obj.mode = broadcastModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1129,7 +1129,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1516,7 +1516,7 @@ export const GetBlockWithTxsResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.block = message.block ? Block.toAmino(message.block) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts index 6394fc4be1..b0bbbeddf4 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts @@ -556,7 +556,7 @@ export const Tx = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -694,7 +694,7 @@ export const TxRaw = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -841,7 +841,7 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; return obj; }, @@ -1026,7 +1026,7 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1210,19 +1210,19 @@ export const TxBody = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extension_options = []; + obj.extension_options = message.extensionOptions; } if (message.nonCriticalExtensionOptions) { obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.non_critical_extension_options = []; + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; } return obj; }, @@ -1362,7 +1362,7 @@ export const AuthInfo = { if (message.signerInfos) { obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); } else { - obj.signer_infos = []; + obj.signer_infos = message.signerInfos; } obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1702,13 +1702,13 @@ export const ModeInfo_Single = { fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { const message = createBaseModeInfo_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -1830,7 +1830,7 @@ export const ModeInfo_Multi = { if (message.modeInfos) { obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); } else { - obj.mode_infos = []; + obj.mode_infos = message.modeInfos; } return obj; }, @@ -1984,11 +1984,11 @@ export const Fee = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -2107,9 +2107,9 @@ export const Tip = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.tipper = message.tipper; + obj.tipper = message.tipper === "" ? undefined : message.tipper; return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2244,7 +2244,7 @@ export const AuxSignerData = { message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -2253,9 +2253,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts index 496351bab8..d4742ee7d4 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts @@ -443,7 +443,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -823,7 +823,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = message.moduleName; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -926,7 +926,7 @@ export const QueryModuleVersionsResponse = { if (message.moduleVersions) { obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); } else { - obj.module_versions = []; + obj.module_versions = message.moduleVersions; } return obj; }, @@ -1095,7 +1095,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.amino.ts index 92673592c2..60ac05e8c1 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -32,14 +33,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), - info: plan.info, + height: omitDefault(plan.height)?.toString?.(), + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -51,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: { + plan: plan == null ? plan : { name: plan.name, time: plan.time, - height: BigInt(plan.height), + height: plan.height == null ? plan.height : BigInt(plan.height), info: plan.info, - upgradedClientState: { + upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } @@ -70,7 +71,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.ts index 8b91d13afb..e1dd8a5a0a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/tx.ts @@ -166,7 +166,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -335,7 +335,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts index 53a8f02865..f7c0520f77 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts @@ -269,10 +269,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -401,8 +401,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -513,8 +513,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -626,7 +626,7 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.version = message.version ? message.version.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.amino.ts index b1829bb2bc..93abf3fd7e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -52,14 +53,14 @@ export const AminoConverter = { delayed }: MsgCreateVestingAccount): MsgCreateVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - end_time: endTime.toString(), - delayed + end_time: omitDefault(endTime)?.toString?.(), + delayed: omitDefault(delayed) }; }, fromAmino: ({ @@ -72,11 +73,11 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - endTime: BigInt(end_time), + endTime: end_time == null ? end_time : BigInt(end_time), delayed }; } @@ -89,11 +90,11 @@ export const AminoConverter = { amount }: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), amount: amount.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -105,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -121,14 +122,14 @@ export const AminoConverter = { vestingPeriods }: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, - start_time: startTime.toString(), + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), + start_time: omitDefault(startTime)?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })) }; @@ -142,10 +143,10 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: BigInt(start_time), - vestingPeriods: vesting_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + startTime: start_time == null ? start_time : BigInt(start_time), + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts index 2b6911c967..23ff1b99de 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts @@ -246,15 +246,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.end_time = message.endTime ? message.endTime.toString() : undefined; - obj.delayed = message.delayed; + obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -460,12 +460,12 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -690,13 +690,13 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts index ce283a3b2e..d46fa33da4 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts @@ -288,17 +288,17 @@ export const BaseVestingAccount = { if (message.originalVesting) { obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.original_vesting = []; + obj.original_vesting = message.originalVesting; } if (message.delegatedFree) { obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_free = []; + obj.delegated_free = message.delegatedFree; } if (message.delegatedVesting) { obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_vesting = []; + obj.delegated_vesting = message.delegatedVesting; } obj.end_time = message.endTime ? message.endTime.toString() : undefined; return obj; @@ -633,7 +633,7 @@ export const Period = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -775,7 +775,7 @@ export const PeriodicVestingAccount = { if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputinstantrpc/cosmos_proto/cosmos.ts index 827994b72c..323c2ddf40 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos_proto/cosmos.ts @@ -202,8 +202,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -333,17 +333,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts index 53c8bf0dde..a0cf4fa807 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts @@ -257,22 +257,22 @@ export const GenesisState = { if (message.codes) { obj.codes = message.codes.map(e => e ? Code.toAmino(e) : undefined); } else { - obj.codes = []; + obj.codes = message.codes; } if (message.contracts) { obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e) : undefined); } else { - obj.contracts = []; + obj.contracts = message.contracts; } if (message.sequences) { obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e) : undefined); } else { - obj.sequences = []; + obj.sequences = message.sequences; } if (message.genMsgs) { obj.gen_msgs = message.genMsgs.map(e => e ? GenesisState_GenMsgs.toAmino(e) : undefined); } else { - obj.gen_msgs = []; + obj.gen_msgs = message.genMsgs; } return obj; }, @@ -556,7 +556,7 @@ export const Code = { obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; - obj.pinned = message.pinned; + obj.pinned = message.pinned === false ? undefined : message.pinned; return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -690,12 +690,12 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.contract_state = []; + obj.contract_state = message.contractState; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts index 83feddf0a2..8e7cd6c134 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts @@ -165,7 +165,7 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -262,7 +262,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts index ca49c00721..5026591c1b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts @@ -382,9 +382,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -600,17 +600,17 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.admin = message.admin; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -771,9 +771,9 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -917,9 +917,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1100,15 +1100,15 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1251,10 +1251,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1380,9 +1380,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1523,12 +1523,12 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -1670,12 +1670,12 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts index bb2d5d1cce..eb38798ea0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts @@ -437,7 +437,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -549,7 +549,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -662,7 +662,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -784,7 +784,7 @@ export const QueryContractHistoryResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1022,7 +1022,7 @@ export const QueryContractsByCodeResponse = { if (message.contracts) { obj.contracts = message.contracts.map(e => e); } else { - obj.contracts = []; + obj.contracts = message.contracts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1136,7 +1136,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1258,7 +1258,7 @@ export const QueryAllContractStateResponse = { if (message.models) { obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.models = []; + obj.models = message.models; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1370,7 +1370,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1575,7 +1575,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1894,8 +1894,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; return obj; }, @@ -2009,7 +2009,7 @@ export const QueryCodeResponse = { toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { const obj: any = {}; obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; - obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; return obj; }, fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { @@ -2226,7 +2226,7 @@ export const QueryCodesResponse = { if (message.codeInfos) { obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); } else { - obj.code_infos = []; + obj.code_infos = message.codeInfos; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2454,7 +2454,7 @@ export const QueryPinnedCodesResponse = { if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts index db3abbec45..005a774ec6 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { @@ -73,11 +74,11 @@ export const AminoConverter = { instantiatePermission }: MsgStoreCode): MsgStoreCodeAminoType["value"] => { return { - sender, + sender: omitDefault(sender), wasm_byte_code: toBase64(wasmByteCode), instantiate_permission: { permission: instantiatePermission.permission, - address: instantiatePermission.address + address: omitDefault(instantiatePermission.address) } }; }, @@ -88,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: fromBase64(wasm_byte_code), - instantiatePermission: { - permission: accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), + instantiatePermission: instantiate_permission == null ? instantiate_permission : { + permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -107,14 +108,14 @@ export const AminoConverter = { funds }: MsgInstantiateContract): MsgInstantiateContractAminoType["value"] => { return { - sender, - admin, - code_id: codeId.toString(), - label, + sender: omitDefault(sender), + admin: omitDefault(admin), + code_id: omitDefault(codeId)?.toString?.(), + label: omitDefault(label), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -129,10 +130,10 @@ export const AminoConverter = { return { sender, admin, - codeId: BigInt(code_id), + codeId: code_id == null ? code_id : BigInt(code_id), label, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -148,12 +149,12 @@ export const AminoConverter = { funds }: MsgExecuteContract): MsgExecuteContractAminoType["value"] => { return { - sender, - contract, + sender: omitDefault(sender), + contract: omitDefault(contract), msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -166,8 +167,8 @@ export const AminoConverter = { return { sender, contract, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -183,9 +184,9 @@ export const AminoConverter = { msg }: MsgMigrateContract): MsgMigrateContractAminoType["value"] => { return { - sender, - contract, - code_id: codeId.toString(), + sender: omitDefault(sender), + contract: omitDefault(contract), + code_id: omitDefault(codeId)?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, @@ -198,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: BigInt(code_id), - msg: toUtf8(JSON.stringify(msg)) + codeId: code_id == null ? code_id : BigInt(code_id), + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) }; } }, @@ -211,9 +212,9 @@ export const AminoConverter = { contract }: MsgUpdateAdmin): MsgUpdateAdminAminoType["value"] => { return { - sender, - new_admin: newAdmin, - contract + sender: omitDefault(sender), + new_admin: omitDefault(newAdmin), + contract: omitDefault(contract) }; }, fromAmino: ({ @@ -235,8 +236,8 @@ export const AminoConverter = { contract }: MsgClearAdmin): MsgClearAdminAminoType["value"] => { return { - sender, - contract + sender: omitDefault(sender), + contract: omitDefault(contract) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts index b020cc0738..4659919c1e 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts @@ -316,7 +316,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -596,15 +596,15 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -715,7 +715,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -864,13 +864,13 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1109,8 +1109,8 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1332,9 +1332,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1518,8 +1518,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts index 49e230122c..8eef86ad3d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts @@ -321,13 +321,13 @@ export const AccessTypeParam = { fromAmino(object: AccessTypeParamAmino): AccessTypeParam { const message = createBaseAccessTypeParam(); if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); + message.value = object.value; } return message; }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = accessTypeToJSON(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -428,7 +428,7 @@ export const AccessConfig = { fromAmino(object: AccessConfigAmino): AccessConfig { const message = createBaseAccessConfig(); if (object.permission !== undefined && object.permission !== null) { - message.permission = accessTypeFromJSON(object.permission); + message.permission = object.permission; } if (object.address !== undefined && object.address !== null) { message.address = object.address; @@ -437,8 +437,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = accessTypeToJSON(message.permission); - obj.address = message.address; + obj.permission = message.permission === 0 ? undefined : message.permission; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -559,7 +559,7 @@ export const Params = { message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); } if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { - message.instantiateDefaultPermission = accessTypeFromJSON(object.instantiate_default_permission); + message.instantiateDefaultPermission = object.instantiate_default_permission; } if (object.max_wasm_code_size !== undefined && object.max_wasm_code_size !== null) { message.maxWasmCodeSize = BigInt(object.max_wasm_code_size); @@ -569,7 +569,7 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = accessTypeToJSON(message.instantiateDefaultPermission); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; return obj; }, @@ -699,7 +699,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -897,11 +897,11 @@ export const ContractInfo = { toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; obj.extension = message.extension ? Any.toAmino(message.extension) : undefined; return obj; }, @@ -1033,7 +1033,7 @@ export const ContractCodeHistoryEntry = { fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); if (object.operation !== undefined && object.operation !== null) { - message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + message.operation = object.operation; } if (object.code_id !== undefined && object.code_id !== null) { message.codeId = BigInt(object.code_id); @@ -1048,7 +1048,7 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + obj.operation = message.operation === 0 ? undefined : message.operation; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/claims.ts index 4320f6636a..7e6c20d76b 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/claims.ts @@ -211,7 +211,7 @@ export const Claim = { fromAmino(object: ClaimAmino): Claim { const message = createBaseClaim(); if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } if (object.completed !== undefined && object.completed !== null) { message.completed = object.completed; @@ -223,9 +223,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = actionToJSON(message.action); - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = message.action === 0 ? undefined : message.action; + obj.completed = message.completed === false ? undefined : message.completed; + obj.claimable_amount = message.claimableAmount === "" ? undefined : message.claimableAmount; return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -360,12 +360,12 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = message.address === "" ? undefined : message.address; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, @@ -485,11 +485,11 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/genesis.ts index 3e78603a28..f6ed9ff78d 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/genesis.ts @@ -151,7 +151,7 @@ export const GenesisState = { if (message.claimsRecords) { obj.claims_records = message.claimsRecords.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims_records = []; + obj.claims_records = message.claimsRecords; } return obj; }, @@ -352,20 +352,20 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = message.enableClaims === false ? undefined : message.enableClaims; obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = message.claimsDenom === "" ? undefined : message.claimsDenom; if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { - obj.authorized_channels = []; + obj.authorized_channels = message.authorizedChannels; } if (message.evmChannels) { obj.evm_channels = message.evmChannels.map(e => e); } else { - obj.evm_channels = []; + obj.evm_channels = message.evmChannels; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.ts index ddd75cbaec..2018f52b10 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/claims/v1/query.ts @@ -287,7 +287,7 @@ export const QueryTotalUnclaimedResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -651,7 +651,7 @@ export const QueryClaimsRecordsResponse = { if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -741,7 +741,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -851,11 +851,11 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts index 20b8fc6d75..7ce1b4da96 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts @@ -208,12 +208,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -311,7 +311,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts index 23e066f1a4..96bb2a0e58 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts @@ -231,7 +231,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -321,7 +321,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/erc20.ts index e0c816c1fa..c0181a0f74 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/erc20.ts @@ -260,16 +260,16 @@ export const TokenPair = { message.enabled = object.enabled; } if (object.contract_owner !== undefined && object.contract_owner !== null) { - message.contractOwner = ownerFromJSON(object.contract_owner); + message.contractOwner = object.contract_owner; } return message; }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = ownerToJSON(message.contractOwner); + obj.erc20_address = message.erc20Address === "" ? undefined : message.erc20Address; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.contract_owner = message.contractOwner === 0 ? undefined : message.contractOwner; return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -391,8 +391,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -513,9 +513,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.erc20address = message.erc20address === "" ? undefined : message.erc20address; return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -635,9 +635,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/genesis.ts index ef920d583f..7965af5ad5 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/genesis.ts @@ -135,7 +135,7 @@ export const GenesisState = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } return obj; }, @@ -240,8 +240,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = message.enableErc20; - obj.enable_evm_hook = message.enableEvmHook; + obj.enable_erc20 = message.enableErc20 === false ? undefined : message.enableErc20; + obj.enable_evm_hook = message.enableEvmHook === false ? undefined : message.enableEvmHook; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.ts index 1772568744..5d582cb95b 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/query.ts @@ -290,7 +290,7 @@ export const QueryTokenPairsResponse = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -380,7 +380,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = message.token; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.amino.ts index 0be2123e86..514c9c6a37 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgConvertCoin, MsgConvertCoinSDKType, MsgConvertERC20, MsgConvertERC20SDKType } from "./tx"; export interface MsgConvertCoinAminoType extends AminoMsg { type: "/evmos.erc20.v1.MsgConvertCoin"; @@ -34,8 +35,8 @@ export const AminoConverter = { denom: coin.denom, amount: coin.amount }, - receiver, - sender + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ @@ -44,7 +45,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: { + coin: coin == null ? coin : { denom: coin.denom, amount: coin.amount }, @@ -62,10 +63,10 @@ export const AminoConverter = { sender }: MsgConvertERC20): MsgConvertERC20AminoType["value"] => { return { - contract_address: contractAddress, - amount, - receiver, - sender + contract_address: omitDefault(contractAddress), + amount: omitDefault(amount), + receiver: omitDefault(receiver), + sender: omitDefault(sender) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.ts index 605414b3ec..486029ad07 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/erc20/v1/tx.ts @@ -172,8 +172,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -377,10 +377,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/fees.ts index 980edfa4e5..0d72231999 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/fees.ts @@ -130,9 +130,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts index 119372e1cb..68c84403ed 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -150,7 +150,7 @@ export const GenesisState = { if (message.devFeeInfos) { obj.dev_fee_infos = message.devFeeInfos.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.dev_fee_infos = []; + obj.dev_fee_infos = message.devFeeInfos; } return obj; }, @@ -305,11 +305,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = message.enableFees; - obj.developer_shares = message.developerShares; - obj.validator_shares = message.validatorShares; + obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; + obj.developer_shares = padDecimal(message.developerShares) === "" ? undefined : padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares) === "" ? undefined : padDecimal(message.validatorShares); obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; - obj.min_gas_price = message.minGasPrice; + obj.min_gas_price = padDecimal(message.minGasPrice) === "" ? undefined : padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.ts index 005310d29a..b455127f67 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/query.ts @@ -336,7 +336,7 @@ export const QueryDevFeeInfosResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -426,7 +426,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -780,7 +780,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -896,7 +896,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.amino.ts index c226ee6556..18aaa3533b 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.amino.ts @@ -1,4 +1,5 @@ import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgRegisterDevFeeInfo, MsgRegisterDevFeeInfoSDKType, MsgCancelDevFeeInfo, MsgCancelDevFeeInfoSDKType, MsgUpdateDevFeeInfo, MsgUpdateDevFeeInfoSDKType } from "./tx"; export interface MsgRegisterDevFeeInfoAminoType extends AminoMsg { type: "/evmos.fees.v1.MsgRegisterDevFeeInfo"; @@ -34,9 +35,9 @@ export const AminoConverter = { nonces }: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress, + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress), nonces: nonces.map(el0 => el0.toString()) }; }, @@ -50,7 +51,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map(el0 => BigInt(el0)) + nonces: nonces.map?.(el0 => BigInt(el0)) }; } }, @@ -61,8 +62,8 @@ export const AminoConverter = { deployerAddress }: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress) }; }, fromAmino: ({ @@ -83,9 +84,9 @@ export const AminoConverter = { withdrawAddress }: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAminoType["value"] => { return { - contract_address: contractAddress, - deployer_address: deployerAddress, - withdraw_address: withdrawAddress + contract_address: omitDefault(contractAddress), + deployer_address: omitDefault(deployerAddress), + withdraw_address: omitDefault(withdrawAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.ts index 42e644af59..437bb6b2fe 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/tx.ts @@ -239,13 +239,13 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -418,8 +418,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -607,9 +607,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts index 40e2e6314f..c25d70cd42 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -163,12 +163,12 @@ export const GenesisState = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } return obj; }, @@ -305,10 +305,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = message.enableIncentives; - obj.allocation_limit = message.allocationLimit; - obj.incentives_epoch_identifier = message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler; + obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; + obj.allocation_limit = padDecimal(message.allocationLimit) === "" ? undefined : padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; + obj.reward_scaler = padDecimal(message.rewardScaler) === "" ? undefined : padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts index c563bf6a30..397ec5baa2 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts @@ -238,13 +238,13 @@ export const Incentive = { }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; return obj; @@ -368,8 +368,8 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; return obj; }, @@ -528,15 +528,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -656,9 +656,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts index 8232ee1043..0e03fbe393 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts @@ -446,7 +446,7 @@ export const QueryIncentivesResponse = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -536,7 +536,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -732,7 +732,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -848,7 +848,7 @@ export const QueryGasMetersResponse = { if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -954,8 +954,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1250,7 +1250,7 @@ export const QueryAllocationMetersResponse = { if (message.allocationMeters) { obj.allocation_meters = message.allocationMeters.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocation_meters = []; + obj.allocation_meters = message.allocationMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1340,7 +1340,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts index 021f781274..2390374c0a 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts @@ -192,7 +192,7 @@ export const GenesisState = { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; @@ -334,10 +334,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = message.enableInflation === false ? undefined : message.enableInflation; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts index 571fd32b00..6ef4300957 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/inflation.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -184,9 +184,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards; - obj.usage_incentives = message.usageIncentives; - obj.community_pool = message.communityPool; + obj.staking_rewards = padDecimal(message.stakingRewards) === "" ? undefined : padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives) === "" ? undefined : padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -338,11 +338,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a; - obj.r = message.r; - obj.c = message.c; - obj.bonding_target = message.bondingTarget; - obj.max_variance = message.maxVariance; + obj.a = padDecimal(message.a) === "" ? undefined : padDecimal(message.a); + obj.r = padDecimal(message.r) === "" ? undefined : padDecimal(message.r); + obj.c = padDecimal(message.c) === "" ? undefined : padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget) === "" ? undefined : padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance) === "" ? undefined : padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts index 627e3d9fe0..b67fb6b1ef 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -947,7 +947,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate; + obj.inflation_rate = padDecimal(message.inflationRate) === "" ? undefined : padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/genesis.ts index fd797582aa..11b39553c0 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/recovery/v1/genesis.ts @@ -208,7 +208,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = message.enableRecovery === false ? undefined : message.enableRecovery; obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.ts index 1601453e8c..bfda615b80 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/query.ts @@ -109,7 +109,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { @@ -250,17 +250,17 @@ export const QueryBalancesResponse = { if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.locked = []; + obj.locked = message.locked; } if (message.unvested) { obj.unvested = message.unvested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.unvested = []; + obj.unvested = message.unvested; } if (message.vested) { obj.vested = message.vested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.vested = []; + obj.vested = message.vested; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.amino.ts index ef55f48dca..edb8ed1f1b 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -46,24 +47,24 @@ export const AminoConverter = { merge }: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAminoType["value"] => { return { - from_address: fromAddress, - to_address: toAddress, + from_address: omitDefault(fromAddress), + to_address: omitDefault(toAddress), start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length.toString(), + length: omitDefault(el0.length)?.toString?.(), amount: el0.amount.map(el1 => ({ - denom: el1.denom, - amount: el1.amount + denom: omitDefault(el1.denom), + amount: omitDefault(el1.amount) })) })), - merge + merge: omitDefault(merge) }; }, fromAmino: ({ @@ -78,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + lockupPeriods: lockup_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) @@ -104,9 +105,9 @@ export const AminoConverter = { destAddress }: MsgClawback): MsgClawbackAminoType["value"] => { return { - funder_address: funderAddress, - account_address: accountAddress, - dest_address: destAddress + funder_address: omitDefault(funderAddress), + account_address: omitDefault(accountAddress), + dest_address: omitDefault(destAddress) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.ts index 1a301fc010..c6dc1c0a23 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/tx.ts @@ -252,20 +252,20 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } - obj.merge = message.merge; + obj.merge = message.merge === false ? undefined : message.merge; return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -453,9 +453,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + obj.dest_address = message.destAddress === "" ? undefined : message.destAddress; return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/vesting.ts index ffb222d228..03523bb20e 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/vesting/v1/vesting.ts @@ -189,17 +189,17 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/auth.ts b/__fixtures__/v-next/outputinstantrpc/google/api/auth.ts index 7cd1e92b5f..c4ac81b745 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/auth.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/auth.ts @@ -442,12 +442,12 @@ export const Authentication = { if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } if (message.providers) { obj.providers = message.providers.map(e => e ? AuthProvider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, @@ -592,13 +592,13 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = message.allowWithoutCredential === false ? undefined : message.allowWithoutCredential; if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { - obj.requirements = []; + obj.requirements = message.requirements; } return obj; }, @@ -719,9 +719,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = message.header === null ? undefined : message.header; + obj.query = message.query === null ? undefined : message.query; + obj.value_prefix = message.valuePrefix === "" ? undefined : message.valuePrefix; return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -895,15 +895,15 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = message.id === "" ? undefined : message.id; + obj.issuer = message.issuer === "" ? undefined : message.issuer; + obj.jwks_uri = message.jwksUri === "" ? undefined : message.jwksUri; + obj.audiences = message.audiences === "" ? undefined : message.audiences; + obj.authorization_url = message.authorizationUrl === "" ? undefined : message.authorizationUrl; if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { - obj.jwt_locations = []; + obj.jwt_locations = message.jwtLocations; } return obj; }, @@ -992,7 +992,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = message.canonicalScopes === "" ? undefined : message.canonicalScopes; return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1096,8 +1096,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = message.providerId === "" ? undefined : message.providerId; + obj.audiences = message.audiences === "" ? undefined : message.audiences; return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/backend.ts b/__fixtures__/v-next/outputinstantrpc/google/api/backend.ts index 2c398a7e21..953d36987c 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/backend.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/backend.ts @@ -289,7 +289,7 @@ export const Backend = { if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -491,7 +491,7 @@ export const BackendRule = { message.operationDeadline = object.operation_deadline; } if (object.path_translation !== undefined && object.path_translation !== null) { - message.pathTranslation = backendRule_PathTranslationFromJSON(object.path_translation); + message.pathTranslation = object.path_translation; } if (object.jwt_audience !== undefined && object.jwt_audience !== null) { message.jwtAudience = object.jwt_audience; @@ -506,15 +506,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = backendRule_PathTranslationToJSON(message.pathTranslation); - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.address = message.address === "" ? undefined : message.address; + obj.deadline = message.deadline === 0 ? undefined : message.deadline; + obj.min_deadline = message.minDeadline === 0 ? undefined : message.minDeadline; + obj.operation_deadline = message.operationDeadline === 0 ? undefined : message.operationDeadline; + obj.path_translation = message.pathTranslation === 0 ? undefined : message.pathTranslation; + obj.jwt_audience = message.jwtAudience === null ? undefined : message.jwtAudience; + obj.disable_auth = message.disableAuth === null ? undefined : message.disableAuth; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/billing.ts b/__fixtures__/v-next/outputinstantrpc/google/api/billing.ts index e2ad5411bf..cae2208762 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/billing.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/billing.ts @@ -191,7 +191,7 @@ export const Billing = { if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -302,11 +302,11 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/config_change.ts b/__fixtures__/v-next/outputinstantrpc/google/api/config_change.ts index 644c92458c..3c4038a3da 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/config_change.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/config_change.ts @@ -273,21 +273,21 @@ export const ConfigChange = { message.newValue = object.new_value; } if (object.change_type !== undefined && object.change_type !== null) { - message.changeType = changeTypeFromJSON(object.change_type); + message.changeType = object.change_type; } message.advices = object.advices?.map(e => Advice.fromAmino(e)) || []; return message; }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = changeTypeToJSON(message.changeType); + obj.element = message.element === "" ? undefined : message.element; + obj.old_value = message.oldValue === "" ? undefined : message.oldValue; + obj.new_value = message.newValue === "" ? undefined : message.newValue; + obj.change_type = message.changeType === 0 ? undefined : message.changeType; if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { - obj.advices = []; + obj.advices = message.advices; } return obj; }, @@ -376,7 +376,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/consumer.ts b/__fixtures__/v-next/outputinstantrpc/google/api/consumer.ts index ac14aaa414..bf377fdf76 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/consumer.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/consumer.ts @@ -222,7 +222,7 @@ export const ProjectProperties = { if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toAmino(e) : undefined); } else { - obj.properties = []; + obj.properties = message.properties; } return obj; }, @@ -334,7 +334,7 @@ export const Property = { message.name = object.name; } if (object.type !== undefined && object.type !== null) { - message.type = property_PropertyTypeFromJSON(object.type); + message.type = object.type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -343,9 +343,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = property_PropertyTypeToJSON(message.type); - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === 0 ? undefined : message.type; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/context.ts b/__fixtures__/v-next/outputinstantrpc/google/api/context.ts index 91b357a791..e4d582c18c 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/context.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/context.ts @@ -211,7 +211,7 @@ export const Context = { if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -388,26 +388,26 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; if (message.requested) { obj.requested = message.requested.map(e => e); } else { - obj.requested = []; + obj.requested = message.requested; } if (message.provided) { obj.provided = message.provided.map(e => e); } else { - obj.provided = []; + obj.provided = message.provided; } if (message.allowedRequestExtensions) { obj.allowed_request_extensions = message.allowedRequestExtensions.map(e => e); } else { - obj.allowed_request_extensions = []; + obj.allowed_request_extensions = message.allowedRequestExtensions; } if (message.allowedResponseExtensions) { obj.allowed_response_extensions = message.allowedResponseExtensions.map(e => e); } else { - obj.allowed_response_extensions = []; + obj.allowed_response_extensions = message.allowedResponseExtensions; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/control.ts b/__fixtures__/v-next/outputinstantrpc/google/api/control.ts index c4a382b7a1..084229d3cd 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/control.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/control.ts @@ -94,7 +94,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = message.environment; + obj.environment = message.environment === "" ? undefined : message.environment; return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts b/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts index 976cec91cd..50c81443a3 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts @@ -524,19 +524,19 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -641,8 +641,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = message.min === 0 ? undefined : message.min; + obj.max = message.max === 0 ? undefined : message.max; return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -890,9 +890,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1012,9 +1012,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1120,7 +1120,7 @@ export const Distribution_BucketOptions_Explicit = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, @@ -1247,12 +1247,12 @@ export const Distribution_Exemplar = { }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.attachments = []; + obj.attachments = message.attachments; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/documentation.ts b/__fixtures__/v-next/outputinstantrpc/google/api/documentation.ts index e08d2d92e5..77dcae98fc 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/documentation.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/documentation.ts @@ -403,20 +403,20 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = message.summary; + obj.summary = message.summary === "" ? undefined : message.summary; if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.pages = []; + obj.pages = message.pages; } if (message.rules) { obj.rules = message.rules.map(e => e ? DocumentationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.documentation_root_url = message.documentationRootUrl; - obj.service_root_url = message.serviceRootUrl; - obj.overview = message.overview; + obj.documentation_root_url = message.documentationRootUrl === "" ? undefined : message.documentationRootUrl; + obj.service_root_url = message.serviceRootUrl === "" ? undefined : message.serviceRootUrl; + obj.overview = message.overview === "" ? undefined : message.overview; return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -536,9 +536,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.description = message.description; - obj.deprecation_description = message.deprecationDescription; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.description = message.description === "" ? undefined : message.description; + obj.deprecation_description = message.deprecationDescription === "" ? undefined : message.deprecationDescription; return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -664,12 +664,12 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = message.name; - obj.content = message.content; + obj.name = message.name === "" ? undefined : message.name; + obj.content = message.content === "" ? undefined : message.content; if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.subpages = []; + obj.subpages = message.subpages; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/endpoint.ts b/__fixtures__/v-next/outputinstantrpc/google/api/endpoint.ts index ea00824b27..63ea26cf9e 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/endpoint.ts @@ -203,14 +203,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } - obj.target = message.target; - obj.allow_cors = message.allowCors; + obj.target = message.target === "" ? undefined : message.target; + obj.allow_cors = message.allowCors === false ? undefined : message.allowCors; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts index fcf65dd441..6a5142fdc6 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -349,10 +349,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -468,7 +468,7 @@ export const ParseResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -617,10 +617,10 @@ export const CheckRequest = { if (message.typeEnv) { obj.type_env = message.typeEnv.map(e => e ? Decl.toAmino(e) : undefined); } else { - obj.type_env = []; + obj.type_env = message.typeEnv; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = message.container === "" ? undefined : message.container; + obj.no_std_env = message.noStdEnv === false ? undefined : message.noStdEnv; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -736,7 +736,7 @@ export const CheckResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -842,7 +842,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -1028,7 +1028,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1144,7 +1144,7 @@ export const EvalResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -1257,7 +1257,7 @@ export const IssueDetails = { fromAmino(object: IssueDetailsAmino): IssueDetails { const message = createBaseIssueDetails(); if (object.severity !== undefined && object.severity !== null) { - message.severity = issueDetails_SeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.position !== undefined && object.position !== null) { message.position = SourcePosition.fromAmino(object.position); @@ -1269,7 +1269,7 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = issueDetails_SeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; obj.id = message.id ? message.id.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts index 1ce384353f..4a275bcb18 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts @@ -1015,7 +1015,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1271,16 +1271,16 @@ export const Type = { message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1311,15 +1311,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1637,7 +1637,7 @@ export const Type_FunctionType = { if (message.argTypes) { obj.arg_types = message.argTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.arg_types = []; + obj.arg_types = message.argTypes; } return obj; }, @@ -1748,11 +1748,11 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.parameter_types = []; + obj.parameter_types = message.parameterTypes; } return obj; }, @@ -1877,7 +1877,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -2005,7 +2005,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2102,7 +2102,7 @@ export const Decl_FunctionDecl = { if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toAmino(e) : undefined); } else { - obj.overloads = []; + obj.overloads = message.overloads; } return obj; }, @@ -2285,20 +2285,20 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2426,11 +2426,11 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { - obj.overload_id = []; + obj.overload_id = message.overloadId; } obj.value = message.value ? Constant.toAmino(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts index cdf6dbc118..7578b2cf10 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts @@ -251,12 +251,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -591,7 +591,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -698,7 +698,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e.toString()); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts index cc2921cfe6..fb9adcfcc5 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts @@ -153,12 +153,12 @@ export const Explain = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.exprSteps) { obj.expr_steps = message.exprSteps.map(e => e ? Explain_ExprStep.toAmino(e) : undefined); } else { - obj.expr_steps = []; + obj.expr_steps = message.exprSteps; } return obj; }, @@ -266,7 +266,7 @@ export const Explain_ExprStep = { toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.value_index = message.valueIndex; + obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts index 0b30071ed5..8707c2b3cd 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts @@ -937,7 +937,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1060,8 +1060,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1190,11 +1190,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1292,7 +1292,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1403,11 +1403,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = message.messageName === "" ? undefined : message.messageName; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1551,7 +1551,7 @@ export const Expr_CreateStruct_Entry = { toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1747,9 +1747,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1949,7 +1949,7 @@ export const Constant = { fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1979,12 +1979,12 @@ export const Constant = { }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -2093,7 +2093,7 @@ export const SourceInfo_PositionsEntry = { toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2442,12 +2442,12 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2596,10 +2596,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts index 6ff0077e97..a2a4461fbe 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts @@ -369,7 +369,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -408,18 +408,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -523,8 +523,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -621,7 +621,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -719,7 +719,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/decl.ts index d58da40c85..aa5c27d0e9 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/decl.ts @@ -231,9 +231,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = message.id === 0 ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.doc = message.doc === "" ? undefined : message.doc; obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -361,12 +361,12 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = message.id === 0 ? undefined : message.id; + obj.type = message.type === "" ? undefined : message.type; if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } return obj; }, @@ -607,10 +607,10 @@ export const FunctionDecl = { if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = message.receiverFunction === false ? undefined : message.receiverFunction; return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/eval.ts index 2613dc06f8..a0c78e0fcc 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/eval.ts @@ -264,12 +264,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -377,7 +377,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -602,7 +602,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -700,7 +700,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -789,7 +789,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts index f19e9fa07b..558ab489b3 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts @@ -513,7 +513,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -727,7 +727,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -822,7 +822,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -945,8 +945,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1075,11 +1075,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1177,7 +1177,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1288,11 +1288,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1433,8 +1433,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = message.id === 0 ? undefined : message.id; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1630,9 +1630,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1804,7 +1804,7 @@ export const Literal = { fromAmino(object: LiteralAmino): Literal { const message = createBaseLiteral(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1828,12 +1828,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/source.ts index 74d34127db..afa2dccaf0 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/source.ts @@ -163,8 +163,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === 0 ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -336,11 +336,11 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -483,10 +483,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts index 38649aee4f..9b332a9930 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts @@ -369,7 +369,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -408,18 +408,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -523,8 +523,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -621,7 +621,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -719,7 +719,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/http.ts b/__fixtures__/v-next/outputinstantrpc/google/api/http.ts index 0464bcb646..27fefd5395 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/http.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/http.ts @@ -756,9 +756,9 @@ export const Http = { if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -998,19 +998,19 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.additional_bindings = []; + obj.additional_bindings = message.additionalBindings; } return obj; }, @@ -1115,8 +1115,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/httpbody.ts b/__fixtures__/v-next/outputinstantrpc/google/api/httpbody.ts index 2bc4912c79..bc07994016 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/httpbody.ts @@ -219,12 +219,12 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = message.contentType === "" ? undefined : message.contentType; obj.data = message.data ? base64FromBytes(message.data) : undefined; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/label.ts b/__fixtures__/v-next/outputinstantrpc/google/api/label.ts index 10b62de5e0..a26f34855d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/label.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/label.ts @@ -153,7 +153,7 @@ export const LabelDescriptor = { message.key = object.key; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = labelDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -162,9 +162,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = labelDescriptor_ValueTypeToJSON(message.valueType); - obj.description = message.description; + obj.key = message.key === "" ? undefined : message.key; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/log.ts b/__fixtures__/v-next/outputinstantrpc/google/api/log.ts index 240c58997a..aaf0a95b5c 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/log.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/log.ts @@ -180,14 +180,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.description = message.description; - obj.display_name = message.displayName; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/logging.ts b/__fixtures__/v-next/outputinstantrpc/google/api/logging.ts index 0af3ad896c..640f2aced6 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/logging.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/logging.ts @@ -217,12 +217,12 @@ export const Logging = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -333,11 +333,11 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.logs) { obj.logs = message.logs.map(e => e); } else { - obj.logs = []; + obj.logs = message.logs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/metric.ts b/__fixtures__/v-next/outputinstantrpc/google/api/metric.ts index 8529a34f14..e77750b1b5 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/metric.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/metric.ts @@ -616,10 +616,10 @@ export const MetricDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.metric_kind !== undefined && object.metric_kind !== null) { - message.metricKind = metricDescriptor_MetricKindFromJSON(object.metric_kind); + message.metricKind = object.metric_kind; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = metricDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.unit !== undefined && object.unit !== null) { message.unit = object.unit; @@ -634,31 +634,31 @@ export const MetricDescriptor = { message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromAmino(object.metadata); } if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } message.monitoredResourceTypes = object.monitored_resource_types?.map(e => e) || []; return message; }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.metric_kind = metricDescriptor_MetricKindToJSON(message.metricKind); - obj.value_type = metricDescriptor_ValueTypeToJSON(message.valueType); - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = message.metricKind === 0 ? undefined : message.metricKind; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { - obj.monitored_resource_types = []; + obj.monitored_resource_types = message.monitoredResourceTypes; } return obj; }, @@ -771,7 +771,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromAmino(object: MetricDescriptor_MetricDescriptorMetadataAmino): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } if (object.sample_period !== undefined && object.sample_period !== null) { message.samplePeriod = Duration.fromAmino(object.sample_period); @@ -783,7 +783,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -888,8 +888,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1030,7 +1030,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/monitored_resource.ts b/__fixtures__/v-next/outputinstantrpc/google/api/monitored_resource.ts index 9b623d4982..08ce330325 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/monitored_resource.ts @@ -348,22 +348,22 @@ export const MonitoredResourceDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } return message; }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.display_name = message.displayName === "" ? undefined : message.displayName; + obj.description = message.description === "" ? undefined : message.description; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -466,8 +466,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -608,7 +608,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -717,8 +717,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/monitoring.ts b/__fixtures__/v-next/outputinstantrpc/google/api/monitoring.ts index 4df9a3652e..ab5f9b5a3d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/monitoring.ts @@ -265,12 +265,12 @@ export const Monitoring = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -381,11 +381,11 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts b/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts index e5bee1b8e7..750cfdfbd4 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts @@ -401,12 +401,12 @@ export const Quota = { if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toAmino(e) : undefined); } else { - obj.limits = []; + obj.limits = message.limits; } if (message.metricRules) { obj.metric_rules = message.metricRules.map(e => e ? MetricRule.toAmino(e) : undefined); } else { - obj.metric_rules = []; + obj.metric_rules = message.metricRules; } return obj; }, @@ -512,7 +512,7 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? message.value.toString() : undefined; return obj; }, @@ -654,7 +654,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -765,7 +765,7 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? message.value.toString() : undefined; return obj; }, @@ -1041,21 +1041,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; - obj.duration = message.duration; - obj.metric = message.metric; - obj.unit = message.unit; + obj.duration = message.duration === "" ? undefined : message.duration; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/resource.ts b/__fixtures__/v-next/outputinstantrpc/google/api/resource.ts index 1ef9b96024..0e4a5e2623 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/resource.ts @@ -517,7 +517,7 @@ export const ResourceDescriptor = { message.nameField = object.name_field; } if (object.history !== undefined && object.history !== null) { - message.history = resourceDescriptor_HistoryFromJSON(object.history); + message.history = object.history; } if (object.plural !== undefined && object.plural !== null) { message.plural = object.plural; @@ -525,25 +525,25 @@ export const ResourceDescriptor = { if (object.singular !== undefined && object.singular !== null) { message.singular = object.singular; } - message.style = object.style?.map(e => resourceDescriptor_StyleFromJSON(e)) || []; + message.style = object.style?.map(e => e) || []; return message; }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { - obj.pattern = []; + obj.pattern = message.pattern; } - obj.name_field = message.nameField; - obj.history = resourceDescriptor_HistoryToJSON(message.history); - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = message.nameField === "" ? undefined : message.nameField; + obj.history = message.history === 0 ? undefined : message.history; + obj.plural = message.plural === "" ? undefined : message.plural; + obj.singular = message.singular === "" ? undefined : message.singular; if (message.style) { - obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); + obj.style = message.style.map(e => e); } else { - obj.style = []; + obj.style = message.style; } return obj; }, @@ -648,8 +648,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = message.type === "" ? undefined : message.type; + obj.child_type = message.childType === "" ? undefined : message.childType; return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/routing.ts b/__fixtures__/v-next/outputinstantrpc/google/api/routing.ts index 43980d662e..f045948f92 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/routing.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/routing.ts @@ -890,7 +890,7 @@ export const RoutingRule = { if (message.routingParameters) { obj.routing_parameters = message.routingParameters.map(e => e ? RoutingParameter.toAmino(e) : undefined); } else { - obj.routing_parameters = []; + obj.routing_parameters = message.routingParameters; } return obj; }, @@ -995,8 +995,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = message.field; - obj.path_template = message.pathTemplate; + obj.field = message.field === "" ? undefined : message.field; + obj.path_template = message.pathTemplate === "" ? undefined : message.pathTemplate; return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/service.ts b/__fixtures__/v-next/outputinstantrpc/google/api/service.ts index 92c85c7773..0a985a4bd4 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/service.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/service.ts @@ -722,24 +722,24 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; - obj.producer_project_id = message.producerProjectId; - obj.id = message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.id = message.id === "" ? undefined : message.id; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } if (message.types) { obj.types = message.types.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.types = []; + obj.types = message.types; } if (message.enums) { obj.enums = message.enums.map(e => e ? Enum.toAmino(e) : undefined); } else { - obj.enums = []; + obj.enums = message.enums; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.backend = message.backend ? Backend.toAmino(message.backend) : undefined; @@ -751,23 +751,23 @@ export const Service = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } obj.control = message.control ? Control.toAmino(message.control) : undefined; if (message.logs) { obj.logs = message.logs.map(e => e ? LogDescriptor.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } if (message.metrics) { obj.metrics = message.metrics.map(e => e ? MetricDescriptor.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.billing = message.billing ? Billing.toAmino(message.billing) : undefined; obj.logging = message.logging ? Logging.toAmino(message.logging) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/check_error.ts index 664d72afef..9cfb8461ed 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/check_error.ts @@ -333,7 +333,7 @@ export const CheckError = { fromAmino(object: CheckErrorAmino): CheckError { const message = createBaseCheckError(); if (object.code !== undefined && object.code !== null) { - message.code = checkError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -348,9 +348,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = checkError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.detail = message.detail === "" ? undefined : message.detail; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts index af739438ec..14f84eed08 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts @@ -417,14 +417,14 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.minimum = message.minimum; - obj.maximum = message.maximum; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.minimum = message.minimum === 0 ? undefined : message.minimum; + obj.maximum = message.maximum === 0 ? undefined : message.maximum; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } obj.linear_buckets = message.linearBuckets ? Distribution_LinearBuckets.toAmino(message.linearBuckets) : undefined; obj.exponential_buckets = message.exponentialBuckets ? Distribution_ExponentialBuckets.toAmino(message.exponentialBuckets) : undefined; @@ -432,7 +432,7 @@ export const Distribution = { if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -553,9 +553,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -675,9 +675,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { @@ -783,7 +783,7 @@ export const Distribution_ExplicitBuckets = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts index 42a252a826..6908f69686 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts @@ -406,21 +406,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; + obj.status = message.status === 0 ? undefined : message.status; obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts index 7203011747..4fdb683fb5 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts @@ -261,8 +261,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -535,7 +535,7 @@ export const LogEntry = { message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -573,12 +573,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -586,7 +586,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -725,10 +725,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -850,9 +850,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts index 6f369d68b9..53dc5f8432 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts @@ -176,8 +176,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -428,10 +428,10 @@ export const MetricValue = { } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.bool_value = message.boolValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -542,11 +542,11 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { - obj.metric_values = []; + obj.metric_values = message.metricValues; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/operation.ts index 0f16196025..f35cf14063 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/operation.ts @@ -243,8 +243,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -524,16 +524,16 @@ export const Operation = { message.metricValueSets = object.metric_value_sets?.map(e => MetricValueSet.fromAmino(e)) || []; message.logEntries = object.log_entries?.map(e => LogEntry.fromAmino(e)) || []; if (object.importance !== undefined && object.importance !== null) { - message.importance = operation_ImportanceFromJSON(object.importance); + message.importance = object.importance; } message.extensions = object.extensions?.map(e => Any.fromAmino(e)) || []; return message; }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.operation_name = message.operationName === "" ? undefined : message.operationName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.labels = {}; @@ -545,18 +545,18 @@ export const Operation = { if (message.metricValueSets) { obj.metric_value_sets = message.metricValueSets.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.metric_value_sets = []; + obj.metric_value_sets = message.metricValueSets; } if (message.logEntries) { obj.log_entries = message.logEntries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.log_entries = []; + obj.log_entries = message.logEntries; } - obj.importance = operation_ImportanceToJSON(message.importance); + obj.importance = message.importance === 0 ? undefined : message.importance; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/quota_controller.ts index b4e44edf6a..932a0e3206 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/quota_controller.ts @@ -453,9 +453,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -558,8 +558,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -764,15 +764,15 @@ export const QuotaOperation = { }, {}); message.quotaMetrics = object.quota_metrics?.map(e => MetricValueSet.fromAmino(e)) || []; if (object.quota_mode !== undefined && object.quota_mode !== null) { - message.quotaMode = quotaOperation_QuotaModeFromJSON(object.quota_mode); + message.quotaMode = object.quota_mode; } return message; }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.method_name = message.methodName === "" ? undefined : message.methodName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -782,9 +782,9 @@ export const QuotaOperation = { if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.quota_mode = quotaOperation_QuotaModeToJSON(message.quotaMode); + obj.quota_mode = message.quotaMode === 0 ? undefined : message.quotaMode; return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -932,18 +932,18 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { - obj.allocate_errors = []; + obj.allocate_errors = message.allocateErrors; } if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1066,7 +1066,7 @@ export const QuotaError = { fromAmino(object: QuotaErrorAmino): QuotaError { const message = createBaseQuotaError(); if (object.code !== undefined && object.code !== null) { - message.code = quotaError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -1081,9 +1081,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = quotaError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.description = message.description; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts index 5e388e7e04..0b5467322d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts @@ -395,9 +395,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -557,14 +557,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { - obj.check_errors = []; + obj.check_errors = message.checkErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -680,7 +680,7 @@ export const CheckResponse_CheckInfo = { if (message.unusedArguments) { obj.unused_arguments = message.unusedArguments.map(e => e); } else { - obj.unused_arguments = []; + obj.unused_arguments = message.unusedArguments; } obj.consumer_info = message.consumerInfo ? CheckResponse_ConsumerInfo.toAmino(message.consumerInfo) : undefined; return obj; @@ -797,7 +797,7 @@ export const CheckResponse_ConsumerInfo = { message.projectNumber = BigInt(object.project_number); } if (object.type !== undefined && object.type !== null) { - message.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + message.type = object.type; } if (object.consumer_number !== undefined && object.consumer_number !== null) { message.consumerNumber = BigInt(object.consumer_number); @@ -807,7 +807,7 @@ export const CheckResponse_ConsumerInfo = { toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; return obj; }, @@ -934,13 +934,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1069,10 +1069,10 @@ export const ReportResponse = { if (message.reportErrors) { obj.report_errors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toAmino(e) : undefined); } else { - obj.report_errors = []; + obj.report_errors = message.reportErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1178,7 +1178,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v2/service_controller.ts index 9c8027e793..aa0391be97 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v2/service_controller.ts @@ -305,15 +305,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } - obj.flags = message.flags; + obj.flags = message.flags === "" ? undefined : message.flags; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -465,11 +465,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.permission = message.permission === "" ? undefined : message.permission; + obj.container = message.container === "" ? undefined : message.container; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -572,8 +572,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -848,12 +848,12 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/resources.ts index a0489b7055..7f9a439da8 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/resources.ts @@ -682,8 +682,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -834,14 +834,14 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } if (message.steps) { obj.steps = message.steps.map(e => e ? OperationMetadata_Step.toAmino(e) : undefined); } else { - obj.steps = []; + obj.steps = message.steps; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = message.progressPercentage === 0 ? undefined : message.progressPercentage; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -940,14 +940,14 @@ export const OperationMetadata_Step = { message.description = object.description; } if (object.status !== undefined && object.status !== null) { - message.status = operationMetadata_StatusFromJSON(object.status); + message.status = object.status; } return message; }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = operationMetadata_StatusToJSON(message.status); + obj.description = message.description === "" ? undefined : message.description; + obj.status = message.status === 0 ? undefined : message.status; return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1058,7 +1058,7 @@ export const Diagnostic = { message.location = object.location; } if (object.kind !== undefined && object.kind !== null) { - message.kind = diagnostic_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.message !== undefined && object.message !== null) { message.message = object.message; @@ -1067,9 +1067,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = diagnostic_KindToJSON(message.kind); - obj.message = message.message; + obj.location = message.location === "" ? undefined : message.location; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1179,11 +1179,11 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { - obj.files = []; + obj.files = message.files; } return obj; }, @@ -1298,15 +1298,15 @@ export const ConfigFile = { message.fileContents = bytesFromBase64(object.file_contents); } if (object.file_type !== undefined && object.file_type !== null) { - message.fileType = configFile_FileTypeFromJSON(object.file_type); + message.fileType = object.file_type; } return message; }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = message.filePath === "" ? undefined : message.filePath; obj.file_contents = message.fileContents ? base64FromBytes(message.fileContents) : undefined; - obj.file_type = configFile_FileTypeToJSON(message.fileType); + obj.file_type = message.fileType === 0 ? undefined : message.fileType; return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1394,7 +1394,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1491,7 +1491,7 @@ export const ChangeReport = { if (message.configChanges) { obj.config_changes = message.configChanges.map(e => e ? ConfigChange.toAmino(e) : undefined); } else { - obj.config_changes = []; + obj.config_changes = message.configChanges; } return obj; }, @@ -1665,7 +1665,7 @@ export const Rollout = { message.createdBy = object.created_by; } if (object.status !== undefined && object.status !== null) { - message.status = rollout_RolloutStatusFromJSON(object.status); + message.status = object.status; } if (object.traffic_percent_strategy !== undefined && object.traffic_percent_strategy !== null) { message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy); @@ -1680,13 +1680,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; - obj.created_by = message.createdBy; - obj.status = rollout_RolloutStatusToJSON(message.status); + obj.created_by = message.createdBy === "" ? undefined : message.createdBy; + obj.status = message.status === 0 ? undefined : message.status; obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1789,8 +1789,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/servicemanager.ts index 0eef3cf142..a5b9a64b21 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicemanagement/v1/servicemanager.ts @@ -562,10 +562,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -678,9 +678,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -768,7 +768,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -946,7 +946,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1034,7 +1034,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1238,15 +1238,15 @@ export const GetServiceConfigRequest = { message.configId = object.config_id; } if (object.view !== undefined && object.view !== null) { - message.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = getServiceConfigRequest_ConfigViewToJSON(message.view); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.config_id = message.configId === "" ? undefined : message.configId; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1366,9 +1366,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1481,9 +1481,9 @@ export const ListServiceConfigsResponse = { if (message.serviceConfigs) { obj.service_configs = message.serviceConfigs.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.service_configs = []; + obj.service_configs = message.serviceConfigs; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1589,7 +1589,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1712,9 +1712,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = message.validateOnly === false ? undefined : message.validateOnly; return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -1910,7 +1910,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -2047,10 +2047,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2163,9 +2163,9 @@ export const ListServiceRolloutsResponse = { if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toAmino(e) : undefined); } else { - obj.rollouts = []; + obj.rollouts = message.rollouts; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2269,8 +2269,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2527,17 +2527,17 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.id = message.id === "" ? undefined : message.id; if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { - obj.change_reports = []; + obj.change_reports = message.changeReports; } if (message.diagnostics) { obj.diagnostics = message.diagnostics.map(e => e ? Diagnostic.toAmino(e) : undefined); } else { - obj.diagnostics = []; + obj.diagnostics = message.diagnostics; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/resources.ts index 92ed28996a..024c546cb1 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/resources.ts @@ -283,16 +283,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -552,12 +552,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -566,12 +566,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -670,7 +670,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/serviceusage.ts index 19687a0bad..2d43ff4fd6 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1/serviceusage.ts @@ -414,7 +414,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -618,15 +618,15 @@ export const DisableServiceRequest = { message.disableDependentServices = object.disable_dependent_services; } if (object.check_if_service_has_usage !== undefined && object.check_if_service_has_usage !== null) { - message.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage); + message.checkIfServiceHasUsage = object.check_if_service_has_usage; } return message; }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = disableServiceRequest_CheckIfServiceHasUsageToJSON(message.checkIfServiceHasUsage); + obj.name = message.name === "" ? undefined : message.name; + obj.disable_dependent_services = message.disableDependentServices === false ? undefined : message.disableDependentServices; + obj.check_if_service_has_usage = message.checkIfServiceHasUsage === 0 ? undefined : message.checkIfServiceHasUsage; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -804,7 +804,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -940,10 +940,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1056,9 +1056,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1168,11 +1168,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1292,12 +1292,12 @@ export const BatchEnableServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } if (message.failures) { obj.failures = message.failures.map(e => e ? BatchEnableServicesResponse_EnableFailure.toAmino(e) : undefined); } else { - obj.failures = []; + obj.failures = message.failures; } return obj; }, @@ -1402,8 +1402,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = message.serviceId === "" ? undefined : message.serviceId; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1513,11 +1513,11 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.names) { obj.names = message.names.map(e => e); } else { - obj.names = []; + obj.names = message.names; } return obj; }, @@ -1615,7 +1615,7 @@ export const BatchGetServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts index 6d82be44c5..d4583eb019 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts @@ -777,16 +777,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1046,12 +1046,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -1060,12 +1060,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -1164,7 +1164,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1345,20 +1345,20 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.display_name = message.displayName === "" ? undefined : message.displayName; if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.consumer_quota_limits = []; + obj.consumer_quota_limits = message.consumerQuotaLimits; } if (message.descendantConsumerQuotaLimits) { obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.descendant_consumer_quota_limits = []; + obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits; } - obj.unit = message.unit; + obj.unit = message.unit === "" ? undefined : message.unit; return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1532,15 +1532,15 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.is_precise = message.isPrecise === false ? undefined : message.isPrecise; + obj.allows_admin_overrides = message.allowsAdminOverrides === false ? undefined : message.allowsAdminOverrides; if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { - obj.quota_buckets = []; + obj.quota_buckets = message.quotaBuckets; } return obj; }, @@ -1644,8 +1644,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -1973,8 +1973,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2181,7 +2181,7 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2189,9 +2189,9 @@ export const QuotaOverride = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.admin_override_ancestor = message.adminOverrideAncestor === "" ? undefined : message.adminOverrideAncestor; return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2288,7 +2288,7 @@ export const OverrideInlineSource = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2392,8 +2392,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2600,7 +2600,7 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2608,9 +2608,9 @@ export const AdminQuotaPolicy = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2714,8 +2714,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = message.email === "" ? undefined : message.email; + obj.unique_id = message.uniqueId === "" ? undefined : message.uniqueId; return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/serviceusage.ts index b10371e498..3ce3566f5d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/serviceusage.ts @@ -969,7 +969,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1057,7 +1057,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1145,7 +1145,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1281,10 +1281,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1397,9 +1397,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1509,11 +1509,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1644,16 +1644,16 @@ export const ListConsumerQuotaMetricsRequest = { message.pageToken = object.page_token; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = quotaViewToJSON(message.view); + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -1766,9 +1766,9 @@ export const ListConsumerQuotaMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -1866,14 +1866,14 @@ export const GetConsumerQuotaMetricRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -1971,14 +1971,14 @@ export const GetConsumerQuotaLimitRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2126,18 +2126,18 @@ export const CreateAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2304,19 +2304,19 @@ export const UpdateAdminOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2447,17 +2447,17 @@ export const DeleteAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2578,9 +2578,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -2693,9 +2693,9 @@ export const ListAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -2792,7 +2792,7 @@ export const BatchCreateAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2941,18 +2941,18 @@ export const ImportAdminOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3050,7 +3050,7 @@ export const ImportAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3267,18 +3267,18 @@ export const CreateConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3445,19 +3445,19 @@ export const UpdateConsumerOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3588,17 +3588,17 @@ export const DeleteConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3719,9 +3719,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -3834,9 +3834,9 @@ export const ListConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -3933,7 +3933,7 @@ export const BatchCreateConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4082,18 +4082,18 @@ export const ImportConsumerOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4191,7 +4191,7 @@ export const ImportConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4357,7 +4357,7 @@ export const ImportAdminQuotaPoliciesResponse = { if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toAmino(e) : undefined); } else { - obj.policies = []; + obj.policies = message.policies; } return obj; }, @@ -4718,7 +4718,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -4818,14 +4818,14 @@ export const GetServiceIdentityResponse = { message.identity = ServiceIdentity.fromAmino(object.identity); } if (object.state !== undefined && object.state !== null) { - message.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/source_info.ts b/__fixtures__/v-next/outputinstantrpc/google/api/source_info.ts index 6744c567c6..9e0ba28110 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/source_info.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/source_info.ts @@ -93,7 +93,7 @@ export const SourceInfo = { if (message.sourceFiles) { obj.source_files = message.sourceFiles.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.source_files = []; + obj.source_files = message.sourceFiles; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/system_parameter.ts b/__fixtures__/v-next/outputinstantrpc/google/api/system_parameter.ts index 1809103059..27679cfc2d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/system_parameter.ts @@ -202,7 +202,7 @@ export const SystemParameters = { if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -313,11 +313,11 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { - obj.parameters = []; + obj.parameters = message.parameters; } return obj; }, @@ -438,9 +438,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = message.name; - obj.http_header = message.httpHeader; - obj.url_query_parameter = message.urlQueryParameter; + obj.name = message.name === "" ? undefined : message.name; + obj.http_header = message.httpHeader === "" ? undefined : message.httpHeader; + obj.url_query_parameter = message.urlQueryParameter === "" ? undefined : message.urlQueryParameter; return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/usage.ts b/__fixtures__/v-next/outputinstantrpc/google/api/usage.ts index fb98bc774b..d855f107fa 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/usage.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/usage.ts @@ -243,14 +243,14 @@ export const Usage = { if (message.requirements) { obj.requirements = message.requirements.map(e => e); } else { - obj.requirements = []; + obj.requirements = message.requirements; } if (message.rules) { obj.rules = message.rules.map(e => e ? UsageRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.producer_notification_channel = message.producerNotificationChannel; + obj.producer_notification_channel = message.producerNotificationChannel === "" ? undefined : message.producerNotificationChannel; return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -370,9 +370,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.allow_unregistered_calls = message.allowUnregisteredCalls; - obj.skip_service_control = message.skipServiceControl; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.allow_unregistered_calls = message.allowUnregisteredCalls === false ? undefined : message.allowUnregisteredCalls; + obj.skip_service_control = message.skipServiceControl === false ? undefined : message.skipServiceControl; return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/visibility.ts b/__fixtures__/v-next/outputinstantrpc/google/api/visibility.ts index 9fcf20f062..c1b47c4efe 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/visibility.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/visibility.ts @@ -184,7 +184,7 @@ export const Visibility = { if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -289,8 +289,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.restriction = message.restriction; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.restriction = message.restriction === "" ? undefined : message.restriction; return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts index 2eabff49d4..073190bdac 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts @@ -408,21 +408,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; + obj.status = message.status === 0 ? undefined : message.status; obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts index f53af495cb..30e86d2510 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts @@ -385,8 +385,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -743,7 +743,7 @@ export const LogEntry = { message.receiveTimestamp = fromTimestamp(Timestamp.fromAmino(object.receive_timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.insert_id !== undefined && object.insert_id !== null) { message.insertId = object.insert_id; @@ -781,15 +781,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.receive_timestamp = message.receiveTimestamp ? Timestamp.toAmino(toTimestamp(message.receiveTimestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); - obj.insert_id = message.insertId; + obj.severity = message.severity === 0 ? undefined : message.severity; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -798,9 +798,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.span_id = message.spanId === "" ? undefined : message.spanId; + obj.trace_sampled = message.traceSampled === false ? undefined : message.traceSampled; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -938,10 +938,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1063,9 +1063,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1185,9 +1185,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = message.uid === "" ? undefined : message.uid; + obj.index = message.index === 0 ? undefined : message.index; + obj.total_splits = message.totalSplits === 0 ? undefined : message.totalSplits; return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging.ts index bc598cb108..fb3584aab8 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging.ts @@ -612,7 +612,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -715,8 +715,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -929,7 +929,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -940,10 +940,10 @@ export const WriteLogEntriesRequest = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = message.partialSuccess === false ? undefined : message.partialSuccess; + obj.dry_run = message.dryRun === false ? undefined : message.dryRun; return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1116,7 +1116,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === 0 ? undefined : message.key; obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1408,12 +1408,12 @@ export const ListLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.order_by = message.orderBy === "" ? undefined : message.orderBy; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1526,9 +1526,9 @@ export const ListLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1632,8 +1632,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -1746,9 +1746,9 @@ export const ListMonitoredResourceDescriptorsResponse = { if (message.resourceDescriptors) { obj.resource_descriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.resource_descriptors = []; + obj.resource_descriptors = message.resourceDescriptors; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -1890,13 +1890,13 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -2010,9 +2010,9 @@ export const ListLogsResponse = { if (message.logNames) { obj.log_names = message.logNames.map(e => e); } else { - obj.log_names = []; + obj.log_names = message.logNames; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2143,9 +2143,9 @@ export const TailLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2265,12 +2265,12 @@ export const TailLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.suppressionInfo) { obj.suppression_info = message.suppressionInfo.map(e => e ? TailLogEntriesResponse_SuppressionInfo.toAmino(e) : undefined); } else { - obj.suppression_info = []; + obj.suppression_info = message.suppressionInfo; } return obj; }, @@ -2366,7 +2366,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { fromAmino(object: TailLogEntriesResponse_SuppressionInfoAmino): TailLogEntriesResponse_SuppressionInfo { const message = createBaseTailLogEntriesResponse_SuppressionInfo(); if (object.reason !== undefined && object.reason !== null) { - message.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + message.reason = object.reason; } if (object.suppressed_count !== undefined && object.suppressed_count !== null) { message.suppressedCount = object.suppressed_count; @@ -2375,8 +2375,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason); - obj.suppressed_count = message.suppressedCount; + obj.reason = message.reason === 0 ? undefined : message.reason; + obj.suppressed_count = message.suppressedCount === 0 ? undefined : message.suppressedCount; return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts index 1b93d63270..9cb168f8c8 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts @@ -1936,7 +1936,7 @@ export const LogBucket = { message.locked = object.locked; } if (object.lifecycle_state !== undefined && object.lifecycle_state !== null) { - message.lifecycleState = lifecycleStateFromJSON(object.lifecycle_state); + message.lifecycleState = object.lifecycle_state; } message.restrictedFields = object.restricted_fields?.map(e => e) || []; if (object.cmek_settings !== undefined && object.cmek_settings !== null) { @@ -1946,17 +1946,17 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = lifecycleStateToJSON(message.lifecycleState); + obj.retention_days = message.retentionDays === 0 ? undefined : message.retentionDays; + obj.locked = message.locked === false ? undefined : message.locked; + obj.lifecycle_state = message.lifecycleState === 0 ? undefined : message.lifecycleState; if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { - obj.restricted_fields = []; + obj.restricted_fields = message.restrictedFields; } obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; return obj; @@ -2110,11 +2110,11 @@ export const LogView = { }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -2365,7 +2365,7 @@ export const LogSink = { } message.exclusions = object.exclusions?.map(e => LogExclusion.fromAmino(e)) || []; if (object.output_version_format !== undefined && object.output_version_format !== null) { - message.outputVersionFormat = logSink_VersionFormatFromJSON(object.output_version_format); + message.outputVersionFormat = object.output_version_format; } if (object.writer_identity !== undefined && object.writer_identity !== null) { message.writerIdentity = object.writer_identity; @@ -2386,19 +2386,19 @@ export const LogSink = { }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.destination = message.destination === "" ? undefined : message.destination; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.description = message.description === "" ? undefined : message.description; + obj.disabled = message.disabled === false ? undefined : message.disabled; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.output_version_format = logSink_VersionFormatToJSON(message.outputVersionFormat); - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = message.outputVersionFormat === 0 ? undefined : message.outputVersionFormat; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; + obj.include_children = message.includeChildren === false ? undefined : message.includeChildren; obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; @@ -2505,8 +2505,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = message.usePartitionedTables === false ? undefined : message.usePartitionedTables; + obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning === false ? undefined : message.usesTimestampColumnPartitioning; return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -2626,9 +2626,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -2741,9 +2741,9 @@ export const ListBucketsResponse = { if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toAmino(e) : undefined); } else { - obj.buckets = []; + obj.buckets = message.buckets; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -2865,8 +2865,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.bucket_id = message.bucketId === "" ? undefined : message.bucketId; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -2991,7 +2991,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3081,7 +3081,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -3169,7 +3169,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -3257,7 +3257,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -3377,9 +3377,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -3492,9 +3492,9 @@ export const ListViewsResponse = { if (message.views) { obj.views = message.views.map(e => e ? LogView.toAmino(e) : undefined); } else { - obj.views = []; + obj.views = message.views; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -3616,8 +3616,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.view_id = message.viewId === "" ? undefined : message.viewId; obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -3742,7 +3742,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3832,7 +3832,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -3920,7 +3920,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -4040,9 +4040,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -4155,9 +4155,9 @@ export const ListSinksResponse = { if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toAmino(e) : undefined); } else { - obj.sinks = []; + obj.sinks = message.sinks; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -4245,7 +4245,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -4367,9 +4367,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -4509,9 +4509,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -4600,7 +4600,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -4768,10 +4768,10 @@ export const LogExclusion = { }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; return obj; @@ -4893,9 +4893,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -5008,9 +5008,9 @@ export const ListExclusionsResponse = { if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -5098,7 +5098,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -5204,7 +5204,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -5329,7 +5329,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5419,7 +5419,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -5507,7 +5507,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -5631,7 +5631,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5753,9 +5753,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.service_account_id = message.serviceAccountId === "" ? undefined : message.serviceAccountId; return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -5843,7 +5843,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -5967,7 +5967,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6121,11 +6121,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.kms_service_account_id = message.kmsServiceAccountId === "" ? undefined : message.kmsServiceAccountId; + obj.storage_location = message.storageLocation === "" ? undefined : message.storageLocation; + obj.disable_default_sink = message.disableDefaultSink === false ? undefined : message.disableDefaultSink; return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -6245,9 +6245,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.destination = message.destination === "" ? undefined : message.destination; return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -6415,7 +6415,7 @@ export const CopyLogEntriesMetadata = { message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); } if (object.state !== undefined && object.state !== null) { - message.state = operationStateFromJSON(object.state); + message.state = object.state; } if (object.cancellation_requested !== undefined && object.cancellation_requested !== null) { message.cancellationRequested = object.cancellation_requested; @@ -6435,11 +6435,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.state = operationStateToJSON(message.state); - obj.cancellation_requested = message.cancellationRequested; + obj.state = message.state === 0 ? undefined : message.state; + obj.cancellation_requested = message.cancellationRequested === false ? undefined : message.cancellationRequested; obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = message.progress === 0 ? undefined : message.progress; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_metrics.ts index c527afe2c9..740e2beef9 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_metrics.ts @@ -434,8 +434,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -718,18 +718,18 @@ export const LogMetric = { message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); } if (object.version !== undefined && object.version !== null) { - message.version = logMetric_ApiVersionFromJSON(object.version); + message.version = object.version; } return message; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = message.valueExtractor === "" ? undefined : message.valueExtractor; obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -739,7 +739,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.version = logMetric_ApiVersionToJSON(message.version); + obj.version = message.version === 0 ? undefined : message.version; return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -859,9 +859,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -974,9 +974,9 @@ export const ListLogMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1064,7 +1064,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1170,7 +1170,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1277,7 +1277,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1366,7 +1366,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/google/longrunning/operations.ts b/__fixtures__/v-next/outputinstantrpc/google/longrunning/operations.ts index 20133f6772..92d219685d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/longrunning/operations.ts @@ -350,9 +350,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = message.done; + obj.done = message.done === false ? undefined : message.done; obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -442,7 +442,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -578,10 +578,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -694,9 +694,9 @@ export const ListOperationsResponse = { if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -784,7 +784,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -872,7 +872,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -978,7 +978,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1083,8 +1083,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = message.responseType === "" ? undefined : message.responseType; + obj.metadata_type = message.metadataType === "" ? undefined : message.metadataType; return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/api.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/api.ts index 8e8f3ca94f..f3fb5a648e 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/api.ts @@ -467,31 +467,31 @@ export const Api = { } message.mixins = object.mixins?.map(e => Mixin.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { - obj.mixins = []; + obj.mixins = message.mixins; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -675,23 +675,23 @@ export const Method = { } message.options = object.options?.map(e => Option.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = message.name === "" ? undefined : message.name; + obj.request_type_url = message.requestTypeUrl === "" ? undefined : message.requestTypeUrl; + obj.request_streaming = message.requestStreaming === false ? undefined : message.requestStreaming; + obj.response_type_url = message.responseTypeUrl === "" ? undefined : message.responseTypeUrl; + obj.response_streaming = message.responseStreaming === false ? undefined : message.responseStreaming; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -795,8 +795,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = message.name === "" ? undefined : message.name; + obj.root = message.root === "" ? undefined : message.root; return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/compiler/plugin.ts index 2d6c02af1d..d9afa67558 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/compiler/plugin.ts @@ -275,10 +275,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = message.major; - obj.minor = message.minor; - obj.patch = message.patch; - obj.suffix = message.suffix; + obj.major = message.major === 0 ? undefined : message.major; + obj.minor = message.minor === 0 ? undefined : message.minor; + obj.patch = message.patch === 0 ? undefined : message.patch; + obj.suffix = message.suffix === "" ? undefined : message.suffix; return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -431,13 +431,13 @@ export const CodeGeneratorRequest = { if (message.fileToGenerate) { obj.file_to_generate = message.fileToGenerate.map(e => e); } else { - obj.file_to_generate = []; + obj.file_to_generate = message.fileToGenerate; } - obj.parameter = message.parameter; + obj.parameter = message.parameter === "" ? undefined : message.parameter; if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.proto_file = []; + obj.proto_file = message.protoFile; } obj.compiler_version = message.compilerVersion ? Version.toAmino(message.compilerVersion) : undefined; return obj; @@ -549,11 +549,11 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -674,9 +674,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = message.name; - obj.insertion_point = message.insertionPoint; - obj.content = message.content; + obj.name = message.name === "" ? undefined : message.name; + obj.insertion_point = message.insertionPoint === "" ? undefined : message.insertionPoint; + obj.content = message.content === "" ? undefined : message.content; return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts index 31db994ad2..c3f1203ab9 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts @@ -1464,7 +1464,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -1793,46 +1793,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2114,47 +2114,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2277,8 +2277,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2383,8 +2383,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2481,7 +2481,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -2689,10 +2689,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -2716,15 +2716,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2831,7 +2831,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3004,22 +3004,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3124,8 +3124,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3247,8 +3247,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3377,11 +3377,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -3553,12 +3553,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3923,7 +3923,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -3972,30 +3972,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4154,14 +4154,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4330,13 +4330,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4352,16 +4352,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4459,7 +4459,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4586,12 +4586,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4702,11 +4702,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4817,11 +4817,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4941,19 +4941,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5151,14 +5151,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5262,8 +5262,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5360,7 +5360,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -5552,19 +5552,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -5662,7 +5662,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -5817,11 +5817,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/field_mask.ts index 9b2c3c999a..1c21f0603a 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/field_mask.ts @@ -492,7 +492,7 @@ export const FieldMask = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/source_context.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/source_context.ts index 82bcb1121b..88cf9c3e3b 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/source_context.ts @@ -92,7 +92,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = message.fileName; + obj.file_name = message.fileName === "" ? undefined : message.fileName; return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/struct.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/struct.ts index 2f0d398820..4a433eedd9 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/struct.ts @@ -229,7 +229,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -511,7 +511,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.number_value !== undefined && object.number_value !== null) { message.numberValue = object.number_value; @@ -532,10 +532,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.number_value = message.numberValue === null ? undefined : message.numberValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; @@ -634,7 +634,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/type.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/type.ts index c58dc587d6..2d773bfb19 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/type.ts @@ -551,30 +551,30 @@ export const Type = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { - obj.fields = []; + obj.fields = message.fields; } if (message.oneofs) { obj.oneofs = message.oneofs.map(e => e); } else { - obj.oneofs = []; + obj.oneofs = message.oneofs; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -781,10 +781,10 @@ export const Field = { fromAmino(object: FieldAmino): Field { const message = createBaseField(); if (object.kind !== undefined && object.kind !== null) { - message.kind = field_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.cardinality !== undefined && object.cardinality !== null) { - message.cardinality = field_CardinalityFromJSON(object.cardinality); + message.cardinality = object.cardinality; } if (object.number !== undefined && object.number !== null) { message.number = object.number; @@ -812,20 +812,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = field_KindToJSON(message.kind); - obj.cardinality = field_CardinalityToJSON(message.cardinality); - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.cardinality = message.cardinality === 0 ? undefined : message.cardinality; + obj.number = message.number === 0 ? undefined : message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.packed = message.packed === false ? undefined : message.packed; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -985,25 +985,25 @@ export const Enum = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { - obj.enumvalue = []; + obj.enumvalue = message.enumvalue; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1129,12 +1129,12 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1241,7 +1241,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts index 7a09facc61..814ea49c4c 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts @@ -259,7 +259,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -347,7 +347,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -615,7 +615,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -703,7 +703,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -791,7 +791,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === false ? undefined : message.value; return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -879,7 +879,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts index 4be65bc155..0165405e0a 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts @@ -788,7 +788,7 @@ export const AttributeContext = { if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, @@ -892,8 +892,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1084,7 +1084,7 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; + obj.ip = message.ip === "" ? undefined : message.ip; obj.port = message.port ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { @@ -1092,8 +1092,8 @@ export const AttributeContext_Peer = { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = message.principal === "" ? undefined : message.principal; + obj.region_code = message.regionCode === "" ? undefined : message.regionCode; return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1229,10 +1229,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = message.service === "" ? undefined : message.service; + obj.operation = message.operation === "" ? undefined : message.operation; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1398,18 +1398,18 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = message.principal === "" ? undefined : message.principal; if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { - obj.audiences = []; + obj.audiences = message.audiences; } - obj.presenter = message.presenter; + obj.presenter = message.presenter === "" ? undefined : message.presenter; obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); } else { - obj.access_levels = []; + obj.access_levels = message.accessLevels; } return obj; }, @@ -1513,8 +1513,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -1819,22 +1819,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = message.id === "" ? undefined : message.id; + obj.method = message.method === "" ? undefined : message.method; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = message.path === "" ? undefined : message.path; + obj.host = message.host === "" ? undefined : message.host; + obj.scheme = message.scheme === "" ? undefined : message.scheme; + obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -1938,8 +1938,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2246,8 +2246,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2344,8 +2344,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2689,28 +2689,28 @@ export const AttributeContext_Resource = { }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = message.service === "" ? undefined : message.service; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = message.uid === "" ? undefined : message.uid; obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; obj.delete_time = message.deleteTime ? Timestamp.toAmino(toTimestamp(message.deleteTime)) : undefined; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = message.etag === "" ? undefined : message.etag; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputinstantrpc/google/rpc/error_details.ts b/__fixtures__/v-next/outputinstantrpc/google/rpc/error_details.ts index b8c41aeb78..e0f767f60a 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/rpc/error_details.ts @@ -649,9 +649,9 @@ export const DebugInfo = { if (message.stackEntries) { obj.stack_entries = message.stackEntries.map(e => e); } else { - obj.stack_entries = []; + obj.stack_entries = message.stackEntries; } - obj.detail = message.detail; + obj.detail = message.detail === "" ? undefined : message.detail; return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -748,7 +748,7 @@ export const QuotaFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? QuotaFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -853,8 +853,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = message.subject; - obj.description = message.description; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -957,8 +957,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1115,8 +1115,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.domain = message.domain; + obj.reason = message.reason === "" ? undefined : message.reason; + obj.domain = message.domain === "" ? undefined : message.domain; obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1219,7 +1219,7 @@ export const PreconditionFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1340,9 +1340,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = message.type; - obj.subject = message.subject; - obj.description = message.description; + obj.type = message.type === "" ? undefined : message.type; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1439,7 +1439,7 @@ export const BadRequest = { if (message.fieldViolations) { obj.field_violations = message.fieldViolations.map(e => e ? BadRequest_FieldViolation.toAmino(e) : undefined); } else { - obj.field_violations = []; + obj.field_violations = message.fieldViolations; } return obj; }, @@ -1544,8 +1544,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = message.field; - obj.description = message.description; + obj.field = message.field === "" ? undefined : message.field; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1649,8 +1649,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = message.requestId; - obj.serving_data = message.servingData; + obj.request_id = message.requestId === "" ? undefined : message.requestId; + obj.serving_data = message.servingData === "" ? undefined : message.servingData; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1786,10 +1786,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = message.resourceType; - obj.resource_name = message.resourceName; - obj.owner = message.owner; - obj.description = message.description; + obj.resource_type = message.resourceType === "" ? undefined : message.resourceType; + obj.resource_name = message.resourceName === "" ? undefined : message.resourceName; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -1886,7 +1886,7 @@ export const Help = { if (message.links) { obj.links = message.links.map(e => e ? Help_Link.toAmino(e) : undefined); } else { - obj.links = []; + obj.links = message.links; } return obj; }, @@ -1991,8 +1991,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = message.description; - obj.url = message.url; + obj.description = message.description === "" ? undefined : message.description; + obj.url = message.url === "" ? undefined : message.url; return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -2096,8 +2096,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = message.locale; - obj.message = message.message; + obj.locale = message.locale === "" ? undefined : message.locale; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputinstantrpc/google/rpc/status.ts b/__fixtures__/v-next/outputinstantrpc/google/rpc/status.ts index eab4f0f35c..bab5c2f9c8 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/rpc/status.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/rpc/status.ts @@ -151,12 +151,12 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = message.code; - obj.message = message.message; + obj.code = message.code === 0 ? undefined : message.code; + obj.message = message.message === "" ? undefined : message.message; if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.details = []; + obj.details = message.details; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/helpers.ts b/__fixtures__/v-next/outputinstantrpc/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/v-next/outputinstantrpc/helpers.ts +++ b/__fixtures__/v-next/outputinstantrpc/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/genesis.ts index a1aeb24f13..5b0b9efa32 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/genesis.ts @@ -127,11 +127,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.ts index 8f9252e490..96cd23516d 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/query.ts @@ -172,7 +172,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { @@ -485,7 +485,7 @@ export const QueryDenomTracesResponse = { if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/transfer.ts index ec8c7fd069..8a098f7429 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/transfer.ts @@ -143,8 +143,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = message.path; - obj.base_denom = message.baseDenom; + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -254,8 +254,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = message.sendEnabled; - obj.receive_enabled = message.receiveEnabled; + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.amino.ts index a03ccde6de..9a150e19d7 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.amino.ts @@ -31,19 +31,19 @@ export const AminoConverter = { timeoutTimestamp }: MsgTransfer): MsgTransferAminoType["value"] => { return { - source_port: sourcePort, - source_channel: sourceChannel, + source_port: omitDefault(sourcePort), + source_channel: omitDefault(sourceChannel), token: { denom: token.denom, amount: token.amount }, - sender, - receiver, + sender: omitDefault(sender), + receiver: omitDefault(receiver), timeout_height: timeoutHeight ? { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp.toString() + timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() }; }, fromAmino: ({ @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: { + token: token == null ? token : { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: BigInt(timeout_height.revision_height || "0"), revisionNumber: BigInt(timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(timeout_timestamp) + timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : BigInt(timeout_timestamp) }; } } diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts index a6e3bd1dd0..a833616377 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts @@ -227,11 +227,11 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v2/packet.ts index 88a453a77e..2a1111cf41 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v2/packet.ts @@ -148,10 +148,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts index 8aea9c46ed..8a19cbb071 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts @@ -427,10 +427,10 @@ export const Channel = { fromAmino(object: ChannelAmino): Channel { const message = createBaseChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -443,15 +443,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -627,10 +627,10 @@ export const IdentifiedChannel = { fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { const message = createBaseIdentifiedChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -649,17 +649,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -769,8 +769,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -983,10 +983,10 @@ export const Packet = { toAmino(message: Packet): PacketAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; @@ -1133,8 +1133,8 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1247,7 +1247,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result ? base64FromBytes(message.result) : undefined; - obj.error = message.error; + obj.error = message.error === null ? undefined : message.error; return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts index 4af54092e2..229991d01f 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts @@ -279,37 +279,37 @@ export const GenesisState = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } if (message.receipts) { obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.receipts = []; + obj.receipts = message.receipts; } if (message.sendSequences) { obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.send_sequences = []; + obj.send_sequences = message.sendSequences; } if (message.recvSequences) { obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.recv_sequences = []; + obj.recv_sequences = message.recvSequences; } if (message.ackSequences) { obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.ack_sequences = []; + obj.ack_sequences = message.ackSequences; } obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; return obj; @@ -439,8 +439,8 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts index b4a5916f73..7326d28aaa 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts @@ -713,8 +713,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1081,7 +1081,7 @@ export const QueryChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1196,7 +1196,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = message.connection === "" ? undefined : message.connection; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1336,7 +1336,7 @@ export const QueryConnectionChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1449,8 +1449,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -1728,8 +1728,8 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1878,7 +1878,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2008,8 +2008,8 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2268,8 +2268,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2409,7 +2409,7 @@ export const QueryPacketCommitmentsResponse = { if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -2540,8 +2540,8 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2670,7 +2670,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = message.received === false ? undefined : message.received; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2800,8 +2800,8 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -3091,13 +3091,13 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3237,7 +3237,7 @@ export const QueryPacketAcknowledgementsResponse = { if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -3381,12 +3381,12 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3517,7 +3517,7 @@ export const QueryUnreceivedPacketsResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3660,12 +3660,12 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { - obj.packet_ack_sequences = []; + obj.packet_ack_sequences = message.packetAckSequences; } return obj; }, @@ -3796,7 +3796,7 @@ export const QueryUnreceivedAcksResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3908,8 +3908,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts index a2055c9569..2ff50c2822 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts @@ -166,18 +166,18 @@ export const AminoConverter = { signer }: MsgChannelOpenInit): MsgChannelOpenInitAminoType["value"] => { return { - port_id: portId, + port_id: omitDefault(portId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -213,25 +213,25 @@ export const AminoConverter = { signer }: MsgChannelOpenTry): MsgChannelOpenTryAminoType["value"] => { return { - port_id: portId, - previous_channel_id: previousChannelId, + port_id: omitDefault(portId), + previous_channel_id: omitDefault(previousChannelId), channel: { state: channel.state, ordering: channel.ordering, counterparty: { - port_id: channel.counterparty.portId, - channel_id: channel.counterparty.channelId + port_id: omitDefault(channel.counterparty.portId), + channel_id: omitDefault(channel.counterparty.channelId) }, connection_hops: channel.connectionHops, - version: channel.version + version: omitDefault(channel.version) }, - counterparty_version: counterpartyVersion, + counterparty_version: omitDefault(counterpartyVersion), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -278,16 +278,16 @@ export const AminoConverter = { signer }: MsgChannelOpenAck): MsgChannelOpenAckAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - counterparty_channel_id: counterpartyChannelId, - counterparty_version: counterpartyVersion, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + counterparty_channel_id: omitDefault(counterpartyChannelId), + counterparty_version: omitDefault(counterpartyVersion), proof_try: proofTry, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -323,14 +323,14 @@ export const AminoConverter = { signer }: MsgChannelOpenConfirm): MsgChannelOpenConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -360,9 +360,9 @@ export const AminoConverter = { signer }: MsgChannelCloseInit): MsgChannelCloseInitAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, - signer + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -387,14 +387,14 @@ export const AminoConverter = { signer }: MsgChannelCloseConfirm): MsgChannelCloseConfirmAminoType["value"] => { return { - port_id: portId, - channel_id: channelId, + port_id: omitDefault(portId), + channel_id: omitDefault(channelId), proof_init: proofInit, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -426,24 +426,24 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + sequence: omitDefault(packet.sequence)?.toString?.(), + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -486,25 +486,25 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + sequence: omitDefault(packet.sequence)?.toString?.(), + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), - signer + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: BigInt(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), signer }; } @@ -550,17 +550,17 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + sequence: omitDefault(packet.sequence)?.toString?.(), + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,8 +568,8 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv.toString(), - signer + next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: BigInt(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), signer }; } @@ -616,25 +616,25 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence.toString(), - source_port: packet.sourcePort, - source_channel: packet.sourceChannel, - destination_port: packet.destinationPort, - destination_channel: packet.destinationChannel, + sequence: omitDefault(packet.sequence)?.toString?.(), + source_port: omitDefault(packet.sourcePort), + source_channel: omitDefault(packet.sourceChannel), + destination_port: omitDefault(packet.destinationPort), + destination_channel: omitDefault(packet.destinationChannel), data: packet.data, timeout_height: packet.timeoutHeight ? { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp.toString() + timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, - acknowledgement, + acknowledgement: acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts index 1ccc6579e9..78b3c99694 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts @@ -438,9 +438,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -708,13 +708,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -980,13 +980,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1220,11 +1220,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1424,9 +1424,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1660,11 +1660,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1887,7 +1887,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -2129,7 +2129,7 @@ export const MsgTimeout = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2388,7 +2388,7 @@ export const MsgTimeoutOnClose = { obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2628,7 +2628,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts index 7df67ccdfb..ab02de0478 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts @@ -274,7 +274,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -506,11 +506,11 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } return obj; }, @@ -653,10 +653,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -802,8 +802,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -1019,7 +1019,7 @@ export const Params = { if (message.allowedClients) { obj.allowed_clients = message.allowedClients.map(e => e); } else { - obj.allowed_clients = []; + obj.allowed_clients = message.allowedClients; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts index 78c6175ea0..52eff4f978 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts @@ -245,20 +245,20 @@ export const GenesisState = { if (message.clients) { obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.clients = []; + obj.clients = message.clients; } if (message.clientsConsensus) { obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); } else { - obj.clients_consensus = []; + obj.clients_consensus = message.clientsConsensus; } if (message.clientsMetadata) { obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); } else { - obj.clients_metadata = []; + obj.clients_metadata = message.clientsMetadata; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = message.createLocalhost; + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; return obj; }, @@ -486,11 +486,11 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { - obj.client_metadata = []; + obj.client_metadata = message.clientMetadata; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts index 8f1d60ec04..753af92de0 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts @@ -398,7 +398,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -747,7 +747,7 @@ export const QueryClientStatesResponse = { if (message.clientStates) { obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.client_states = []; + obj.client_states = message.clientStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -895,10 +895,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1142,7 +1142,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1264,7 +1264,7 @@ export const QueryConsensusStatesResponse = { if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1360,7 +1360,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1454,7 +1454,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = message.status === "" ? undefined : message.status; return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.amino.ts index 727e135426..4d5ea3aac3 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.amino.ts @@ -1,5 +1,6 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../../helpers"; import { MsgCreateClient, MsgCreateClientSDKType, MsgUpdateClient, MsgUpdateClientSDKType, MsgUpgradeClient, MsgUpgradeClientSDKType, MsgSubmitMisbehaviour, MsgSubmitMisbehaviourSDKType } from "./tx"; export interface MsgCreateClientAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateClient"; @@ -64,14 +65,14 @@ export const AminoConverter = { }: MsgCreateClient): MsgCreateClientAminoType["value"] => { return { client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -80,11 +81,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -100,12 +101,12 @@ export const AminoConverter = { signer }: MsgUpdateClient): MsgUpdateClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), header: { - type_url: header.typeUrl, + type_url: omitDefault(header.typeUrl), value: header.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -115,7 +116,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: { + header: header == null ? header : { typeUrl: header.type_url, value: header.value }, @@ -134,18 +135,18 @@ export const AminoConverter = { signer }: MsgUpgradeClient): MsgUpgradeClientAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, consensus_state: { - type_url: consensusState.typeUrl, + type_url: omitDefault(consensusState.typeUrl), value: consensusState.value }, proof_upgrade_client: proofUpgradeClient, proof_upgrade_consensus_state: proofUpgradeConsensusState, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -158,11 +159,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -180,12 +181,12 @@ export const AminoConverter = { signer }: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), misbehaviour: { - type_url: misbehaviour.typeUrl, + type_url: omitDefault(misbehaviour.typeUrl), value: misbehaviour.value }, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -195,7 +196,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: { + misbehaviour: misbehaviour == null ? misbehaviour : { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.ts index 5dbf86d41e..37a65a4678 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/tx.ts @@ -256,7 +256,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -458,9 +458,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -712,12 +712,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -919,9 +919,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/commitment/v1/commitment.ts index 8f41402d5f..6cb04bf163 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/commitment/v1/commitment.ts @@ -350,7 +350,7 @@ export const MerklePath = { if (message.keyPath) { obj.key_path = message.keyPath.map(e => e); } else { - obj.key_path = []; + obj.key_path = message.keyPath; } return obj; }, @@ -454,7 +454,7 @@ export const MerkleProof = { if (message.proofs) { obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); } else { - obj.proofs = []; + obj.proofs = message.proofs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts index 0337c623e7..965fa427e4 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts @@ -359,7 +359,7 @@ export const ConnectionEnd = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -371,13 +371,13 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -551,7 +551,7 @@ export const IdentifiedConnection = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -563,14 +563,14 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -700,8 +700,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -805,7 +805,7 @@ export const ClientPaths = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -922,11 +922,11 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -1043,11 +1043,11 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; if (message.features) { obj.features = message.features.map(e => e); } else { - obj.features = []; + obj.features = message.features; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts index 7f6fc315bd..8280f6b8e5 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts @@ -157,12 +157,12 @@ export const GenesisState = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } if (message.clientConnectionPaths) { obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); } else { - obj.client_connection_paths = []; + obj.client_connection_paths = message.clientConnectionPaths; } obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts index 6d3534fc5b..ec6bc9cb01 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts @@ -302,7 +302,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -669,7 +669,7 @@ export const QueryConnectionsResponse = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -766,7 +766,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -903,7 +903,7 @@ export const QueryClientConnectionsResponse = { if (message.connectionPaths) { obj.connection_paths = message.connectionPaths.map(e => e); } else { - obj.connection_paths = []; + obj.connection_paths = message.connectionPaths; } obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1000,7 +1000,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1262,7 +1262,7 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1411,7 +1411,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.amino.ts index 53e0a3765c..01fe9e5e6a 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.amino.ts @@ -94,20 +94,20 @@ export const AminoConverter = { signer }: MsgConnectionOpenInit): MsgConnectionOpenInitAminoType["value"] => { return { - client_id: clientId, + client_id: omitDefault(clientId), counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, - delay_period: delayPeriod.toString(), - signer + delay_period: omitDefault(delayPeriod)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - delayPeriod: BigInt(delay_period), + delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), signer }; } @@ -152,22 +152,22 @@ export const AminoConverter = { signer }: MsgConnectionOpenTry): MsgConnectionOpenTryAminoType["value"] => { return { - client_id: clientId, - previous_connection_id: previousConnectionId, + client_id: omitDefault(clientId), + previous_connection_id: omitDefault(previousConnectionId), client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, counterparty: { - client_id: counterparty.clientId, - connection_id: counterparty.connectionId, + client_id: omitDefault(counterparty.clientId), + connection_id: omitDefault(counterparty.connectionId), prefix: { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod.toString(), + delay_period: omitDefault(delayPeriod)?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ - identifier: el0.identifier, + identifier: omitDefault(el0.identifier), features: el0.features })), proof_height: proofHeight ? { @@ -181,7 +181,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -201,19 +201,19 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: BigInt(delay_period), - counterpartyVersions: counterparty_versions.map(el0 => ({ + delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + counterpartyVersions: counterparty_versions.map?.(el0 => ({ identifier: el0.identifier, features: el0.features })), @@ -247,14 +247,14 @@ export const AminoConverter = { signer }: MsgConnectionOpenAck): MsgConnectionOpenAckAminoType["value"] => { return { - connection_id: connectionId, - counterparty_connection_id: counterpartyConnectionId, + connection_id: omitDefault(connectionId), + counterparty_connection_id: omitDefault(counterpartyConnectionId), version: { - identifier: version.identifier, + identifier: omitDefault(version.identifier), features: version.features }, client_state: { - type_url: clientState.typeUrl, + type_url: omitDefault(clientState.typeUrl), value: clientState.value }, proof_height: proofHeight ? { @@ -268,7 +268,7 @@ export const AminoConverter = { revision_height: omitDefault(consensusHeight.revisionHeight)?.toString(), revision_number: omitDefault(consensusHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, @@ -318,13 +318,13 @@ export const AminoConverter = { signer }: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAminoType["value"] => { return { - connection_id: connectionId, + connection_id: omitDefault(connectionId), proof_ack: proofAck, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - signer + signer: omitDefault(signer) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts index 76220be7c7..b327cae029 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts @@ -330,11 +330,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -694,22 +694,22 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.counterparty_versions = []; + obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -1029,8 +1029,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1038,7 +1038,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1256,10 +1256,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.ts index b1336bf73d..6c07efd0d6 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/port/v1/query.ts @@ -166,7 +166,7 @@ export const QueryAppVersionRequest = { message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -178,11 +178,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -292,8 +292,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/localhost/v1/localhost.ts index 373d322c0d..2fe9922ee8 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/localhost/v1/localhost.ts @@ -111,7 +111,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts index 977ea64a47..eb3629e7b1 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts @@ -562,7 +562,7 @@ export const ClientState = { obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -693,7 +693,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -862,7 +862,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1010,7 +1010,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1145,7 +1145,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1158,7 +1158,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1426,7 +1426,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1437,8 +1437,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1552,7 +1552,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts index e97e9da8cd..a2b744046e 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts @@ -558,9 +558,9 @@ export const ClientState = { toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -691,7 +691,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -860,7 +860,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1008,7 +1008,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1143,7 +1143,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1156,7 +1156,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1424,7 +1424,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1435,8 +1435,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1550,7 +1550,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts index c9f9afcefe..2caa3c6e01 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts @@ -432,7 +432,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -442,15 +442,15 @@ export const ClientState = { if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -710,7 +710,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/claim.ts index c7eae447ed..5bc987ed93 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/claim.ts @@ -189,16 +189,16 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_claimable_amount = []; + obj.initial_claimable_amount = message.initialClaimableAmount; } if (message.actionCompleted) { obj.action_completed = message.actionCompleted.map(e => e); } else { - obj.action_completed = []; + obj.action_completed = message.actionCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/genesis.ts index 0046900270..5a1a0a2411 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/genesis.ts @@ -139,7 +139,7 @@ export const GenesisState = { if (message.claimRecords) { obj.claim_records = message.claimRecords.map(e => e ? ClaimRecord.toAmino(e) : undefined); } else { - obj.claim_records = []; + obj.claim_records = message.claimRecords; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/params.ts index d3a558fa67..71c8eb7b1d 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/params.ts @@ -146,7 +146,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = message.claimDenom === "" ? undefined : message.claimDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.ts index cfece6f557..760b9bf353 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/claim/v1beta1/query.ts @@ -260,7 +260,7 @@ export const QueryModuleAccountBalanceResponse = { if (message.moduleAccountBalance) { obj.moduleAccountBalance = message.moduleAccountBalance.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.moduleAccountBalance = []; + obj.moduleAccountBalance = message.moduleAccountBalance; } return obj; }, @@ -525,7 +525,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -725,14 +725,14 @@ export const QueryClaimableForActionRequest = { message.address = object.address; } if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } return message; }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = actionToJSON(message.action); + obj.address = message.address === "" ? undefined : message.address; + obj.action = message.action === 0 ? undefined : message.action; return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -835,7 +835,7 @@ export const QueryClaimableForActionResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -930,7 +930,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { @@ -1033,7 +1033,7 @@ export const QueryTotalClaimableResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts index e41039e504..c55d1e3936 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts @@ -261,12 +261,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -370,7 +370,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts index f082f28211..efeb5c1186 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts @@ -190,7 +190,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, @@ -285,7 +285,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts index d5df8c4c97..d7cd0c8597 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timesta import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -296,12 +296,12 @@ export const SmoothWeightChangeParams = { if (message.initialPoolWeights) { obj.initial_pool_weights = message.initialPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.initial_pool_weights = []; + obj.initial_pool_weights = message.initialPoolWeights; } if (message.targetPoolWeights) { obj.target_pool_weights = message.targetPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.target_pool_weights = []; + obj.target_pool_weights = message.targetPoolWeights; } return obj; }, @@ -430,8 +430,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -545,7 +545,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -747,17 +747,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e481a8e582..4b691b23cc 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../../helpers"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; @@ -53,10 +54,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -65,14 +66,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -81,9 +82,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ @@ -94,24 +95,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: { + smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { startTime: pool_params.smooth_weight_change_params.start_time, - duration: { + duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: { + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: { + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, @@ -119,8 +120,8 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map(el0 => ({ - token: { + poolAssets: pool_assets.map?.(el0 => ({ + token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts index a063e5c721..84eb8cdd7f 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -157,14 +157,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 4e992c0f61..0402a1d98d 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -152,8 +152,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -386,22 +386,22 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_liquidity = []; + obj.pool_liquidity = message.poolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 7811c40f43..69b805b629 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,6 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -40,18 +41,18 @@ export const AminoConverter = { scalingFactorController }: MsgCreateStableswapPool): MsgCreateStableswapPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee) }, initial_pool_liquidity: initialPoolLiquidity.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), scaling_factors: scalingFactors.map(el0 => el0.toString()), - future_pool_governor: futurePoolGovernor, - scaling_factor_controller: scalingFactorController + future_pool_governor: omitDefault(futurePoolGovernor), + scaling_factor_controller: omitDefault(scalingFactorController) }; }, fromAmino: ({ @@ -64,15 +65,15 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map(el0 => BigInt(el0)), + scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -86,8 +87,8 @@ export const AminoConverter = { scalingFactors }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, @@ -98,8 +99,8 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: BigInt(pool_id), - scalingFactors: scaling_factors.map(el0 => BigInt(el0)) + poolId: pool_id == null ? pool_id : BigInt(pool_id), + scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)) }; } } diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts index 6bcbe85987..0fe4465e12 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts @@ -237,20 +237,20 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_pool_liquidity = []; + obj.initial_pool_liquidity = message.initialPoolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -489,12 +489,12 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts index e8c5b774a0..a167293adc 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts @@ -110,7 +110,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -250,7 +250,7 @@ export const GenesisState = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts index d52f44c604..c6a83f0e1d 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts @@ -765,7 +765,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1127,7 +1127,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = message.poolType === "" ? undefined : message.poolType; return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1249,7 +1249,7 @@ export const QueryCalcJoinPoolSharesRequest = { if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -1366,11 +1366,11 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1484,7 +1484,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1587,7 +1587,7 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1979,7 +1979,7 @@ export const QueryTotalPoolLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -2294,7 +2294,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -2414,9 +2414,9 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } - obj.shares_out = message.sharesOut; + obj.shares_out = message.sharesOut === "" ? undefined : message.sharesOut; return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2545,8 +2545,8 @@ export const QuerySpotPriceRequest = { toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2683,9 +2683,9 @@ export const QueryPoolsWithFilterRequest = { if (message.minLiquidity) { obj.min_liquidity = message.minLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_liquidity = []; + obj.min_liquidity = message.minLiquidity; } - obj.pool_type = message.poolType; + obj.pool_type = message.poolType === "" ? undefined : message.poolType; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2807,7 +2807,7 @@ export const QueryPoolsWithFilterResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2903,7 +2903,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -3053,13 +3053,13 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -3154,7 +3154,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3304,14 +3304,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = message.tokenOut; + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3405,7 +3405,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { @@ -3582,7 +3582,7 @@ export const QueryTotalLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.amino.ts index e82624ab3d..f8828244da 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -110,12 +111,12 @@ export const AminoConverter = { tokenInMaxs }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - share_out_amount: shareOutAmount, + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + share_out_amount: omitDefault(shareOutAmount), token_in_maxs: tokenInMaxs.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -127,9 +128,9 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map(el0 => ({ + tokenInMaxs: token_in_maxs.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -145,12 +146,12 @@ export const AminoConverter = { tokenOutMins }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - share_in_amount: shareInAmount, + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + share_in_amount: omitDefault(shareInAmount), token_out_mins: tokenOutMins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -162,9 +163,9 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map(el0 => ({ + tokenOutMins: token_out_mins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -180,16 +181,16 @@ export const AminoConverter = { tokenOutMinAmount }: MsgSwapExactAmountIn): MsgSwapExactAmountInAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), - token_out_denom: el0.tokenOutDenom + pool_id: omitDefault(el0.poolId)?.toString?.(), + token_out_denom: omitDefault(el0.tokenOutDenom) })), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - token_out_min_amount: tokenOutMinAmount + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -200,11 +201,11 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: { + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -221,12 +222,12 @@ export const AminoConverter = { tokenOut }: MsgSwapExactAmountOut): MsgSwapExactAmountOutAminoType["value"] => { return { - sender, + sender: omitDefault(sender), routes: routes.map(el0 => ({ - pool_id: el0.poolId.toString(), - token_in_denom: el0.tokenInDenom + pool_id: omitDefault(el0.poolId)?.toString?.(), + token_in_denom: omitDefault(el0.tokenInDenom) })), - token_in_max_amount: tokenInMaxAmount, + token_in_max_amount: omitDefault(tokenInMaxAmount), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -241,12 +242,12 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: { + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount } @@ -262,13 +263,13 @@ export const AminoConverter = { shareOutMinAmount }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount }, - share_out_min_amount: shareOutMinAmount + share_out_min_amount: omitDefault(shareOutMinAmount) }; }, fromAmino: ({ @@ -279,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: BigInt(pool_id), - tokenIn: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -298,11 +299,11 @@ export const AminoConverter = { tokenInMaxAmount }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - token_in_denom: tokenInDenom, - share_out_amount: shareOutAmount, - token_in_max_amount: tokenInMaxAmount + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + token_in_denom: omitDefault(tokenInDenom), + share_out_amount: omitDefault(shareOutAmount), + token_in_max_amount: omitDefault(tokenInMaxAmount) }; }, fromAmino: ({ @@ -314,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -330,13 +331,13 @@ export const AminoConverter = { shareInMaxAmount }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount }, - share_in_max_amount: shareInMaxAmount + share_in_max_amount: omitDefault(shareInMaxAmount) }; }, fromAmino: ({ @@ -347,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: BigInt(pool_id), - tokenOut: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount }, @@ -366,11 +367,11 @@ export const AminoConverter = { tokenOutMinAmount }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { - sender, - pool_id: poolId.toString(), - token_out_denom: tokenOutDenom, - share_in_amount: shareInAmount, - token_out_min_amount: tokenOutMinAmount + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.(), + token_out_denom: omitDefault(tokenOutDenom), + share_in_amount: omitDefault(shareInAmount), + token_out_min_amount: omitDefault(tokenOutMinAmount) }; }, fromAmino: ({ @@ -382,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts index f22c1c47f7..096beac3dc 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts @@ -393,13 +393,13 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -516,11 +516,11 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in = []; + obj.token_in = message.tokenIn; } return obj; }, @@ -671,13 +671,13 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out_mins = []; + obj.token_out_mins = message.tokenOutMins; } return obj; }, @@ -781,7 +781,7 @@ export const MsgExitPoolResponse = { if (message.tokenOut) { obj.token_out = message.tokenOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out = []; + obj.token_out = message.tokenOut; } return obj; }, @@ -895,7 +895,7 @@ export const SwapAmountInRoute = { toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -1045,14 +1045,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1146,7 +1146,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1259,7 +1259,7 @@ export const SwapAmountOutRoute = { toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1409,13 +1409,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1510,7 +1510,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1656,10 +1656,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1753,7 +1753,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1913,11 +1913,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -2011,7 +2011,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2171,11 +2171,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2269,7 +2269,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2415,10 +2415,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2512,7 +2512,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts index 1d0fdc8495..0793fc0d01 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts @@ -146,8 +146,8 @@ export const QuerySpotPriceRequest = { toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -241,7 +241,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/params.ts index c24264e4f9..0988ddc5f2 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -82,7 +82,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts index baddae7a6b..9081c6e243 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts @@ -278,12 +278,12 @@ export const Gauge = { toAmino(message: Gauge): GaugeAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -291,7 +291,7 @@ export const Gauge = { if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.distributed_coins = []; + obj.distributed_coins = message.distributedCoins; } return obj; }, @@ -395,7 +395,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts index f4c27851fc..da04c4968a 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts @@ -175,12 +175,12 @@ export const GenesisState = { if (message.gauges) { obj.gauges = message.gauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.gauges = []; + obj.gauges = message.gauges; } if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/params.ts index 0f7917d5bd..8a9358b50c 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/params.ts @@ -86,7 +86,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = message.distrEpochIdentifier; + obj.distr_epoch_identifier = message.distrEpochIdentifier === "" ? undefined : message.distrEpochIdentifier; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts index ba82d0e35c..f7c21c9cd7 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts @@ -378,7 +378,7 @@ export const ModuleToDistributeCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -788,7 +788,7 @@ export const GaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1007,7 +1007,7 @@ export const ActiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1121,7 +1121,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1243,7 +1243,7 @@ export const ActiveGaugesPerDenomResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1462,7 +1462,7 @@ export const UpcomingGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1576,7 +1576,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1698,7 +1698,7 @@ export const UpcomingGaugesPerDenomResponse = { if (message.upcomingGauges) { obj.upcoming_gauges = message.upcomingGauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.upcoming_gauges = []; + obj.upcoming_gauges = message.upcomingGauges; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1843,11 +1843,11 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { - obj.lock_ids = []; + obj.lock_ids = message.lockIds; } obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; return obj; @@ -1952,7 +1952,7 @@ export const RewardsEstResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -2130,7 +2130,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.amino.ts index fc284ed915..094567f886 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.amino.ts @@ -3,6 +3,7 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -50,20 +51,20 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: isPerpetual, - owner, + is_perpetual: omitDefault(isPerpetual), + owner: omitDefault(owner), distribute_to: { lock_query_type: distributeTo.lockQueryType, - denom: distributeTo.denom, + denom: omitDefault(distributeTo.denom), duration: (distributeTo.duration * 1_000_000_000).toString(), timestamp: distributeTo.timestamp }, coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver.toString() + num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() }; }, fromAmino: ({ @@ -77,21 +78,21 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: { - lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: distribute_to == null ? distribute_to : { + lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: { + duration: distribute_to.duration == null ? distribute_to.duration : { seconds: BigInt(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, timestamp: distribute_to.timestamp }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: BigInt(num_epochs_paid_over) + numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : BigInt(num_epochs_paid_over) }; } }, @@ -103,11 +104,11 @@ export const AminoConverter = { rewards }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { - owner, - gauge_id: gaugeId.toString(), + owner: omitDefault(owner), + gauge_id: omitDefault(gaugeId)?.toString?.(), rewards: rewards.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -118,8 +119,8 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: BigInt(gauge_id), - rewards: rewards.map(el0 => ({ + gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), + rewards: rewards.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts index 2413baf192..8bd45ca411 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts @@ -234,13 +234,13 @@ export const MsgCreateGauge = { }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; + obj.owner = message.owner === "" ? undefined : message.owner; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -451,12 +451,12 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts index a5912d2253..8a142aa777 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts @@ -137,12 +137,12 @@ export const GenesisState = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts index 3741a3798b..893e285ca6 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts @@ -316,13 +316,13 @@ export const PeriodLock = { toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -452,7 +452,7 @@ export const QueryCondition = { fromAmino(object: QueryConditionAmino): QueryCondition { const message = createBaseQueryCondition(); if (object.lock_query_type !== undefined && object.lock_query_type !== null) { - message.lockQueryType = lockQueryTypeFromJSON(object.lock_query_type); + message.lockQueryType = object.lock_query_type; } if (object.denom !== undefined && object.denom !== null) { message.denom = object.denom; @@ -467,8 +467,8 @@ export const QueryCondition = { }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = lockQueryTypeToJSON(message.lockQueryType); - obj.denom = message.denom; + obj.lock_query_type = message.lockQueryType === 0 ? undefined : message.lockQueryType; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; @@ -617,7 +617,7 @@ export const SyntheticLock = { toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/params.ts index 6688646110..76927d2be8 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/params.ts @@ -89,7 +89,7 @@ export const Params = { if (message.forceUnlockAllowedAddresses) { obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses.map(e => e); } else { - obj.force_unlock_allowed_addresses = []; + obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts index 8d5341ea32..096af91e0d 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts @@ -508,7 +508,7 @@ export const ModuleBalanceResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -686,7 +686,7 @@ export const ModuleLockedAmountResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -781,7 +781,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -884,7 +884,7 @@ export const AccountUnlockableCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -979,7 +979,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1082,7 +1082,7 @@ export const AccountUnlockingCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1177,7 +1177,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1280,7 +1280,7 @@ export const AccountLockedCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1391,7 +1391,7 @@ export const AccountLockedPastTimeRequest = { }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1495,7 +1495,7 @@ export const AccountLockedPastTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1606,7 +1606,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1710,7 +1710,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1821,7 +1821,7 @@ export const AccountUnlockedBeforeTimeRequest = { }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1925,7 +1925,7 @@ export const AccountUnlockedBeforeTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2052,9 +2052,9 @@ export const AccountLockedPastTimeDenomRequest = { }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2157,7 +2157,7 @@ export const AccountLockedPastTimeDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2270,7 +2270,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2365,7 +2365,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2756,7 +2756,7 @@ export const SyntheticLockupsByLockupIDResponse = { if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2869,7 +2869,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2973,7 +2973,7 @@ export const AccountLockedLongerDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3086,7 +3086,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3190,7 +3190,7 @@ export const AccountLockedDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3303,7 +3303,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3407,7 +3407,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3536,9 +3536,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { @@ -3641,7 +3641,7 @@ export const AccountLockedLongerDurationDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.amino.ts index 5a645daaa7..8a0babacb9 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.amino.ts @@ -3,6 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -66,11 +67,11 @@ export const AminoConverter = { coins }: MsgLockTokens): MsgLockTokensAminoType["value"] => { return { - owner, + owner: omitDefault(owner), duration: (duration * 1_000_000_000).toString(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -81,11 +82,11 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: { + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -98,7 +99,7 @@ export const AminoConverter = { owner }: MsgBeginUnlockingAll): MsgBeginUnlockingAllAminoType["value"] => { return { - owner + owner: omitDefault(owner) }; }, fromAmino: ({ @@ -117,11 +118,11 @@ export const AminoConverter = { coins }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { - owner, - ID: ID.toString(), + owner: omitDefault(owner), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -132,8 +133,8 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: BigInt(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : BigInt(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -148,8 +149,8 @@ export const AminoConverter = { duration }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { - owner, - ID: ID.toString(), + owner: omitDefault(owner), + ID: omitDefault(ID)?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -160,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: BigInt(ID), - duration: { + ID: ID == null ? ID : BigInt(ID), + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -176,11 +177,11 @@ export const AminoConverter = { coins }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { - owner, - ID: ID.toString(), + owner: omitDefault(owner), + ID: omitDefault(ID)?.toString?.(), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })) }; }, @@ -191,8 +192,8 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: BigInt(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : BigInt(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts index 345bd2487e..95df255a3b 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts @@ -251,12 +251,12 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -447,7 +447,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -550,7 +550,7 @@ export const MsgBeginUnlockingAllResponse = { if (message.unlocks) { obj.unlocks = message.unlocks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.unlocks = []; + obj.unlocks = message.unlocks; } return obj; }, @@ -685,12 +685,12 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -785,7 +785,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -915,7 +915,7 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; @@ -1011,7 +1011,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1145,12 +1145,12 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1245,7 +1245,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts index 34351fddb5..d585343399 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -200,7 +200,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions) === "" ? undefined : padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -310,8 +310,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -453,10 +453,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking) === "" ? undefined : padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives) === "" ? undefined : padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards) === "" ? undefined : padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -674,16 +674,16 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions) === "" ? undefined : padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.reduction_factor = padDecimal(message.reductionFactor) === "" ? undefined : padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { - obj.weighted_developer_rewards_receivers = []; + obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/genesis.ts index b29808c96d..0315f713e4 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/genesis.ts @@ -155,7 +155,7 @@ export const GenesisState = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.distr_info = message.distrInfo ? DistrInfo.toAmino(message.distrInfo) : undefined; obj.pool_to_gauges = message.poolToGauges ? PoolToGauges.toAmino(message.poolToGauges) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/gov.ts index 009320c035..ed45704525 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/gov.ts @@ -173,12 +173,12 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -311,12 +311,12 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts index 66e9c871b4..d300003020 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts @@ -145,7 +145,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = message.mintedDenom === "" ? undefined : message.mintedDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -248,7 +248,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -365,11 +365,11 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -483,7 +483,7 @@ export const DistrRecord = { toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -720,7 +720,7 @@ export const PoolToGauges = { if (message.poolToGauge) { obj.pool_to_gauge = message.poolToGauge.map(e => e ? PoolToGauge.toAmino(e) : undefined); } else { - obj.pool_to_gauge = []; + obj.pool_to_gauge = message.poolToGauge; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts index e554c3684a..296e0a744e 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts @@ -306,7 +306,7 @@ export const QueryGaugeIdsResponse = { if (message.gaugeIdsWithDuration) { obj.gauge_ids_with_duration = message.gaugeIdsWithDuration.map(e => e ? QueryGaugeIdsResponse_GaugeIdWithDuration.toAmino(e) : undefined); } else { - obj.gauge_ids_with_duration = []; + obj.gauge_ids_with_duration = message.gaugeIdsWithDuration; } return obj; }, @@ -439,7 +439,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { const obj: any = {}; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -956,7 +956,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -1268,7 +1268,7 @@ export const QueryIncentivizedPoolsResponse = { if (message.incentivizedPools) { obj.incentivized_pools = message.incentivizedPools.map(e => e ? IncentivizedPool.toAmino(e) : undefined); } else { - obj.incentivized_pools = []; + obj.incentivized_pools = message.incentivizedPools; } return obj; }, @@ -1446,7 +1446,7 @@ export const QueryExternalIncentiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/sumtree/v1beta1/tree.ts index a5d833729c..e87e04aa8f 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/sumtree/v1beta1/tree.ts @@ -111,7 +111,7 @@ export const Node = { if (message.children) { obj.children = message.children.map(e => e ? Child.toAmino(e) : undefined); } else { - obj.children = []; + obj.children = message.children; } return obj; }, @@ -223,7 +223,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index ? base64FromBytes(message.index) : undefined; - obj.accumulation = message.accumulation; + obj.accumulation = message.accumulation === "" ? undefined : message.accumulation; return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/genesis.ts index 6dfe23c838..1d4e6d244a 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/genesis.ts @@ -198,22 +198,22 @@ export const GenesisState = { if (message.superfluidAssets) { obj.superfluid_assets = message.superfluidAssets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.superfluid_assets = []; + obj.superfluid_assets = message.superfluidAssets; } if (message.osmoEquivalentMultipliers) { obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers.map(e => e ? OsmoEquivalentMultiplierRecord.toAmino(e) : undefined); } else { - obj.osmo_equivalent_multipliers = []; + obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers; } if (message.intermediaryAccounts) { obj.intermediary_accounts = message.intermediaryAccounts.map(e => e ? SuperfluidIntermediaryAccount.toAmino(e) : undefined); } else { - obj.intermediary_accounts = []; + obj.intermediary_accounts = message.intermediaryAccounts; } if (message.intemediaryAccountConnections) { obj.intemediary_account_connections = message.intemediaryAccountConnections.map(e => e ? LockIdIntermediaryAccountConnection.toAmino(e) : undefined); } else { - obj.intemediary_account_connections = []; + obj.intemediary_account_connections = message.intemediaryAccountConnections; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts index 7b829e49cf..f8aae493a2 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -89,7 +89,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor; + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor) === "" ? undefined : padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts index 2e84dbdb3a..023c4bb8bc 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts @@ -587,7 +587,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -675,13 +675,13 @@ export const AssetTypeResponse = { fromAmino(object: AssetTypeResponseAmino): AssetTypeResponse { const message = createBaseAssetTypeResponse(); if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -858,7 +858,7 @@ export const AllAssetsResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -953,7 +953,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1193,10 +1193,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1413,7 +1413,7 @@ export const AllIntermediaryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? SuperfluidIntermediaryAccountInfo.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1701,7 +1701,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1804,7 +1804,7 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? Delegations.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1931,9 +1931,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; + obj.amount_sfsd = message.amountSfsd === "" ? undefined : message.amountSfsd; + obj.osmo_equivalent = message.osmoEquivalent === "" ? undefined : message.osmoEquivalent; return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -2101,7 +2101,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = message.totalDelegations === "" ? undefined : message.totalDelegations; return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2227,9 +2227,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2332,7 +2332,7 @@ export const SuperfluidDelegationAmountResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -2427,7 +2427,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2570,12 +2570,12 @@ export const SuperfluidDelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -2687,8 +2687,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2835,17 +2835,17 @@ export const SuperfluidUndelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalUndelegatedCoins) { obj.total_undelegated_coins = message.totalUndelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_undelegated_coins = []; + obj.total_undelegated_coins = message.totalUndelegatedCoins; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2956,8 +2956,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -3060,7 +3060,7 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } return obj; }, @@ -3171,8 +3171,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3275,7 +3275,7 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } return obj; }, @@ -3370,7 +3370,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { @@ -3535,17 +3535,17 @@ export const QueryTotalDelegationByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.delegationResponse) { obj.delegation_response = message.delegationResponse.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_response = []; + obj.delegation_response = message.delegationResponse; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -3733,7 +3733,7 @@ export const QueryUnpoolWhitelistResponse = { if (message.poolIds) { obj.pool_ids = message.poolIds.map(e => e.toString()); } else { - obj.pool_ids = []; + obj.pool_ids = message.poolIds; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts index 93f755735d..8e9cdeeb9b 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -250,14 +250,14 @@ export const SuperfluidAsset = { message.denom = object.denom; } if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -385,8 +385,8 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, @@ -516,8 +516,8 @@ export const OsmoEquivalentMultiplierRecord = { toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.multiplier = padDecimal(message.multiplier) === "" ? undefined : padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -663,8 +663,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -779,7 +779,7 @@ export const LockIdIntermediaryAccountConnection = { toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { @@ -891,7 +891,7 @@ export const UnpoolWhitelistedPools = { if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.amino.ts index ab182966bc..7c3be9a269 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -51,9 +52,9 @@ export const AminoConverter = { valAddr }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { - sender, - lock_id: lockId.toString(), - val_addr: valAddr + sender: omitDefault(sender), + lock_id: omitDefault(lockId)?.toString?.(), + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -63,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: BigInt(lock_id), + lockId: lock_id == null ? lock_id : BigInt(lock_id), valAddr: val_addr }; } @@ -75,8 +76,8 @@ export const AminoConverter = { lockId }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { - sender, - lock_id: lockId.toString() + sender: omitDefault(sender), + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -85,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: BigInt(lock_id) + lockId: lock_id == null ? lock_id : BigInt(lock_id) }; } }, @@ -96,8 +97,8 @@ export const AminoConverter = { lockId }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { - sender, - lock_id: lockId.toString() + sender: omitDefault(sender), + lock_id: omitDefault(lockId)?.toString?.() }; }, fromAmino: ({ @@ -106,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: BigInt(lock_id) + lockId: lock_id == null ? lock_id : BigInt(lock_id) }; } }, @@ -118,12 +119,12 @@ export const AminoConverter = { valAddr }: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAminoType["value"] => { return { - sender, + sender: omitDefault(sender), coins: coins.map(el0 => ({ - denom: el0.denom, - amount: el0.amount + denom: omitDefault(el0.denom), + amount: omitDefault(el0.amount) })), - val_addr: valAddr + val_addr: omitDefault(valAddr) }; }, fromAmino: ({ @@ -133,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -148,8 +149,8 @@ export const AminoConverter = { poolId }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { - sender, - pool_id: poolId.toString() + sender: omitDefault(sender), + pool_id: omitDefault(poolId)?.toString?.() }; }, fromAmino: ({ @@ -158,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: BigInt(pool_id) + poolId: pool_id == null ? pool_id : BigInt(pool_id) }; } } diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts index d6c8ecdf48..510ec0f9ff 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts @@ -237,9 +237,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.val_addr = message.valAddr; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -425,7 +425,7 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, @@ -612,7 +612,7 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, @@ -819,13 +819,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } - obj.val_addr = message.valAddr; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -1033,7 +1033,7 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, @@ -1146,7 +1146,7 @@ export const MsgUnPoolWhitelistedPoolResponse = { if (message.exitedLockIds) { obj.exited_lock_ids = message.exitedLockIds.map(e => e.toString()); } else { - obj.exited_lock_ids = []; + obj.exited_lock_ids = message.exitedLockIds; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/v1beta1/gov.ts index ef1303f875..bd15a1eac4 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/v1beta1/gov.ts @@ -177,12 +177,12 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -315,12 +315,12 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { - obj.superfluid_asset_denoms = []; + obj.superfluid_asset_denoms = message.superfluidAssetDenoms; } return obj; }, @@ -478,14 +478,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } - obj.is_overwrite = message.isOverwrite; + obj.is_overwrite = message.isOverwrite === false ? undefined : message.isOverwrite; return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index d845692338..05d6c404d5 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -91,7 +91,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/genesis.ts index a32614c5f2..37b436e896 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/genesis.ts @@ -137,7 +137,7 @@ export const GenesisState = { if (message.factoryDenoms) { obj.factory_denoms = message.factoryDenoms.map(e => e ? GenesisDenom.toAmino(e) : undefined); } else { - obj.factory_denoms = []; + obj.factory_denoms = message.factoryDenoms; } return obj; }, @@ -250,7 +250,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/params.ts index 7deb5a8423..ec74dead0e 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/params.ts @@ -92,7 +92,7 @@ export const Params = { if (message.denomCreationFee) { obj.denom_creation_fee = message.denomCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.denom_creation_fee = []; + obj.denom_creation_fee = message.denomCreationFee; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.ts index 0312760e4e..c1efa97f11 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/query.ts @@ -335,7 +335,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -525,7 +525,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { @@ -628,7 +628,7 @@ export const QueryDenomsFromCreatorResponse = { if (message.denoms) { obj.denoms = message.denoms.map(e => e); } else { - obj.denoms = []; + obj.denoms = message.denoms; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.amino.ts index 6ac7848d13..49e38cc8ab 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,6 +2,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -66,8 +67,8 @@ export const AminoConverter = { subdenom }: MsgCreateDenom): MsgCreateDenomAminoType["value"] => { return { - sender, - subdenom + sender: omitDefault(sender), + subdenom: omitDefault(subdenom) }; }, fromAmino: ({ @@ -87,7 +88,7 @@ export const AminoConverter = { amount }: MsgMint): MsgMintAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: amount.amount @@ -100,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -114,7 +115,7 @@ export const AminoConverter = { amount }: MsgBurn): MsgBurnAminoType["value"] => { return { - sender, + sender: omitDefault(sender), amount: { denom: amount.denom, amount: amount.amount @@ -127,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -142,9 +143,9 @@ export const AminoConverter = { newAdmin }: MsgChangeAdmin): MsgChangeAdminAminoType["value"] => { return { - sender, - denom, - new_admin: newAdmin + sender: omitDefault(sender), + denom: omitDefault(denom), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -166,20 +167,20 @@ export const AminoConverter = { metadata }: MsgSetDenomMetadata): MsgSetDenomMetadataAminoType["value"] => { return { - sender, + sender: omitDefault(sender), metadata: { - description: metadata.description, + description: omitDefault(metadata.description), denom_units: metadata.denomUnits.map(el0 => ({ - denom: el0.denom, - exponent: el0.exponent, + denom: omitDefault(el0.denom), + exponent: omitDefault(el0.exponent), aliases: el0.aliases })), - base: metadata.base, - display: metadata.display, - name: metadata.name, - symbol: metadata.symbol, - uri: metadata.uri, - uri_hash: metadata.uriHash + base: omitDefault(metadata.base), + display: omitDefault(metadata.display), + name: omitDefault(metadata.name), + symbol: omitDefault(metadata.symbol), + uri: omitDefault(metadata.uri), + uri_hash: omitDefault(metadata.uriHash) } }; }, @@ -189,9 +190,9 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: { + metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map(el1 => ({ + denomUnits: metadata.denom_units.map?.(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.ts index dafe17af1f..1d5e1ca9f6 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/tokenfactory/v1beta1/tx.ts @@ -263,8 +263,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.subdenom = message.subdenom === "" ? undefined : message.subdenom; return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -358,7 +358,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = message.newTokenDenom === "" ? undefined : message.newTokenDenom; return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -470,7 +470,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -657,7 +657,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -858,9 +858,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -1046,7 +1046,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/genesis.ts index 56fd519109..6a972ec472 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/genesis.ts @@ -120,7 +120,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = message.pruneEpochIdentifier === "" ? undefined : message.pruneEpochIdentifier; obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, @@ -242,7 +242,7 @@ export const GenesisState = { if (message.twaps) { obj.twaps = message.twaps.map(e => e ? TwapRecord.toAmino(e) : undefined); } else { - obj.twaps = []; + obj.twaps = message.twaps; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts index 2cce0d9899..27961fa180 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -210,8 +210,8 @@ export const ArithmeticTwapRequest = { toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; return obj; @@ -307,7 +307,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -452,8 +452,8 @@ export const ArithmeticTwapToNowRequest = { toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -548,7 +548,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts index 4ea22c0220..59fcabcc49 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -283,14 +283,14 @@ export const TwapRecord = { toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; + obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; + obj.height = message.height ? message.height.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice) === "" ? undefined : padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice) === "" ? undefined : padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts index 93458496b4..4a8467c23d 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts @@ -112,7 +112,7 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/genesis.ts index 4769542628..871256595a 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/genesis.ts @@ -107,11 +107,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = message.basedenom; + obj.basedenom = message.basedenom === "" ? undefined : message.basedenom; if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.feetokens = []; + obj.feetokens = message.feetokens; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/gov.ts index 4fc390a412..7dcaf01d98 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/gov.ts @@ -133,8 +133,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts index be26f613a7..e2484fa928 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -245,7 +245,7 @@ export const QueryFeeTokensResponse = { if (message.feeTokens) { obj.fee_tokens = message.feeTokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.fee_tokens = []; + obj.fee_tokens = message.feeTokens; } return obj; }, @@ -340,7 +340,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -453,7 +453,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID ? message.poolID.toString() : undefined; - obj.spot_price = message.spotPrice; + obj.spot_price = padDecimal(message.spotPrice) === "" ? undefined : padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -547,7 +547,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -811,7 +811,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = message.baseDenom; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts index 50923a519e..04a1eac3b4 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts @@ -1342,7 +1342,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1534,7 +1534,7 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; return obj; @@ -1640,8 +1640,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -1820,12 +1820,12 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; @@ -1967,9 +1967,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.path = message.path; + obj.path = message.path === "" ? undefined : message.path; obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.prove = message.prove === false ? undefined : message.prove; return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2121,7 +2121,7 @@ export const RequestBeginBlock = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } return obj; }, @@ -2220,14 +2220,14 @@ export const RequestCheckTx = { message.tx = bytesFromBase64(object.tx); } if (object.type !== undefined && object.type !== null) { - message.type = checkTxTypeFromJSON(object.type); + message.type = object.type; } return message; }, toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.type = checkTxTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2771,8 +2771,8 @@ export const RequestLoadSnapshotChunk = { toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -2892,9 +2892,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3357,7 +3357,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3445,7 +3445,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3669,8 +3669,8 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; @@ -3793,9 +3793,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -3927,7 +3927,7 @@ export const ResponseInitChain = { if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; @@ -4151,15 +4151,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.index = message.index ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4256,7 +4256,7 @@ export const ResponseBeginBlock = { if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4467,18 +4467,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4688,18 +4688,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4836,13 +4836,13 @@ export const ResponseEndBlock = { if (message.validatorUpdates) { obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validator_updates = []; + obj.validator_updates = message.validatorUpdates; } obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -5047,7 +5047,7 @@ export const ResponseListSnapshots = { if (message.snapshots) { obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); } else { - obj.snapshots = []; + obj.snapshots = message.snapshots; } return obj; }, @@ -5130,13 +5130,13 @@ export const ResponseOfferSnapshot = { fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = responseOfferSnapshot_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -5357,7 +5357,7 @@ export const ResponseApplySnapshotChunk = { fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); if (object.result !== undefined && object.result !== null) { - message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + message.result = object.result; } message.refetchChunks = object.refetch_chunks?.map(e => e) || []; message.rejectSenders = object.reject_senders?.map(e => e) || []; @@ -5365,16 +5365,16 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { - obj.refetch_chunks = []; + obj.refetch_chunks = message.refetchChunks; } if (message.rejectSenders) { obj.reject_senders = message.rejectSenders.map(e => e); } else { - obj.reject_senders = []; + obj.reject_senders = message.rejectSenders; } return obj; }, @@ -5741,11 +5741,11 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, @@ -5856,11 +5856,11 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -5983,7 +5983,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.index = message.index; + obj.index = message.index === false ? undefined : message.index; return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -6124,7 +6124,7 @@ export const TxResult = { toAmino(message: TxResult): TxResultAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -6449,7 +6449,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6589,7 +6589,7 @@ export const Evidence = { fromAmino(object: EvidenceAmino): Evidence { const message = createBaseEvidence(); if (object.type !== undefined && object.type !== null) { - message.type = evidenceTypeFromJSON(object.type); + message.type = object.type; } if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); @@ -6607,7 +6607,7 @@ export const Evidence = { }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = evidenceTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; @@ -6766,8 +6766,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts index 8cdc44a66c..6393e6860c 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts @@ -214,7 +214,7 @@ export const Proof = { if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); } else { - obj.aunts = []; + obj.aunts = message.aunts; } return obj; }, @@ -442,9 +442,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -564,7 +564,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -663,7 +663,7 @@ export const ProofOps = { if (message.ops) { obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); } else { - obj.ops = []; + obj.ops = message.ops; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts index b54daacdb2..ca7ef79b7b 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts @@ -119,7 +119,7 @@ export const BitArray = { if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { - obj.elems = []; + obj.elems = message.elems; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts index 87704a15a3..2303697558 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts @@ -396,12 +396,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = message.nodeId === "" ? undefined : message.nodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; - obj.moniker = message.moniker; + obj.moniker = message.moniker === "" ? undefined : message.moniker; obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -506,8 +506,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -633,11 +633,11 @@ export const PeerInfo = { }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { - obj.address_info = []; + obj.address_info = message.addressInfo; } obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; return obj; @@ -775,10 +775,10 @@ export const PeerAddressInfo = { }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; - obj.dial_failures = message.dialFailures; + obj.dial_failures = message.dialFailures === 0 ? undefined : message.dialFailures; return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts index a9ad7c29eb..5543313c32 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts @@ -489,7 +489,7 @@ export const LightClientAttackEvidence = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -589,7 +589,7 @@ export const EvidenceList = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts index 57564d97f6..7ac17d0710 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts @@ -623,7 +623,7 @@ export const ValidatorParams = { if (message.pubKeyTypes) { obj.pub_key_types = message.pubKeyTypes.map(e => e); } else { - obj.pub_key_types = []; + obj.pub_key_types = message.pubKeyTypes; } return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts index c0418b78ed..1c6e685520 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts @@ -433,7 +433,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = message.total === 0 ? undefined : message.total; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, @@ -556,7 +556,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -968,7 +968,7 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; @@ -1077,7 +1077,7 @@ export const Data = { if (message.txs) { obj.txs = message.txs.map(e => base64FromBytes(e)); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, @@ -1255,7 +1255,7 @@ export const Vote = { fromAmino(object: VoteAmino): Vote { const message = createBaseVote(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1282,13 +1282,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; - obj.validator_index = message.validatorIndex; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -1436,12 +1436,12 @@ export const Commit = { toAmino(message: Commit): CommitAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1563,7 +1563,7 @@ export const CommitSig = { fromAmino(object: CommitSigAmino): CommitSig { const message = createBaseCommitSig(); if (object.block_id_flag !== undefined && object.block_id_flag !== null) { - message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + message.blockIdFlag = object.block_id_flag; } if (object.validator_address !== undefined && object.validator_address !== null) { message.validatorAddress = bytesFromBase64(object.validator_address); @@ -1578,7 +1578,7 @@ export const CommitSig = { }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; @@ -1745,7 +1745,7 @@ export const Proposal = { fromAmino(object: ProposalAmino): Proposal { const message = createBaseProposal(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1769,10 +1769,10 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts index 104304adf3..e4dcd1df7b 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts @@ -158,7 +158,7 @@ export const ValidatorSet = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts index b2fe2649bc..a4fa8adb2e 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts @@ -133,7 +133,7 @@ export const App = { toAmino(message: App): AppAmino { const obj: any = {}; obj.protocol = message.protocol ? message.protocol.toString() : undefined; - obj.software = message.software; + obj.software = message.software === "" ? undefined : message.software; return obj; }, fromAminoMsg(object: AppAminoMsg): App { diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts index 533d7261bf..1672cbeb5a 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts @@ -47,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.ts index c4405f81d9..18dc4fccfd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.ts @@ -215,12 +215,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -353,12 +353,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -588,12 +588,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -726,12 +726,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -937,12 +937,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts index e6f7269391..b2d09362e5 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts @@ -47,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.ts index f092bcfdcf..fbfdbaa250 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.ts @@ -215,12 +215,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -353,12 +353,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -588,12 +588,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -726,12 +726,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -937,12 +937,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/genesis.ts index f0afd85003..5f7090e58c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts index 5d00426330..0dcb3cfe9c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -179,7 +179,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -291,8 +291,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); - obj.owner = omitDefault(message.owner); + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -496,7 +496,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -607,8 +607,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); - obj.owner = omitDefault(message.owner); + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -718,7 +718,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); + obj.auditor = message.auditor === "" ? undefined : message.auditor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts index e17312d9d8..795564d5ab 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -142,8 +142,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -268,12 +268,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -390,11 +390,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts index e627a055d1..744cdaea28 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/endpoint.ts @@ -110,13 +110,13 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } return message; }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); + obj.kind = message.kind === 0 ? undefined : message.kind; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts index e7194bd44d..2952b003de 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts @@ -165,7 +165,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -282,11 +282,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -403,11 +403,11 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -562,7 +562,7 @@ export const ResourceUnits = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts index 63de392e14..94ec94a9ad 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -142,8 +142,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -268,12 +268,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -390,11 +390,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts index 74a24aa013..be419c7c7e 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/endpoint.ts @@ -132,7 +132,7 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.sequence_number !== undefined && object.sequence_number !== null) { message.sequenceNumber = object.sequence_number; @@ -141,8 +141,8 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); - obj.sequence_number = message.sequenceNumber; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.sequence_number = message.sequenceNumber ?? 0; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts index a9ab0ef5ee..ebf175c5da 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts @@ -142,7 +142,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -259,11 +259,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -396,12 +396,12 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.name = message.name; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.name = message.name ?? ""; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resourceunits.ts index d25b492f16..50f5eed058 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resourceunits.ts @@ -161,12 +161,12 @@ export const ResourceUnits = { if (message.storage) { obj.storage = message.storage.map(e => e ? Storage.toAmino(e) : undefined); } else { - obj.storage = []; + obj.storage = message.storage; } if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts index 3d90abcb1e..97a159b755 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: { + id: id == null ? id : { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts index 8b0e2ea2da..85be35e2d2 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts @@ -217,8 +217,8 @@ export const CertificateID = { }, toAmino(message: CertificateID): CertificateIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateIDAminoMsg): CertificateID { @@ -332,7 +332,7 @@ export const Certificate = { fromAmino(object: CertificateAmino): Certificate { const message = createBaseCertificate(); if (object.state !== undefined && object.state !== null) { - message.state = certificate_StateFromJSON(object.state); + message.state = object.state; } if (object.cert !== undefined && object.cert !== null) { message.cert = bytesFromBase64(object.cert); @@ -344,9 +344,9 @@ export const Certificate = { }, toAmino(message: Certificate): CertificateAmino { const obj: any = {}; - obj.state = certificate_StateToJSON(message.state); - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.state = message.state ?? 0; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: CertificateAminoMsg): Certificate { @@ -472,9 +472,9 @@ export const CertificateFilter = { }, toAmino(message: CertificateFilter): CertificateFilterAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: CertificateFilterAminoMsg): CertificateFilter { @@ -600,9 +600,9 @@ export const MsgCreateCertificate = { }, toAmino(message: MsgCreateCertificate): MsgCreateCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.owner = message.owner ?? ""; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: MsgCreateCertificateAminoMsg): MsgCreateCertificate { @@ -769,7 +769,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : undefined; + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts index 212362519c..2eaeabe483 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts @@ -113,8 +113,8 @@ export const GenesisCertificate = { }, toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; + obj.owner = message.owner ?? ""; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { @@ -217,7 +217,7 @@ export const GenesisState = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts index 1392ab89c7..052e85a1bd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts @@ -130,8 +130,8 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; - obj.serial = message.serial; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateResponseAminoMsg): CertificateResponse { @@ -361,7 +361,7 @@ export const QueryCertificatesResponse = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts index 478b587e04..2d44e7d00b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts @@ -93,7 +93,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts index 078159edc2..84962d1153 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts @@ -309,14 +309,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -499,8 +499,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -705,13 +705,13 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -878,7 +878,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1061,8 +1061,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1192,7 +1192,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -1204,9 +1204,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1333,9 +1333,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts index 131e5a7fdc..91a8b7b9e8 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts @@ -123,11 +123,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -247,9 +247,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts index 590e3d7c62..c87af8edfb 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsSDKType } from "../../base/ import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, Exact, omitDefault } from "../../../helpers"; +import { isSet, Exact } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -254,7 +254,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -421,7 +421,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -588,7 +588,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -787,9 +787,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { @@ -921,12 +921,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, @@ -1057,7 +1057,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -1069,10 +1069,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1198,9 +1198,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? Coin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts index f73b7ec130..2e3bcdfd95 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts index 7670915a11..070df61d68 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts @@ -291,7 +291,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -519,11 +519,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts index cf9918c322..634df2e79b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts @@ -93,7 +93,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts index 79a30a0b75..ac7a64875d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts @@ -175,8 +175,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -306,7 +306,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -318,9 +318,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -447,9 +447,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts index 655ea1d188..becae35579 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts @@ -239,15 +239,15 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; - obj.depositor = message.depositor; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -446,9 +446,9 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; - obj.depositor = message.depositor; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -631,8 +631,8 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -799,7 +799,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts index de6bc5c7e6..67f5f75a50 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts @@ -123,11 +123,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -247,9 +247,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts index 32b1994f50..f22ef7825a 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -181,7 +181,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -193,10 +193,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts index e00c68e560..fd457a41ef 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupid.ts @@ -118,9 +118,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts index d21048cbc6..c7d7c8794f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts @@ -131,7 +131,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -298,7 +298,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -465,7 +465,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts index bb14fc045a..348c8404dd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts @@ -126,12 +126,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts index 002d051ea0..4d0f379f40 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts index 95a6e4a95e..0b1dd61131 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts @@ -291,7 +291,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -519,11 +519,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts index c94bd89c88..7e8cd775d4 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts @@ -120,9 +120,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index 0e6cf7a88d..d50522d305 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -230,66 +230,66 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - groups: groups.map(el0 => ({ + groups: groups.map?.(el0 => ({ name: el0.name, - requirements: { - signedBy: { + requirements: el0.requirements == null ? el0.requirements : { + signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map(el2 => ({ + attributes: el0.requirements.attributes.map?.(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map(el1 => ({ - resources: { - cpu: { - units: { + resources: el0.resources.map?.(el1 => ({ + resources: el1.resources == null ? el1.resources : { + cpu: el1.resources.cpu == null ? el1.resources.cpu : { + units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map(el4 => ({ + attributes: el1.resources.cpu.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - memory: { - quantity: { + memory: el1.resources.memory == null ? el1.resources.memory : { + quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map(el4 => ({ + attributes: el1.resources.memory.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map(el3 => ({ + storage: el1.resources.storage.map?.(el3 => ({ name: el3.name, - quantity: { + quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map(el4 => ({ + attributes: el3.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map(el3 => ({ - kind: endpoint_KindFromJSON(el3.kind), + endpoints: el1.resources.endpoints.map?.(el3 => ({ + kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: { + price: el1.price == null ? el1.price : { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount }, @@ -322,11 +322,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount }, @@ -353,9 +353,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, version }; @@ -377,9 +377,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) } }; } @@ -401,9 +401,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; @@ -426,9 +426,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; @@ -451,9 +451,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/genesis.ts index 2139e1f100..38a1b97539 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/genesis.ts @@ -116,12 +116,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts index ad0a702d60..aaf8022b3c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -206,10 +206,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -329,7 +329,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -505,11 +505,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -629,7 +629,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts index 0aaefc0212..ea0603b2bf 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts @@ -249,8 +249,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -409,7 +409,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = Coin.fromAmino(object.balance); @@ -424,12 +424,12 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -604,7 +604,7 @@ export const Payment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = payment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = Coin.fromAmino(object.rate); @@ -619,13 +619,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = payment_StateToJSON(message.state); - obj.rate = message.rate ? Coin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/genesis.ts index 9966056a31..424a9090f7 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/genesis.ts @@ -116,12 +116,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts index ad5e874011..f1e15c34e3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -206,10 +206,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -329,7 +329,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -505,11 +505,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -629,7 +629,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts index d3bfeec30a..b5a84739fd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts @@ -262,8 +262,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -448,7 +448,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = DecCoin.fromAmino(object.balance); @@ -469,14 +469,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt; - obj.depositor = message.depositor; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; + obj.depositor = message.depositor ?? ""; + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -651,7 +651,7 @@ export const FractionalPayment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = fractionalPayment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = DecCoin.fromAmino(object.rate); @@ -666,13 +666,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = fractionalPayment_StateToJSON(message.state); - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts index 717ec30d0e..47f8cedbd1 100644 --- a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts @@ -83,7 +83,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts index c188a15ca0..451b4d2b9b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/params.ts @@ -128,9 +128,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); - obj.initial_inflation = padDecimal(message.initialInflation); - obj.variance = padDecimal(message.variance); + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor) ?? ""; + obj.initial_inflation = padDecimal(message.initialInflation) ?? ""; + obj.variance = padDecimal(message.variance) ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts index 49c3f4b4ba..a557ebdae8 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -287,10 +287,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : undefined; - obj.provider = message.provider; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.provider = message.provider ?? ""; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -457,7 +457,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -688,11 +688,11 @@ export const BidID = { }, toAmino(message: BidID): BidIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: BidIDAminoMsg): BidID { @@ -822,7 +822,7 @@ export const Bid = { message.bidId = BidID.fromAmino(object.bid_id); } if (object.state !== undefined && object.state !== null) { - message.state = bid_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -834,10 +834,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; - obj.state = bid_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -1011,12 +1011,12 @@ export const BidFilters = { }, toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: BidFiltersAminoMsg): BidFilters { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts index 8783bb2a27..aaabda5bff 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts @@ -136,14 +136,14 @@ export const GenesisState = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } if (message.leases) { obj.leases = message.leases.map(e => e ? Lease.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts index ece57673c6..9d4b850b65 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -306,11 +306,11 @@ export const LeaseID = { }, toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: LeaseIDAminoMsg): LeaseID { @@ -453,7 +453,7 @@ export const Lease = { message.leaseId = LeaseID.fromAmino(object.lease_id); } if (object.state !== undefined && object.state !== null) { - message.state = lease_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -468,11 +468,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; - obj.state = lease_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = omitDefault(message.createdAt); - obj.closed_on = omitDefault(message.closedOn); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -646,12 +646,12 @@ export const LeaseFilters = { }, toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: LeaseFiltersAminoMsg): LeaseFilters { @@ -745,7 +745,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -912,7 +912,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1079,7 +1079,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts index 4f60227d29..0b91ae0a3f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -223,10 +223,10 @@ export const OrderID = { }, toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; return obj; }, fromAminoMsg(object: OrderIDAminoMsg): OrderID { @@ -356,7 +356,7 @@ export const Order = { message.orderId = OrderID.fromAmino(object.order_id); } if (object.state !== undefined && object.state !== null) { - message.state = order_StateFromJSON(object.state); + message.state = object.state; } if (object.spec !== undefined && object.spec !== null) { message.spec = GroupSpec.fromAmino(object.spec); @@ -368,10 +368,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; - obj.state = order_StateToJSON(message.state); - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.state = message.state ?? 0; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -529,11 +529,11 @@ export const OrderFilters = { }, toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: OrderFiltersAminoMsg): OrderFilters { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts index fe08d612a3..55097d51a9 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts @@ -101,8 +101,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : undefined; - obj.order_max_bids = message.orderMaxBids; + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.ts index ee55c69319..1d2312f1e6 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/query.ts @@ -371,7 +371,7 @@ export const QueryOrdersResponse = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -791,7 +791,7 @@ export const QueryBidsResponse = { if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toAmino(e) : undefined); } else { - obj.bids = []; + obj.bids = message.bids; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1228,7 +1228,7 @@ export const QueryLeasesResponse = { if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts index e8401755fa..0fc7ee0a5d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts @@ -107,18 +107,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: { + order: order == null ? order : { owner: order.owner, - dseq: BigInt(order.dseq), + dseq: order.dseq == null ? order.dseq : BigInt(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: { + price: price == null ? price : { denom: price.denom, amount: price.amount }, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount } @@ -144,9 +144,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -173,9 +173,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -202,9 +202,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -231,9 +231,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: { + leaseId: lease_id == null ? lease_id : { owner: lease_id.owner, - dseq: BigInt(lease_id.dseq), + dseq: lease_id.dseq == null ? lease_id.dseq : BigInt(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts index 831b4eea3c..3ee12d22c8 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts @@ -70,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -111,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts index 2e5804f24d..5efcee47a3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts @@ -191,8 +191,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -340,14 +340,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -568,14 +568,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -742,7 +742,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -963,14 +963,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/genesis.ts index 7506e24013..68c52ba5d5 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts index d90c974036..8a038a1507 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts @@ -70,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -111,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts index c1a7b90a9c..44fe450f46 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts @@ -191,8 +191,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -340,14 +340,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -568,14 +568,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -742,7 +742,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -963,14 +963,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts index 37ff4383b2..14ff7180dc 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -241,7 +241,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -337,7 +337,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts b/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts index 4bb488eaa4..d3a5f64934 100644 --- a/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts +++ b/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "capability.v1"; /** * Capability defines an implementation of an object capability. The index @@ -126,7 +126,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -230,8 +230,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = omitDefault(message.module); - obj.name = omitDefault(message.name); + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { @@ -328,7 +328,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts index 3436536c8d..a45ec787fa 100644 --- a/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts @@ -123,7 +123,7 @@ export const GenesisOwners = { toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; obj.index = message.index ? message.index.toString() : undefined; - obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : CapabilityOwners.fromPartial({}); + obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, fromAminoMsg(object: GenesisOwnersAminoMsg): GenesisOwners { @@ -237,7 +237,7 @@ export const GenesisState = { if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/confio/proofs.ts b/__fixtures__/v-next/outputosmojs/confio/proofs.ts index 6abf5898a1..9924a42c98 100644 --- a/__fixtures__/v-next/outputosmojs/confio/proofs.ts +++ b/__fixtures__/v-next/outputosmojs/confio/proofs.ts @@ -655,7 +655,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1051,16 +1051,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1069,10 +1069,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1181,7 +1181,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1193,7 +1193,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1333,8 +1333,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1511,7 +1511,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1520,13 +1520,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { @@ -1623,7 +1623,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1848,12 +1848,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -2116,7 +2116,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts index 9f796d1459..6e2f98ed3a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -139,7 +139,7 @@ export const Config = { if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e) : undefined); } else { - obj.modules = []; + obj.modules = message.modules; } return obj; }, @@ -250,7 +250,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts index 393886e5ab..f6c47f871c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -226,16 +226,16 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = omitDefault(message.goImport); + obj.go_import = message.goImport === "" ? undefined : message.goImport; if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { - obj.use_package = []; + obj.use_package = message.usePackage; } if (message.canMigrateFrom) { obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); } else { - obj.can_migrate_from = []; + obj.can_migrate_from = message.canMigrateFrom; } return obj; }, @@ -346,8 +346,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.revision = omitDefault(message.revision); + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -441,7 +441,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = omitDefault(message.module); + obj.module = message.module === "" ? undefined : message.module; return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts index 14439e48cf..b2db394435 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -181,10 +181,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = omitDefault(message.accountNumber); - obj.sequence = omitDefault(message.sequence); + obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -317,11 +317,11 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { - obj.permissions = []; + obj.permissions = message.permissions; } return obj; }, @@ -480,11 +480,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = omitDefault(message.maxMemoCharacters); - obj.tx_sig_limit = omitDefault(message.txSigLimit); - obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); - obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); - obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); + obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/genesis.ts index 4a1998cde7..3ee09b328c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/genesis.ts @@ -114,7 +114,7 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts index 8a884a3210..b1b803f9ef 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -372,7 +372,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -468,7 +468,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -905,7 +905,7 @@ export const QueryModuleAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, @@ -1073,7 +1073,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = omitDefault(message.bech32Prefix); + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1261,7 +1261,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1355,7 +1355,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts index dd1370ff3d..535deadad2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/authz.ts @@ -153,7 +153,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -406,8 +406,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -512,7 +512,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/genesis.ts index 439e82bf78..f7aedb368f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts index 1ce457fe2e..92a2bd8404 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -218,9 +218,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -340,7 +340,7 @@ export const QueryGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -452,7 +452,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -572,7 +572,7 @@ export const QueryGranterGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -684,7 +684,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -804,7 +804,7 @@ export const QueryGranteeGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts index b035d8f4ff..9653f58093 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrant"; @@ -43,11 +44,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -62,8 +63,8 @@ export const AminoConverter = { return { granter, grantee, - grant: { - authorization: { + grant: grant == null ? grant : { + authorization: grant.authorization == null ? grant.authorization : { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, @@ -79,9 +80,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -92,7 +93,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map(el0 => ({ + msgs: msgs.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })) @@ -107,9 +108,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts index b7fc2ce0ac..f2d95e1479 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -203,8 +203,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -308,7 +308,7 @@ export const MsgExecResponse = { if (message.results) { obj.results = message.results.map(e => base64FromBytes(e)); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -425,11 +425,11 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -629,9 +629,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/authz.ts index 0add015538..22794060dd 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/authz.ts @@ -102,7 +102,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts index 82f38238bd..b92b3f0cd5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -271,9 +271,9 @@ export const Params = { if (message.sendEnabled) { obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); } else { - obj.send_enabled = []; + obj.send_enabled = message.sendEnabled; } - obj.default_send_enabled = omitDefault(message.defaultSendEnabled); + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -383,8 +383,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.enabled = omitDefault(message.enabled); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -500,11 +500,11 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -621,11 +621,11 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -729,7 +729,7 @@ export const Supply = { if (message.total) { obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -862,12 +862,12 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.exponent = omitDefault(message.exponent); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } return obj; }, @@ -1080,18 +1080,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = omitDefault(message.description); + obj.description = message.description === "" ? undefined : message.description; if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { - obj.denom_units = []; + obj.denom_units = message.denomUnits; } - obj.base = omitDefault(message.base); - obj.display = omitDefault(message.display); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts index e1a25720d0..31d97ef473 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -189,17 +189,17 @@ export const GenesisState = { if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } if (message.denomMetadata) { obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.denom_metadata = []; + obj.denom_metadata = message.denomMetadata; } return obj; }, @@ -316,11 +316,11 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts index 7fb55afa0b..caf3f19930 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -425,8 +425,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.denom = omitDefault(message.denom); + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -630,7 +630,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -750,7 +750,7 @@ export const QueryAllBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -862,7 +862,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -982,7 +982,7 @@ export const QuerySpendableBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1197,7 +1197,7 @@ export const QueryTotalSupplyResponse = { if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1293,7 +1293,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1767,7 +1767,7 @@ export const QueryDenomsMetadataResponse = { if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.metadatas = []; + obj.metadatas = message.metadatas; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1863,7 +1863,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -2067,7 +2067,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2178,7 +2178,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, @@ -2298,7 +2298,7 @@ export const QueryDenomOwnersResponse = { if (message.denomOwners) { obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); } else { - obj.denom_owners = []; + obj.denom_owners = message.denomOwners; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts index 91e06445ec..a675254230 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -93,16 +93,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map(el0 => ({ + inputs: inputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map(el0 => ({ + outputs: outputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts index c490a22d2c..4158a8d2f3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -156,12 +156,12 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -360,12 +360,12 @@ export const MsgMultiSend = { if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); } else { - obj.inputs = []; + obj.inputs = message.inputs; } if (message.outputs) { obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); } else { - obj.outputs = []; + obj.outputs = message.outputs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts index a74bcfd52b..318f5ebb22 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts @@ -556,25 +556,25 @@ export const TxResponse = { toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -707,12 +707,12 @@ export const ABCIMessageLog = { }, toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; - obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -829,11 +829,11 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -944,8 +944,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1211,16 +1211,16 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1442,7 +1442,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1568,12 +1568,12 @@ export const TxMsgData = { if (message.data) { obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1762,7 +1762,7 @@ export const SearchTxsResult = { if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/kv/v1beta1/kv.ts index 5b0b04a862..ff0ddb56a8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/kv/v1beta1/kv.ts @@ -105,7 +105,7 @@ export const Pairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts index dc523fa7ad..8ab74190e4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/node/v1beta1/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "cosmos.base.node.v1beta1"; /** ConfigRequest defines the request structure for the Config gRPC query. */ export interface ConfigRequest {} @@ -163,7 +163,7 @@ export const ConfigResponse = { }, toAmino(message: ConfigResponse): ConfigResponseAmino { const obj: any = {}; - obj.minimum_gas_price = omitDefault(message.minimumGasPrice); + obj.minimum_gas_price = message.minimumGasPrice === "" ? undefined : message.minimumGasPrice; return obj; }, fromAminoMsg(object: ConfigResponseAminoMsg): ConfigResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts index d7708ab1d8..9735629f38 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts @@ -237,8 +237,8 @@ export const PageRequest = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.offset = message.offset ? message.offset.toString() : undefined; obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts index 11ffa1caba..ad4e68b634 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -210,7 +210,7 @@ export const ListAllInterfacesResponse = { if (message.interfaceNames) { obj.interface_names = message.interfaceNames.map(e => e); } else { - obj.interface_names = []; + obj.interface_names = message.interfaceNames; } return obj; }, @@ -305,7 +305,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = omitDefault(message.interfaceName); + obj.interface_name = message.interfaceName === "" ? undefined : message.interfaceName; return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { @@ -408,7 +408,7 @@ export const ListImplementationsResponse = { if (message.implementationMessageNames) { obj.implementation_message_names = message.implementationMessageNames.map(e => e); } else { - obj.implementation_message_names = []; + obj.implementation_message_names = message.implementationMessageNames; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts index befdfdd287..2947178a22 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -682,11 +682,11 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -790,7 +790,7 @@ export const AuthnDescriptor = { if (message.signModes) { obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); } else { - obj.sign_modes = []; + obj.sign_modes = message.signModes; } return obj; }, @@ -917,9 +917,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.number = omitDefault(message.number); - obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1013,7 +1013,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1116,7 +1116,7 @@ export const CodecDescriptor = { if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); } else { - obj.interfaces = []; + obj.interfaces = message.interfaces; } return obj; }, @@ -1255,16 +1255,16 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { - obj.interface_accepting_messages = []; + obj.interface_accepting_messages = message.interfaceAcceptingMessages; } if (message.interfaceImplementers) { obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); } else { - obj.interface_implementers = []; + obj.interface_implementers = message.interfaceImplementers; } return obj; }, @@ -1375,8 +1375,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.type_url = omitDefault(message.typeUrl); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1492,11 +1492,11 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { - obj.field_descriptor_names = []; + obj.field_descriptor_names = message.fieldDescriptorNames; } return obj; }, @@ -1591,7 +1591,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1685,7 +1685,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -2790,7 +2790,7 @@ export const QueryServicesDescriptor = { if (message.queryServices) { obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); } else { - obj.query_services = []; + obj.query_services = message.queryServices; } return obj; }, @@ -2923,12 +2923,12 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.is_module = omitDefault(message.isModule); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } return obj; }, @@ -3039,8 +3039,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.full_query_path = omitDefault(message.fullQueryPath); + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts index 56152fb16d..5c3b4b8b46 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -274,8 +274,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -380,7 +380,7 @@ export const Metadata = { if (message.chunkHashes) { obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); } else { - obj.chunk_hashes = []; + obj.chunk_hashes = message.chunkHashes; } return obj; }, @@ -654,7 +654,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -799,7 +799,7 @@ export const SnapshotIAVLItem = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.height = message.height === 0 ? undefined : message.height; return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -909,8 +909,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { @@ -1218,7 +1218,7 @@ export const SnapshotSchema = { if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e)); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts index 16a465f03c..a619fad8c3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts @@ -156,7 +156,7 @@ export const CommitInfo = { if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { - obj.store_infos = []; + obj.store_infos = message.storeInfos; } return obj; }, @@ -267,7 +267,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts index bc2a3add64..48f7b71f2f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/listening.ts @@ -150,8 +150,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts index 9bfa5d8683..e8c3efc632 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -307,7 +307,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -440,11 +440,11 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = omitDefault(message.blockHeight); + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -672,11 +672,11 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = omitDefault(message.blockHeight); + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -820,10 +820,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); - obj.proposer_priority = omitDefault(message.proposerPriority); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -917,7 +917,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1379,7 +1379,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = omitDefault(message.syncing); + obj.syncing = message.syncing === false ? undefined : message.syncing; return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1775,18 +1775,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.app_name = omitDefault(message.appName); - obj.version = omitDefault(message.version); - obj.git_commit = omitDefault(message.gitCommit); - obj.build_tags = omitDefault(message.buildTags); - obj.go_version = omitDefault(message.goVersion); + obj.name = message.name === "" ? undefined : message.name; + obj.app_name = message.appName === "" ? undefined : message.appName; + obj.version = message.version === "" ? undefined : message.version; + obj.git_commit = message.gitCommit === "" ? undefined : message.gitCommit; + obj.build_tags = message.buildTags === "" ? undefined : message.buildTags; + obj.go_version = message.goVersion === "" ? undefined : message.goVersion; if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { - obj.build_deps = []; + obj.build_deps = message.buildDeps; } - obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); + obj.cosmos_sdk_version = message.cosmosSdkVersion === "" ? undefined : message.cosmosSdkVersion; return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1912,9 +1912,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.version = omitDefault(message.version); - obj.sum = omitDefault(message.sum); + obj.path = message.path === "" ? undefined : message.path; + obj.version = message.version === "" ? undefined : message.version; + obj.sum = message.sum === "" ? undefined : message.sum; return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts index e6a29eefd8..accde841e6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -158,8 +158,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -269,8 +269,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -364,7 +364,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = omitDefault(message.int); + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -458,7 +458,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = omitDefault(message.dec); + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts index b92fdb59a6..b7bdb0eca0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -126,7 +126,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -236,8 +236,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = omitDefault(message.module); - obj.name = omitDefault(message.name); + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { @@ -340,7 +340,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts index f9b96ead89..1eed614f22 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -122,7 +122,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -239,11 +239,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts index 427221763b..e6bd264055 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -126,9 +126,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.invariant_module_name = omitDefault(message.invariantModuleName); - obj.invariant_route = omitDefault(message.invariantRoute); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.invariant_module_name = message.invariantModuleName === "" ? undefined : message.invariantModuleName; + obj.invariant_route = message.invariantRoute === "" ? undefined : message.invariantRoute; return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts index 2068fe302c..430a7cc8c0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -162,11 +162,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = omitDefault(message.purpose); - obj.coin_type = omitDefault(message.coinType); - obj.account = omitDefault(message.account); - obj.change = omitDefault(message.change); - obj.address_index = omitDefault(message.addressIndex); + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts index 3f154390ba..2b5957a040 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -228,7 +228,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -344,7 +344,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = omitDefault(message.privKeyType); + obj.priv_key_type = message.privKeyType === "" ? undefined : message.privKeyType; return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts index e90be81493..d6c9bcd083 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -115,11 +115,11 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = omitDefault(message.threshold); + obj.threshold = message.threshold === 0 ? undefined : message.threshold; if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.public_keys = []; + obj.public_keys = message.publicKeys; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts index e30e247767..3e55fa8335 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -123,7 +123,7 @@ export const MultiSignature = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -234,7 +234,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts index 08d0bdc0e2..4e748ddecd 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -386,10 +386,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = padDecimal(message.communityTax); - obj.base_proposer_reward = padDecimal(message.baseProposerReward); - obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); - obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); + obj.community_tax = padDecimal(message.communityTax) === "" ? undefined : padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward) === "" ? undefined : padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward) === "" ? undefined : padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -508,9 +508,9 @@ export const ValidatorHistoricalRewards = { if (message.cumulativeRewardRatio) { obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.cumulative_reward_ratio = []; + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; } - obj.reference_count = omitDefault(message.referenceCount); + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -629,9 +629,9 @@ export const ValidatorCurrentRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -734,7 +734,7 @@ export const ValidatorAccumulatedCommission = { if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.commission = []; + obj.commission = message.commission; } return obj; }, @@ -838,7 +838,7 @@ export const ValidatorOutstandingRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -949,8 +949,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = omitDefault(message.validatorPeriod); - obj.fraction = padDecimal(message.fraction); + obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.fraction = padDecimal(message.fraction) === "" ? undefined : padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1053,7 +1053,7 @@ export const ValidatorSlashEvents = { if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, @@ -1157,7 +1157,7 @@ export const FeePool = { if (message.communityPool) { obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.community_pool = []; + obj.community_pool = message.communityPool; } return obj; }, @@ -1306,13 +1306,13 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1439,9 +1439,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = omitDefault(message.previousPeriod); - obj.stake = padDecimal(message.stake); - obj.height = message.height; + obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.stake = padDecimal(message.stake) === "" ? undefined : padDecimal(message.stake); + obj.height = message.height ? message.height.toString() : "0"; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1557,11 +1557,11 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.reward = []; + obj.reward = message.reward; } return obj; }, @@ -1720,11 +1720,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); - obj.amount = omitDefault(message.amount); - obj.deposit = omitDefault(message.deposit); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts index b68bcbb8b7..0e10589c86 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, Params, ParamsSDKType, FeePool, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -272,8 +272,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -389,11 +389,11 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } return obj; }, @@ -504,7 +504,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -631,8 +631,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.period = omitDefault(message.period); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.period = message.period ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -743,7 +743,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -870,8 +870,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -1014,9 +1014,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.height = omitDefault(message.height); - obj.period = omitDefault(message.period); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.height = message.height ? message.height.toString() : undefined; + obj.period = message.period ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1302,38 +1302,38 @@ export const GenesisState = { if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); } else { - obj.delegator_withdraw_infos = []; + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; } - obj.previous_proposer = omitDefault(message.previousProposer); + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } if (message.validatorAccumulatedCommissions) { obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); } else { - obj.validator_accumulated_commissions = []; + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; } if (message.validatorHistoricalRewards) { obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_historical_rewards = []; + obj.validator_historical_rewards = message.validatorHistoricalRewards; } if (message.validatorCurrentRewards) { obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_current_rewards = []; + obj.validator_current_rewards = message.validatorCurrentRewards; } if (message.delegatorStartingInfos) { obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); } else { - obj.delegator_starting_infos = []; + obj.delegator_starting_infos = message.delegatorStartingInfos; } if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts index 4cb31de91e..6f371fb9d9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -577,7 +577,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -765,7 +765,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1001,9 +1001,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.starting_height = omitDefault(message.startingHeight); - obj.ending_height = omitDefault(message.endingHeight); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1123,7 +1123,7 @@ export const QueryValidatorSlashesResponse = { if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.slashes = []; + obj.slashes = message.slashes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1235,8 +1235,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1339,7 +1339,7 @@ export const QueryDelegationRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1434,7 +1434,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1559,12 +1559,12 @@ export const QueryDelegationTotalRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } if (message.total) { obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -1659,7 +1659,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1762,7 +1762,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e); } else { - obj.validators = []; + obj.validators = message.validators; } return obj; }, @@ -1857,7 +1857,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -1951,7 +1951,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { @@ -2127,7 +2127,7 @@ export const QueryCommunityPoolResponse = { if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.pool = []; + obj.pool = message.pool; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts index 05a4e031f8..86be0e8941 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts @@ -111,7 +111,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts index b31b69bc55..9111e51c82 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -205,8 +205,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -389,8 +389,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -493,7 +493,7 @@ export const MsgWithdrawDelegatorRewardResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -588,7 +588,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -691,7 +691,7 @@ export const MsgWithdrawValidatorCommissionResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -811,9 +811,9 @@ export const MsgFundCommunityPool = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.depositor = omitDefault(message.depositor); + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts index de0fcd30f2..2023957a7c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts @@ -146,7 +146,7 @@ export const Equivocation = { obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/genesis.ts index 377c6d600f..215dd9186e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/genesis.ts @@ -93,7 +93,7 @@ export const GenesisState = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.ts index 43a0309c51..baefd03bce 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/query.ts @@ -446,7 +446,7 @@ export const QueryAllEvidenceResponse = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts index 4abb8bc814..6d45f73942 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts @@ -33,7 +33,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: { + evidence: evidence == null ? evidence : { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts index 982d2c4f5b..0a0bf90fc7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -120,7 +120,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = omitDefault(message.submitter); + obj.submitter = message.submitter === "" ? undefined : message.submitter; obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts index cc92537f4d..0415449bf2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/feegrant.ts @@ -201,7 +201,7 @@ export const BasicAllowance = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -378,12 +378,12 @@ export const PeriodicAllowance = { if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_spend_limit = []; + obj.period_spend_limit = message.periodSpendLimit; } if (message.periodCanSpend) { obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_can_spend = []; + obj.period_can_spend = message.periodCanSpend; } obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; return obj; @@ -505,7 +505,7 @@ export const AllowedMsgAllowance = { if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { - obj.allowed_messages = []; + obj.allowed_messages = message.allowedMessages; } return obj; }, @@ -632,8 +632,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/genesis.ts index 444fb5e442..321e439d17 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts index 5de2635516..d33df578bc 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -179,8 +179,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -384,7 +384,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -504,7 +504,7 @@ export const QueryAllowancesResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -616,7 +616,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -736,7 +736,7 @@ export const QueryAllowancesByGranterResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts index 08792b032d..ae2e63181f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: { + allowance: allowance == null ? allowance : { typeUrl: allowance.type_url, value: allowance.value } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts index c4552f7bde..9ebbf0153a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -160,8 +160,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, @@ -345,8 +345,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/genutil/v1beta1/genesis.ts index cd36157736..090e69bfb6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/genutil/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.genTxs) { obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); } else { - obj.gen_txs = []; + obj.gen_txs = message.genTxs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts index 75e346e9e3..a56e70033f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -216,21 +216,21 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts index 3e89736a29..b96b22f7e6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts @@ -385,7 +385,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -394,8 +394,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -528,11 +528,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -758,7 +758,7 @@ export const Proposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -787,20 +787,20 @@ export const Proposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -942,10 +942,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1094,13 +1094,13 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1219,7 +1219,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -1441,9 +1441,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts index dee555b474..7ad43394e5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts @@ -543,7 +543,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -558,9 +558,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -680,7 +680,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -793,7 +793,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1117,7 +1117,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1213,7 +1213,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1452,7 +1452,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1776,7 +1776,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index 3ee8d1dcaa..c8dd2d001c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -90,11 +90,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -122,7 +122,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, @@ -152,9 +152,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata }; } @@ -184,10 +184,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -216,9 +216,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts index 01be694061..e78bee2a2b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts @@ -279,15 +279,15 @@ export const MsgSubmitProposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -492,7 +492,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -698,7 +698,7 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -707,10 +707,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -931,14 +931,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1143,12 +1143,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts index d4ccdd31b9..e4a104c14c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -216,21 +216,21 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts index 6d372a3042..9a097f1646 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts @@ -4,7 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -418,7 +418,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -427,8 +427,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -538,8 +538,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -672,11 +672,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -883,7 +883,7 @@ export const Proposal = { message.content = Any.fromAmino(object.content); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -907,14 +907,14 @@ export const Proposal = { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; @@ -1059,10 +1059,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1203,20 +1203,20 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; return message; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1336,7 +1336,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts index 1f96095559..d2c004fdfc 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts @@ -543,7 +543,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -558,9 +558,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -680,7 +680,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -793,7 +793,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1117,7 +1117,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1213,7 +1213,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1452,7 +1452,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1776,7 +1776,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index 8614717a58..db9b98121a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -74,11 +74,11 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -105,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option) + option: option == null ? option : voteOptionFromJSON(option) }; } }, @@ -133,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -164,9 +164,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts index 78f1b759c5..9100dc0ecd 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts @@ -237,9 +237,9 @@ export const MsgSubmitProposal = { if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -333,7 +333,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -453,15 +453,15 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -666,12 +666,12 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -877,12 +877,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts index ef84b16f78..9587f19981 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts @@ -382,7 +382,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -476,7 +476,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -862,14 +862,14 @@ export const EventExec = { message.proposalId = BigInt(object.proposal_id); } if (object.result !== undefined && object.result !== null) { - message.result = proposalExecutorResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = proposalExecutorResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -980,7 +980,7 @@ export const EventLeaveGroup = { toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts index 5721dec4df..8cc0c14195 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoSDKType, GroupMember, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -256,33 +256,33 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = omitDefault(message.groupSeq); + obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } if (message.groupMembers) { obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.group_members = []; + obj.group_members = message.groupMembers; } - obj.group_policy_seq = omitDefault(message.groupPolicySeq); + obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } - obj.proposal_seq = omitDefault(message.proposalSeq); + obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts index d5728d9930..b8a5930a07 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -461,7 +461,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -649,7 +649,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -853,7 +853,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -973,7 +973,7 @@ export const QueryGroupMembersResponse = { if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1085,7 +1085,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1205,7 +1205,7 @@ export const QueryGroupsByAdminResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1317,7 +1317,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1437,7 +1437,7 @@ export const QueryGroupPoliciesByGroupResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1549,7 +1549,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1669,7 +1669,7 @@ export const QueryGroupPoliciesByAdminResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1765,7 +1765,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -1969,7 +1969,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2089,7 +2089,7 @@ export const QueryProposalsByGroupPolicyResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2201,8 +2201,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); - obj.voter = omitDefault(message.voter); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2406,7 +2406,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2526,7 +2526,7 @@ export const QueryVotesByProposalResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2638,7 +2638,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = omitDefault(message.voter); + obj.voter = message.voter === "" ? undefined : message.voter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2758,7 +2758,7 @@ export const QueryVotesByVoterResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2870,7 +2870,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2990,7 +2990,7 @@ export const QueryGroupsByMemberResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3086,7 +3086,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index e44a0f0c10..26b8514f79 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -155,14 +156,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -172,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -190,12 +191,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, - group_id: groupId.toString(), + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -207,8 +208,8 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: BigInt(group_id), - memberUpdates: member_updates.map(el0 => ({ + groupId: group_id == null ? group_id : BigInt(group_id), + memberUpdates: member_updates.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -225,9 +226,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - new_admin: newAdmin + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -237,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), newAdmin: new_admin }; } @@ -250,9 +251,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -262,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), metadata }; } @@ -276,11 +277,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata, + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -293,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), metadata, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -313,18 +314,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: groupPolicyAsAdmin, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -339,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -348,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -363,9 +364,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -388,10 +389,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -404,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -419,9 +420,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -446,14 +447,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -467,11 +468,11 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -482,8 +483,8 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), - address + proposal_id: omitDefault(proposalId)?.toString?.(), + address: omitDefault(address) }; }, fromAmino: ({ @@ -491,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), address }; } @@ -506,11 +507,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + proposal_id: omitDefault(proposalId)?.toString?.(), + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -521,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata, - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -536,8 +537,8 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), - signer + proposal_id: omitDefault(proposalId)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -545,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), signer }; } @@ -557,8 +558,8 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, - group_id: groupId.toString() + address: omitDefault(address), + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ @@ -567,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: BigInt(group_id) + groupId: group_id == null ? group_id : BigInt(group_id) }; } } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts index 454021ce46..10104bd574 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts @@ -581,13 +581,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -813,12 +813,12 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.member_updates = []; + obj.member_updates = message.memberUpdates; } return obj; }, @@ -1018,9 +1018,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1219,9 +1219,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1436,9 +1436,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1533,7 +1533,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1659,9 +1659,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -1841,15 +1841,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1961,7 +1961,7 @@ export const MsgCreateGroupWithPolicyResponse = { toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2160,8 +2160,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -2361,9 +2361,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2600,25 +2600,25 @@ export const MsgSubmitProposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.exec = execToJSON(message.exec); + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2823,7 +2823,7 @@ export const MsgWithdrawProposal = { toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -3042,23 +3042,23 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; - obj.exec = execToJSON(message.exec); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3242,7 +3242,7 @@ export const MsgExec = { toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3425,7 +3425,7 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts index a89f3d893f..73b4063c32 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts @@ -643,9 +643,9 @@ export const Member = { }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; return obj; }, @@ -749,7 +749,7 @@ export const Members = { if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } return obj; }, @@ -860,7 +860,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === "" ? undefined : message.threshold; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -971,7 +971,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = message.percentage === "" ? undefined : message.percentage; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1258,10 +1258,10 @@ export const GroupInfo = { toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1563,10 +1563,10 @@ export const GroupPolicyInfo = { }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; @@ -1848,10 +1848,10 @@ export const Proposal = { message.groupPolicyVersion = BigInt(object.group_policy_version); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.result !== undefined && object.result !== null) { - message.result = proposalResultFromJSON(object.result); + message.result = object.result; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -1860,7 +1860,7 @@ export const Proposal = { message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); } if (object.executor_result !== undefined && object.executor_result !== null) { - message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; return message; @@ -1868,25 +1868,25 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = proposalStatusToJSON(message.status); - obj.result = proposalResultToJSON(message.result); + obj.status = message.status === 0 ? undefined : message.status; + obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; - obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -2029,10 +2029,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2178,7 +2178,7 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -2191,9 +2191,9 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts b/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts index 31a52ee2c3..31bd2e33f5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/ics23/v1/proofs.ts @@ -661,7 +661,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1075,16 +1075,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1093,10 +1093,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1211,7 +1211,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1223,7 +1223,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1369,8 +1369,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1553,7 +1553,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1562,13 +1562,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { @@ -1671,7 +1671,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1908,12 +1908,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -2188,7 +2188,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts index 9eea096513..17bf9f9269 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -131,8 +131,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = padDecimal(message.inflation); - obj.annual_provisions = padDecimal(message.annualProvisions); + obj.inflation = padDecimal(message.inflation) === "" ? undefined : padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions) === "" ? undefined : padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -306,12 +306,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.inflation_rate_change = padDecimal(message.inflationRateChange); - obj.inflation_max = padDecimal(message.inflationMax); - obj.inflation_min = padDecimal(message.inflationMin); - obj.goal_bonded = padDecimal(message.goalBonded); - obj.blocks_per_year = omitDefault(message.blocksPerYear); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = padDecimal(message.inflationRateChange) === "" ? undefined : padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax) === "" ? undefined : padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin) === "" ? undefined : padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded) === "" ? undefined : padDecimal(message.goalBonded); + obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts index 97faaf1d91..002e8cc120 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -168,10 +168,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -297,9 +297,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -425,9 +425,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts index 3a87a6d85f..5d01ac2e0a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -133,12 +133,12 @@ export const GenesisState = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } if (message.entries) { obj.entries = message.entries.map(e => e ? Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -255,11 +255,11 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts index 042b0ee4c4..76e5dd82e1 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -223,12 +223,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.description = omitDefault(message.description); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.id = message.id === "" ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.description = message.description === "" ? undefined : message.description; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -387,10 +387,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts index 7521ccf76a..a624b1e3f4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -271,8 +271,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -366,7 +366,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = omitDefault(message.amount); + obj.amount = message.amount ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -476,8 +476,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -571,7 +571,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -665,7 +665,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -759,7 +759,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = omitDefault(message.amount); + obj.amount = message.amount ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -885,8 +885,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1006,7 +1006,7 @@ export const QueryNFTsResponse = { if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1118,8 +1118,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1307,7 +1307,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { @@ -1614,7 +1614,7 @@ export const QueryClassesResponse = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts index 2b6216e6e1..06eefbb691 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -148,10 +148,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts index 89f6a8dac2..56cf24cf56 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -236,9 +236,9 @@ export const TableDescriptor = { if (message.index) { obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e) : undefined); } else { - obj.index = []; + obj.index = message.index; } - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -348,8 +348,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.auto_increment = omitDefault(message.autoIncrement); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.auto_increment = message.autoIncrement === false ? undefined : message.autoIncrement; return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -475,9 +475,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.id = omitDefault(message.id); - obj.unique = omitDefault(message.unique); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.id = message.id === 0 ? undefined : message.id; + obj.unique = message.unique === false ? undefined : message.unique; return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -571,7 +571,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts index 0ffe2136a1..94980f501d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/orm/v1alpha1/schema.ts @@ -227,7 +227,7 @@ export const ModuleSchemaDescriptor = { if (message.schemaFile) { obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); } else { - obj.schema_file = []; + obj.schema_file = message.schemaFile; } obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; @@ -349,15 +349,15 @@ export const ModuleSchemaDescriptor_FileEntry = { message.protoFileName = object.proto_file_name; } if (object.storage_type !== undefined && object.storage_type !== null) { - message.storageType = storageTypeFromJSON(object.storage_type); + message.storageType = object.storage_type; } return message; }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = storageTypeToJSON(message.storageType); + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts index 91bcc6399e..deffe0c13f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -146,12 +146,12 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { - obj.changes = []; + obj.changes = message.changes; } return obj; }, @@ -278,9 +278,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts index 72a4221bd2..a58d62676b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -168,8 +168,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -439,7 +439,7 @@ export const QuerySubspacesResponse = { if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); } else { - obj.subspaces = []; + obj.subspaces = message.subspaces; } return obj; }, @@ -556,11 +556,11 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); + obj.subspace = message.subspace === "" ? undefined : message.subspace; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts index a926d14a80..a67badb043 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -198,12 +198,12 @@ export const GenesisState = { if (message.signingInfos) { obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e) : undefined); } else { - obj.signing_infos = []; + obj.signing_infos = message.signingInfos; } if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -314,7 +314,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -431,11 +431,11 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -546,8 +546,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = omitDefault(message.index); - obj.missed = omitDefault(message.missed); + obj.index = message.index ? message.index.toString() : undefined; + obj.missed = message.missed === false ? undefined : message.missed; return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts index 370520366b..1283775958 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -336,7 +336,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = omitDefault(message.consAddress); + obj.cons_address = message.consAddress === "" ? undefined : message.consAddress; return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { @@ -643,7 +643,7 @@ export const QuerySigningInfosResponse = { if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e) : undefined); } else { - obj.info = []; + obj.info = message.info; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts index 5650ad4673..cff5d64084 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts @@ -215,11 +215,11 @@ export const ValidatorSigningInfo = { }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; - obj.tombstoned = message.tombstoned; + obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.ts index 56364813f3..f6091360f7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/tx.ts @@ -90,7 +90,7 @@ export const MsgUnjail = { }, toAmino(message: MsgUnjail): MsgUnjailAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr ?? ""; return obj; }, fromAminoMsg(object: MsgUnjailAminoMsg): MsgUnjail { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts index 452e594d2a..dd8583fa84 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/authz.ts @@ -213,7 +213,7 @@ export const StakeAuthorization = { message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); } if (object.authorization_type !== undefined && object.authorization_type !== null) { - message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + message.authorizationType = object.authorization_type; } return message; }, @@ -222,7 +222,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { @@ -325,7 +325,7 @@ export const StakeAuthorization_Validators = { if (message.address) { obj.address = message.address.map(e => e); } else { - obj.address = []; + obj.address = message.address; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts index 8426ce97c6..d1d79c6bc8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -273,29 +273,29 @@ export const GenesisState = { if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); } else { - obj.last_validator_powers = []; + obj.last_validator_powers = message.lastValidatorPowers; } if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } if (message.delegations) { obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); } else { - obj.delegations = []; + obj.delegations = message.delegations; } if (message.unbondingDelegations) { obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_delegations = []; + obj.unbonding_delegations = message.unbondingDelegations; } if (message.redelegations) { obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); } else { - obj.redelegations = []; + obj.redelegations = message.redelegations; } - obj.exported = omitDefault(message.exported); + obj.exported = message.exported === false ? undefined : message.exported; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -405,8 +405,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.power = omitDefault(message.power); + obj.address = message.address === "" ? undefined : message.address; + obj.power = message.power ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts index f65460b0f6..7fbfaf652f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -603,7 +603,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = omitDefault(message.status); + obj.status = message.status === "" ? undefined : message.status; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -723,7 +723,7 @@ export const QueryValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -819,7 +819,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1023,7 +1023,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1143,7 +1143,7 @@ export const QueryValidatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1255,7 +1255,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1375,7 +1375,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1487,8 +1487,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1692,8 +1692,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -1897,7 +1897,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2017,7 +2017,7 @@ export const QueryDelegatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2129,7 +2129,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2249,7 +2249,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2393,9 +2393,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.src_validator_addr = omitDefault(message.srcValidatorAddr); - obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2515,7 +2515,7 @@ export const QueryRedelegationsResponse = { if (message.redelegationResponses) { obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); } else { - obj.redelegation_responses = []; + obj.redelegation_responses = message.redelegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2627,7 +2627,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2747,7 +2747,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2859,8 +2859,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -3048,7 +3048,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts index 250f530c95..675e3c6edb 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -622,7 +622,7 @@ export const HistoricalInfo = { if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.valset = []; + obj.valset = message.valset; } return obj; }, @@ -749,9 +749,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate) === "" ? undefined : padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate) === "" ? undefined : padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate) === "" ? undefined : padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1020,11 +1020,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1251,7 +1251,7 @@ export const Validator = { message.jailed = object.jailed; } if (object.status !== undefined && object.status !== null) { - message.status = bondStatusFromJSON(object.status); + message.status = object.status; } if (object.tokens !== undefined && object.tokens !== null) { message.tokens = object.tokens; @@ -1278,17 +1278,17 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = bondStatusToJSON(message.status); - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = padDecimal(message.delegatorShares) === "" ? undefined : padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1391,7 +1391,7 @@ export const ValAddresses = { if (message.addresses) { obj.addresses = message.addresses.map(e => e); } else { - obj.addresses = []; + obj.addresses = message.addresses; } return obj; }, @@ -1502,8 +1502,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1606,7 +1606,7 @@ export const DVPairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, @@ -1733,9 +1733,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -1838,7 +1838,7 @@ export const DVVTriplets = { if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); } else { - obj.triplets = []; + obj.triplets = message.triplets; } return obj; }, @@ -1965,9 +1965,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2099,12 +2099,12 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2249,8 +2249,8 @@ export const UnbondingDelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2394,8 +2394,8 @@ export const RedelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = padDecimal(message.sharesDst) === "" ? undefined : padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2543,13 +2543,13 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2725,11 +2725,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = padDecimal(message.minCommissionRate) === "" ? undefined : padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2951,7 +2951,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { @@ -3071,7 +3071,7 @@ export const RedelegationResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -3182,8 +3182,8 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.not_bonded_tokens = message.notBondedTokens; - obj.bonded_tokens = message.bondedTokens; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts index 3f3fa4907d..7d5f289a9b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts @@ -125,14 +125,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: { + commission: commission == null ? commission : { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -141,7 +141,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: { + value: value == null ? value : { denom: value.denom, amount: value.amount } @@ -176,7 +176,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, @@ -213,7 +213,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -248,7 +248,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -279,7 +279,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts index 0dc8c8f7d7..afc174d921 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -338,9 +338,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -558,9 +558,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = padDecimal(message.commissionRate) === "" ? undefined : padDecimal(message.commissionRate); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -759,8 +759,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -976,9 +976,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1199,8 +1199,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts index 1c32ddf6f1..1c77a38c7b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts @@ -258,7 +258,7 @@ export const SignatureDescriptors = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -599,7 +599,7 @@ export const SignatureDescriptor_Data_Single = { fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); @@ -608,7 +608,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -729,7 +729,7 @@ export const SignatureDescriptor_Data_Multi = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts index 746a4dd781..be830eac4f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts @@ -436,7 +436,7 @@ export const GetTxsEventRequest = { message.pagination = PageRequest.fromAmino(object.pagination); } if (object.order_by !== undefined && object.order_by !== null) { - message.orderBy = orderByFromJSON(object.order_by); + message.orderBy = object.order_by; } return message; }, @@ -445,10 +445,10 @@ export const GetTxsEventRequest = { if (message.events) { obj.events = message.events.map(e => e); } else { - obj.events = []; + obj.events = message.events; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = orderByToJSON(message.orderBy); + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -589,12 +589,12 @@ export const GetTxsEventResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } if (message.txResponses) { obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.tx_responses = []; + obj.tx_responses = message.txResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -700,14 +700,14 @@ export const BroadcastTxRequest = { message.txBytes = bytesFromBase64(object.tx_bytes); } if (object.mode !== undefined && object.mode !== null) { - message.mode = broadcastModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; - obj.mode = broadcastModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1117,7 +1117,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1490,7 +1490,7 @@ export const GetBlockWithTxsResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.block = message.block ? Block.toAmino(message.block) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts index 254f2c8e98..d184e8a9f2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts @@ -552,7 +552,7 @@ export const Tx = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -690,7 +690,7 @@ export const TxRaw = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -835,7 +835,7 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; return obj; }, @@ -1012,7 +1012,7 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1194,19 +1194,19 @@ export const TxBody = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extension_options = []; + obj.extension_options = message.extensionOptions; } if (message.nonCriticalExtensionOptions) { obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.non_critical_extension_options = []; + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; } return obj; }, @@ -1342,7 +1342,7 @@ export const AuthInfo = { if (message.signerInfos) { obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); } else { - obj.signer_infos = []; + obj.signer_infos = message.signerInfos; } obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1672,13 +1672,13 @@ export const ModeInfo_Single = { fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { const message = createBaseModeInfo_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -1798,7 +1798,7 @@ export const ModeInfo_Multi = { if (message.modeInfos) { obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); } else { - obj.mode_infos = []; + obj.mode_infos = message.modeInfos; } return obj; }, @@ -1950,11 +1950,11 @@ export const Fee = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -2073,9 +2073,9 @@ export const Tip = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.tipper = message.tipper; + obj.tipper = message.tipper === "" ? undefined : message.tipper; return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2208,7 +2208,7 @@ export const AuxSignerData = { message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -2217,9 +2217,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts index a3c1b83d67..b943cfbbd9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -440,7 +440,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -534,7 +534,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -628,7 +628,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = omitDefault(message.lastHeight); + obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -816,7 +816,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = omitDefault(message.moduleName); + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -919,7 +919,7 @@ export const QueryModuleVersionsResponse = { if (message.moduleVersions) { obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); } else { - obj.module_versions = []; + obj.module_versions = message.moduleVersions; } return obj; }, @@ -1087,7 +1087,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts index 92673592c2..60ac05e8c1 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -32,14 +33,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), - info: plan.info, + height: omitDefault(plan.height)?.toString?.(), + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -51,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: { + plan: plan == null ? plan : { name: plan.name, time: plan.time, - height: BigInt(plan.height), + height: plan.height == null ? plan.height : BigInt(plan.height), info: plan.info, - upgradedClientState: { + upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } @@ -70,7 +71,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts index 30fb5572a7..1211d840ef 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -164,7 +164,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = omitDefault(message.authority); + obj.authority = message.authority === "" ? undefined : message.authority; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -332,7 +332,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = omitDefault(message.authority); + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts index 3b8d0a5c60..9106903c36 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts @@ -265,10 +265,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -395,8 +395,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -507,8 +507,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -618,7 +618,7 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.version = message.version ? message.version.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index e840986a6c..93abf3fd7e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -73,11 +73,11 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - endTime: BigInt(end_time), + endTime: end_time == null ? end_time : BigInt(end_time), delayed }; } @@ -106,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -143,10 +143,10 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: BigInt(start_time), - vestingPeriods: vesting_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + startTime: start_time == null ? start_time : BigInt(start_time), + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts index c82bff7a9c..8db83d0b54 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -244,15 +244,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.end_time = omitDefault(message.endTime); - obj.delayed = omitDefault(message.delayed); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -457,12 +457,12 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -684,13 +684,13 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); - obj.start_time = omitDefault(message.startTime); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts index 7a0f0ca405..7f9a183e5f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -284,19 +284,19 @@ export const BaseVestingAccount = { if (message.originalVesting) { obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.original_vesting = []; + obj.original_vesting = message.originalVesting; } if (message.delegatedFree) { obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_free = []; + obj.delegated_free = message.delegatedFree; } if (message.delegatedVesting) { obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_vesting = []; + obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = omitDefault(message.endTime); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -407,7 +407,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = omitDefault(message.startTime); + obj.start_time = message.startTime ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -617,11 +617,11 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = omitDefault(message.length); + obj.length = message.length ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -755,11 +755,11 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = omitDefault(message.startTime); + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts index 4681777848..ee618b424e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, omitDefault } from "../helpers"; +import { isSet, DeepPartial } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -202,8 +202,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -333,17 +333,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts index ac1a8f9bf4..b17333e345 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts @@ -272,7 +272,7 @@ export const ContractExecutionAuthorization = { if (message.grants) { obj.grants = message.grants.map(e => e ? ContractGrant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } return obj; }, @@ -376,7 +376,7 @@ export const ContractMigrationAuthorization = { if (message.grants) { obj.grants = message.grants.map(e => e ? ContractGrant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } return obj; }, @@ -503,7 +503,7 @@ export const ContractGrant = { }, toAmino(message: ContractGrant): ContractGrantAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; obj.limit = message.limit ? Any.toAmino(message.limit) : undefined; obj.filter = message.filter ? Any.toAmino(message.filter) : undefined; return obj; @@ -702,7 +702,7 @@ export const MaxFundsLimit = { if (message.amounts) { obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amounts = []; + obj.amounts = message.amounts; } return obj; }, @@ -823,7 +823,7 @@ export const CombinedLimit = { if (message.amounts) { obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amounts = []; + obj.amounts = message.amounts; } return obj; }, @@ -1000,7 +1000,7 @@ export const AcceptedMessageKeysFilter = { if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, @@ -1104,7 +1104,7 @@ export const AcceptedMessagesFilter = { if (message.messages) { obj.messages = message.messages.map(e => JSON.parse(fromUtf8(e))); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts index 78bad104ff..7d8179f081 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts @@ -255,22 +255,22 @@ export const GenesisState = { if (message.codes) { obj.codes = message.codes.map(e => e ? Code.toAmino(e) : undefined); } else { - obj.codes = []; + obj.codes = message.codes; } if (message.contracts) { obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e) : undefined); } else { - obj.contracts = []; + obj.contracts = message.contracts; } if (message.sequences) { obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e) : undefined); } else { - obj.sequences = []; + obj.sequences = message.sequences; } if (message.genMsgs) { obj.gen_msgs = message.genMsgs.map(e => e ? GenesisState_GenMsgs.toAmino(e) : undefined); } else { - obj.gen_msgs = []; + obj.gen_msgs = message.genMsgs; } return obj; }, @@ -544,7 +544,7 @@ export const Code = { obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; - obj.pinned = message.pinned; + obj.pinned = message.pinned === false ? undefined : message.pinned; return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -676,12 +676,12 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.contract_state = []; + obj.contract_state = message.contractState; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts index 18cdf7b957..7f8ed59d54 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts @@ -161,7 +161,7 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -258,7 +258,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts index 58ff68362a..97a075a35e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -380,9 +380,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -596,17 +596,17 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.admin = omitDefault(message.admin); - obj.code_id = omitDefault(message.codeId); - obj.label = omitDefault(message.label); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -765,10 +765,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); - obj.code_id = omitDefault(message.codeId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -911,9 +911,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1094,15 +1094,15 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1245,10 +1245,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.new_admin = omitDefault(message.newAdmin); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1374,9 +1374,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1517,12 +1517,12 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -1664,12 +1664,12 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts index 907044b691..c97f57b0db 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts @@ -437,7 +437,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -547,7 +547,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -658,7 +658,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -778,7 +778,7 @@ export const QueryContractHistoryResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1010,7 +1010,7 @@ export const QueryContractsByCodeResponse = { if (message.contracts) { obj.contracts = message.contracts.map(e => e); } else { - obj.contracts = []; + obj.contracts = message.contracts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1122,7 +1122,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1242,7 +1242,7 @@ export const QueryAllContractStateResponse = { if (message.models) { obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.models = []; + obj.models = message.models; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1354,7 +1354,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1559,7 +1559,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1874,8 +1874,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; return obj; }, @@ -1987,7 +1987,7 @@ export const QueryCodeResponse = { toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { const obj: any = {}; obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; - obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; return obj; }, fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { @@ -2200,7 +2200,7 @@ export const QueryCodesResponse = { if (message.codeInfos) { obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); } else { - obj.code_infos = []; + obj.code_infos = message.codeInfos; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2424,7 +2424,7 @@ export const QueryPinnedCodesResponse = { if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index 476501027c..005a774ec6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -89,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: fromBase64(wasm_byte_code), - instantiatePermission: { - permission: accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), + instantiatePermission: instantiate_permission == null ? instantiate_permission : { + permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -130,10 +130,10 @@ export const AminoConverter = { return { sender, admin, - codeId: BigInt(code_id), + codeId: code_id == null ? code_id : BigInt(code_id), label, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -167,8 +167,8 @@ export const AminoConverter = { return { sender, contract, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -199,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: BigInt(code_id), - msg: toUtf8(JSON.stringify(msg)) + codeId: code_id == null ? code_id : BigInt(code_id), + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) }; } }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts index 5561ae679a..8925655d3a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts @@ -314,7 +314,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -590,15 +590,15 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -709,7 +709,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -858,13 +858,13 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1101,8 +1101,8 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1324,9 +1324,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1509,8 +1509,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts index 2da069f9e4..246bc67fd5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts @@ -321,13 +321,13 @@ export const AccessTypeParam = { fromAmino(object: AccessTypeParamAmino): AccessTypeParam { const message = createBaseAccessTypeParam(); if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); + message.value = object.value; } return message; }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = accessTypeToJSON(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -428,7 +428,7 @@ export const AccessConfig = { fromAmino(object: AccessConfigAmino): AccessConfig { const message = createBaseAccessConfig(); if (object.permission !== undefined && object.permission !== null) { - message.permission = accessTypeFromJSON(object.permission); + message.permission = object.permission; } if (object.address !== undefined && object.address !== null) { message.address = object.address; @@ -437,8 +437,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = accessTypeToJSON(message.permission); - obj.address = message.address; + obj.permission = message.permission === 0 ? undefined : message.permission; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -555,7 +555,7 @@ export const Params = { message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); } if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { - message.instantiateDefaultPermission = accessTypeFromJSON(object.instantiate_default_permission); + message.instantiateDefaultPermission = object.instantiate_default_permission; } if (object.max_wasm_code_size !== undefined && object.max_wasm_code_size !== null) { message.maxWasmCodeSize = BigInt(object.max_wasm_code_size); @@ -565,7 +565,7 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = accessTypeToJSON(message.instantiateDefaultPermission); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; return obj; }, @@ -693,7 +693,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -885,11 +885,11 @@ export const ContractInfo = { toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; obj.extension = message.extension ? Any.toAmino(message.extension) : undefined; return obj; }, @@ -1017,7 +1017,7 @@ export const ContractCodeHistoryEntry = { fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); if (object.operation !== undefined && object.operation !== null) { - message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + message.operation = object.operation; } if (object.code_id !== undefined && object.code_id !== null) { message.codeId = BigInt(object.code_id); @@ -1032,7 +1032,7 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + obj.operation = message.operation === 0 ? undefined : message.operation; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts index 5f6ccdd93e..a0ef80a174 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/claims.ts @@ -211,7 +211,7 @@ export const Claim = { fromAmino(object: ClaimAmino): Claim { const message = createBaseClaim(); if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } if (object.completed !== undefined && object.completed !== null) { message.completed = object.completed; @@ -223,9 +223,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = actionToJSON(message.action); - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = message.action === 0 ? undefined : message.action; + obj.completed = message.completed === false ? undefined : message.completed; + obj.claimable_amount = message.claimableAmount === "" ? undefined : message.claimableAmount; return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -360,12 +360,12 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = message.address === "" ? undefined : message.address; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, @@ -485,11 +485,11 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts index ff4c1b829c..75787cf163 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/genesis.ts @@ -149,7 +149,7 @@ export const GenesisState = { if (message.claimsRecords) { obj.claims_records = message.claimsRecords.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims_records = []; + obj.claims_records = message.claimsRecords; } return obj; }, @@ -346,20 +346,20 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = message.enableClaims === false ? undefined : message.enableClaims; obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = message.claimsDenom === "" ? undefined : message.claimsDenom; if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { - obj.authorized_channels = []; + obj.authorized_channels = message.authorizedChannels; } if (message.evmChannels) { obj.evm_channels = message.evmChannels.map(e => e); } else { - obj.evm_channels = []; + obj.evm_channels = message.evmChannels; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts index 6e08525bab..ea69a7a5a9 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -286,7 +286,7 @@ export const QueryTotalUnclaimedResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -643,7 +643,7 @@ export const QueryClaimsRecordsResponse = { if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -733,7 +733,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -843,11 +843,11 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts index e30ac5ca9e..8121ee1aa1 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts @@ -202,12 +202,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -305,7 +305,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts index 9b4f3a3b64..740e19087d 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; @@ -227,7 +227,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -317,7 +317,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -405,7 +405,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts index 2798dd64ff..a1a6171e51 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/erc20.ts @@ -260,16 +260,16 @@ export const TokenPair = { message.enabled = object.enabled; } if (object.contract_owner !== undefined && object.contract_owner !== null) { - message.contractOwner = ownerFromJSON(object.contract_owner); + message.contractOwner = object.contract_owner; } return message; }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = ownerToJSON(message.contractOwner); + obj.erc20_address = message.erc20Address === "" ? undefined : message.erc20Address; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.contract_owner = message.contractOwner === 0 ? undefined : message.contractOwner; return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -389,8 +389,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -511,9 +511,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.erc20address = message.erc20address === "" ? undefined : message.erc20address; return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -633,9 +633,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts index bbe5bc2794..cfbf1c0132 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -133,7 +133,7 @@ export const GenesisState = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } return obj; }, @@ -238,8 +238,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = omitDefault(message.enableErc20); - obj.enable_evm_hook = omitDefault(message.enableEvmHook); + obj.enable_erc20 = message.enableErc20 === false ? undefined : message.enableErc20; + obj.enable_evm_hook = message.enableEvmHook === false ? undefined : message.enableEvmHook; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts index bfb11688d2..4ebf9f9d72 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { TokenPair, TokenPairSDKType } from "./erc20"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -286,7 +286,7 @@ export const QueryTokenPairsResponse = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -376,7 +376,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = omitDefault(message.token); + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts index cad7e1500f..514c9c6a37 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: { + coin: coin == null ? coin : { denom: coin.denom, amount: coin.amount }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts index 61fc6f01f4..cfa9a1abee 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -170,8 +170,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = omitDefault(message.receiver); - obj.sender = omitDefault(message.sender); + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -374,10 +374,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.amount = omitDefault(message.amount); - obj.receiver = omitDefault(message.receiver); - obj.sender = omitDefault(message.sender); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts index 7fc339f15a..7d90631735 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -130,9 +130,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts index 34ae995eba..730f35130a 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -148,7 +148,7 @@ export const GenesisState = { if (message.devFeeInfos) { obj.dev_fee_infos = message.devFeeInfos.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.dev_fee_infos = []; + obj.dev_fee_infos = message.devFeeInfos; } return obj; }, @@ -301,11 +301,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = omitDefault(message.enableFees); - obj.developer_shares = padDecimal(message.developerShares); - obj.validator_shares = padDecimal(message.validatorShares); - obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); - obj.min_gas_price = padDecimal(message.minGasPrice); + obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; + obj.developer_shares = padDecimal(message.developerShares) === "" ? undefined : padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares) === "" ? undefined : padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.min_gas_price = padDecimal(message.minGasPrice) === "" ? undefined : padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts index 27bc75f7d8..1b798bc035 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -332,7 +332,7 @@ export const QueryDevFeeInfosResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -422,7 +422,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -769,7 +769,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = omitDefault(message.deployerAddress); + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -883,7 +883,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts index a53f2bf860..18aaa3533b 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts @@ -51,7 +51,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map(el0 => BigInt(el0)) + nonces: nonces.map?.(el0 => BigInt(el0)) }; } }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts index dd20ba2bbe..71f9248868 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -239,13 +239,13 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -417,8 +417,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -605,9 +605,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts index 627f64725d..cbdf211bb4 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -161,12 +161,12 @@ export const GenesisState = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } return obj; }, @@ -303,10 +303,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = omitDefault(message.enableIncentives); - obj.allocation_limit = padDecimal(message.allocationLimit); - obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); - obj.reward_scaler = padDecimal(message.rewardScaler); + obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; + obj.allocation_limit = padDecimal(message.allocationLimit) === "" ? undefined : padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; + obj.reward_scaler = padDecimal(message.rewardScaler) === "" ? undefined : padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts index cbe7c604fe..06b1ccdf05 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts @@ -236,13 +236,13 @@ export const Incentive = { }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; return obj; @@ -364,8 +364,8 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; return obj; }, @@ -524,15 +524,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -652,9 +652,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts index 4e87ec66e6..d7ea6bbc22 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -442,7 +442,7 @@ export const QueryIncentivesResponse = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -532,7 +532,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -724,7 +724,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); + obj.contract = message.contract === "" ? undefined : message.contract; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -838,7 +838,7 @@ export const QueryGasMetersResponse = { if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -944,8 +944,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); - obj.participant = omitDefault(message.participant); + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1033,7 +1033,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = omitDefault(message.gasMeter); + obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1234,7 +1234,7 @@ export const QueryAllocationMetersResponse = { if (message.allocationMeters) { obj.allocation_meters = message.allocationMeters.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocation_meters = []; + obj.allocation_meters = message.allocationMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1324,7 +1324,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts index 84890e40ec..5067ec9475 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -183,10 +183,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = omitDefault(message.period); - obj.epoch_identifier = omitDefault(message.epochIdentifier); - obj.epochs_per_period = omitDefault(message.epochsPerPeriod); - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.period = message.period ? message.period.toString() : undefined; + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; + obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -322,10 +322,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = omitDefault(message.enableInflation); + obj.enable_inflation = message.enableInflation === false ? undefined : message.enableInflation; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts index 2d40c8c9e6..9042b2b46f 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/inflation.ts @@ -184,9 +184,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = padDecimal(message.stakingRewards); - obj.usage_incentives = padDecimal(message.usageIncentives); - obj.community_pool = padDecimal(message.communityPool); + obj.staking_rewards = padDecimal(message.stakingRewards) === "" ? undefined : padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives) === "" ? undefined : padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -338,11 +338,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = padDecimal(message.a); - obj.r = padDecimal(message.r); - obj.c = padDecimal(message.c); - obj.bonding_target = padDecimal(message.bondingTarget); - obj.max_variance = padDecimal(message.maxVariance); + obj.a = padDecimal(message.a) === "" ? undefined : padDecimal(message.a); + obj.r = padDecimal(message.r) === "" ? undefined : padDecimal(message.r); + obj.c = padDecimal(message.c) === "" ? undefined : padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget) === "" ? undefined : padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance) === "" ? undefined : padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts index ac3da0b02e..03ba7f060b 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -314,7 +314,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -624,7 +624,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -934,7 +934,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = padDecimal(message.inflationRate); + obj.inflation_rate = padDecimal(message.inflationRate) === "" ? undefined : padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts index dbde850c7f..e736cf9a71 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -204,7 +204,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = omitDefault(message.enableRecovery); + obj.enable_recovery = message.enableRecovery === false ? undefined : message.enableRecovery; obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts index 9f1b481adc..40ca16b58f 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -109,7 +109,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { @@ -250,17 +250,17 @@ export const QueryBalancesResponse = { if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.locked = []; + obj.locked = message.locked; } if (message.unvested) { obj.unvested = message.unvested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.unvested = []; + obj.unvested = message.unvested; } if (message.vested) { obj.vested = message.vested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.vested = []; + obj.vested = message.vested; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index 031641c46c..edb8ed1f1b 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -79,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + lockupPeriods: lockup_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts index 8d2160e359..9389069720 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.ts @@ -252,20 +252,20 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } - obj.merge = message.merge; + obj.merge = message.merge === false ? undefined : message.merge; return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -452,9 +452,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + obj.dest_address = message.destAddress === "" ? undefined : message.destAddress; return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts index 19942ffdf1..e09a392758 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/vesting.ts @@ -187,17 +187,17 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/auth.ts b/__fixtures__/v-next/outputosmojs/google/api/auth.ts index 0cdffb3793..cc7a09366e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/auth.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -442,12 +442,12 @@ export const Authentication = { if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } if (message.providers) { obj.providers = message.providers.map(e => e ? AuthProvider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, @@ -590,13 +590,13 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = omitDefault(message.allowWithoutCredential); + obj.allow_without_credential = message.allowWithoutCredential === false ? undefined : message.allowWithoutCredential; if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { - obj.requirements = []; + obj.requirements = message.requirements; } return obj; }, @@ -717,9 +717,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = omitDefault(message.header); - obj.query = omitDefault(message.query); - obj.value_prefix = omitDefault(message.valuePrefix); + obj.header = message.header === null ? undefined : message.header; + obj.query = message.query === null ? undefined : message.query; + obj.value_prefix = message.valuePrefix === "" ? undefined : message.valuePrefix; return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -893,15 +893,15 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.issuer = omitDefault(message.issuer); - obj.jwks_uri = omitDefault(message.jwksUri); - obj.audiences = omitDefault(message.audiences); - obj.authorization_url = omitDefault(message.authorizationUrl); + obj.id = message.id === "" ? undefined : message.id; + obj.issuer = message.issuer === "" ? undefined : message.issuer; + obj.jwks_uri = message.jwksUri === "" ? undefined : message.jwksUri; + obj.audiences = message.audiences === "" ? undefined : message.audiences; + obj.authorization_url = message.authorizationUrl === "" ? undefined : message.authorizationUrl; if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { - obj.jwt_locations = []; + obj.jwt_locations = message.jwtLocations; } return obj; }, @@ -990,7 +990,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = omitDefault(message.canonicalScopes); + obj.canonical_scopes = message.canonicalScopes === "" ? undefined : message.canonicalScopes; return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1094,8 +1094,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = omitDefault(message.providerId); - obj.audiences = omitDefault(message.audiences); + obj.provider_id = message.providerId === "" ? undefined : message.providerId; + obj.audiences = message.audiences === "" ? undefined : message.audiences; return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputosmojs/google/api/backend.ts b/__fixtures__/v-next/outputosmojs/google/api/backend.ts index 12474b0c38..5c8762eec0 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/backend.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/backend.ts @@ -289,7 +289,7 @@ export const Backend = { if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -491,7 +491,7 @@ export const BackendRule = { message.operationDeadline = object.operation_deadline; } if (object.path_translation !== undefined && object.path_translation !== null) { - message.pathTranslation = backendRule_PathTranslationFromJSON(object.path_translation); + message.pathTranslation = object.path_translation; } if (object.jwt_audience !== undefined && object.jwt_audience !== null) { message.jwtAudience = object.jwt_audience; @@ -506,15 +506,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = backendRule_PathTranslationToJSON(message.pathTranslation); - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.address = message.address === "" ? undefined : message.address; + obj.deadline = message.deadline === 0 ? undefined : message.deadline; + obj.min_deadline = message.minDeadline === 0 ? undefined : message.minDeadline; + obj.operation_deadline = message.operationDeadline === 0 ? undefined : message.operationDeadline; + obj.path_translation = message.pathTranslation === 0 ? undefined : message.pathTranslation; + obj.jwt_audience = message.jwtAudience === null ? undefined : message.jwtAudience; + obj.disable_auth = message.disableAuth === null ? undefined : message.disableAuth; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputosmojs/google/api/billing.ts b/__fixtures__/v-next/outputosmojs/google/api/billing.ts index 25748e61ce..09911b5f83 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/billing.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -191,7 +191,7 @@ export const Billing = { if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -302,11 +302,11 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/config_change.ts b/__fixtures__/v-next/outputosmojs/google/api/config_change.ts index 48d9d8a7a6..ea9183ad6b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/config_change.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/config_change.ts @@ -273,21 +273,21 @@ export const ConfigChange = { message.newValue = object.new_value; } if (object.change_type !== undefined && object.change_type !== null) { - message.changeType = changeTypeFromJSON(object.change_type); + message.changeType = object.change_type; } message.advices = object.advices?.map(e => Advice.fromAmino(e)) || []; return message; }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = changeTypeToJSON(message.changeType); + obj.element = message.element === "" ? undefined : message.element; + obj.old_value = message.oldValue === "" ? undefined : message.oldValue; + obj.new_value = message.newValue === "" ? undefined : message.newValue; + obj.change_type = message.changeType === 0 ? undefined : message.changeType; if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { - obj.advices = []; + obj.advices = message.advices; } return obj; }, @@ -376,7 +376,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputosmojs/google/api/consumer.ts b/__fixtures__/v-next/outputosmojs/google/api/consumer.ts index b6a13b39a4..8a25b5e2b5 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/consumer.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/consumer.ts @@ -222,7 +222,7 @@ export const ProjectProperties = { if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toAmino(e) : undefined); } else { - obj.properties = []; + obj.properties = message.properties; } return obj; }, @@ -334,7 +334,7 @@ export const Property = { message.name = object.name; } if (object.type !== undefined && object.type !== null) { - message.type = property_PropertyTypeFromJSON(object.type); + message.type = object.type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -343,9 +343,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = property_PropertyTypeToJSON(message.type); - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === 0 ? undefined : message.type; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputosmojs/google/api/context.ts b/__fixtures__/v-next/outputosmojs/google/api/context.ts index 51ff6e3de9..46b14c81bb 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/context.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -211,7 +211,7 @@ export const Context = { if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -388,26 +388,26 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.requested) { obj.requested = message.requested.map(e => e); } else { - obj.requested = []; + obj.requested = message.requested; } if (message.provided) { obj.provided = message.provided.map(e => e); } else { - obj.provided = []; + obj.provided = message.provided; } if (message.allowedRequestExtensions) { obj.allowed_request_extensions = message.allowedRequestExtensions.map(e => e); } else { - obj.allowed_request_extensions = []; + obj.allowed_request_extensions = message.allowedRequestExtensions; } if (message.allowedResponseExtensions) { obj.allowed_response_extensions = message.allowedResponseExtensions.map(e => e); } else { - obj.allowed_response_extensions = []; + obj.allowed_response_extensions = message.allowedResponseExtensions; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/control.ts b/__fixtures__/v-next/outputosmojs/google/api/control.ts index a549261d13..d19b4adc27 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/control.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -94,7 +94,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = omitDefault(message.environment); + obj.environment = message.environment === "" ? undefined : message.environment; return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputosmojs/google/api/distribution.ts b/__fixtures__/v-next/outputosmojs/google/api/distribution.ts index 1466a41042..60bda2d65a 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/distribution.ts @@ -518,19 +518,19 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -635,8 +635,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = message.min === 0 ? undefined : message.min; + obj.max = message.max === 0 ? undefined : message.max; return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -878,9 +878,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1000,9 +1000,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1108,7 +1108,7 @@ export const Distribution_BucketOptions_Explicit = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, @@ -1235,12 +1235,12 @@ export const Distribution_Exemplar = { }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.attachments = []; + obj.attachments = message.attachments; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/documentation.ts b/__fixtures__/v-next/outputosmojs/google/api/documentation.ts index 8582352e48..9eb8d07f9a 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/documentation.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -403,20 +403,20 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = omitDefault(message.summary); + obj.summary = message.summary === "" ? undefined : message.summary; if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.pages = []; + obj.pages = message.pages; } if (message.rules) { obj.rules = message.rules.map(e => e ? DocumentationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.documentation_root_url = omitDefault(message.documentationRootUrl); - obj.service_root_url = omitDefault(message.serviceRootUrl); - obj.overview = omitDefault(message.overview); + obj.documentation_root_url = message.documentationRootUrl === "" ? undefined : message.documentationRootUrl; + obj.service_root_url = message.serviceRootUrl === "" ? undefined : message.serviceRootUrl; + obj.overview = message.overview === "" ? undefined : message.overview; return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -536,9 +536,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.description = omitDefault(message.description); - obj.deprecation_description = omitDefault(message.deprecationDescription); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.description = message.description === "" ? undefined : message.description; + obj.deprecation_description = message.deprecationDescription === "" ? undefined : message.deprecationDescription; return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -664,12 +664,12 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.content = message.content === "" ? undefined : message.content; if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.subpages = []; + obj.subpages = message.subpages; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts b/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts index cbf9b0f575..dc0e5efdbf 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -203,14 +203,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } - obj.target = omitDefault(message.target); - obj.allow_cors = omitDefault(message.allowCors); + obj.target = message.target === "" ? undefined : message.target; + obj.allow_cors = message.allowCors === false ? undefined : message.allowCors; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts index 741c31cfdc..1b4e7a7db3 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -349,10 +349,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -466,7 +466,7 @@ export const ParseResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -613,10 +613,10 @@ export const CheckRequest = { if (message.typeEnv) { obj.type_env = message.typeEnv.map(e => e ? Decl.toAmino(e) : undefined); } else { - obj.type_env = []; + obj.type_env = message.typeEnv; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = message.container === "" ? undefined : message.container; + obj.no_std_env = message.noStdEnv === false ? undefined : message.noStdEnv; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -730,7 +730,7 @@ export const CheckResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -834,7 +834,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -1016,7 +1016,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1130,7 +1130,7 @@ export const EvalResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -1239,7 +1239,7 @@ export const IssueDetails = { fromAmino(object: IssueDetailsAmino): IssueDetails { const message = createBaseIssueDetails(); if (object.severity !== undefined && object.severity !== null) { - message.severity = issueDetails_SeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.position !== undefined && object.position !== null) { message.position = SourcePosition.fromAmino(object.position); @@ -1251,7 +1251,7 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = issueDetails_SeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; obj.id = message.id ? message.id.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts index a82ef2a462..cfd08ea9d7 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts @@ -1003,7 +1003,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1245,16 +1245,16 @@ export const Type = { message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1285,15 +1285,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1603,7 +1603,7 @@ export const Type_FunctionType = { if (message.argTypes) { obj.arg_types = message.argTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.arg_types = []; + obj.arg_types = message.argTypes; } return obj; }, @@ -1714,11 +1714,11 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.parameter_types = []; + obj.parameter_types = message.parameterTypes; } return obj; }, @@ -1839,7 +1839,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -1963,7 +1963,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2060,7 +2060,7 @@ export const Decl_FunctionDecl = { if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toAmino(e) : undefined); } else { - obj.overloads = []; + obj.overloads = message.overloads; } return obj; }, @@ -2241,20 +2241,20 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2380,11 +2380,11 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { - obj.overload_id = []; + obj.overload_id = message.overloadId; } obj.value = message.value ? Constant.toAmino(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts index e7198c75ec..866006f708 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -251,12 +251,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -361,8 +361,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = omitDefault(message.expr); - obj.value = omitDefault(message.value); + obj.expr = message.expr ? message.expr.toString() : undefined; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -581,7 +581,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -688,7 +688,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e.toString()); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts index dcc7999ea6..0edf23f26d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -153,12 +153,12 @@ export const Explain = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.exprSteps) { obj.expr_steps = message.exprSteps.map(e => e ? Explain_ExprStep.toAmino(e) : undefined); } else { - obj.expr_steps = []; + obj.expr_steps = message.exprSteps; } return obj; }, @@ -263,8 +263,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.value_index = omitDefault(message.valueIndex); + obj.id = message.id ? message.id.toString() : undefined; + obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts index a72c45f7b2..3606b3d7a6 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts @@ -917,7 +917,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1038,8 +1038,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1166,11 +1166,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1268,7 +1268,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1379,11 +1379,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = message.messageName === "" ? undefined : message.messageName; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1521,7 +1521,7 @@ export const Expr_CreateStruct_Entry = { toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1707,9 +1707,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1903,7 +1903,7 @@ export const Constant = { fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1933,12 +1933,12 @@ export const Constant = { }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -2045,7 +2045,7 @@ export const SourceInfo_PositionsEntry = { toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2390,12 +2390,12 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2544,10 +2544,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts index bb2064f140..d57eefc5dd 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts @@ -357,7 +357,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -396,18 +396,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -511,8 +511,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -609,7 +609,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -707,7 +707,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts index d1d5a1b327..3101af0a6f 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -227,9 +227,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.name = omitDefault(message.name); - obj.doc = omitDefault(message.doc); + obj.id = message.id === 0 ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.doc = message.doc === "" ? undefined : message.doc; obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -357,12 +357,12 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.type = omitDefault(message.type); + obj.id = message.id === 0 ? undefined : message.id; + obj.type = message.type === "" ? undefined : message.type; if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } return obj; }, @@ -597,10 +597,10 @@ export const FunctionDecl = { if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = omitDefault(message.receiverFunction); + obj.receiver_function = message.receiverFunction === false ? undefined : message.receiverFunction; return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts index 5b17093b8c..c12150cb6f 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -264,12 +264,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -375,7 +375,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -594,7 +594,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -692,7 +692,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -781,7 +781,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts index 6bc5990076..d58a01a12e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts @@ -509,7 +509,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -709,7 +709,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -804,7 +804,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -925,8 +925,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1053,11 +1053,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1155,7 +1155,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1266,11 +1266,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1407,8 +1407,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = message.id === 0 ? undefined : message.id; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1594,9 +1594,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1764,7 +1764,7 @@ export const Literal = { fromAmino(object: LiteralAmino): Literal { const message = createBaseLiteral(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1788,12 +1788,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts index 02937ec4f7..d16d3661dd 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -163,8 +163,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === 0 ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -336,11 +336,11 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = omitDefault(message.location); + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -483,10 +483,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = omitDefault(message.location); - obj.offset = omitDefault(message.offset); - obj.line = omitDefault(message.line); - obj.column = omitDefault(message.column); + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts index e57002f63a..5fd366e283 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts @@ -357,7 +357,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -396,18 +396,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -511,8 +511,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -609,7 +609,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -707,7 +707,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/http.ts b/__fixtures__/v-next/outputosmojs/google/api/http.ts index 54950be930..b28d53472e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/http.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -756,9 +756,9 @@ export const Http = { if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -996,19 +996,19 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.get = omitDefault(message.get); - obj.put = omitDefault(message.put); - obj.post = omitDefault(message.post); - obj.delete = omitDefault(message.delete); - obj.patch = omitDefault(message.patch); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = omitDefault(message.body); - obj.response_body = omitDefault(message.responseBody); + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.additional_bindings = []; + obj.additional_bindings = message.additionalBindings; } return obj; }, @@ -1113,8 +1113,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = omitDefault(message.kind); - obj.path = omitDefault(message.path); + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts b/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts index 571dc87f46..1f30544a76 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/httpbody.ts @@ -219,12 +219,12 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = message.contentType === "" ? undefined : message.contentType; obj.data = message.data ? base64FromBytes(message.data) : undefined; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/label.ts b/__fixtures__/v-next/outputosmojs/google/api/label.ts index d007e92793..9296177d0d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/label.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/label.ts @@ -153,7 +153,7 @@ export const LabelDescriptor = { message.key = object.key; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = labelDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -162,9 +162,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = labelDescriptor_ValueTypeToJSON(message.valueType); - obj.description = message.description; + obj.key = message.key === "" ? undefined : message.key; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/google/api/log.ts b/__fixtures__/v-next/outputosmojs/google/api/log.ts index fb3abdb358..b09da36df3 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/log.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -180,14 +180,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.description = omitDefault(message.description); - obj.display_name = omitDefault(message.displayName); + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/google/api/logging.ts b/__fixtures__/v-next/outputosmojs/google/api/logging.ts index 694144935a..dd24e7d373 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/logging.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -217,12 +217,12 @@ export const Logging = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -333,11 +333,11 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.logs) { obj.logs = message.logs.map(e => e); } else { - obj.logs = []; + obj.logs = message.logs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/metric.ts b/__fixtures__/v-next/outputosmojs/google/api/metric.ts index e24f62192a..794f3be511 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/metric.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/metric.ts @@ -614,10 +614,10 @@ export const MetricDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.metric_kind !== undefined && object.metric_kind !== null) { - message.metricKind = metricDescriptor_MetricKindFromJSON(object.metric_kind); + message.metricKind = object.metric_kind; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = metricDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.unit !== undefined && object.unit !== null) { message.unit = object.unit; @@ -632,31 +632,31 @@ export const MetricDescriptor = { message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromAmino(object.metadata); } if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } message.monitoredResourceTypes = object.monitored_resource_types?.map(e => e) || []; return message; }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.metric_kind = metricDescriptor_MetricKindToJSON(message.metricKind); - obj.value_type = metricDescriptor_ValueTypeToJSON(message.valueType); - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = message.metricKind === 0 ? undefined : message.metricKind; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { - obj.monitored_resource_types = []; + obj.monitored_resource_types = message.monitoredResourceTypes; } return obj; }, @@ -765,7 +765,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromAmino(object: MetricDescriptor_MetricDescriptorMetadataAmino): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } if (object.sample_period !== undefined && object.sample_period !== null) { message.samplePeriod = Duration.fromAmino(object.sample_period); @@ -777,7 +777,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -882,8 +882,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1024,7 +1024,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts b/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts index 60d96b7fb3..50fad02b25 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/monitored_resource.ts @@ -348,22 +348,22 @@ export const MonitoredResourceDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } return message; }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.display_name = message.displayName === "" ? undefined : message.displayName; + obj.description = message.description === "" ? undefined : message.description; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -466,8 +466,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -608,7 +608,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -717,8 +717,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts b/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts index a2ec14344d..3560e4415a 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -265,12 +265,12 @@ export const Monitoring = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -381,11 +381,11 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/quota.ts b/__fixtures__/v-next/outputosmojs/google/api/quota.ts index f490194d42..2c21ac194b 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/quota.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; +import { DeepPartial, isSet, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -401,12 +401,12 @@ export const Quota = { if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toAmino(e) : undefined); } else { - obj.limits = []; + obj.limits = message.limits; } if (message.metricRules) { obj.metric_rules = message.metricRules.map(e => e ? MetricRule.toAmino(e) : undefined); } else { - obj.metric_rules = []; + obj.metric_rules = message.metricRules; } return obj; }, @@ -510,8 +510,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -652,7 +652,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -761,8 +761,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1031,21 +1031,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); - obj.default_limit = omitDefault(message.defaultLimit); - obj.max_limit = omitDefault(message.maxLimit); - obj.free_tier = omitDefault(message.freeTier); - obj.duration = omitDefault(message.duration); - obj.metric = omitDefault(message.metric); - obj.unit = omitDefault(message.unit); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.duration = message.duration === "" ? undefined : message.duration; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = omitDefault(message.displayName); + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputosmojs/google/api/resource.ts b/__fixtures__/v-next/outputosmojs/google/api/resource.ts index 89fff423d2..1617ef9cef 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/resource.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/resource.ts @@ -517,7 +517,7 @@ export const ResourceDescriptor = { message.nameField = object.name_field; } if (object.history !== undefined && object.history !== null) { - message.history = resourceDescriptor_HistoryFromJSON(object.history); + message.history = object.history; } if (object.plural !== undefined && object.plural !== null) { message.plural = object.plural; @@ -525,25 +525,25 @@ export const ResourceDescriptor = { if (object.singular !== undefined && object.singular !== null) { message.singular = object.singular; } - message.style = object.style?.map(e => resourceDescriptor_StyleFromJSON(e)) || []; + message.style = object.style?.map(e => e) || []; return message; }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { - obj.pattern = []; + obj.pattern = message.pattern; } - obj.name_field = message.nameField; - obj.history = resourceDescriptor_HistoryToJSON(message.history); - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = message.nameField === "" ? undefined : message.nameField; + obj.history = message.history === 0 ? undefined : message.history; + obj.plural = message.plural === "" ? undefined : message.plural; + obj.singular = message.singular === "" ? undefined : message.singular; if (message.style) { - obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); + obj.style = message.style.map(e => e); } else { - obj.style = []; + obj.style = message.style; } return obj; }, @@ -648,8 +648,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = message.type === "" ? undefined : message.type; + obj.child_type = message.childType === "" ? undefined : message.childType; return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputosmojs/google/api/routing.ts b/__fixtures__/v-next/outputosmojs/google/api/routing.ts index a6713ad47f..925add4d28 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/routing.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -890,7 +890,7 @@ export const RoutingRule = { if (message.routingParameters) { obj.routing_parameters = message.routingParameters.map(e => e ? RoutingParameter.toAmino(e) : undefined); } else { - obj.routing_parameters = []; + obj.routing_parameters = message.routingParameters; } return obj; }, @@ -995,8 +995,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.path_template = omitDefault(message.pathTemplate); + obj.field = message.field === "" ? undefined : message.field; + obj.path_template = message.pathTemplate === "" ? undefined : message.pathTemplate; return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputosmojs/google/api/service.ts b/__fixtures__/v-next/outputosmojs/google/api/service.ts index b96a25fd89..4613d841fc 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/service.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersSDKType } from "./system_parameter"; import { SourceInfo, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -694,24 +694,24 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.title = omitDefault(message.title); - obj.producer_project_id = omitDefault(message.producerProjectId); - obj.id = omitDefault(message.id); + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.id = message.id === "" ? undefined : message.id; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } if (message.types) { obj.types = message.types.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.types = []; + obj.types = message.types; } if (message.enums) { obj.enums = message.enums.map(e => e ? Enum.toAmino(e) : undefined); } else { - obj.enums = []; + obj.enums = message.enums; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.backend = message.backend ? Backend.toAmino(message.backend) : undefined; @@ -723,23 +723,23 @@ export const Service = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } obj.control = message.control ? Control.toAmino(message.control) : undefined; if (message.logs) { obj.logs = message.logs.map(e => e ? LogDescriptor.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } if (message.metrics) { obj.metrics = message.metrics.map(e => e ? MetricDescriptor.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.billing = message.billing ? Billing.toAmino(message.billing) : undefined; obj.logging = message.logging ? Logging.toAmino(message.logging) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts index ad08b7468c..fc55fd2e0c 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/check_error.ts @@ -331,7 +331,7 @@ export const CheckError = { fromAmino(object: CheckErrorAmino): CheckError { const message = createBaseCheckError(); if (object.code !== undefined && object.code !== null) { - message.code = checkError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -346,9 +346,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = checkError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.detail = message.detail === "" ? undefined : message.detail; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts index 2dcb7740d8..632d45e59a 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -408,15 +408,15 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = omitDefault(message.count); - obj.mean = omitDefault(message.mean); - obj.minimum = omitDefault(message.minimum); - obj.maximum = omitDefault(message.maximum); - obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); + obj.count = message.count ? message.count.toString() : undefined; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.minimum = message.minimum === 0 ? undefined : message.minimum; + obj.maximum = message.maximum === 0 ? undefined : message.maximum; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } obj.linear_buckets = message.linearBuckets ? Distribution_LinearBuckets.toAmino(message.linearBuckets) : undefined; obj.exponential_buckets = message.exponentialBuckets ? Distribution_ExponentialBuckets.toAmino(message.exponentialBuckets) : undefined; @@ -424,7 +424,7 @@ export const Distribution = { if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -545,9 +545,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.width = omitDefault(message.width); - obj.offset = omitDefault(message.offset); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -667,9 +667,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.growth_factor = omitDefault(message.growthFactor); - obj.scale = omitDefault(message.scale); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { @@ -775,7 +775,7 @@ export const Distribution_ExplicitBuckets = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts index 205ee6bd28..8b5815c699 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -398,21 +398,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = omitDefault(message.requestMethod); - obj.request_url = omitDefault(message.requestUrl); - obj.request_size = omitDefault(message.requestSize); - obj.status = omitDefault(message.status); - obj.response_size = omitDefault(message.responseSize); - obj.user_agent = omitDefault(message.userAgent); - obj.remote_ip = omitDefault(message.remoteIp); - obj.server_ip = omitDefault(message.serverIp); - obj.referer = omitDefault(message.referer); + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; + obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = omitDefault(message.cacheLookup); - obj.cache_hit = omitDefault(message.cacheHit); - obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); - obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); - obj.protocol = omitDefault(message.protocol); + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; + obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts index b316cdfbae..9523bbb2ad 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts @@ -261,8 +261,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -525,7 +525,7 @@ export const LogEntry = { message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -563,12 +563,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -576,7 +576,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -715,10 +715,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -838,9 +838,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts index 379a026ffb..086ca8e542 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts @@ -176,8 +176,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -424,10 +424,10 @@ export const MetricValue = { } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.bool_value = message.boolValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -538,11 +538,11 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { - obj.metric_values = []; + obj.metric_values = message.metricValues; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts index 869611e17f..077f27f85d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/operation.ts @@ -243,8 +243,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -524,16 +524,16 @@ export const Operation = { message.metricValueSets = object.metric_value_sets?.map(e => MetricValueSet.fromAmino(e)) || []; message.logEntries = object.log_entries?.map(e => LogEntry.fromAmino(e)) || []; if (object.importance !== undefined && object.importance !== null) { - message.importance = operation_ImportanceFromJSON(object.importance); + message.importance = object.importance; } message.extensions = object.extensions?.map(e => Any.fromAmino(e)) || []; return message; }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.operation_name = message.operationName === "" ? undefined : message.operationName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.labels = {}; @@ -545,18 +545,18 @@ export const Operation = { if (message.metricValueSets) { obj.metric_value_sets = message.metricValueSets.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.metric_value_sets = []; + obj.metric_value_sets = message.metricValueSets; } if (message.logEntries) { obj.log_entries = message.logEntries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.log_entries = []; + obj.log_entries = message.logEntries; } - obj.importance = operation_ImportanceToJSON(message.importance); + obj.importance = message.importance === 0 ? undefined : message.importance; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts index 5b6628c3a1..b69a987f59 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/quota_controller.ts @@ -451,9 +451,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -556,8 +556,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -762,15 +762,15 @@ export const QuotaOperation = { }, {}); message.quotaMetrics = object.quota_metrics?.map(e => MetricValueSet.fromAmino(e)) || []; if (object.quota_mode !== undefined && object.quota_mode !== null) { - message.quotaMode = quotaOperation_QuotaModeFromJSON(object.quota_mode); + message.quotaMode = object.quota_mode; } return message; }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.method_name = message.methodName === "" ? undefined : message.methodName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -780,9 +780,9 @@ export const QuotaOperation = { if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.quota_mode = quotaOperation_QuotaModeToJSON(message.quotaMode); + obj.quota_mode = message.quotaMode === 0 ? undefined : message.quotaMode; return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -930,18 +930,18 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { - obj.allocate_errors = []; + obj.allocate_errors = message.allocateErrors; } if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1062,7 +1062,7 @@ export const QuotaError = { fromAmino(object: QuotaErrorAmino): QuotaError { const message = createBaseQuotaError(); if (object.code !== undefined && object.code !== null) { - message.code = quotaError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -1077,9 +1077,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = quotaError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.description = message.description; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts index 0d48af0b65..10eaf425e5 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts @@ -393,9 +393,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -553,14 +553,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { - obj.check_errors = []; + obj.check_errors = message.checkErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -674,7 +674,7 @@ export const CheckResponse_CheckInfo = { if (message.unusedArguments) { obj.unused_arguments = message.unusedArguments.map(e => e); } else { - obj.unused_arguments = []; + obj.unused_arguments = message.unusedArguments; } obj.consumer_info = message.consumerInfo ? CheckResponse_ConsumerInfo.toAmino(message.consumerInfo) : undefined; return obj; @@ -787,7 +787,7 @@ export const CheckResponse_ConsumerInfo = { message.projectNumber = BigInt(object.project_number); } if (object.type !== undefined && object.type !== null) { - message.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + message.type = object.type; } if (object.consumer_number !== undefined && object.consumer_number !== null) { message.consumerNumber = BigInt(object.consumer_number); @@ -797,7 +797,7 @@ export const CheckResponse_ConsumerInfo = { toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; return obj; }, @@ -924,13 +924,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1059,10 +1059,10 @@ export const ReportResponse = { if (message.reportErrors) { obj.report_errors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toAmino(e) : undefined); } else { - obj.report_errors = []; + obj.report_errors = message.reportErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1166,7 +1166,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts index b88fbc22af..90be68d113 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -303,15 +303,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = omitDefault(message.serviceName); - obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } - obj.flags = omitDefault(message.flags); + obj.flags = message.flags === "" ? undefined : message.flags; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -463,11 +463,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.type = omitDefault(message.type); - obj.permission = omitDefault(message.permission); - obj.container = omitDefault(message.container); - obj.location = omitDefault(message.location); + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.permission = message.permission === "" ? undefined : message.permission; + obj.container = message.container === "" ? undefined : message.container; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -570,8 +570,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -844,12 +844,12 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = omitDefault(message.serviceName); - obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts index ee0f2da91b..4701289aae 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/resources.ts @@ -682,8 +682,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -834,14 +834,14 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } if (message.steps) { obj.steps = message.steps.map(e => e ? OperationMetadata_Step.toAmino(e) : undefined); } else { - obj.steps = []; + obj.steps = message.steps; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = message.progressPercentage === 0 ? undefined : message.progressPercentage; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -940,14 +940,14 @@ export const OperationMetadata_Step = { message.description = object.description; } if (object.status !== undefined && object.status !== null) { - message.status = operationMetadata_StatusFromJSON(object.status); + message.status = object.status; } return message; }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = operationMetadata_StatusToJSON(message.status); + obj.description = message.description === "" ? undefined : message.description; + obj.status = message.status === 0 ? undefined : message.status; return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1058,7 +1058,7 @@ export const Diagnostic = { message.location = object.location; } if (object.kind !== undefined && object.kind !== null) { - message.kind = diagnostic_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.message !== undefined && object.message !== null) { message.message = object.message; @@ -1067,9 +1067,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = diagnostic_KindToJSON(message.kind); - obj.message = message.message; + obj.location = message.location === "" ? undefined : message.location; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1179,11 +1179,11 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { - obj.files = []; + obj.files = message.files; } return obj; }, @@ -1298,15 +1298,15 @@ export const ConfigFile = { message.fileContents = bytesFromBase64(object.file_contents); } if (object.file_type !== undefined && object.file_type !== null) { - message.fileType = configFile_FileTypeFromJSON(object.file_type); + message.fileType = object.file_type; } return message; }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = message.filePath === "" ? undefined : message.filePath; obj.file_contents = message.fileContents ? base64FromBytes(message.fileContents) : undefined; - obj.file_type = configFile_FileTypeToJSON(message.fileType); + obj.file_type = message.fileType === 0 ? undefined : message.fileType; return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1394,7 +1394,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1491,7 +1491,7 @@ export const ChangeReport = { if (message.configChanges) { obj.config_changes = message.configChanges.map(e => e ? ConfigChange.toAmino(e) : undefined); } else { - obj.config_changes = []; + obj.config_changes = message.configChanges; } return obj; }, @@ -1661,7 +1661,7 @@ export const Rollout = { message.createdBy = object.created_by; } if (object.status !== undefined && object.status !== null) { - message.status = rollout_RolloutStatusFromJSON(object.status); + message.status = object.status; } if (object.traffic_percent_strategy !== undefined && object.traffic_percent_strategy !== null) { message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy); @@ -1676,13 +1676,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; - obj.created_by = message.createdBy; - obj.status = rollout_RolloutStatusToJSON(message.status); + obj.created_by = message.createdBy === "" ? undefined : message.createdBy; + obj.status = message.status === 0 ? undefined : message.status; obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1785,8 +1785,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts index f3d7e1527d..4811dfe0f8 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicemanagement/v1/servicemanager.ts @@ -562,10 +562,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -678,9 +678,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -768,7 +768,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -944,7 +944,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1032,7 +1032,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1234,15 +1234,15 @@ export const GetServiceConfigRequest = { message.configId = object.config_id; } if (object.view !== undefined && object.view !== null) { - message.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = getServiceConfigRequest_ConfigViewToJSON(message.view); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.config_id = message.configId === "" ? undefined : message.configId; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1362,9 +1362,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1477,9 +1477,9 @@ export const ListServiceConfigsResponse = { if (message.serviceConfigs) { obj.service_configs = message.serviceConfigs.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.service_configs = []; + obj.service_configs = message.serviceConfigs; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1583,7 +1583,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1704,9 +1704,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = message.validateOnly === false ? undefined : message.validateOnly; return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -1898,7 +1898,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -2035,10 +2035,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2151,9 +2151,9 @@ export const ListServiceRolloutsResponse = { if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toAmino(e) : undefined); } else { - obj.rollouts = []; + obj.rollouts = message.rollouts; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2257,8 +2257,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2511,17 +2511,17 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.id = message.id === "" ? undefined : message.id; if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { - obj.change_reports = []; + obj.change_reports = message.changeReports; } if (message.diagnostics) { obj.diagnostics = message.diagnostics.map(e => e ? Diagnostic.toAmino(e) : undefined); } else { - obj.diagnostics = []; + obj.diagnostics = message.diagnostics; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts index 8aa4b33b41..b0f73ac4cd 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/resources.ts @@ -281,16 +281,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -540,12 +540,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -554,12 +554,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -658,7 +658,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts index 8ba91edc98..25232cdbb2 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1/serviceusage.ts @@ -414,7 +414,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -616,15 +616,15 @@ export const DisableServiceRequest = { message.disableDependentServices = object.disable_dependent_services; } if (object.check_if_service_has_usage !== undefined && object.check_if_service_has_usage !== null) { - message.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage); + message.checkIfServiceHasUsage = object.check_if_service_has_usage; } return message; }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = disableServiceRequest_CheckIfServiceHasUsageToJSON(message.checkIfServiceHasUsage); + obj.name = message.name === "" ? undefined : message.name; + obj.disable_dependent_services = message.disableDependentServices === false ? undefined : message.disableDependentServices; + obj.check_if_service_has_usage = message.checkIfServiceHasUsage === 0 ? undefined : message.checkIfServiceHasUsage; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -800,7 +800,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -936,10 +936,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1052,9 +1052,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1164,11 +1164,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1288,12 +1288,12 @@ export const BatchEnableServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } if (message.failures) { obj.failures = message.failures.map(e => e ? BatchEnableServicesResponse_EnableFailure.toAmino(e) : undefined); } else { - obj.failures = []; + obj.failures = message.failures; } return obj; }, @@ -1398,8 +1398,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = message.serviceId === "" ? undefined : message.serviceId; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1509,11 +1509,11 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.names) { obj.names = message.names.map(e => e); } else { - obj.names = []; + obj.names = message.names; } return obj; }, @@ -1611,7 +1611,7 @@ export const BatchGetServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts index 875a80b305..a3d9539c1d 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts @@ -775,16 +775,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1034,12 +1034,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -1048,12 +1048,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -1152,7 +1152,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1333,20 +1333,20 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.display_name = message.displayName === "" ? undefined : message.displayName; if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.consumer_quota_limits = []; + obj.consumer_quota_limits = message.consumerQuotaLimits; } if (message.descendantConsumerQuotaLimits) { obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.descendant_consumer_quota_limits = []; + obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits; } - obj.unit = message.unit; + obj.unit = message.unit === "" ? undefined : message.unit; return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1520,15 +1520,15 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.is_precise = message.isPrecise === false ? undefined : message.isPrecise; + obj.allows_admin_overrides = message.allowsAdminOverrides === false ? undefined : message.allowsAdminOverrides; if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { - obj.quota_buckets = []; + obj.quota_buckets = message.quotaBuckets; } return obj; }, @@ -1632,8 +1632,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -1951,8 +1951,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2157,7 +2157,7 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2165,9 +2165,9 @@ export const QuotaOverride = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.admin_override_ancestor = message.adminOverrideAncestor === "" ? undefined : message.adminOverrideAncestor; return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2264,7 +2264,7 @@ export const OverrideInlineSource = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2368,8 +2368,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2574,7 +2574,7 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2582,9 +2582,9 @@ export const AdminQuotaPolicy = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2688,8 +2688,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = message.email === "" ? undefined : message.email; + obj.unique_id = message.uniqueId === "" ? undefined : message.uniqueId; return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts index 552ad55b8a..6536a3b8eb 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/serviceusage.ts @@ -969,7 +969,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1057,7 +1057,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1145,7 +1145,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1281,10 +1281,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1397,9 +1397,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1509,11 +1509,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1644,16 +1644,16 @@ export const ListConsumerQuotaMetricsRequest = { message.pageToken = object.page_token; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = quotaViewToJSON(message.view); + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -1766,9 +1766,9 @@ export const ListConsumerQuotaMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -1866,14 +1866,14 @@ export const GetConsumerQuotaMetricRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -1971,14 +1971,14 @@ export const GetConsumerQuotaLimitRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2124,18 +2124,18 @@ export const CreateAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2298,19 +2298,19 @@ export const UpdateAdminOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2441,17 +2441,17 @@ export const DeleteAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2572,9 +2572,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -2687,9 +2687,9 @@ export const ListAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -2786,7 +2786,7 @@ export const BatchCreateAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2933,18 +2933,18 @@ export const ImportAdminOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3042,7 +3042,7 @@ export const ImportAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3256,18 +3256,18 @@ export const CreateConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3430,19 +3430,19 @@ export const UpdateConsumerOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3573,17 +3573,17 @@ export const DeleteConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3704,9 +3704,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -3819,9 +3819,9 @@ export const ListConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -3918,7 +3918,7 @@ export const BatchCreateConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4065,18 +4065,18 @@ export const ImportConsumerOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4174,7 +4174,7 @@ export const ImportConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4339,7 +4339,7 @@ export const ImportAdminQuotaPoliciesResponse = { if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toAmino(e) : undefined); } else { - obj.policies = []; + obj.policies = message.policies; } return obj; }, @@ -4696,7 +4696,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -4794,14 +4794,14 @@ export const GetServiceIdentityResponse = { message.identity = ServiceIdentity.fromAmino(object.identity); } if (object.state !== undefined && object.state !== null) { - message.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputosmojs/google/api/source_info.ts b/__fixtures__/v-next/outputosmojs/google/api/source_info.ts index 1246be15fc..cad7fccdb0 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/source_info.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/source_info.ts @@ -93,7 +93,7 @@ export const SourceInfo = { if (message.sourceFiles) { obj.source_files = message.sourceFiles.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.source_files = []; + obj.source_files = message.sourceFiles; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts b/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts index 48ddde7e8c..18e24e53f9 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -202,7 +202,7 @@ export const SystemParameters = { if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -313,11 +313,11 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { - obj.parameters = []; + obj.parameters = message.parameters; } return obj; }, @@ -438,9 +438,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.http_header = omitDefault(message.httpHeader); - obj.url_query_parameter = omitDefault(message.urlQueryParameter); + obj.name = message.name === "" ? undefined : message.name; + obj.http_header = message.httpHeader === "" ? undefined : message.httpHeader; + obj.url_query_parameter = message.urlQueryParameter === "" ? undefined : message.urlQueryParameter; return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputosmojs/google/api/usage.ts b/__fixtures__/v-next/outputosmojs/google/api/usage.ts index 5e4d36914a..d5a8062601 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/usage.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -243,14 +243,14 @@ export const Usage = { if (message.requirements) { obj.requirements = message.requirements.map(e => e); } else { - obj.requirements = []; + obj.requirements = message.requirements; } if (message.rules) { obj.rules = message.rules.map(e => e ? UsageRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); + obj.producer_notification_channel = message.producerNotificationChannel === "" ? undefined : message.producerNotificationChannel; return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -370,9 +370,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); - obj.skip_service_control = omitDefault(message.skipServiceControl); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.allow_unregistered_calls = message.allowUnregisteredCalls === false ? undefined : message.allowUnregisteredCalls; + obj.skip_service_control = message.skipServiceControl === false ? undefined : message.skipServiceControl; return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputosmojs/google/api/visibility.ts b/__fixtures__/v-next/outputosmojs/google/api/visibility.ts index 1516a7138f..2fb45ec310 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/visibility.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -184,7 +184,7 @@ export const Visibility = { if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -289,8 +289,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.restriction = omitDefault(message.restriction); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.restriction = message.restriction === "" ? undefined : message.restriction; return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts b/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts index d4292fcd65..3eef764c1f 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -400,21 +400,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = omitDefault(message.requestMethod); - obj.request_url = omitDefault(message.requestUrl); - obj.request_size = omitDefault(message.requestSize); - obj.status = omitDefault(message.status); - obj.response_size = omitDefault(message.responseSize); - obj.user_agent = omitDefault(message.userAgent); - obj.remote_ip = omitDefault(message.remoteIp); - obj.server_ip = omitDefault(message.serverIp); - obj.referer = omitDefault(message.referer); + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; + obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = omitDefault(message.cacheLookup); - obj.cache_hit = omitDefault(message.cacheHit); - obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); - obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); - obj.protocol = omitDefault(message.protocol); + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; + obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts index 41f907a278..2bb750c63b 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts @@ -385,8 +385,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -729,7 +729,7 @@ export const LogEntry = { message.receiveTimestamp = fromTimestamp(Timestamp.fromAmino(object.receive_timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.insert_id !== undefined && object.insert_id !== null) { message.insertId = object.insert_id; @@ -767,15 +767,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.receive_timestamp = message.receiveTimestamp ? Timestamp.toAmino(toTimestamp(message.receiveTimestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); - obj.insert_id = message.insertId; + obj.severity = message.severity === 0 ? undefined : message.severity; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -784,9 +784,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.span_id = message.spanId === "" ? undefined : message.spanId; + obj.trace_sampled = message.traceSampled === false ? undefined : message.traceSampled; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -924,10 +924,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1047,9 +1047,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1169,9 +1169,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = message.uid === "" ? undefined : message.uid; + obj.index = message.index === 0 ? undefined : message.index; + obj.total_splits = message.totalSplits === 0 ? undefined : message.totalSplits; return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts index f08f40812d..9fa9802575 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging.ts @@ -612,7 +612,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -715,8 +715,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -927,7 +927,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -938,10 +938,10 @@ export const WriteLogEntriesRequest = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = message.partialSuccess === false ? undefined : message.partialSuccess; + obj.dry_run = message.dryRun === false ? undefined : message.dryRun; return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1111,7 +1111,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === 0 ? undefined : message.key; obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1403,12 +1403,12 @@ export const ListLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.order_by = message.orderBy === "" ? undefined : message.orderBy; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1521,9 +1521,9 @@ export const ListLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1627,8 +1627,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -1741,9 +1741,9 @@ export const ListMonitoredResourceDescriptorsResponse = { if (message.resourceDescriptors) { obj.resource_descriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.resource_descriptors = []; + obj.resource_descriptors = message.resourceDescriptors; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -1885,13 +1885,13 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -2005,9 +2005,9 @@ export const ListLogsResponse = { if (message.logNames) { obj.log_names = message.logNames.map(e => e); } else { - obj.log_names = []; + obj.log_names = message.logNames; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2136,9 +2136,9 @@ export const TailLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2258,12 +2258,12 @@ export const TailLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.suppressionInfo) { obj.suppression_info = message.suppressionInfo.map(e => e ? TailLogEntriesResponse_SuppressionInfo.toAmino(e) : undefined); } else { - obj.suppression_info = []; + obj.suppression_info = message.suppressionInfo; } return obj; }, @@ -2359,7 +2359,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { fromAmino(object: TailLogEntriesResponse_SuppressionInfoAmino): TailLogEntriesResponse_SuppressionInfo { const message = createBaseTailLogEntriesResponse_SuppressionInfo(); if (object.reason !== undefined && object.reason !== null) { - message.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + message.reason = object.reason; } if (object.suppressed_count !== undefined && object.suppressed_count !== null) { message.suppressedCount = object.suppressed_count; @@ -2368,8 +2368,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason); - obj.suppressed_count = message.suppressedCount; + obj.reason = message.reason === 0 ? undefined : message.reason; + obj.suppressed_count = message.suppressedCount === 0 ? undefined : message.suppressedCount; return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts index ee151f5703..e79c91750e 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts @@ -1934,7 +1934,7 @@ export const LogBucket = { message.locked = object.locked; } if (object.lifecycle_state !== undefined && object.lifecycle_state !== null) { - message.lifecycleState = lifecycleStateFromJSON(object.lifecycle_state); + message.lifecycleState = object.lifecycle_state; } message.restrictedFields = object.restricted_fields?.map(e => e) || []; if (object.cmek_settings !== undefined && object.cmek_settings !== null) { @@ -1944,17 +1944,17 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = lifecycleStateToJSON(message.lifecycleState); + obj.retention_days = message.retentionDays === 0 ? undefined : message.retentionDays; + obj.locked = message.locked === false ? undefined : message.locked; + obj.lifecycle_state = message.lifecycleState === 0 ? undefined : message.lifecycleState; if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { - obj.restricted_fields = []; + obj.restricted_fields = message.restrictedFields; } obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; return obj; @@ -2108,11 +2108,11 @@ export const LogView = { }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -2361,7 +2361,7 @@ export const LogSink = { } message.exclusions = object.exclusions?.map(e => LogExclusion.fromAmino(e)) || []; if (object.output_version_format !== undefined && object.output_version_format !== null) { - message.outputVersionFormat = logSink_VersionFormatFromJSON(object.output_version_format); + message.outputVersionFormat = object.output_version_format; } if (object.writer_identity !== undefined && object.writer_identity !== null) { message.writerIdentity = object.writer_identity; @@ -2382,19 +2382,19 @@ export const LogSink = { }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.destination = message.destination === "" ? undefined : message.destination; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.description = message.description === "" ? undefined : message.description; + obj.disabled = message.disabled === false ? undefined : message.disabled; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.output_version_format = logSink_VersionFormatToJSON(message.outputVersionFormat); - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = message.outputVersionFormat === 0 ? undefined : message.outputVersionFormat; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; + obj.include_children = message.includeChildren === false ? undefined : message.includeChildren; obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; @@ -2501,8 +2501,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = message.usePartitionedTables === false ? undefined : message.usePartitionedTables; + obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning === false ? undefined : message.usesTimestampColumnPartitioning; return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -2622,9 +2622,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -2737,9 +2737,9 @@ export const ListBucketsResponse = { if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toAmino(e) : undefined); } else { - obj.buckets = []; + obj.buckets = message.buckets; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -2859,8 +2859,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.bucket_id = message.bucketId === "" ? undefined : message.bucketId; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -2981,7 +2981,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3071,7 +3071,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -3159,7 +3159,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -3247,7 +3247,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -3367,9 +3367,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -3482,9 +3482,9 @@ export const ListViewsResponse = { if (message.views) { obj.views = message.views.map(e => e ? LogView.toAmino(e) : undefined); } else { - obj.views = []; + obj.views = message.views; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -3604,8 +3604,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.view_id = message.viewId === "" ? undefined : message.viewId; obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -3726,7 +3726,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3816,7 +3816,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -3904,7 +3904,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -4024,9 +4024,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -4139,9 +4139,9 @@ export const ListSinksResponse = { if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toAmino(e) : undefined); } else { - obj.sinks = []; + obj.sinks = message.sinks; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -4229,7 +4229,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -4349,9 +4349,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -4487,9 +4487,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -4578,7 +4578,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -4746,10 +4746,10 @@ export const LogExclusion = { }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; return obj; @@ -4871,9 +4871,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -4986,9 +4986,9 @@ export const ListExclusionsResponse = { if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -5076,7 +5076,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -5180,7 +5180,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -5301,7 +5301,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5391,7 +5391,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -5479,7 +5479,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -5599,7 +5599,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5721,9 +5721,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.service_account_id = message.serviceAccountId === "" ? undefined : message.serviceAccountId; return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -5811,7 +5811,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -5931,7 +5931,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6085,11 +6085,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.kms_service_account_id = message.kmsServiceAccountId === "" ? undefined : message.kmsServiceAccountId; + obj.storage_location = message.storageLocation === "" ? undefined : message.storageLocation; + obj.disable_default_sink = message.disableDefaultSink === false ? undefined : message.disableDefaultSink; return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -6209,9 +6209,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.destination = message.destination === "" ? undefined : message.destination; return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -6377,7 +6377,7 @@ export const CopyLogEntriesMetadata = { message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); } if (object.state !== undefined && object.state !== null) { - message.state = operationStateFromJSON(object.state); + message.state = object.state; } if (object.cancellation_requested !== undefined && object.cancellation_requested !== null) { message.cancellationRequested = object.cancellation_requested; @@ -6397,11 +6397,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.state = operationStateToJSON(message.state); - obj.cancellation_requested = message.cancellationRequested; + obj.state = message.state === 0 ? undefined : message.state; + obj.cancellation_requested = message.cancellationRequested === false ? undefined : message.cancellationRequested; obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = message.progress === 0 ? undefined : message.progress; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts index 6508c4d04e..cdc0b64526 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_metrics.ts @@ -434,8 +434,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -714,18 +714,18 @@ export const LogMetric = { message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); } if (object.version !== undefined && object.version !== null) { - message.version = logMetric_ApiVersionFromJSON(object.version); + message.version = object.version; } return message; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = message.valueExtractor === "" ? undefined : message.valueExtractor; obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -735,7 +735,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.version = logMetric_ApiVersionToJSON(message.version); + obj.version = message.version === 0 ? undefined : message.version; return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -855,9 +855,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -970,9 +970,9 @@ export const ListLogMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1060,7 +1060,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1164,7 +1164,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1269,7 +1269,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1358,7 +1358,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts b/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts index 6e93a77dd9..3be3b9ca1e 100644 --- a/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputosmojs/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { Any, AnySDKType } from "../protobuf/any"; import { Status, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -344,9 +344,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = omitDefault(message.done); + obj.done = message.done === false ? undefined : message.done; obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -436,7 +436,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -572,10 +572,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.filter = omitDefault(message.filter); - obj.page_size = omitDefault(message.pageSize); - obj.page_token = omitDefault(message.pageToken); + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -688,9 +688,9 @@ export const ListOperationsResponse = { if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.next_page_token = omitDefault(message.nextPageToken); + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -778,7 +778,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -866,7 +866,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -970,7 +970,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1075,8 +1075,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = omitDefault(message.responseType); - obj.metadata_type = omitDefault(message.metadataType); + obj.response_type = message.responseType === "" ? undefined : message.responseType; + obj.metadata_type = message.metadataType === "" ? undefined : message.metadataType; return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts index 978eb2f955..4605e80dcd 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/any.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts index a5f96b192e..12bd7ef7fe 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/api.ts @@ -465,31 +465,31 @@ export const Api = { } message.mixins = object.mixins?.map(e => Mixin.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { - obj.mixins = []; + obj.mixins = message.mixins; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -673,23 +673,23 @@ export const Method = { } message.options = object.options?.map(e => Option.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = message.name === "" ? undefined : message.name; + obj.request_type_url = message.requestTypeUrl === "" ? undefined : message.requestTypeUrl; + obj.request_streaming = message.requestStreaming === false ? undefined : message.requestStreaming; + obj.response_type_url = message.responseTypeUrl === "" ? undefined : message.responseTypeUrl; + obj.response_streaming = message.responseStreaming === false ? undefined : message.responseStreaming; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -793,8 +793,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = message.name === "" ? undefined : message.name; + obj.root = message.root === "" ? undefined : message.root; return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts index f9b2ceae10..d14334f31a 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -275,10 +275,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = omitDefault(message.major); - obj.minor = omitDefault(message.minor); - obj.patch = omitDefault(message.patch); - obj.suffix = omitDefault(message.suffix); + obj.major = message.major === 0 ? undefined : message.major; + obj.minor = message.minor === 0 ? undefined : message.minor; + obj.patch = message.patch === 0 ? undefined : message.patch; + obj.suffix = message.suffix === "" ? undefined : message.suffix; return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -429,13 +429,13 @@ export const CodeGeneratorRequest = { if (message.fileToGenerate) { obj.file_to_generate = message.fileToGenerate.map(e => e); } else { - obj.file_to_generate = []; + obj.file_to_generate = message.fileToGenerate; } - obj.parameter = omitDefault(message.parameter); + obj.parameter = message.parameter === "" ? undefined : message.parameter; if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.proto_file = []; + obj.proto_file = message.protoFile; } obj.compiler_version = message.compilerVersion ? Version.toAmino(message.compilerVersion) : undefined; return obj; @@ -547,11 +547,11 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = omitDefault(message.error); + obj.error = message.error === "" ? undefined : message.error; if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -672,9 +672,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.insertion_point = omitDefault(message.insertionPoint); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.insertion_point = message.insertionPoint === "" ? undefined : message.insertionPoint; + obj.content = message.content === "" ? undefined : message.content; return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts index cc58297686..b50e35a551 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts @@ -1464,7 +1464,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -1789,46 +1789,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2108,47 +2108,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2269,8 +2269,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2375,8 +2375,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2473,7 +2473,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -2679,10 +2679,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -2706,15 +2706,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2819,7 +2819,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -2990,22 +2990,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3110,8 +3110,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3231,8 +3231,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3359,11 +3359,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -3533,12 +3533,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3903,7 +3903,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -3952,30 +3952,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4134,14 +4134,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4310,13 +4310,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4332,16 +4332,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4439,7 +4439,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4566,12 +4566,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4682,11 +4682,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4797,11 +4797,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4921,19 +4921,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5127,14 +5127,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5238,8 +5238,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5336,7 +5336,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -5528,19 +5528,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -5638,7 +5638,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -5793,11 +5793,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts index 0c5572d601..cc9aafef17 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/duration.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/field_mask.ts index c4a3a96871..d37614db1b 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/field_mask.ts @@ -492,7 +492,7 @@ export const FieldMask = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts index 39b956c553..15dbabdc65 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -92,7 +92,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = omitDefault(message.fileName); + obj.file_name = message.fileName === "" ? undefined : message.fileName; return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts index 6403d257d6..554554bf3c 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/struct.ts @@ -227,7 +227,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -505,7 +505,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.number_value !== undefined && object.number_value !== null) { message.numberValue = object.number_value; @@ -526,10 +526,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.number_value = message.numberValue === null ? undefined : message.numberValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; @@ -628,7 +628,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts index 9c21f03545..babec48dab 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, omitDefault, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts index 5d9cb5507f..117434b38d 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/type.ts @@ -549,30 +549,30 @@ export const Type = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { - obj.fields = []; + obj.fields = message.fields; } if (message.oneofs) { obj.oneofs = message.oneofs.map(e => e); } else { - obj.oneofs = []; + obj.oneofs = message.oneofs; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -779,10 +779,10 @@ export const Field = { fromAmino(object: FieldAmino): Field { const message = createBaseField(); if (object.kind !== undefined && object.kind !== null) { - message.kind = field_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.cardinality !== undefined && object.cardinality !== null) { - message.cardinality = field_CardinalityFromJSON(object.cardinality); + message.cardinality = object.cardinality; } if (object.number !== undefined && object.number !== null) { message.number = object.number; @@ -810,20 +810,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = field_KindToJSON(message.kind); - obj.cardinality = field_CardinalityToJSON(message.cardinality); - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.cardinality = message.cardinality === 0 ? undefined : message.cardinality; + obj.number = message.number === 0 ? undefined : message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.packed = message.packed === false ? undefined : message.packed; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -981,25 +981,25 @@ export const Enum = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { - obj.enumvalue = []; + obj.enumvalue = message.enumvalue; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1125,12 +1125,12 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1235,7 +1235,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts index 39352e4e44..ce270c54b8 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -259,7 +259,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -347,7 +347,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -435,7 +435,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -523,7 +523,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -611,7 +611,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -699,7 +699,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -787,7 +787,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === false ? undefined : message.value; return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -875,7 +875,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts index 9a5bd4cfa8..dda03523d5 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts @@ -774,7 +774,7 @@ export const AttributeContext = { if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, @@ -878,8 +878,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1068,7 +1068,7 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; + obj.ip = message.ip === "" ? undefined : message.ip; obj.port = message.port ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { @@ -1076,8 +1076,8 @@ export const AttributeContext_Peer = { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = message.principal === "" ? undefined : message.principal; + obj.region_code = message.regionCode === "" ? undefined : message.regionCode; return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1213,10 +1213,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = message.service === "" ? undefined : message.service; + obj.operation = message.operation === "" ? undefined : message.operation; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1380,18 +1380,18 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = message.principal === "" ? undefined : message.principal; if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { - obj.audiences = []; + obj.audiences = message.audiences; } - obj.presenter = message.presenter; + obj.presenter = message.presenter === "" ? undefined : message.presenter; obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); } else { - obj.access_levels = []; + obj.access_levels = message.accessLevels; } return obj; }, @@ -1495,8 +1495,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -1797,22 +1797,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = message.id === "" ? undefined : message.id; + obj.method = message.method === "" ? undefined : message.method; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = message.path === "" ? undefined : message.path; + obj.host = message.host === "" ? undefined : message.host; + obj.scheme = message.scheme === "" ? undefined : message.scheme; + obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -1916,8 +1916,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2218,8 +2218,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2316,8 +2316,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2661,28 +2661,28 @@ export const AttributeContext_Resource = { }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = message.service === "" ? undefined : message.service; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = message.uid === "" ? undefined : message.uid; obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; obj.delete_time = message.deleteTime ? Timestamp.toAmino(toTimestamp(message.deleteTime)) : undefined; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = message.etag === "" ? undefined : message.etag; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts b/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts index 789fe6b87e..7d413eb8ee 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; +import { isSet, DeepPartial, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -647,9 +647,9 @@ export const DebugInfo = { if (message.stackEntries) { obj.stack_entries = message.stackEntries.map(e => e); } else { - obj.stack_entries = []; + obj.stack_entries = message.stackEntries; } - obj.detail = omitDefault(message.detail); + obj.detail = message.detail === "" ? undefined : message.detail; return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -746,7 +746,7 @@ export const QuotaFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? QuotaFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -851,8 +851,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -955,8 +955,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1113,8 +1113,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = omitDefault(message.reason); - obj.domain = omitDefault(message.domain); + obj.reason = message.reason === "" ? undefined : message.reason; + obj.domain = message.domain === "" ? undefined : message.domain; obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1217,7 +1217,7 @@ export const PreconditionFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1338,9 +1338,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = omitDefault(message.type); - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.type = message.type === "" ? undefined : message.type; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1437,7 +1437,7 @@ export const BadRequest = { if (message.fieldViolations) { obj.field_violations = message.fieldViolations.map(e => e ? BadRequest_FieldViolation.toAmino(e) : undefined); } else { - obj.field_violations = []; + obj.field_violations = message.fieldViolations; } return obj; }, @@ -1542,8 +1542,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.description = omitDefault(message.description); + obj.field = message.field === "" ? undefined : message.field; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1647,8 +1647,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = omitDefault(message.requestId); - obj.serving_data = omitDefault(message.servingData); + obj.request_id = message.requestId === "" ? undefined : message.requestId; + obj.serving_data = message.servingData === "" ? undefined : message.servingData; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1784,10 +1784,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = omitDefault(message.resourceType); - obj.resource_name = omitDefault(message.resourceName); - obj.owner = omitDefault(message.owner); - obj.description = omitDefault(message.description); + obj.resource_type = message.resourceType === "" ? undefined : message.resourceType; + obj.resource_name = message.resourceName === "" ? undefined : message.resourceName; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -1884,7 +1884,7 @@ export const Help = { if (message.links) { obj.links = message.links.map(e => e ? Help_Link.toAmino(e) : undefined); } else { - obj.links = []; + obj.links = message.links; } return obj; }, @@ -1989,8 +1989,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = omitDefault(message.description); - obj.url = omitDefault(message.url); + obj.description = message.description === "" ? undefined : message.description; + obj.url = message.url === "" ? undefined : message.url; return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -2094,8 +2094,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = omitDefault(message.locale); - obj.message = omitDefault(message.message); + obj.locale = message.locale === "" ? undefined : message.locale; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/status.ts b/__fixtures__/v-next/outputosmojs/google/rpc/status.ts index e05f745a0f..f2f15145dc 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/status.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -151,12 +151,12 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = omitDefault(message.code); - obj.message = omitDefault(message.message); + obj.code = message.code === 0 ? undefined : message.code; + obj.message = message.message === "" ? undefined : message.message; if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.details = []; + obj.details = message.details; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts index 9da00ba60a..10ad52d8ee 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/ack.ts @@ -122,8 +122,8 @@ export const IncentivizedAcknowledgement = { toAmino(message: IncentivizedAcknowledgement): IncentivizedAcknowledgementAmino { const obj: any = {}; obj.app_acknowledgement = message.appAcknowledgement ? base64FromBytes(message.appAcknowledgement) : undefined; - obj.forward_relayer_address = message.forwardRelayerAddress; - obj.underlying_app_success = message.underlyingAppSuccess; + obj.forward_relayer_address = message.forwardRelayerAddress === "" ? undefined : message.forwardRelayerAddress; + obj.underlying_app_success = message.underlyingAppSuccess === false ? undefined : message.underlyingAppSuccess; return obj; }, fromAminoMsg(object: IncentivizedAcknowledgementAminoMsg): IncentivizedAcknowledgement { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts index 063dd08f74..4fd9bc8e02 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/fee.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** Fee defines the ICS29 receive, acknowledgement and timeout fees */ export interface Fee { @@ -188,17 +188,17 @@ export const Fee = { if (message.recvFee) { obj.recv_fee = message.recvFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.recv_fee = []; + obj.recv_fee = message.recvFee; } if (message.ackFee) { obj.ack_fee = message.ackFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.ack_fee = []; + obj.ack_fee = message.ackFee; } if (message.timeoutFee) { obj.timeout_fee = message.timeoutFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.timeout_fee = []; + obj.timeout_fee = message.timeoutFee; } return obj; }, @@ -332,11 +332,11 @@ export const PacketFee = { toAmino(message: PacketFee): PacketFeeAmino { const obj: any = {}; obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; - obj.refund_address = omitDefault(message.refundAddress); + obj.refund_address = message.refundAddress === "" ? undefined : message.refundAddress; if (message.relayers) { obj.relayers = message.relayers.map(e => e); } else { - obj.relayers = []; + obj.relayers = message.relayers; } return obj; }, @@ -440,7 +440,7 @@ export const PacketFees = { if (message.packetFees) { obj.packet_fees = message.packetFees.map(e => e ? PacketFee.toAmino(e) : undefined); } else { - obj.packet_fees = []; + obj.packet_fees = message.packetFees; } return obj; }, @@ -544,7 +544,7 @@ export const IdentifiedPacketFees = { if (message.packetFees) { obj.packet_fees = message.packetFees.map(e => e ? PacketFee.toAmino(e) : undefined); } else { - obj.packet_fees = []; + obj.packet_fees = message.packetFees; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts index 886c4eb44b..45171de156 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedPacketFees, IdentifiedPacketFeesSDKType } from "./fee"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** GenesisState defines the ICS29 fee middleware genesis state */ export interface GenesisState { @@ -266,27 +266,27 @@ export const GenesisState = { if (message.identifiedFees) { obj.identified_fees = message.identifiedFees.map(e => e ? IdentifiedPacketFees.toAmino(e) : undefined); } else { - obj.identified_fees = []; + obj.identified_fees = message.identifiedFees; } if (message.feeEnabledChannels) { obj.fee_enabled_channels = message.feeEnabledChannels.map(e => e ? FeeEnabledChannel.toAmino(e) : undefined); } else { - obj.fee_enabled_channels = []; + obj.fee_enabled_channels = message.feeEnabledChannels; } if (message.registeredPayees) { obj.registered_payees = message.registeredPayees.map(e => e ? RegisteredPayee.toAmino(e) : undefined); } else { - obj.registered_payees = []; + obj.registered_payees = message.registeredPayees; } if (message.registeredCounterpartyPayees) { obj.registered_counterparty_payees = message.registeredCounterpartyPayees.map(e => e ? RegisteredCounterpartyPayee.toAmino(e) : undefined); } else { - obj.registered_counterparty_payees = []; + obj.registered_counterparty_payees = message.registeredCounterpartyPayees; } if (message.forwardRelayers) { obj.forward_relayers = message.forwardRelayers.map(e => e ? ForwardRelayerAddress.toAmino(e) : undefined); } else { - obj.forward_relayers = []; + obj.forward_relayers = message.forwardRelayers; } return obj; }, @@ -397,8 +397,8 @@ export const FeeEnabledChannel = { }, toAmino(message: FeeEnabledChannel): FeeEnabledChannelAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: FeeEnabledChannelAminoMsg): FeeEnabledChannel { @@ -524,9 +524,9 @@ export const RegisteredPayee = { }, toAmino(message: RegisteredPayee): RegisteredPayeeAmino { const obj: any = {}; - obj.channel_id = omitDefault(message.channelId); - obj.relayer = omitDefault(message.relayer); - obj.payee = omitDefault(message.payee); + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.relayer = message.relayer === "" ? undefined : message.relayer; + obj.payee = message.payee === "" ? undefined : message.payee; return obj; }, fromAminoMsg(object: RegisteredPayeeAminoMsg): RegisteredPayee { @@ -652,9 +652,9 @@ export const RegisteredCounterpartyPayee = { }, toAmino(message: RegisteredCounterpartyPayee): RegisteredCounterpartyPayeeAmino { const obj: any = {}; - obj.channel_id = omitDefault(message.channelId); - obj.relayer = omitDefault(message.relayer); - obj.counterparty_payee = omitDefault(message.counterpartyPayee); + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.relayer = message.relayer === "" ? undefined : message.relayer; + obj.counterparty_payee = message.counterpartyPayee === "" ? undefined : message.counterpartyPayee; return obj; }, fromAminoMsg(object: RegisteredCounterpartyPayeeAminoMsg): RegisteredCounterpartyPayee { @@ -748,7 +748,7 @@ export const ForwardRelayerAddress = { }, toAmino(message: ForwardRelayerAddress): ForwardRelayerAddressAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: ForwardRelayerAddressAminoMsg): ForwardRelayerAddress { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts index 2cf1da81aa..1f7ea72df3 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/metadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** * Metadata defines the ICS29 channel specific metadata encoded into the channel version bytestring @@ -108,8 +108,8 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.fee_version = omitDefault(message.feeVersion); - obj.app_version = omitDefault(message.appVersion); + obj.fee_version = message.feeVersion === "" ? undefined : message.feeVersion; + obj.app_version = message.appVersion === "" ? undefined : message.appVersion; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts index f222e50923..d0b3daeba7 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts @@ -3,7 +3,7 @@ import { IdentifiedPacketFees, IdentifiedPacketFeesSDKType } from "./fee"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { FeeEnabledChannel, FeeEnabledChannelSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** QueryIncentivizedPacketsRequest defines the request type for the IncentivizedPackets rpc */ export interface QueryIncentivizedPacketsRequest { @@ -373,7 +373,7 @@ export const QueryIncentivizedPacketsRequest = { toAmino(message: QueryIncentivizedPacketsRequest): QueryIncentivizedPacketsRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.query_height = omitDefault(message.queryHeight); + obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryIncentivizedPacketsRequestAminoMsg): QueryIncentivizedPacketsRequest { @@ -492,7 +492,7 @@ export const QueryIncentivizedPacketsResponse = { if (message.incentivizedPackets) { obj.incentivized_packets = message.incentivizedPackets.map(e => e ? IdentifiedPacketFees.toAmino(e) : undefined); } else { - obj.incentivized_packets = []; + obj.incentivized_packets = message.incentivizedPackets; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -588,7 +588,7 @@ export const QueryIncentivizedPacketRequest = { }, toAmino(message: QueryIncentivizedPacketRequest): QueryIncentivizedPacketRequestAmino { const obj: any = {}; - obj.query_height = omitDefault(message.queryHeight); + obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryIncentivizedPacketRequestAminoMsg): QueryIncentivizedPacketRequest { @@ -825,9 +825,9 @@ export const QueryIncentivizedPacketsForChannelRequest = { toAmino(message: QueryIncentivizedPacketsForChannelRequest): QueryIncentivizedPacketsForChannelRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.query_height = omitDefault(message.queryHeight); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryIncentivizedPacketsForChannelRequestAminoMsg): QueryIncentivizedPacketsForChannelRequest { @@ -946,7 +946,7 @@ export const QueryIncentivizedPacketsForChannelResponse = { if (message.incentivizedPackets) { obj.incentivized_packets = message.incentivizedPackets.map(e => e ? IdentifiedPacketFees.toAmino(e) : undefined); } else { - obj.incentivized_packets = []; + obj.incentivized_packets = message.incentivizedPackets; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1124,7 +1124,7 @@ export const QueryTotalRecvFeesResponse = { if (message.recvFees) { obj.recv_fees = message.recvFees.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.recv_fees = []; + obj.recv_fees = message.recvFees; } return obj; }, @@ -1301,7 +1301,7 @@ export const QueryTotalAckFeesResponse = { if (message.ackFees) { obj.ack_fees = message.ackFees.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.ack_fees = []; + obj.ack_fees = message.ackFees; } return obj; }, @@ -1478,7 +1478,7 @@ export const QueryTotalTimeoutFeesResponse = { if (message.timeoutFees) { obj.timeout_fees = message.timeoutFees.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.timeout_fees = []; + obj.timeout_fees = message.timeoutFees; } return obj; }, @@ -1589,8 +1589,8 @@ export const QueryPayeeRequest = { }, toAmino(message: QueryPayeeRequest): QueryPayeeRequestAmino { const obj: any = {}; - obj.channel_id = omitDefault(message.channelId); - obj.relayer = omitDefault(message.relayer); + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.relayer = message.relayer === "" ? undefined : message.relayer; return obj; }, fromAminoMsg(object: QueryPayeeRequestAminoMsg): QueryPayeeRequest { @@ -1684,7 +1684,7 @@ export const QueryPayeeResponse = { }, toAmino(message: QueryPayeeResponse): QueryPayeeResponseAmino { const obj: any = {}; - obj.payee_address = omitDefault(message.payeeAddress); + obj.payee_address = message.payeeAddress === "" ? undefined : message.payeeAddress; return obj; }, fromAminoMsg(object: QueryPayeeResponseAminoMsg): QueryPayeeResponse { @@ -1794,8 +1794,8 @@ export const QueryCounterpartyPayeeRequest = { }, toAmino(message: QueryCounterpartyPayeeRequest): QueryCounterpartyPayeeRequestAmino { const obj: any = {}; - obj.channel_id = omitDefault(message.channelId); - obj.relayer = omitDefault(message.relayer); + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.relayer = message.relayer === "" ? undefined : message.relayer; return obj; }, fromAminoMsg(object: QueryCounterpartyPayeeRequestAminoMsg): QueryCounterpartyPayeeRequest { @@ -1889,7 +1889,7 @@ export const QueryCounterpartyPayeeResponse = { }, toAmino(message: QueryCounterpartyPayeeResponse): QueryCounterpartyPayeeResponseAmino { const obj: any = {}; - obj.counterparty_payee = omitDefault(message.counterpartyPayee); + obj.counterparty_payee = message.counterpartyPayee === "" ? undefined : message.counterpartyPayee; return obj; }, fromAminoMsg(object: QueryCounterpartyPayeeResponseAminoMsg): QueryCounterpartyPayeeResponse { @@ -2000,7 +2000,7 @@ export const QueryFeeEnabledChannelsRequest = { toAmino(message: QueryFeeEnabledChannelsRequest): QueryFeeEnabledChannelsRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.query_height = omitDefault(message.queryHeight); + obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelsRequestAminoMsg): QueryFeeEnabledChannelsRequest { @@ -2119,7 +2119,7 @@ export const QueryFeeEnabledChannelsResponse = { if (message.feeEnabledChannels) { obj.fee_enabled_channels = message.feeEnabledChannels.map(e => e ? FeeEnabledChannel.toAmino(e) : undefined); } else { - obj.fee_enabled_channels = []; + obj.fee_enabled_channels = message.feeEnabledChannels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2231,8 +2231,8 @@ export const QueryFeeEnabledChannelRequest = { }, toAmino(message: QueryFeeEnabledChannelRequest): QueryFeeEnabledChannelRequestAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelRequestAminoMsg): QueryFeeEnabledChannelRequest { @@ -2326,7 +2326,7 @@ export const QueryFeeEnabledChannelResponse = { }, toAmino(message: QueryFeeEnabledChannelResponse): QueryFeeEnabledChannelResponseAmino { const obj: any = {}; - obj.fee_enabled = omitDefault(message.feeEnabled); + obj.fee_enabled = message.feeEnabled === false ? undefined : message.feeEnabled; return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelResponseAminoMsg): QueryFeeEnabledChannelResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts index d29f247ac3..2c76b422d9 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts @@ -164,16 +164,16 @@ export const AminoConverter = { relayers }: MsgPayPacketFeeAminoType["value"]): MsgPayPacketFee => { return { - fee: { - recvFee: fee.recv_fee.map(el1 => ({ + fee: fee == null ? fee : { + recvFee: fee.recv_fee.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })), - ackFee: fee.ack_fee.map(el1 => ({ + ackFee: fee.ack_fee.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })), - timeoutFee: fee.timeout_fee.map(el1 => ({ + timeoutFee: fee.timeout_fee.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) @@ -215,17 +215,17 @@ export const AminoConverter = { packet_fee }: MsgPayPacketFeeAsyncAminoType["value"]): MsgPayPacketFeeAsync => { return { - packetFee: { - fee: { - recvFee: packet_fee.fee.recv_fee.map(el2 => ({ + packetFee: packet_fee == null ? packet_fee : { + fee: packet_fee.fee == null ? packet_fee.fee : { + recvFee: packet_fee.fee.recv_fee.map?.(el2 => ({ denom: el2.denom, amount: el2.amount })), - ackFee: packet_fee.fee.ack_fee.map(el2 => ({ + ackFee: packet_fee.fee.ack_fee.map?.(el2 => ({ denom: el2.denom, amount: el2.amount })), - timeoutFee: packet_fee.fee.timeout_fee.map(el2 => ({ + timeoutFee: packet_fee.fee.timeout_fee.map?.(el2 => ({ denom: el2.denom, amount: el2.amount })) diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts index fe4e56a9bf..2f5d0fecab 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.ts @@ -1,6 +1,6 @@ import { Fee, FeeSDKType, PacketFee, PacketFeeSDKType } from "./fee"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.fee.v1"; /** MsgRegisterPayee defines the request type for the RegisterPayee rpc */ export interface MsgRegisterPayee { @@ -247,10 +247,10 @@ export const MsgRegisterPayee = { }, toAmino(message: MsgRegisterPayee): MsgRegisterPayeeAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.relayer = omitDefault(message.relayer); - obj.payee = omitDefault(message.payee); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.relayer = message.relayer === "" ? undefined : message.relayer; + obj.payee = message.payee === "" ? undefined : message.payee; return obj; }, fromAminoMsg(object: MsgRegisterPayeeAminoMsg): MsgRegisterPayee { @@ -465,10 +465,10 @@ export const MsgRegisterCounterpartyPayee = { }, toAmino(message: MsgRegisterCounterpartyPayee): MsgRegisterCounterpartyPayeeAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.relayer = omitDefault(message.relayer); - obj.counterparty_payee = omitDefault(message.counterpartyPayee); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.relayer = message.relayer === "" ? undefined : message.relayer; + obj.counterparty_payee = message.counterpartyPayee === "" ? undefined : message.counterpartyPayee; return obj; }, fromAminoMsg(object: MsgRegisterCounterpartyPayeeAminoMsg): MsgRegisterCounterpartyPayee { @@ -706,13 +706,13 @@ export const MsgPayPacketFee = { toAmino(message: MsgPayPacketFee): MsgPayPacketFeeAmino { const obj: any = {}; obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; - obj.source_port_id = omitDefault(message.sourcePortId); - obj.source_channel_id = omitDefault(message.sourceChannelId); - obj.signer = omitDefault(message.signer); + obj.source_port_id = message.sourcePortId === "" ? undefined : message.sourcePortId; + obj.source_channel_id = message.sourceChannelId === "" ? undefined : message.sourceChannelId; + obj.signer = message.signer === "" ? undefined : message.signer; if (message.relayers) { obj.relayers = message.relayers.map(e => e); } else { - obj.relayers = []; + obj.relayers = message.relayers; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts index a581182ccb..dfdf65050f 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/controller.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; /** * Params defines the set of on-chain interchain accounts parameters. @@ -89,7 +89,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.controller_enabled = omitDefault(message.controllerEnabled); + obj.controller_enabled = message.controllerEnabled === false ? undefined : message.controllerEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts index 0ce1b54f99..01691fb2a2 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/query.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType } from "./controller"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; /** QueryInterchainAccountRequest is the request type for the Query/InterchainAccount RPC method. */ export interface QueryInterchainAccountRequest { @@ -134,8 +134,8 @@ export const QueryInterchainAccountRequest = { }, toAmino(message: QueryInterchainAccountRequest): QueryInterchainAccountRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.connection_id = omitDefault(message.connectionId); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryInterchainAccountRequestAminoMsg): QueryInterchainAccountRequest { @@ -229,7 +229,7 @@ export const QueryInterchainAccountResponse = { }, toAmino(message: QueryInterchainAccountResponse): QueryInterchainAccountResponseAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryInterchainAccountResponseAminoMsg): QueryInterchainAccountResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index ce6d02019a..79b7fe4a6b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -77,12 +77,12 @@ export const AminoConverter = { return { owner, connectionId: connection_id, - packetData: { - type: typeFromJSON(packet_data.type), + packetData: packet_data == null ? packet_data : { + type: packet_data.type == null ? packet_data.type : typeFromJSON(packet_data.type), data: packet_data.data, memo: packet_data.memo }, - relativeTimeout: BigInt(relative_timeout) + relativeTimeout: relative_timeout == null ? relative_timeout : BigInt(relative_timeout) }; } } diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts index fcb7c1dac4..5427811a51 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts @@ -1,6 +1,6 @@ import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType } from "../../v1/packet"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.controller.v1"; /** MsgRegisterInterchainAccount defines the payload for Msg/RegisterAccount */ export interface MsgRegisterInterchainAccount { @@ -167,9 +167,9 @@ export const MsgRegisterInterchainAccount = { }, toAmino(message: MsgRegisterInterchainAccount): MsgRegisterInterchainAccountAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.connection_id = omitDefault(message.connectionId); - obj.version = omitDefault(message.version); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: MsgRegisterInterchainAccountAminoMsg): MsgRegisterInterchainAccount { @@ -279,8 +279,8 @@ export const MsgRegisterInterchainAccountResponse = { }, toAmino(message: MsgRegisterInterchainAccountResponse): MsgRegisterInterchainAccountResponseAmino { const obj: any = {}; - obj.channel_id = omitDefault(message.channelId); - obj.port_id = omitDefault(message.portId); + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; return obj; }, fromAminoMsg(object: MsgRegisterInterchainAccountResponseAminoMsg): MsgRegisterInterchainAccountResponse { @@ -422,10 +422,10 @@ export const MsgSendTx = { }, toAmino(message: MsgSendTx): MsgSendTxAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.connection_id = omitDefault(message.connectionId); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.packet_data = message.packetData ? InterchainAccountPacketData.toAmino(message.packetData) : undefined; - obj.relative_timeout = omitDefault(message.relativeTimeout); + obj.relative_timeout = message.relativeTimeout ? message.relativeTimeout.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSendTxAminoMsg): MsgSendTx { @@ -519,7 +519,7 @@ export const MsgSendTxResponse = { }, toAmino(message: MsgSendTxResponse): MsgSendTxResponseAmino { const obj: any = {}; - obj.sequence = omitDefault(message.sequence); + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSendTxResponseAminoMsg): MsgSendTxResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts index c701804b15..2bd4eae1d3 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/genesis/v1/genesis.ts @@ -3,7 +3,7 @@ import { ParamsSDKType as Params1SDKType } from "../../controller/v1/controller" import { Params as Params2 } from "../../host/v1/host"; import { ParamsSDKType as Params2SDKType } from "../../host/v1/host"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.genesis.v1"; /** GenesisState defines the interchain accounts genesis state */ export interface GenesisState { @@ -344,17 +344,17 @@ export const ControllerGenesisState = { if (message.activeChannels) { obj.active_channels = message.activeChannels.map(e => e ? ActiveChannel.toAmino(e) : undefined); } else { - obj.active_channels = []; + obj.active_channels = message.activeChannels; } if (message.interchainAccounts) { obj.interchain_accounts = message.interchainAccounts.map(e => e ? RegisteredInterchainAccount.toAmino(e) : undefined); } else { - obj.interchain_accounts = []; + obj.interchain_accounts = message.interchainAccounts; } if (message.ports) { obj.ports = message.ports.map(e => e); } else { - obj.ports = []; + obj.ports = message.ports; } obj.params = message.params ? Params1.toAmino(message.params) : undefined; return obj; @@ -513,14 +513,14 @@ export const HostGenesisState = { if (message.activeChannels) { obj.active_channels = message.activeChannels.map(e => e ? ActiveChannel.toAmino(e) : undefined); } else { - obj.active_channels = []; + obj.active_channels = message.activeChannels; } if (message.interchainAccounts) { obj.interchain_accounts = message.interchainAccounts.map(e => e ? RegisteredInterchainAccount.toAmino(e) : undefined); } else { - obj.interchain_accounts = []; + obj.interchain_accounts = message.interchainAccounts; } - obj.port = omitDefault(message.port); + obj.port = message.port === "" ? undefined : message.port; obj.params = message.params ? Params2.toAmino(message.params) : undefined; return obj; }, @@ -663,10 +663,10 @@ export const ActiveChannel = { }, toAmino(message: ActiveChannel): ActiveChannelAmino { const obj: any = {}; - obj.connection_id = omitDefault(message.connectionId); - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.is_middleware_enabled = omitDefault(message.isMiddlewareEnabled); + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.is_middleware_enabled = message.isMiddlewareEnabled === false ? undefined : message.isMiddlewareEnabled; return obj; }, fromAminoMsg(object: ActiveChannelAminoMsg): ActiveChannel { @@ -792,9 +792,9 @@ export const RegisteredInterchainAccount = { }, toAmino(message: RegisteredInterchainAccount): RegisteredInterchainAccountAmino { const obj: any = {}; - obj.connection_id = omitDefault(message.connectionId); - obj.port_id = omitDefault(message.portId); - obj.account_address = omitDefault(message.accountAddress); + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; return obj; }, fromAminoMsg(object: RegisteredInterchainAccountAminoMsg): RegisteredInterchainAccount { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts index 14ab1c834e..818d23bf26 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/host/v1/host.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.host.v1"; /** * Params defines the set of on-chain interchain accounts parameters. @@ -114,11 +114,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.host_enabled = omitDefault(message.hostEnabled); + obj.host_enabled = message.hostEnabled === false ? undefined : message.hostEnabled; if (message.allowMessages) { obj.allow_messages = message.allowMessages.map(e => e); } else { - obj.allow_messages = []; + obj.allow_messages = message.allowMessages; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts index c72a293704..5393bc1bbc 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/account.ts @@ -1,6 +1,6 @@ import { BaseAccount, BaseAccountSDKType } from "../../../../cosmos/auth/v1beta1/auth"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.v1"; /** An InterchainAccount is defined as a BaseAccount & the address of the account owner on the controller chain */ export interface InterchainAccount { @@ -102,7 +102,7 @@ export const InterchainAccount = { toAmino(message: InterchainAccount): InterchainAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.account_owner = omitDefault(message.accountOwner); + obj.account_owner = message.accountOwner === "" ? undefined : message.accountOwner; return obj; }, fromAminoMsg(object: InterchainAccountAminoMsg): InterchainAccount { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts index 4e893a05b6..cfaf45769a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/metadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.interchain_accounts.v1"; /** * Metadata defines a set of protocol specific data encoded into the ICS27 channel version bytestring @@ -187,12 +187,12 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.version = omitDefault(message.version); - obj.controller_connection_id = omitDefault(message.controllerConnectionId); - obj.host_connection_id = omitDefault(message.hostConnectionId); - obj.address = omitDefault(message.address); - obj.encoding = omitDefault(message.encoding); - obj.tx_type = omitDefault(message.txType); + obj.version = message.version === "" ? undefined : message.version; + obj.controller_connection_id = message.controllerConnectionId === "" ? undefined : message.controllerConnectionId; + obj.host_connection_id = message.hostConnectionId === "" ? undefined : message.hostConnectionId; + obj.address = message.address === "" ? undefined : message.address; + obj.encoding = message.encoding === "" ? undefined : message.encoding; + obj.tx_type = message.txType === "" ? undefined : message.txType; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts index b334ddb777..795036fb32 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/v1/packet.ts @@ -156,7 +156,7 @@ export const InterchainAccountPacketData = { fromAmino(object: InterchainAccountPacketDataAmino): InterchainAccountPacketData { const message = createBaseInterchainAccountPacketData(); if (object.type !== undefined && object.type !== null) { - message.type = typeFromJSON(object.type); + message.type = object.type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -168,9 +168,9 @@ export const InterchainAccountPacketData = { }, toAmino(message: InterchainAccountPacketData): InterchainAccountPacketDataAmino { const obj: any = {}; - obj.type = typeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; return obj; }, fromAminoMsg(object: InterchainAccountPacketDataAminoMsg): InterchainAccountPacketData { @@ -273,7 +273,7 @@ export const CosmosTx = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts index 0f947b7e4b..b30e6e69d7 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/authz.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** Allocation defines the spend limit for a particular port and channel */ export interface Allocation { @@ -172,17 +172,17 @@ export const Allocation = { }, toAmino(message: Allocation): AllocationAmino { const obj: any = {}; - obj.source_port = omitDefault(message.sourcePort); - obj.source_channel = omitDefault(message.sourceChannel); + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } if (message.allowList) { obj.allow_list = message.allowList.map(e => e); } else { - obj.allow_list = []; + obj.allow_list = message.allowList; } return obj; }, @@ -286,7 +286,7 @@ export const TransferAuthorization = { if (message.allocations) { obj.allocations = message.allocations.map(e => e ? Allocation.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts index dbdda877d7..0d52808a1d 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -125,11 +125,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); + obj.port_id = message.portId === "" ? undefined : message.portId; if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts index 256873b189..9a66d4f0a4 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -172,7 +172,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = omitDefault(message.hash); + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { @@ -479,7 +479,7 @@ export const QueryDenomTracesResponse = { if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts index aebf5dedcb..b8c72af2b3 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -143,8 +143,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.base_denom = omitDefault(message.baseDenom); + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -254,8 +254,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = omitDefault(message.sendEnabled); - obj.receive_enabled = omitDefault(message.receiveEnabled); + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts index 3f350560f0..9a150e19d7 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: { + token: token == null ? token : { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: BigInt(timeout_height.revision_height || "0"), revisionNumber: BigInt(timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(timeout_timestamp) + timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : BigInt(timeout_timestamp) }; } } diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts index fe318bd9e6..5087670a8d 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -221,13 +221,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = omitDefault(message.sourcePort); - obj.source_channel = omitDefault(message.sourceChannel); + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); + obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts index eac665927f..5edc323bdf 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -148,10 +148,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts index e3633ca95f..18c02caad9 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts @@ -425,10 +425,10 @@ export const Channel = { fromAmino(object: ChannelAmino): Channel { const message = createBaseChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -441,15 +441,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -623,10 +623,10 @@ export const IdentifiedChannel = { fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { const message = createBaseIdentifiedChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -645,17 +645,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -765,8 +765,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -973,10 +973,10 @@ export const Packet = { toAmino(message: Packet): PacketAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; @@ -1121,8 +1121,8 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1235,7 +1235,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result ? base64FromBytes(message.result) : undefined; - obj.error = message.error; + obj.error = message.error === null ? undefined : message.error; return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts index 31d257768b..1b622838c5 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -277,39 +277,39 @@ export const GenesisState = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } if (message.receipts) { obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.receipts = []; + obj.receipts = message.receipts; } if (message.sendSequences) { obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.send_sequences = []; + obj.send_sequences = message.sendSequences; } if (message.recvSequences) { obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.recv_sequences = []; + obj.recv_sequences = message.recvSequences; } if (message.ackSequences) { obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.ack_sequences = []; + obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = omitDefault(message.nextChannelSequence); + obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -435,9 +435,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.sequence = omitDefault(message.sequence); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts index 29eb38ee06..0de63dd02b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts @@ -713,8 +713,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1071,7 +1071,7 @@ export const QueryChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1184,7 +1184,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = message.connection === "" ? undefined : message.connection; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1320,7 +1320,7 @@ export const QueryConnectionChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1433,8 +1433,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -1704,8 +1704,8 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1850,7 +1850,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -1978,8 +1978,8 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2234,8 +2234,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2371,7 +2371,7 @@ export const QueryPacketCommitmentsResponse = { if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -2500,8 +2500,8 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2628,7 +2628,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = message.received === false ? undefined : message.received; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2756,8 +2756,8 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -3043,13 +3043,13 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3185,7 +3185,7 @@ export const QueryPacketAcknowledgementsResponse = { if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -3329,12 +3329,12 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3463,7 +3463,7 @@ export const QueryUnreceivedPacketsResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3606,12 +3606,12 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { - obj.packet_ack_sequences = []; + obj.packet_ack_sequences = message.packetAckSequences; } return obj; }, @@ -3740,7 +3740,7 @@ export const QueryUnreceivedAcksResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3852,8 +3852,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts index 70454ca48a..2ff50c2822 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: BigInt(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), signer }; } @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: BigInt(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), signer }; } @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts index 8c049fb2d5..6d135de26a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts @@ -436,9 +436,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -701,13 +701,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -970,13 +970,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1207,11 +1207,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1410,9 +1410,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1643,11 +1643,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1865,7 +1865,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -2100,7 +2100,7 @@ export const MsgTimeout = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2352,7 +2352,7 @@ export const MsgTimeoutOnClose = { obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2587,7 +2587,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts index 0e91880b41..611b20bf1c 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -272,7 +272,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -500,11 +500,11 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } return obj; }, @@ -647,10 +647,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.subject_client_id = omitDefault(message.subjectClientId); - obj.substitute_client_id = omitDefault(message.substituteClientId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -792,8 +792,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -901,8 +901,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { @@ -1005,7 +1005,7 @@ export const Params = { if (message.allowedClients) { obj.allowed_clients = message.allowedClients.map(e => e); } else { - obj.allowed_clients = []; + obj.allowed_clients = message.allowedClients; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts index 22a7887064..2ac904b685 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -241,21 +241,21 @@ export const GenesisState = { if (message.clients) { obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.clients = []; + obj.clients = message.clients; } if (message.clientsConsensus) { obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); } else { - obj.clients_consensus = []; + obj.clients_consensus = message.clientsConsensus; } if (message.clientsMetadata) { obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); } else { - obj.clients_metadata = []; + obj.clients_metadata = message.clientsMetadata; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = omitDefault(message.createLocalhost); - obj.next_client_sequence = omitDefault(message.nextClientSequence); + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; + obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -482,11 +482,11 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { - obj.client_metadata = []; + obj.client_metadata = message.clientMetadata; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts index 51040577ae..b1c24ef0eb 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -398,7 +398,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -739,7 +739,7 @@ export const QueryClientStatesResponse = { if (message.clientStates) { obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.client_states = []; + obj.client_states = message.clientStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -883,10 +883,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); - obj.latest_height = omitDefault(message.latestHeight); + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1124,7 +1124,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1244,7 +1244,7 @@ export const QueryConsensusStatesResponse = { if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1340,7 +1340,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1434,7 +1434,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = omitDefault(message.status); + obj.status = message.status === "" ? undefined : message.status; return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts index da58249ba9..4d5ea3aac3 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts @@ -81,11 +81,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -116,7 +116,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: { + header: header == null ? header : { typeUrl: header.type_url, value: header.value }, @@ -159,11 +159,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -196,7 +196,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: { + misbehaviour: misbehaviour == null ? misbehaviour : { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts index a8e1070cd2..d0c0c67c1b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.ts @@ -252,7 +252,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -451,9 +451,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -700,12 +700,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -904,9 +904,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputosmojs/ibc/core/commitment/v1/commitment.ts index b5dbf998d5..dcb3d37f40 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/commitment/v1/commitment.ts @@ -350,7 +350,7 @@ export const MerklePath = { if (message.keyPath) { obj.key_path = message.keyPath.map(e => e); } else { - obj.key_path = []; + obj.key_path = message.keyPath; } return obj; }, @@ -454,7 +454,7 @@ export const MerkleProof = { if (message.proofs) { obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); } else { - obj.proofs = []; + obj.proofs = message.proofs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts index 3cba14c7bd..452b71da45 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts @@ -355,7 +355,7 @@ export const ConnectionEnd = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -367,13 +367,13 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -543,7 +543,7 @@ export const IdentifiedConnection = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -555,14 +555,14 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -690,8 +690,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -795,7 +795,7 @@ export const ClientPaths = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -912,11 +912,11 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -1033,11 +1033,11 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; if (message.features) { obj.features = message.features.map(e => e); } else { - obj.features = []; + obj.features = message.features; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts index 41fd016bfd..fc225ca31b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -153,14 +153,14 @@ export const GenesisState = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } if (message.clientConnectionPaths) { obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); } else { - obj.client_connection_paths = []; + obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); + obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts index 24551eefb0..e0641a40c2 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts @@ -302,7 +302,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -659,7 +659,7 @@ export const QueryConnectionsResponse = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -756,7 +756,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -891,7 +891,7 @@ export const QueryClientConnectionsResponse = { if (message.connectionPaths) { obj.connection_paths = message.connectionPaths.map(e => e); } else { - obj.connection_paths = []; + obj.connection_paths = message.connectionPaths; } obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -988,7 +988,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1242,7 +1242,7 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1387,7 +1387,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 0684a87c34..01fe9e5e6a 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - delayPeriod: BigInt(delay_period), + delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), signer }; } @@ -201,19 +201,19 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: BigInt(delay_period), - counterpartyVersions: counterparty_versions.map(el0 => ({ + delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + counterpartyVersions: counterparty_versions.map?.(el0 => ({ identifier: el0.identifier, features: el0.features })), @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts index 3d29493cd2..8384d8fb83 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts @@ -324,11 +324,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -677,22 +677,22 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.counterparty_versions = []; + obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -1003,8 +1003,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1012,7 +1012,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1227,10 +1227,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts index 8b74c3a886..15c9cc17af 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/port/v1/query.ts @@ -164,7 +164,7 @@ export const QueryAppVersionRequest = { message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -176,11 +176,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -290,8 +290,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts index ed4e6712fd..df2e455eba 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -109,7 +109,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = omitDefault(message.chainId); + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts index 5539614a78..3d3a0708e2 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts @@ -556,7 +556,7 @@ export const ClientState = { obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -683,7 +683,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -846,7 +846,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -988,7 +988,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1121,7 +1121,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1134,7 +1134,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1396,7 +1396,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1407,8 +1407,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1520,7 +1520,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts index af8132793a..744cf6fb1b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts @@ -554,9 +554,9 @@ export const ClientState = { toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -683,7 +683,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -846,7 +846,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -988,7 +988,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1121,7 +1121,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1134,7 +1134,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1396,7 +1396,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1407,8 +1407,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1520,7 +1520,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts index 4d1c8113b3..2a815fcc94 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts @@ -283,7 +283,7 @@ export const ClientState = { toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; return obj; }, @@ -411,7 +411,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -557,7 +557,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1101,7 +1101,7 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.path = message.path ? base64FromBytes(message.path) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1214,7 +1214,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts index 800b54f3fc..78de32c375 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts @@ -420,7 +420,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -430,15 +430,15 @@ export const ClientState = { if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -692,7 +692,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts b/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts index f09160c276..8adf537d47 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/accum/v1beta1/accum.ts @@ -131,9 +131,9 @@ export const AccumulatorContent = { if (message.accumValue) { obj.accum_value = message.accumValue.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.accum_value = []; + obj.accum_value = message.accumValue; } - obj.total_shares = padDecimal(message.totalShares); + obj.total_shares = padDecimal(message.totalShares) === "" ? undefined : padDecimal(message.totalShares); return obj; }, fromAminoMsg(object: AccumulatorContentAminoMsg): AccumulatorContent { @@ -360,16 +360,16 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.num_shares = padDecimal(message.numShares); + obj.num_shares = padDecimal(message.numShares) === "" ? undefined : padDecimal(message.numShares); if (message.initAccumValue) { obj.init_accum_value = message.initAccumValue.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.init_accum_value = []; + obj.init_accum_value = message.initAccumValue; } if (message.unclaimedRewards) { obj.unclaimed_rewards = message.unclaimedRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.unclaimed_rewards = []; + obj.unclaimed_rewards = message.unclaimedRewards; } obj.options = message.options ? Options.toAmino(message.options) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts index 854eac3dcb..952b6e0de0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -189,16 +189,16 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_claimable_amount = []; + obj.initial_claimable_amount = message.initialClaimableAmount; } if (message.actionCompleted) { obj.action_completed = message.actionCompleted.map(e => e); } else { - obj.action_completed = []; + obj.action_completed = message.actionCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/genesis.ts index 8edd18bc55..a052f4eef6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/genesis.ts @@ -135,7 +135,7 @@ export const GenesisState = { if (message.claimRecords) { obj.claim_records = message.claimRecords.map(e => e ? ClaimRecord.toAmino(e) : undefined); } else { - obj.claim_records = []; + obj.claim_records = message.claimRecords; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts index 5c1b0f5437..496eaecee8 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/params.ts @@ -142,7 +142,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = message.claimDenom === "" ? undefined : message.claimDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts index fe8c5bf1f7..c6a484e2b8 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/claim/v1beta1/query.ts @@ -259,7 +259,7 @@ export const QueryModuleAccountBalanceResponse = { if (message.moduleAccountBalance) { obj.moduleAccountBalance = message.moduleAccountBalance.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.moduleAccountBalance = []; + obj.moduleAccountBalance = message.moduleAccountBalance; } return obj; }, @@ -521,7 +521,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -719,14 +719,14 @@ export const QueryClaimableForActionRequest = { message.address = object.address; } if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } return message; }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = actionToJSON(message.action); + obj.address = message.address === "" ? undefined : message.address; + obj.action = message.action === 0 ? undefined : message.action; return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -829,7 +829,7 @@ export const QueryClaimableForActionResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -924,7 +924,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { @@ -1027,7 +1027,7 @@ export const QueryTotalClaimableResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts index 976e6e0cee..53631ce3d7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts @@ -5,7 +5,7 @@ import { Params, ParamsSDKType } from "./params"; import { Position, PositionSDKType } from "./position"; import { AccumulatorContent, AccumulatorContentSDKType } from "../accum/v1beta1/accum"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** * FullTick contains tick index and pool id along with other tick model @@ -195,8 +195,8 @@ export const FullTick = { }, toAmino(message: FullTick): FullTickAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.tick_index = omitDefault(message.tickIndex); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.tick_index = message.tickIndex ? message.tickIndex.toString() : undefined; obj.info = message.info ? TickInfo.toAmino(message.info) : undefined; return obj; }, @@ -377,18 +377,18 @@ export const PoolData = { if (message.ticks) { obj.ticks = message.ticks.map(e => e ? FullTick.toAmino(e) : undefined); } else { - obj.ticks = []; + obj.ticks = message.ticks; } obj.fee_accumulator = message.feeAccumulator ? AccumObject.toAmino(message.feeAccumulator) : undefined; if (message.incentivesAccumulators) { obj.incentives_accumulators = message.incentivesAccumulators.map(e => e ? AccumObject.toAmino(e) : undefined); } else { - obj.incentives_accumulators = []; + obj.incentives_accumulators = message.incentivesAccumulators; } if (message.incentiveRecords) { obj.incentive_records = message.incentiveRecords.map(e => e ? IncentiveRecord.toAmino(e) : undefined); } else { - obj.incentive_records = []; + obj.incentive_records = message.incentiveRecords; } return obj; }, @@ -547,14 +547,14 @@ export const GenesisState = { if (message.poolData) { obj.pool_data = message.poolData.map(e => e ? PoolData.toAmino(e) : undefined); } else { - obj.pool_data = []; + obj.pool_data = message.poolData; } if (message.positions) { obj.positions = message.positions.map(e => e ? Position.toAmino(e) : undefined); } else { - obj.positions = []; + obj.positions = message.positions; } - obj.next_position_id = omitDefault(message.nextPositionId); + obj.next_position_id = message.nextPositionId ? message.nextPositionId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -664,7 +664,7 @@ export const AccumObject = { }, toAmino(message: AccumObject): AccumObjectAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.accum_content = message.accumContent ? AccumulatorContent.toAmino(message.accumContent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts index b834432bfa..b0e02f74c4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** @@ -208,8 +208,8 @@ export const IncentiveRecord = { toAmino(message: IncentiveRecord): IncentiveRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.incentive_denom = message.incentiveDenom; - obj.incentive_creator_addr = message.incentiveCreatorAddr; + obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; + obj.incentive_creator_addr = message.incentiveCreatorAddr === "" ? undefined : message.incentiveCreatorAddr; obj.incentive_record_body = message.incentiveRecordBody ? IncentiveRecordBody.toAmino(message.incentiveRecordBody) : undefined; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -337,8 +337,8 @@ export const IncentiveRecordBody = { }, toAmino(message: IncentiveRecordBody): IncentiveRecordBodyAmino { const obj: any = {}; - obj.remaining_amount = message.remainingAmount; - obj.emission_rate = message.emissionRate; + obj.remaining_amount = padDecimal(message.remainingAmount) === "" ? undefined : padDecimal(message.remainingAmount); + obj.emission_rate = padDecimal(message.emissionRate) === "" ? undefined : padDecimal(message.emissionRate); obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts index 917cc3c33d..2c08b3f9ef 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/params.ts @@ -129,12 +129,12 @@ export const Params = { if (message.authorizedTickSpacing) { obj.authorized_tick_spacing = message.authorizedTickSpacing.map(e => e.toString()); } else { - obj.authorized_tick_spacing = []; + obj.authorized_tick_spacing = message.authorizedTickSpacing; } if (message.authorizedSwapFees) { obj.authorized_swap_fees = message.authorizedSwapFees.map(e => e); } else { - obj.authorized_swap_fees = []; + obj.authorized_swap_fees = message.authorizedSwapFees; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts index a3d62cd2fb..6517ebfaf6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "../params"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** =============================== UserPositions */ @@ -284,8 +284,8 @@ export const QueryUserPositionsRequest = { }, toAmino(message: QueryUserPositionsRequest): QueryUserPositionsRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.pool_id = omitDefault(message.poolId); + obj.address = message.address === "" ? undefined : message.address; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUserPositionsRequestAminoMsg): QueryUserPositionsRequest { @@ -388,7 +388,7 @@ export const QueryUserPositionsResponse = { if (message.positions) { obj.positions = message.positions.map(e => e ? PositionWithUnderlyingAssetBreakdown.toAmino(e) : undefined); } else { - obj.positions = []; + obj.positions = message.positions; } return obj; }, @@ -483,7 +483,7 @@ export const QueryPositionByIdRequest = { }, toAmino(message: QueryPositionByIdRequest): QueryPositionByIdRequestAmino { const obj: any = {}; - obj.position_id = omitDefault(message.positionId); + obj.position_id = message.positionId ? message.positionId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPositionByIdRequestAminoMsg): QueryPositionByIdRequest { @@ -790,7 +790,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1069,8 +1069,8 @@ export const TickLiquidityNet = { }, toAmino(message: TickLiquidityNet): TickLiquidityNetAmino { const obj: any = {}; - obj.liquidity_net = padDecimal(message.liquidityNet); - obj.tick_index = omitDefault(message.tickIndex); + obj.liquidity_net = padDecimal(message.liquidityNet) === "" ? undefined : padDecimal(message.liquidityNet); + obj.tick_index = message.tickIndex === "" ? undefined : message.tickIndex; return obj; }, fromAminoMsg(object: TickLiquidityNetAminoMsg): TickLiquidityNet { @@ -1196,9 +1196,9 @@ export const LiquidityDepthWithRange = { }, toAmino(message: LiquidityDepthWithRange): LiquidityDepthWithRangeAmino { const obj: any = {}; - obj.liquidity_amount = padDecimal(message.liquidityAmount); - obj.lower_tick = omitDefault(message.lowerTick); - obj.upper_tick = omitDefault(message.upperTick); + obj.liquidity_amount = padDecimal(message.liquidityAmount) === "" ? undefined : padDecimal(message.liquidityAmount); + obj.lower_tick = message.lowerTick === "" ? undefined : message.lowerTick; + obj.upper_tick = message.upperTick === "" ? undefined : message.upperTick; return obj; }, fromAminoMsg(object: LiquidityDepthWithRangeAminoMsg): LiquidityDepthWithRange { @@ -1340,10 +1340,10 @@ export const QueryLiquidityNetInDirectionRequest = { }, toAmino(message: QueryLiquidityNetInDirectionRequest): QueryLiquidityNetInDirectionRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in = omitDefault(message.tokenIn); - obj.start_tick = omitDefault(message.startTick); - obj.bound_tick = omitDefault(message.boundTick); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; + obj.start_tick = message.startTick === null ? undefined : message.startTick; + obj.bound_tick = message.boundTick === null ? undefined : message.boundTick; return obj; }, fromAminoMsg(object: QueryLiquidityNetInDirectionRequestAminoMsg): QueryLiquidityNetInDirectionRequest { @@ -1478,10 +1478,10 @@ export const QueryLiquidityNetInDirectionResponse = { if (message.liquidityDepths) { obj.liquidity_depths = message.liquidityDepths.map(e => e ? TickLiquidityNet.toAmino(e) : undefined); } else { - obj.liquidity_depths = []; + obj.liquidity_depths = message.liquidityDepths; } - obj.current_tick = omitDefault(message.currentTick); - obj.current_liquidity = padDecimal(message.currentLiquidity); + obj.current_tick = message.currentTick ? message.currentTick.toString() : undefined; + obj.current_liquidity = padDecimal(message.currentLiquidity) === "" ? undefined : padDecimal(message.currentLiquidity); return obj; }, fromAminoMsg(object: QueryLiquidityNetInDirectionResponseAminoMsg): QueryLiquidityNetInDirectionResponse { @@ -1575,7 +1575,7 @@ export const QueryTotalLiquidityForRangeRequest = { }, toAmino(message: QueryTotalLiquidityForRangeRequest): QueryTotalLiquidityForRangeRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalLiquidityForRangeRequestAminoMsg): QueryTotalLiquidityForRangeRequest { @@ -1678,7 +1678,7 @@ export const QueryTotalLiquidityForRangeResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? LiquidityDepthWithRange.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -1773,7 +1773,7 @@ export const QueryClaimableFeesRequest = { }, toAmino(message: QueryClaimableFeesRequest): QueryClaimableFeesRequestAmino { const obj: any = {}; - obj.position_id = omitDefault(message.positionId); + obj.position_id = message.positionId ? message.positionId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryClaimableFeesRequestAminoMsg): QueryClaimableFeesRequest { @@ -1876,7 +1876,7 @@ export const QueryClaimableFeesResponse = { if (message.claimableFees) { obj.claimable_fees = message.claimableFees.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.claimable_fees = []; + obj.claimable_fees = message.claimableFees; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts index a4178af544..4d3bcd1b5e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** ===================== MsgCreateConcentratedPool */ export interface MsgCreateConcentratedPool { @@ -185,12 +185,12 @@ export const MsgCreateConcentratedPool = { }, toAmino(message: MsgCreateConcentratedPool): MsgCreateConcentratedPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.denom0 = omitDefault(message.denom0); - obj.denom1 = omitDefault(message.denom1); - obj.tick_spacing = omitDefault(message.tickSpacing); - obj.exponent_at_price_one = omitDefault(message.exponentAtPriceOne); - obj.swap_fee = padDecimal(message.swapFee); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom0 = message.denom0 === "" ? undefined : message.denom0; + obj.denom1 = message.denom1 === "" ? undefined : message.denom1; + obj.tick_spacing = message.tickSpacing ? message.tickSpacing.toString() : undefined; + obj.exponent_at_price_one = message.exponentAtPriceOne === "" ? undefined : message.exponentAtPriceOne; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); return obj; }, fromAminoMsg(object: MsgCreateConcentratedPoolAminoMsg): MsgCreateConcentratedPool { @@ -284,7 +284,7 @@ export const MsgCreateConcentratedPoolResponse = { }, toAmino(message: MsgCreateConcentratedPoolResponse): MsgCreateConcentratedPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateConcentratedPoolResponseAminoMsg): MsgCreateConcentratedPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts index 118ad3bb25..be3fd5bb5d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; export interface Pool { /** pool's address holding all liquidity tokens. */ @@ -292,17 +292,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; - obj.incentives_address = message.incentivesAddress; + obj.address = message.address === "" ? undefined : message.address; + obj.incentives_address = message.incentivesAddress === "" ? undefined : message.incentivesAddress; obj.id = message.id ? message.id.toString() : undefined; - obj.current_tick_liquidity = message.currentTickLiquidity; - obj.token0 = message.token0; - obj.token1 = message.token1; - obj.current_sqrt_price = message.currentSqrtPrice; - obj.current_tick = message.currentTick; + obj.current_tick_liquidity = padDecimal(message.currentTickLiquidity) === "" ? undefined : padDecimal(message.currentTickLiquidity); + obj.token0 = message.token0 === "" ? undefined : message.token0; + obj.token1 = message.token1 === "" ? undefined : message.token1; + obj.current_sqrt_price = padDecimal(message.currentSqrtPrice) === "" ? undefined : padDecimal(message.currentSqrtPrice); + obj.current_tick = message.currentTick === "" ? undefined : message.currentTick; obj.tick_spacing = message.tickSpacing ? message.tickSpacing.toString() : undefined; - obj.exponent_at_price_one = message.exponentAtPriceOne; - obj.swap_fee = message.swapFee; + obj.exponent_at_price_one = message.exponentAtPriceOne === "" ? undefined : message.exponentAtPriceOne; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); obj.last_liquidity_update = message.lastLiquidityUpdate ? Timestamp.toAmino(toTimestamp(message.lastLiquidityUpdate)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts index 57dac2422e..87649428d6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** @@ -214,12 +214,12 @@ export const Position = { toAmino(message: Position): PositionAmino { const obj: any = {}; obj.position_id = message.positionId ? message.positionId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.lower_tick = message.lowerTick ? message.lowerTick.toString() : undefined; obj.upper_tick = message.upperTick ? message.upperTick.toString() : undefined; obj.join_time = message.joinTime ? Timestamp.toAmino(toTimestamp(message.joinTime)) : undefined; - obj.liquidity = message.liquidity; + obj.liquidity = padDecimal(message.liquidity) === "" ? undefined : padDecimal(message.liquidity); return obj; }, fromAminoMsg(object: PositionAminoMsg): Position { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts index d9a8e2c7d1..1a67fa2f25 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tickInfo.ts @@ -158,17 +158,17 @@ export const TickInfo = { }, toAmino(message: TickInfo): TickInfoAmino { const obj: any = {}; - obj.liquidity_gross = padDecimal(message.liquidityGross); - obj.liquidity_net = padDecimal(message.liquidityNet); + obj.liquidity_gross = padDecimal(message.liquidityGross) === "" ? undefined : padDecimal(message.liquidityGross); + obj.liquidity_net = padDecimal(message.liquidityNet) === "" ? undefined : padDecimal(message.liquidityNet); if (message.feeGrowthOutside) { obj.fee_growth_outside = message.feeGrowthOutside.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.fee_growth_outside = []; + obj.fee_growth_outside = message.feeGrowthOutside; } if (message.uptimeTrackers) { obj.uptime_trackers = message.uptimeTrackers.map(e => e ? UptimeTracker.toAmino(e) : undefined); } else { - obj.uptime_trackers = []; + obj.uptime_trackers = message.uptimeTrackers; } return obj; }, @@ -272,7 +272,7 @@ export const UptimeTracker = { if (message.uptimeGrowthOutside) { obj.uptime_growth_outside = message.uptimeGrowthOutside.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.uptime_growth_outside = []; + obj.uptime_growth_outside = message.uptimeGrowthOutside; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index ef32c9b57f..1cae4bdd54 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -94,15 +94,15 @@ export const AminoConverter = { token_min_amount1 }: MsgCreatePositionAminoType["value"]): MsgCreatePosition => { return { - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), sender, - lowerTick: BigInt(lower_tick), - upperTick: BigInt(upper_tick), - tokenDesired0: { + lowerTick: lower_tick == null ? lower_tick : BigInt(lower_tick), + upperTick: upper_tick == null ? upper_tick : BigInt(upper_tick), + tokenDesired0: token_desired0 == null ? token_desired0 : { denom: token_desired0.denom, amount: token_desired0.amount }, - tokenDesired1: { + tokenDesired1: token_desired1 == null ? token_desired1 : { denom: token_desired1.denom, amount: token_desired1.amount }, @@ -130,7 +130,7 @@ export const AminoConverter = { liquidity_amount }: MsgWithdrawPositionAminoType["value"]): MsgWithdrawPosition => { return { - positionId: BigInt(position_id), + positionId: position_id == null ? position_id : BigInt(position_id), sender, liquidityAmount: liquidity_amount }; @@ -152,7 +152,7 @@ export const AminoConverter = { sender }: MsgCollectFeesAminoType["value"]): MsgCollectFees => { return { - positionIds: position_ids.map(el0 => BigInt(el0)), + positionIds: position_ids.map?.(el0 => BigInt(el0)), sender }; } @@ -173,7 +173,7 @@ export const AminoConverter = { sender }: MsgCollectIncentivesAminoType["value"]): MsgCollectIncentives => { return { - positionIds: position_ids.map(el0 => BigInt(el0)), + positionIds: position_ids.map?.(el0 => BigInt(el0)), sender }; } @@ -194,7 +194,7 @@ export const AminoConverter = { sender }: MsgFungifyChargedPositionsAminoType["value"]): MsgFungifyChargedPositions => { return { - positionIds: position_ids.map(el0 => BigInt(el0)), + positionIds: position_ids.map?.(el0 => BigInt(el0)), sender }; } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts index 3e431df2d5..31306b0807 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, toTimestamp, fromTimestamp, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.concentratedliquidity.v1beta1"; /** ===================== MsgCreatePosition */ @@ -373,13 +373,13 @@ export const MsgCreatePosition = { toAmino(message: MsgCreatePosition): MsgCreatePositionAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lower_tick = message.lowerTick ? message.lowerTick.toString() : undefined; obj.upper_tick = message.upperTick ? message.upperTick.toString() : undefined; obj.token_desired0 = message.tokenDesired0 ? Coin.toAmino(message.tokenDesired0) : undefined; obj.token_desired1 = message.tokenDesired1 ? Coin.toAmino(message.tokenDesired1) : undefined; - obj.token_min_amount0 = message.tokenMinAmount0; - obj.token_min_amount1 = message.tokenMinAmount1; + obj.token_min_amount0 = message.tokenMinAmount0 === "" ? undefined : message.tokenMinAmount0; + obj.token_min_amount1 = message.tokenMinAmount1 === "" ? undefined : message.tokenMinAmount1; return obj; }, fromAminoMsg(object: MsgCreatePositionAminoMsg): MsgCreatePosition { @@ -538,10 +538,10 @@ export const MsgCreatePositionResponse = { toAmino(message: MsgCreatePositionResponse): MsgCreatePositionResponseAmino { const obj: any = {}; obj.position_id = message.positionId ? message.positionId.toString() : undefined; - obj.amount0 = message.amount0; - obj.amount1 = message.amount1; + obj.amount0 = message.amount0 === "" ? undefined : message.amount0; + obj.amount1 = message.amount1 === "" ? undefined : message.amount1; obj.join_time = message.joinTime ? Timestamp.toAmino(toTimestamp(message.joinTime)) : undefined; - obj.liquidity_created = message.liquidityCreated; + obj.liquidity_created = padDecimal(message.liquidityCreated) === "" ? undefined : padDecimal(message.liquidityCreated); return obj; }, fromAminoMsg(object: MsgCreatePositionResponseAminoMsg): MsgCreatePositionResponse { @@ -668,8 +668,8 @@ export const MsgWithdrawPosition = { toAmino(message: MsgWithdrawPosition): MsgWithdrawPositionAmino { const obj: any = {}; obj.position_id = message.positionId ? message.positionId.toString() : undefined; - obj.sender = message.sender; - obj.liquidity_amount = message.liquidityAmount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.liquidity_amount = padDecimal(message.liquidityAmount) === "" ? undefined : padDecimal(message.liquidityAmount); return obj; }, fromAminoMsg(object: MsgWithdrawPositionAminoMsg): MsgWithdrawPosition { @@ -779,8 +779,8 @@ export const MsgWithdrawPositionResponse = { }, toAmino(message: MsgWithdrawPositionResponse): MsgWithdrawPositionResponseAmino { const obj: any = {}; - obj.amount0 = message.amount0; - obj.amount1 = message.amount1; + obj.amount0 = message.amount0 === "" ? undefined : message.amount0; + obj.amount1 = message.amount1 === "" ? undefined : message.amount1; return obj; }, fromAminoMsg(object: MsgWithdrawPositionResponseAminoMsg): MsgWithdrawPositionResponse { @@ -908,9 +908,9 @@ export const MsgCollectFees = { if (message.positionIds) { obj.position_ids = message.positionIds.map(e => e.toString()); } else { - obj.position_ids = []; + obj.position_ids = message.positionIds; } - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgCollectFeesAminoMsg): MsgCollectFees { @@ -1013,7 +1013,7 @@ export const MsgCollectFeesResponse = { if (message.collectedFees) { obj.collected_fees = message.collectedFees.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.collected_fees = []; + obj.collected_fees = message.collectedFees; } return obj; }, @@ -1142,9 +1142,9 @@ export const MsgCollectIncentives = { if (message.positionIds) { obj.position_ids = message.positionIds.map(e => e.toString()); } else { - obj.position_ids = []; + obj.position_ids = message.positionIds; } - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgCollectIncentivesAminoMsg): MsgCollectIncentives { @@ -1247,7 +1247,7 @@ export const MsgCollectIncentivesResponse = { if (message.collectedIncentives) { obj.collected_incentives = message.collectedIncentives.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.collected_incentives = []; + obj.collected_incentives = message.collectedIncentives; } return obj; }, @@ -1439,10 +1439,10 @@ export const MsgCreateIncentive = { toAmino(message: MsgCreateIncentive): MsgCreateIncentiveAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.sender = message.sender; - obj.incentive_denom = message.incentiveDenom; - obj.incentive_amount = message.incentiveAmount; - obj.emission_rate = message.emissionRate; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; + obj.incentive_amount = message.incentiveAmount === "" ? undefined : message.incentiveAmount; + obj.emission_rate = padDecimal(message.emissionRate) === "" ? undefined : padDecimal(message.emissionRate); obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -1602,9 +1602,9 @@ export const MsgCreateIncentiveResponse = { }, toAmino(message: MsgCreateIncentiveResponse): MsgCreateIncentiveResponseAmino { const obj: any = {}; - obj.incentive_denom = message.incentiveDenom; - obj.incentive_amount = message.incentiveAmount; - obj.emission_rate = message.emissionRate; + obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; + obj.incentive_amount = padDecimal(message.incentiveAmount) === "" ? undefined : padDecimal(message.incentiveAmount); + obj.emission_rate = padDecimal(message.emissionRate) === "" ? undefined : padDecimal(message.emissionRate); obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.min_uptime = message.minUptime ? Duration.toAmino(message.minUptime) : undefined; return obj; @@ -1734,9 +1734,9 @@ export const MsgFungifyChargedPositions = { if (message.positionIds) { obj.position_ids = message.positionIds.map(e => e.toString()); } else { - obj.position_ids = []; + obj.position_ids = message.positionIds; } - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgFungifyChargedPositionsAminoMsg): MsgFungifyChargedPositions { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts index 188460583e..7fe05b816a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "osmosis.cosmwasmpool.v1beta1"; export interface CosmWasmPool { poolAddress: string; @@ -134,10 +134,10 @@ export const CosmWasmPool = { }, toAmino(message: CosmWasmPool): CosmWasmPoolAmino { const obj: any = {}; - obj.pool_address = omitDefault(message.poolAddress); - obj.contract_address = omitDefault(message.contractAddress); - obj.pool_id = omitDefault(message.poolId); - obj.code_id = omitDefault(message.codeId); + obj.pool_address = message.poolAddress === "" ? undefined : message.poolAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: CosmWasmPoolAminoMsg): CosmWasmPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts index c379ac62b6..5669bcd43c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts @@ -132,7 +132,7 @@ export const MsgCreateCosmWasmPool = { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.instantiate_msg = message.instantiateMsg ? base64FromBytes(message.instantiateMsg) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgCreateCosmWasmPoolAminoMsg): MsgCreateCosmWasmPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts index ba50d54777..615b86610e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/genesis.ts @@ -105,7 +105,7 @@ export const GenesisDowntimeEntry = { fromAmino(object: GenesisDowntimeEntryAmino): GenesisDowntimeEntry { const message = createBaseGenesisDowntimeEntry(); if (object.duration !== undefined && object.duration !== null) { - message.duration = downtimeFromJSON(object.duration); + message.duration = object.duration; } if (object.last_downtime !== undefined && object.last_downtime !== null) { message.lastDowntime = fromTimestamp(Timestamp.fromAmino(object.last_downtime)); @@ -114,7 +114,7 @@ export const GenesisDowntimeEntry = { }, toAmino(message: GenesisDowntimeEntry): GenesisDowntimeEntryAmino { const obj: any = {}; - obj.duration = downtimeToJSON(message.duration); + obj.duration = message.duration === 0 ? undefined : message.duration; obj.last_downtime = message.lastDowntime ? Timestamp.toAmino(toTimestamp(message.lastDowntime)) : undefined; return obj; }, @@ -234,7 +234,7 @@ export const GenesisState = { if (message.downtimes) { obj.downtimes = message.downtimes.map(e => e ? GenesisDowntimeEntry.toAmino(e) : undefined); } else { - obj.downtimes = []; + obj.downtimes = message.downtimes; } obj.last_block_time = message.lastBlockTime ? Timestamp.toAmino(toTimestamp(message.lastBlockTime)) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts index 9e9a56593f..7481746680 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/downtime-detector/v1beta1/query.ts @@ -109,7 +109,7 @@ export const RecoveredSinceDowntimeOfLengthRequest = { fromAmino(object: RecoveredSinceDowntimeOfLengthRequestAmino): RecoveredSinceDowntimeOfLengthRequest { const message = createBaseRecoveredSinceDowntimeOfLengthRequest(); if (object.downtime !== undefined && object.downtime !== null) { - message.downtime = downtimeFromJSON(object.downtime); + message.downtime = object.downtime; } if (object.recovery !== undefined && object.recovery !== null) { message.recovery = Duration.fromAmino(object.recovery); @@ -118,7 +118,7 @@ export const RecoveredSinceDowntimeOfLengthRequest = { }, toAmino(message: RecoveredSinceDowntimeOfLengthRequest): RecoveredSinceDowntimeOfLengthRequestAmino { const obj: any = {}; - obj.downtime = downtimeToJSON(message.downtime); + obj.downtime = message.downtime === 0 ? undefined : message.downtime; obj.recovery = message.recovery ? Duration.toAmino(message.recovery) : undefined; return obj; }, @@ -213,7 +213,7 @@ export const RecoveredSinceDowntimeOfLengthResponse = { }, toAmino(message: RecoveredSinceDowntimeOfLengthResponse): RecoveredSinceDowntimeOfLengthResponseAmino { const obj: any = {}; - obj.succesfully_recovered = message.succesfullyRecovered; + obj.succesfully_recovered = message.succesfullyRecovered === false ? undefined : message.succesfullyRecovered; return obj; }, fromAminoMsg(object: RecoveredSinceDowntimeOfLengthResponseAminoMsg): RecoveredSinceDowntimeOfLengthResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts index 041844a8bd..ebdd8bfaba 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts @@ -255,12 +255,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -364,7 +364,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts index 1e700a3f2d..7e83a61bf7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { @@ -189,7 +189,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, @@ -284,7 +284,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -378,7 +378,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts index 6954a41ab4..18e512da22 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timesta import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -294,12 +294,12 @@ export const SmoothWeightChangeParams = { if (message.initialPoolWeights) { obj.initial_pool_weights = message.initialPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.initial_pool_weights = []; + obj.initial_pool_weights = message.initialPoolWeights; } if (message.targetPoolWeights) { obj.target_pool_weights = message.targetPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.target_pool_weights = []; + obj.target_pool_weights = message.targetPoolWeights; } return obj; }, @@ -426,8 +426,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -539,7 +539,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -735,17 +735,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e481a8e582..4b691b23cc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../../helpers"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; @@ -53,10 +54,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -65,14 +66,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -81,9 +82,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ @@ -94,24 +95,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: { + smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { startTime: pool_params.smooth_weight_change_params.start_time, - duration: { + duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: { + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: { + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, @@ -119,8 +120,8 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map(el0 => ({ - token: { + poolAssets: pool_assets.map?.(el0 => ({ + token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts index cd5c775e8a..55a00278db 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -155,14 +155,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -256,7 +256,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 2a78c97749..9f982ffc6b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -152,8 +152,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = padDecimal(message.swapFee); - obj.exit_fee = padDecimal(message.exitFee); + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -380,22 +380,22 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.id = omitDefault(message.id); + obj.address = message.address === "" ? undefined : message.address; + obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_liquidity = []; + obj.pool_liquidity = message.poolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.scaling_factor_controller = omitDefault(message.scalingFactorController); + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 65a3763636..69b805b629 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -65,15 +65,15 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map(el0 => BigInt(el0)), + scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -99,8 +99,8 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: BigInt(pool_id), - scalingFactors: scaling_factors.map(el0 => BigInt(el0)) + poolId: pool_id == null ? pool_id : BigInt(pool_id), + scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)) }; } } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts index 24dcf8aedb..4b28ae903e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -235,20 +235,20 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_pool_liquidity = []; + obj.initial_pool_liquidity = message.initialPoolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); - obj.scaling_factor_controller = omitDefault(message.scalingFactorController); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -342,7 +342,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -483,12 +483,12 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts index 84cab6faeb..dc29b093d9 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -110,7 +110,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -246,9 +246,9 @@ export const GenesisState = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } - obj.next_pool_number = omitDefault(message.nextPoolNumber); + obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts index 07da149f50..5ef320658e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/gov.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ReplaceMigrationRecordsProposal is a gov Content type for updating the @@ -144,8 +144,8 @@ export const ReplaceMigrationRecordsProposal = { }, toAmino(message: ReplaceMigrationRecordsProposal): ReplaceMigrationRecordsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: ReplaceMigrationRecordsProposalAminoMsg): ReplaceMigrationRecordsProposal { @@ -255,8 +255,8 @@ export const UpdateMigrationRecordsProposal = { }, toAmino(message: UpdateMigrationRecordsProposal): UpdateMigrationRecordsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: UpdateMigrationRecordsProposalAminoMsg): UpdateMigrationRecordsProposal { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts index e1fa250b6f..589ab086db 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -450,7 +450,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -757,7 +757,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -926,7 +926,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = omitDefault(message.numPools); + obj.num_pools = message.numPools ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1020,7 +1020,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1114,7 +1114,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = omitDefault(message.poolType); + obj.pool_type = message.poolType === "" ? undefined : message.poolType; return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1230,11 +1230,11 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -1351,11 +1351,11 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1466,8 +1466,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1570,7 +1570,7 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1665,7 +1665,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1853,7 +1853,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -1956,7 +1956,7 @@ export const QueryTotalPoolLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -2051,7 +2051,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2261,11 +2261,11 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -2385,9 +2385,9 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } - obj.shares_out = omitDefault(message.sharesOut); + obj.shares_out = message.sharesOut === "" ? undefined : message.sharesOut; return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2513,9 +2513,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2650,9 +2650,9 @@ export const QueryPoolsWithFilterRequest = { if (message.minLiquidity) { obj.min_liquidity = message.minLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_liquidity = []; + obj.min_liquidity = message.minLiquidity; } - obj.pool_type = omitDefault(message.poolType); + obj.pool_type = message.poolType === "" ? undefined : message.poolType; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2772,7 +2772,7 @@ export const QueryPoolsWithFilterResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2868,7 +2868,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -3016,13 +3016,13 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_in = omitDefault(message.tokenIn); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -3117,7 +3117,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3265,14 +3265,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = omitDefault(message.tokenOut); + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3366,7 +3366,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { @@ -3542,7 +3542,7 @@ export const QueryTotalLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index fb977802b3..f8828244da 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -128,9 +128,9 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map(el0 => ({ + tokenInMaxs: token_in_maxs.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -163,9 +163,9 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map(el0 => ({ + tokenOutMins: token_out_mins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -201,11 +201,11 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: { + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -242,12 +242,12 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: { + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount } @@ -280,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: BigInt(pool_id), - tokenIn: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -315,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -348,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: BigInt(pool_id), - tokenOut: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount }, @@ -383,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts index 38e70a6802..6fb6a535c3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -391,13 +391,13 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -514,11 +514,11 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in = []; + obj.token_in = message.tokenIn; } return obj; }, @@ -667,13 +667,13 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out_mins = []; + obj.token_out_mins = message.tokenOutMins; } return obj; }, @@ -777,7 +777,7 @@ export const MsgExitPoolResponse = { if (message.tokenOut) { obj.token_out = message.tokenOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out = []; + obj.token_out = message.tokenOut; } return obj; }, @@ -888,8 +888,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -1037,14 +1037,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1138,7 +1138,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1248,8 +1248,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1397,13 +1397,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1498,7 +1498,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1640,10 +1640,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); + obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1737,7 +1737,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1895,11 +1895,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); - obj.share_out_amount = omitDefault(message.shareOutAmount); - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -1993,7 +1993,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2151,11 +2151,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); - obj.share_in_amount = omitDefault(message.shareInAmount); - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2249,7 +2249,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2391,10 +2391,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); + obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2488,7 +2488,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts index 4939ddb355..a6ce4af12a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -143,9 +143,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -239,7 +239,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts index 75be492f8a..3750cd260a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -82,7 +82,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts index 57d32cf46a..0ef9325d65 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts @@ -270,12 +270,12 @@ export const Gauge = { toAmino(message: Gauge): GaugeAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -283,7 +283,7 @@ export const Gauge = { if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.distributed_coins = []; + obj.distributed_coins = message.distributedCoins; } return obj; }, @@ -387,7 +387,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts index baa89e3476..1bece77cf0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -171,14 +171,14 @@ export const GenesisState = { if (message.gauges) { obj.gauges = message.gauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.gauges = []; + obj.gauges = message.gauges; } if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = omitDefault(message.lastGaugeId); + obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts index 1062b7b2b5..ab64e8de54 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -86,7 +86,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); + obj.distr_epoch_identifier = message.distrEpochIdentifier === "" ? undefined : message.distrEpochIdentifier; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts index 8f7a010c74..1cee9da980 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestProtoMsg { @@ -377,7 +377,7 @@ export const ModuleToDistributeCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -472,7 +472,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -779,7 +779,7 @@ export const GaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -994,7 +994,7 @@ export const ActiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1106,7 +1106,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1226,7 +1226,7 @@ export const ActiveGaugesPerDenomResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1441,7 +1441,7 @@ export const UpcomingGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1553,7 +1553,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1673,7 +1673,7 @@ export const UpcomingGaugesPerDenomResponse = { if (message.upcomingGauges) { obj.upcoming_gauges = message.upcomingGauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.upcoming_gauges = []; + obj.upcoming_gauges = message.upcomingGauges; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1816,13 +1816,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { - obj.lock_ids = []; + obj.lock_ids = message.lockIds; } - obj.end_epoch = omitDefault(message.endEpoch); + obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { @@ -1925,7 +1925,7 @@ export const RewardsEstResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -2102,7 +2102,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index 96b42471f0..094567f886 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -78,21 +78,21 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: { - lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: distribute_to == null ? distribute_to : { + lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: { + duration: distribute_to.duration == null ? distribute_to.duration : { seconds: BigInt(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, timestamp: distribute_to.timestamp }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: BigInt(num_epochs_paid_over) + numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : BigInt(num_epochs_paid_over) }; } }, @@ -119,8 +119,8 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: BigInt(gauge_id), - rewards: rewards.map(el0 => ({ + gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), + rewards: rewards.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts index 1569476706..c04852797a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts @@ -230,13 +230,13 @@ export const MsgCreateGauge = { }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; + obj.owner = message.owner === "" ? undefined : message.owner; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -444,12 +444,12 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts index 9b4d99a6f7..c2b3148c15 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -131,16 +131,16 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = omitDefault(message.lastLockId); + obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts index 1c0639eab6..64626a76c0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts @@ -312,13 +312,13 @@ export const PeriodLock = { toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -446,7 +446,7 @@ export const QueryCondition = { fromAmino(object: QueryConditionAmino): QueryCondition { const message = createBaseQueryCondition(); if (object.lock_query_type !== undefined && object.lock_query_type !== null) { - message.lockQueryType = lockQueryTypeFromJSON(object.lock_query_type); + message.lockQueryType = object.lock_query_type; } if (object.denom !== undefined && object.denom !== null) { message.denom = object.denom; @@ -461,8 +461,8 @@ export const QueryCondition = { }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = lockQueryTypeToJSON(message.lockQueryType); - obj.denom = message.denom; + obj.lock_query_type = message.lockQueryType === 0 ? undefined : message.lockQueryType; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; @@ -607,7 +607,7 @@ export const SyntheticLock = { toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/params.ts index d89ef720b5..ddaf4209b6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/params.ts @@ -89,7 +89,7 @@ export const Params = { if (message.forceUnlockAllowedAddresses) { obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses.map(e => e); } else { - obj.force_unlock_allowed_addresses = []; + obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts index 058537d70f..b7c059655a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts @@ -507,7 +507,7 @@ export const ModuleBalanceResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -684,7 +684,7 @@ export const ModuleLockedAmountResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -779,7 +779,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -882,7 +882,7 @@ export const AccountUnlockableCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -977,7 +977,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1080,7 +1080,7 @@ export const AccountUnlockingCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1175,7 +1175,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1278,7 +1278,7 @@ export const AccountLockedCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1389,7 +1389,7 @@ export const AccountLockedPastTimeRequest = { }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1493,7 +1493,7 @@ export const AccountLockedPastTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1604,7 +1604,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1708,7 +1708,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1819,7 +1819,7 @@ export const AccountUnlockedBeforeTimeRequest = { }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1923,7 +1923,7 @@ export const AccountUnlockedBeforeTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2050,9 +2050,9 @@ export const AccountLockedPastTimeDenomRequest = { }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2155,7 +2155,7 @@ export const AccountLockedPastTimeDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2266,7 +2266,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2361,7 +2361,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2746,7 +2746,7 @@ export const SyntheticLockupsByLockupIDResponse = { if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2857,7 +2857,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2961,7 +2961,7 @@ export const AccountLockedLongerDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3072,7 +3072,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3176,7 +3176,7 @@ export const AccountLockedDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3287,7 +3287,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3391,7 +3391,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3518,9 +3518,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { @@ -3623,7 +3623,7 @@ export const AccountLockedLongerDurationDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index 9545e07ec2..8a0babacb9 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -82,11 +82,11 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: { + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -133,8 +133,8 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: BigInt(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : BigInt(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -161,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: BigInt(ID), - duration: { + ID: ID == null ? ID : BigInt(ID), + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -192,8 +192,8 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: BigInt(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : BigInt(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts index bad255d790..0c2ef782fd 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -249,12 +249,12 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -349,7 +349,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -443,7 +443,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -546,7 +546,7 @@ export const MsgBeginUnlockingAllResponse = { if (message.unlocks) { obj.unlocks = message.unlocks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.unlocks = []; + obj.unlocks = message.unlocks; } return obj; }, @@ -679,12 +679,12 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -779,7 +779,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -905,8 +905,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1001,7 +1001,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1133,12 +1133,12 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1233,7 +1233,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts index 6072eeff07..01bd7f3c8a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -127,7 +127,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); + obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts index 2c9c37255e..1fcf3d32ce 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -200,7 +200,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = padDecimal(message.epochProvisions); + obj.epoch_provisions = padDecimal(message.epochProvisions) === "" ? undefined : padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -310,8 +310,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.weight = padDecimal(message.weight); + obj.address = message.address === "" ? undefined : message.address; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -453,10 +453,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = padDecimal(message.staking); - obj.pool_incentives = padDecimal(message.poolIncentives); - obj.developer_rewards = padDecimal(message.developerRewards); - obj.community_pool = padDecimal(message.communityPool); + obj.staking = padDecimal(message.staking) === "" ? undefined : padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives) === "" ? undefined : padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards) === "" ? undefined : padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -668,18 +668,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); - obj.epoch_identifier = omitDefault(message.epochIdentifier); - obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); - obj.reduction_factor = padDecimal(message.reductionFactor); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions) === "" ? undefined : padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_factor = padDecimal(message.reductionFactor) === "" ? undefined : padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { - obj.weighted_developer_rewards_receivers = []; + obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/genesis.ts index 1a36cfc415..3880c39295 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/genesis.ts @@ -149,7 +149,7 @@ export const GenesisState = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.distr_info = message.distrInfo ? DistrInfo.toAmino(message.distrInfo) : undefined; obj.pool_to_gauges = message.poolToGauges ? PoolToGauges.toAmino(message.poolToGauges) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts index 4f46403dbf..6e34b4e191 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -173,12 +173,12 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -311,12 +311,12 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts index d40d5650ed..2fd17937ef 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -145,7 +145,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = omitDefault(message.mintedDenom); + obj.minted_denom = message.mintedDenom === "" ? undefined : message.mintedDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -248,7 +248,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -365,11 +365,11 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = omitDefault(message.totalWeight); + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -480,8 +480,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = omitDefault(message.gaugeId); - obj.weight = omitDefault(message.weight); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -607,8 +607,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.gauge_id = omitDefault(message.gaugeId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -712,7 +712,7 @@ export const PoolToGauges = { if (message.poolToGauge) { obj.pool_to_gauge = message.poolToGauge.map(e => e ? PoolToGauge.toAmino(e) : undefined); } else { - obj.pool_to_gauge = []; + obj.pool_to_gauge = message.poolToGauge; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts index 02a9ad6f04..739daf3e0a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; import { Gauge, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -201,7 +201,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -304,7 +304,7 @@ export const QueryGaugeIdsResponse = { if (message.gaugeIdsWithDuration) { obj.gauge_ids_with_duration = message.gaugeIdsWithDuration.map(e => e ? QueryGaugeIdsResponse_GaugeIdWithDuration.toAmino(e) : undefined); } else { - obj.gauge_ids_with_duration = []; + obj.gauge_ids_with_duration = message.gaugeIdsWithDuration; } return obj; }, @@ -431,9 +431,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = omitDefault(message.gaugeId); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); + obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -943,7 +943,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -1143,9 +1143,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = omitDefault(message.gaugeId); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { @@ -1248,7 +1248,7 @@ export const QueryIncentivizedPoolsResponse = { if (message.incentivizedPools) { obj.incentivized_pools = message.incentivizedPools.map(e => e ? IncentivizedPool.toAmino(e) : undefined); } else { - obj.incentivized_pools = []; + obj.incentivized_pools = message.incentivizedPools; } return obj; }, @@ -1425,7 +1425,7 @@ export const QueryExternalIncentiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts index ad1c3bb6f7..9496c0fc59 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { ModuleRoute, ModuleRouteSDKType } from "./module_route"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** Params holds parameters for the poolmanager module */ export interface Params { @@ -112,7 +112,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -245,12 +245,12 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.next_pool_id = omitDefault(message.nextPoolId); + obj.next_pool_id = message.nextPoolId ? message.nextPoolId.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; if (message.poolRoutes) { obj.pool_routes = message.poolRoutes.map(e => e ? ModuleRoute.toAmino(e) : undefined); } else { - obj.pool_routes = []; + obj.pool_routes = message.poolRoutes; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts index c97a7bbb89..40050fc02c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts @@ -161,7 +161,7 @@ export const ModuleRoute = { fromAmino(object: ModuleRouteAmino): ModuleRoute { const message = createBaseModuleRoute(); if (object.pool_type !== undefined && object.pool_type !== null) { - message.poolType = poolTypeFromJSON(object.pool_type); + message.poolType = object.pool_type; } if (object.pool_id !== undefined && object.pool_id !== null) { message.poolId = BigInt(object.pool_id); @@ -170,7 +170,7 @@ export const ModuleRoute = { }, toAmino(message: ModuleRoute): ModuleRouteAmino { const obj: any = {}; - obj.pool_type = poolTypeToJSON(message.poolType); + obj.pool_type = message.poolType === 0 ? undefined : message.poolType; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts index 51bbc891ce..07d1456e28 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts @@ -2,7 +2,7 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAm import { Params, ParamsSDKType } from "./genesis"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** =============================== Params */ export interface ParamsRequest {} @@ -479,12 +479,12 @@ export const EstimateSwapExactAmountInRequest = { }, toAmino(message: EstimateSwapExactAmountInRequest): EstimateSwapExactAmountInRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in = omitDefault(message.tokenIn); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -611,9 +611,9 @@ export const EstimateSinglePoolSwapExactAmountInRequest = { }, toAmino(message: EstimateSinglePoolSwapExactAmountInRequest): EstimateSinglePoolSwapExactAmountInRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in = omitDefault(message.tokenIn); - obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: EstimateSinglePoolSwapExactAmountInRequestAminoMsg): EstimateSinglePoolSwapExactAmountInRequest { @@ -707,7 +707,7 @@ export const EstimateSwapExactAmountInResponse = { }, toAmino(message: EstimateSwapExactAmountInResponse): EstimateSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: EstimateSwapExactAmountInResponseAminoMsg): EstimateSwapExactAmountInResponse { @@ -839,13 +839,13 @@ export const EstimateSwapExactAmountOutRequest = { }, toAmino(message: EstimateSwapExactAmountOutRequest): EstimateSwapExactAmountOutRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = omitDefault(message.tokenOut); + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: EstimateSwapExactAmountOutRequestAminoMsg): EstimateSwapExactAmountOutRequest { @@ -971,9 +971,9 @@ export const EstimateSinglePoolSwapExactAmountOutRequest = { }, toAmino(message: EstimateSinglePoolSwapExactAmountOutRequest): EstimateSinglePoolSwapExactAmountOutRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); - obj.token_out = omitDefault(message.tokenOut); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: EstimateSinglePoolSwapExactAmountOutRequestAminoMsg): EstimateSinglePoolSwapExactAmountOutRequest { @@ -1067,7 +1067,7 @@ export const EstimateSwapExactAmountOutResponse = { }, toAmino(message: EstimateSwapExactAmountOutResponse): EstimateSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: EstimateSwapExactAmountOutResponseAminoMsg): EstimateSwapExactAmountOutResponse { @@ -1234,7 +1234,7 @@ export const NumPoolsResponse = { }, toAmino(message: NumPoolsResponse): NumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = omitDefault(message.numPools); + obj.num_pools = message.numPools ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: NumPoolsResponseAminoMsg): NumPoolsResponse { @@ -1328,7 +1328,7 @@ export const PoolRequest = { }, toAmino(message: PoolRequest): PoolRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: PoolRequestAminoMsg): PoolRequest { @@ -1516,7 +1516,7 @@ export const AllPoolsRequest = { }, toAmino(message: AllPoolsRequest): AllPoolsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: AllPoolsRequestAminoMsg): AllPoolsRequest { @@ -1619,7 +1619,7 @@ export const AllPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } return obj; }, @@ -1746,9 +1746,9 @@ export const SpotPriceRequest = { }, toAmino(message: SpotPriceRequest): SpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: SpotPriceRequestAminoMsg): SpotPriceRequest { @@ -1842,7 +1842,7 @@ export const SpotPriceResponse = { }, toAmino(message: SpotPriceResponse): SpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: SpotPriceResponseAminoMsg): SpotPriceResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts index d7ac3c70a0..f10782535c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; export interface SwapAmountInRoute { poolId: bigint; @@ -110,8 +110,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -221,8 +221,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index e613fa39db..ea9344a443 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -64,11 +64,11 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: { + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -105,12 +105,12 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: { + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts index fac1c076b1..2193494703 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolmanager.v1beta1"; /** ===================== MsgSwapExactAmountIn */ export interface MsgSwapExactAmountIn { @@ -182,14 +182,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -283,7 +283,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -431,13 +431,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -532,7 +532,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts index b11753665b..700133a96c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, BaseDenom, BaseDenomSDKType, PoolWeights, PoolWeightsSDKType } from "./protorev"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** GenesisState defines the protorev module's genesis state. */ export interface GenesisState { @@ -310,25 +310,25 @@ export const GenesisState = { if (message.tokenPairArbRoutes) { obj.token_pair_arb_routes = message.tokenPairArbRoutes.map(e => e ? TokenPairArbRoutes.toAmino(e) : undefined); } else { - obj.token_pair_arb_routes = []; + obj.token_pair_arb_routes = message.tokenPairArbRoutes; } if (message.baseDenoms) { obj.base_denoms = message.baseDenoms.map(e => e ? BaseDenom.toAmino(e) : undefined); } else { - obj.base_denoms = []; + obj.base_denoms = message.baseDenoms; } obj.pool_weights = message.poolWeights ? PoolWeights.toAmino(message.poolWeights) : undefined; - obj.days_since_module_genesis = omitDefault(message.daysSinceModuleGenesis); + obj.days_since_module_genesis = message.daysSinceModuleGenesis ? message.daysSinceModuleGenesis.toString() : undefined; if (message.developerFees) { obj.developer_fees = message.developerFees.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.developer_fees = []; + obj.developer_fees = message.developerFees; } - obj.latest_block_height = omitDefault(message.latestBlockHeight); - obj.developer_address = omitDefault(message.developerAddress); - obj.max_pool_points_per_block = omitDefault(message.maxPoolPointsPerBlock); - obj.max_pool_points_per_tx = omitDefault(message.maxPoolPointsPerTx); - obj.point_count_for_block = omitDefault(message.pointCountForBlock); + obj.latest_block_height = message.latestBlockHeight ? message.latestBlockHeight.toString() : undefined; + obj.developer_address = message.developerAddress === "" ? undefined : message.developerAddress; + obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; + obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; + obj.point_count_for_block = message.pointCountForBlock ? message.pointCountForBlock.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts index 021882d84a..fd7cb68c99 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/gov.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** * SetProtoRevEnabledProposal is a gov Content type to update whether the @@ -148,9 +148,9 @@ export const SetProtoRevEnabledProposal = { }, toAmino(message: SetProtoRevEnabledProposal): SetProtoRevEnabledProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.enabled = omitDefault(message.enabled); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: SetProtoRevEnabledProposalAminoMsg): SetProtoRevEnabledProposal { @@ -276,9 +276,9 @@ export const SetProtoRevAdminAccountProposal = { }, toAmino(message: SetProtoRevAdminAccountProposal): SetProtoRevAdminAccountProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.account = omitDefault(message.account); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.account = message.account === "" ? undefined : message.account; return obj; }, fromAminoMsg(object: SetProtoRevAdminAccountProposalAminoMsg): SetProtoRevAdminAccountProposal { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts index 0f4daa7596..18dbf357c7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** Params defines the parameters for the module. */ export interface Params { @@ -102,8 +102,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enabled = omitDefault(message.enabled); - obj.admin = omitDefault(message.admin); + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts index 208cefdcfe..ae21deb630 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** TokenPairArbRoutes tracks all of the hot routes for a given pair of tokens */ export interface TokenPairArbRoutes { @@ -258,10 +258,10 @@ export const TokenPairArbRoutes = { if (message.arbRoutes) { obj.arb_routes = message.arbRoutes.map(e => e ? Route.toAmino(e) : undefined); } else { - obj.arb_routes = []; + obj.arb_routes = message.arbRoutes; } - obj.token_in = omitDefault(message.tokenIn); - obj.token_out = omitDefault(message.tokenOut); + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: TokenPairArbRoutesAminoMsg): TokenPairArbRoutes { @@ -380,9 +380,9 @@ export const Route = { if (message.trades) { obj.trades = message.trades.map(e => e ? Trade.toAmino(e) : undefined); } else { - obj.trades = []; + obj.trades = message.trades; } - obj.step_size = omitDefault(message.stepSize); + obj.step_size = message.stepSize === "" ? undefined : message.stepSize; return obj; }, fromAminoMsg(object: RouteAminoMsg): Route { @@ -508,9 +508,9 @@ export const Trade = { }, toAmino(message: Trade): TradeAmino { const obj: any = {}; - obj.pool = omitDefault(message.pool); - obj.token_in = omitDefault(message.tokenIn); - obj.token_out = omitDefault(message.tokenOut); + obj.pool = message.pool ? message.pool.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: TradeAminoMsg): Trade { @@ -660,13 +660,13 @@ export const RouteStatistics = { if (message.profits) { obj.profits = message.profits.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.profits = []; + obj.profits = message.profits; } - obj.number_of_trades = omitDefault(message.numberOfTrades); + obj.number_of_trades = message.numberOfTrades === "" ? undefined : message.numberOfTrades; if (message.route) { obj.route = message.route.map(e => e.toString()); } else { - obj.route = []; + obj.route = message.route; } return obj; }, @@ -793,9 +793,9 @@ export const PoolWeights = { }, toAmino(message: PoolWeights): PoolWeightsAmino { const obj: any = {}; - obj.stable_weight = omitDefault(message.stableWeight); - obj.balancer_weight = omitDefault(message.balancerWeight); - obj.concentrated_weight = omitDefault(message.concentratedWeight); + obj.stable_weight = message.stableWeight ? message.stableWeight.toString() : undefined; + obj.balancer_weight = message.balancerWeight ? message.balancerWeight.toString() : undefined; + obj.concentrated_weight = message.concentratedWeight ? message.concentratedWeight.toString() : undefined; return obj; }, fromAminoMsg(object: PoolWeightsAminoMsg): PoolWeights { @@ -905,8 +905,8 @@ export const BaseDenom = { }, toAmino(message: BaseDenom): BaseDenomAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.step_size = omitDefault(message.stepSize); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.step_size = message.stepSize === "" ? undefined : message.stepSize; return obj; }, fromAminoMsg(object: BaseDenomAminoMsg): BaseDenom { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts index ef242874d5..d46067205f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { RouteStatistics, RouteStatisticsSDKType, TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -788,7 +788,7 @@ export const QueryGetProtoRevNumberOfTradesResponse = { }, toAmino(message: QueryGetProtoRevNumberOfTradesResponse): QueryGetProtoRevNumberOfTradesResponseAmino { const obj: any = {}; - obj.number_of_trades = omitDefault(message.numberOfTrades); + obj.number_of_trades = message.numberOfTrades === "" ? undefined : message.numberOfTrades; return obj; }, fromAminoMsg(object: QueryGetProtoRevNumberOfTradesResponseAminoMsg): QueryGetProtoRevNumberOfTradesResponse { @@ -882,7 +882,7 @@ export const QueryGetProtoRevProfitsByDenomRequest = { }, toAmino(message: QueryGetProtoRevProfitsByDenomRequest): QueryGetProtoRevProfitsByDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryGetProtoRevProfitsByDenomRequestAminoMsg): QueryGetProtoRevProfitsByDenomRequest { @@ -1152,7 +1152,7 @@ export const QueryGetProtoRevAllProfitsResponse = { if (message.profits) { obj.profits = message.profits.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.profits = []; + obj.profits = message.profits; } return obj; }, @@ -1265,7 +1265,7 @@ export const QueryGetProtoRevStatisticsByRouteRequest = { if (message.route) { obj.route = message.route.map(e => e.toString()); } else { - obj.route = []; + obj.route = message.route; } return obj; }, @@ -1536,7 +1536,7 @@ export const QueryGetProtoRevAllRouteStatisticsResponse = { if (message.statistics) { obj.statistics = message.statistics.map(e => e ? RouteStatistics.toAmino(e) : undefined); } else { - obj.statistics = []; + obj.statistics = message.statistics; } return obj; }, @@ -1713,7 +1713,7 @@ export const QueryGetProtoRevTokenPairArbRoutesResponse = { if (message.routes) { obj.routes = message.routes.map(e => e ? TokenPairArbRoutes.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -1881,7 +1881,7 @@ export const QueryGetProtoRevAdminAccountResponse = { }, toAmino(message: QueryGetProtoRevAdminAccountResponse): QueryGetProtoRevAdminAccountResponseAmino { const obj: any = {}; - obj.admin_account = omitDefault(message.adminAccount); + obj.admin_account = message.adminAccount === "" ? undefined : message.adminAccount; return obj; }, fromAminoMsg(object: QueryGetProtoRevAdminAccountResponseAminoMsg): QueryGetProtoRevAdminAccountResponse { @@ -2048,7 +2048,7 @@ export const QueryGetProtoRevDeveloperAccountResponse = { }, toAmino(message: QueryGetProtoRevDeveloperAccountResponse): QueryGetProtoRevDeveloperAccountResponseAmino { const obj: any = {}; - obj.developer_account = omitDefault(message.developerAccount); + obj.developer_account = message.developerAccount === "" ? undefined : message.developerAccount; return obj; }, fromAminoMsg(object: QueryGetProtoRevDeveloperAccountResponseAminoMsg): QueryGetProtoRevDeveloperAccountResponse { @@ -2382,7 +2382,7 @@ export const QueryGetProtoRevMaxPoolPointsPerBlockResponse = { }, toAmino(message: QueryGetProtoRevMaxPoolPointsPerBlockResponse): QueryGetProtoRevMaxPoolPointsPerBlockResponseAmino { const obj: any = {}; - obj.max_pool_points_per_block = omitDefault(message.maxPoolPointsPerBlock); + obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGetProtoRevMaxPoolPointsPerBlockResponseAminoMsg): QueryGetProtoRevMaxPoolPointsPerBlockResponse { @@ -2549,7 +2549,7 @@ export const QueryGetProtoRevMaxPoolPointsPerTxResponse = { }, toAmino(message: QueryGetProtoRevMaxPoolPointsPerTxResponse): QueryGetProtoRevMaxPoolPointsPerTxResponseAmino { const obj: any = {}; - obj.max_pool_points_per_tx = omitDefault(message.maxPoolPointsPerTx); + obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGetProtoRevMaxPoolPointsPerTxResponseAminoMsg): QueryGetProtoRevMaxPoolPointsPerTxResponse { @@ -2725,7 +2725,7 @@ export const QueryGetProtoRevBaseDenomsResponse = { if (message.baseDenoms) { obj.base_denoms = message.baseDenoms.map(e => e ? BaseDenom.toAmino(e) : undefined); } else { - obj.base_denoms = []; + obj.base_denoms = message.baseDenoms; } return obj; }, @@ -2893,7 +2893,7 @@ export const QueryGetProtoRevEnabledResponse = { }, toAmino(message: QueryGetProtoRevEnabledResponse): QueryGetProtoRevEnabledResponseAmino { const obj: any = {}; - obj.enabled = omitDefault(message.enabled); + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: QueryGetProtoRevEnabledResponseAminoMsg): QueryGetProtoRevEnabledResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index 7098e81fbd..a20ead01d1 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -92,10 +92,10 @@ export const AminoConverter = { }: MsgSetHotRoutesAminoType["value"]): MsgSetHotRoutes => { return { admin, - hotRoutes: hot_routes.map(el0 => ({ - arbRoutes: el0.arb_routes.map(el1 => ({ - trades: el1.trades.map(el2 => ({ - pool: BigInt(el2.pool), + hotRoutes: hot_routes.map?.(el0 => ({ + arbRoutes: el0.arb_routes.map?.(el1 => ({ + trades: el1.trades.map?.(el2 => ({ + pool: el2.pool == null ? el2.pool : BigInt(el2.pool), tokenIn: el2.token_in, tokenOut: el2.token_out })), @@ -145,7 +145,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerTxAminoType["value"]): MsgSetMaxPoolPointsPerTx => { return { admin, - maxPoolPointsPerTx: BigInt(max_pool_points_per_tx) + maxPoolPointsPerTx: max_pool_points_per_tx == null ? max_pool_points_per_tx : BigInt(max_pool_points_per_tx) }; } }, @@ -166,7 +166,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerBlockAminoType["value"]): MsgSetMaxPoolPointsPerBlock => { return { admin, - maxPoolPointsPerBlock: BigInt(max_pool_points_per_block) + maxPoolPointsPerBlock: max_pool_points_per_block == null ? max_pool_points_per_block : BigInt(max_pool_points_per_block) }; } }, @@ -191,10 +191,10 @@ export const AminoConverter = { }: MsgSetPoolWeightsAminoType["value"]): MsgSetPoolWeights => { return { admin, - poolWeights: { - stableWeight: BigInt(pool_weights.stable_weight), - balancerWeight: BigInt(pool_weights.balancer_weight), - concentratedWeight: BigInt(pool_weights.concentrated_weight) + poolWeights: pool_weights == null ? pool_weights : { + stableWeight: pool_weights.stable_weight == null ? pool_weights.stable_weight : BigInt(pool_weights.stable_weight), + balancerWeight: pool_weights.balancer_weight == null ? pool_weights.balancer_weight : BigInt(pool_weights.balancer_weight), + concentratedWeight: pool_weights.concentrated_weight == null ? pool_weights.concentrated_weight : BigInt(pool_weights.concentrated_weight) } }; } @@ -219,7 +219,7 @@ export const AminoConverter = { }: MsgSetBaseDenomsAminoType["value"]): MsgSetBaseDenoms => { return { admin, - baseDenoms: base_denoms.map(el0 => ({ + baseDenoms: base_denoms.map?.(el0 => ({ denom: el0.denom, stepSize: el0.step_size })) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts index d8b3ba3958..8fc8badb62 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType } from "./protorev"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.protorev.v1beta1"; /** MsgSetHotRoutes defines the Msg/SetHotRoutes request type. */ export interface MsgSetHotRoutes { @@ -273,11 +273,11 @@ export const MsgSetHotRoutes = { }, toAmino(message: MsgSetHotRoutes): MsgSetHotRoutesAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; if (message.hotRoutes) { obj.hot_routes = message.hotRoutes.map(e => e ? TokenPairArbRoutes.toAmino(e) : undefined); } else { - obj.hot_routes = []; + obj.hot_routes = message.hotRoutes; } return obj; }, @@ -461,8 +461,8 @@ export const MsgSetDeveloperAccount = { }, toAmino(message: MsgSetDeveloperAccount): MsgSetDeveloperAccountAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); - obj.developer_account = omitDefault(message.developerAccount); + obj.admin = message.admin === "" ? undefined : message.admin; + obj.developer_account = message.developerAccount === "" ? undefined : message.developerAccount; return obj; }, fromAminoMsg(object: MsgSetDeveloperAccountAminoMsg): MsgSetDeveloperAccount { @@ -645,7 +645,7 @@ export const MsgSetPoolWeights = { }, toAmino(message: MsgSetPoolWeights): MsgSetPoolWeightsAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pool_weights = message.poolWeights ? PoolWeights.toAmino(message.poolWeights) : undefined; return obj; }, @@ -829,8 +829,8 @@ export const MsgSetMaxPoolPointsPerTx = { }, toAmino(message: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); - obj.max_pool_points_per_tx = omitDefault(message.maxPoolPointsPerTx); + obj.admin = message.admin === "" ? undefined : message.admin; + obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSetMaxPoolPointsPerTxAminoMsg): MsgSetMaxPoolPointsPerTx { @@ -1013,8 +1013,8 @@ export const MsgSetMaxPoolPointsPerBlock = { }, toAmino(message: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); - obj.max_pool_points_per_block = omitDefault(message.maxPoolPointsPerBlock); + obj.admin = message.admin === "" ? undefined : message.admin; + obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSetMaxPoolPointsPerBlockAminoMsg): MsgSetMaxPoolPointsPerBlock { @@ -1203,11 +1203,11 @@ export const MsgSetBaseDenoms = { }, toAmino(message: MsgSetBaseDenoms): MsgSetBaseDenomsAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; if (message.baseDenoms) { obj.base_denoms = message.baseDenoms.map(e => e ? BaseDenom.toAmino(e) : undefined); } else { - obj.base_denoms = []; + obj.base_denoms = message.baseDenoms; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts index f1ebb44a18..90d2c0b6cf 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/sumtree/v1beta1/tree.ts @@ -111,7 +111,7 @@ export const Node = { if (message.children) { obj.children = message.children.map(e => e ? Child.toAmino(e) : undefined); } else { - obj.children = []; + obj.children = message.children; } return obj; }, @@ -223,7 +223,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index ? base64FromBytes(message.index) : undefined; - obj.accumulation = message.accumulation; + obj.accumulation = message.accumulation === "" ? undefined : message.accumulation; return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/genesis.ts index b4b46d1883..06c92087ed 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/genesis.ts @@ -196,22 +196,22 @@ export const GenesisState = { if (message.superfluidAssets) { obj.superfluid_assets = message.superfluidAssets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.superfluid_assets = []; + obj.superfluid_assets = message.superfluidAssets; } if (message.osmoEquivalentMultipliers) { obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers.map(e => e ? OsmoEquivalentMultiplierRecord.toAmino(e) : undefined); } else { - obj.osmo_equivalent_multipliers = []; + obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers; } if (message.intermediaryAccounts) { obj.intermediary_accounts = message.intermediaryAccounts.map(e => e ? SuperfluidIntermediaryAccount.toAmino(e) : undefined); } else { - obj.intermediary_accounts = []; + obj.intermediary_accounts = message.intermediaryAccounts; } if (message.intemediaryAccountConnections) { obj.intemediary_account_connections = message.intemediaryAccountConnections.map(e => e ? LockIdIntermediaryAccountConnection.toAmino(e) : undefined); } else { - obj.intemediary_account_connections = []; + obj.intemediary_account_connections = message.intemediaryAccountConnections; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts index cd728ef211..15e3dd8126 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/params.ts @@ -89,7 +89,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor) === "" ? undefined : padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts index cdb83dfaab..8d953228d9 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts @@ -584,7 +584,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -672,13 +672,13 @@ export const AssetTypeResponse = { fromAmino(object: AssetTypeResponseAmino): AssetTypeResponse { const message = createBaseAssetTypeResponse(); if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -854,7 +854,7 @@ export const AllAssetsResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -949,7 +949,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1185,10 +1185,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1401,7 +1401,7 @@ export const AllIntermediaryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? SuperfluidIntermediaryAccountInfo.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1685,7 +1685,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1788,7 +1788,7 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? Delegations.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1915,9 +1915,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; + obj.amount_sfsd = message.amountSfsd === "" ? undefined : message.amountSfsd; + obj.osmo_equivalent = message.osmoEquivalent === "" ? undefined : message.osmoEquivalent; return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -2084,7 +2084,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = message.totalDelegations === "" ? undefined : message.totalDelegations; return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2210,9 +2210,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2315,7 +2315,7 @@ export const SuperfluidDelegationAmountResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -2410,7 +2410,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2551,12 +2551,12 @@ export const SuperfluidDelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -2668,8 +2668,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2816,17 +2816,17 @@ export const SuperfluidUndelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalUndelegatedCoins) { obj.total_undelegated_coins = message.totalUndelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_undelegated_coins = []; + obj.total_undelegated_coins = message.totalUndelegatedCoins; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2937,8 +2937,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -3041,7 +3041,7 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } return obj; }, @@ -3152,8 +3152,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3256,7 +3256,7 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } return obj; }, @@ -3351,7 +3351,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { @@ -3514,17 +3514,17 @@ export const QueryTotalDelegationByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.delegationResponse) { obj.delegation_response = message.delegationResponse.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_response = []; + obj.delegation_response = message.delegationResponse; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -3711,7 +3711,7 @@ export const QueryUnpoolWhitelistResponse = { if (message.poolIds) { obj.pool_ids = message.poolIds.map(e => e.toString()); } else { - obj.pool_ids = []; + obj.pool_ids = message.poolIds; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts index 395cf3ad54..718ec8f057 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -250,14 +250,14 @@ export const SuperfluidAsset = { message.denom = object.denom; } if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -383,8 +383,8 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, @@ -512,8 +512,8 @@ export const OsmoEquivalentMultiplierRecord = { toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.multiplier = padDecimal(message.multiplier) === "" ? undefined : padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -655,8 +655,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -769,7 +769,7 @@ export const LockIdIntermediaryAccountConnection = { toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { @@ -881,7 +881,7 @@ export const UnpoolWhitelistedPools = { if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index 06225ca5cd..7c3be9a269 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: BigInt(lock_id), + lockId: lock_id == null ? lock_id : BigInt(lock_id), valAddr: val_addr }; } @@ -86,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: BigInt(lock_id) + lockId: lock_id == null ? lock_id : BigInt(lock_id) }; } }, @@ -107,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: BigInt(lock_id) + lockId: lock_id == null ? lock_id : BigInt(lock_id) }; } }, @@ -134,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: BigInt(pool_id) + poolId: pool_id == null ? pool_id : BigInt(pool_id) }; } } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts index aad0a920d4..e6c9a84325 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -235,9 +235,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); - obj.val_addr = omitDefault(message.valAddr); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -420,8 +420,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -604,8 +604,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -810,13 +810,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } - obj.val_addr = omitDefault(message.valAddr); + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -910,7 +910,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1020,8 +1020,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { @@ -1133,7 +1133,7 @@ export const MsgUnPoolWhitelistedPoolResponse = { if (message.exitedLockIds) { obj.exited_lock_ids = message.exitedLockIds.map(e => e.toString()); } else { - obj.exited_lock_ids = []; + obj.exited_lock_ids = message.exitedLockIds; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts index 6c5fef2297..f3873b0a02 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -177,12 +177,12 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -315,12 +315,12 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { - obj.superfluid_asset_denoms = []; + obj.superfluid_asset_denoms = message.superfluidAssetDenoms; } return obj; }, @@ -478,14 +478,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } - obj.is_overwrite = omitDefault(message.isOverwrite); + obj.is_overwrite = message.isOverwrite === false ? undefined : message.isOverwrite; return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index 3663d07ee7..5e13243017 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -91,7 +91,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts index dcccadadb4..07808d716b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -135,7 +135,7 @@ export const GenesisState = { if (message.factoryDenoms) { obj.factory_denoms = message.factoryDenoms.map(e => e ? GenesisDenom.toAmino(e) : undefined); } else { - obj.factory_denoms = []; + obj.factory_denoms = message.factoryDenoms; } return obj; }, @@ -246,7 +246,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/params.ts index 26906d421b..38a257f0db 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/params.ts @@ -92,7 +92,7 @@ export const Params = { if (message.denomCreationFee) { obj.denom_creation_fee = message.denomCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.denom_creation_fee = []; + obj.denom_creation_fee = message.denomCreationFee; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts index 47860c4c4f..c30168573a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -332,7 +332,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -520,7 +520,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = omitDefault(message.creator); + obj.creator = message.creator === "" ? undefined : message.creator; return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { @@ -623,7 +623,7 @@ export const QueryDenomsFromCreatorResponse = { if (message.denoms) { obj.denoms = message.denoms.map(e => e); } else { - obj.denoms = []; + obj.denoms = message.denoms; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts index 8f2a82e542..49e38cc8ab 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -101,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -190,9 +190,9 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: { + metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map(el1 => ({ + denomUnits: metadata.denom_units.map?.(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts index 868b6bcc3f..521762710c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -263,8 +263,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.subdenom = omitDefault(message.subdenom); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.subdenom = message.subdenom === "" ? undefined : message.subdenom; return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -358,7 +358,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = omitDefault(message.newTokenDenom); + obj.new_token_denom = message.newTokenDenom === "" ? undefined : message.newTokenDenom; return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -468,7 +468,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -652,7 +652,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -852,9 +852,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.denom = omitDefault(message.denom); - obj.new_admin = omitDefault(message.newAdmin); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -1037,7 +1037,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts index 710ec0e439..f99d2de274 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -118,7 +118,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); + obj.prune_epoch_identifier = message.pruneEpochIdentifier === "" ? undefined : message.pruneEpochIdentifier; obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, @@ -238,7 +238,7 @@ export const GenesisState = { if (message.twaps) { obj.twaps = message.twaps.map(e => e ? TwapRecord.toAmino(e) : undefined); } else { - obj.twaps = []; + obj.twaps = message.twaps; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts index c390874eeb..d465b30cb5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -208,8 +208,8 @@ export const ArithmeticTwapRequest = { toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; return obj; @@ -305,7 +305,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -448,8 +448,8 @@ export const ArithmeticTwapToNowRequest = { toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -544,7 +544,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts index d165b0d5d9..6ea8acb70e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -279,14 +279,14 @@ export const TwapRecord = { toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; + obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; + obj.height = message.height ? message.height.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice) === "" ? undefined : padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice) === "" ? undefined : padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts index a3fb913c7a..afb398278d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -110,8 +110,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.poolID = omitDefault(message.poolID); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts index 6576be763b..86bc39cd02 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -107,11 +107,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = omitDefault(message.basedenom); + obj.basedenom = message.basedenom === "" ? undefined : message.basedenom; if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.feetokens = []; + obj.feetokens = message.feetokens; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts index a37bcb4eeb..1fe1932611 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -131,8 +131,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts index 8cc97ddc98..c645b5b2bf 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -244,7 +244,7 @@ export const QueryFeeTokensResponse = { if (message.feeTokens) { obj.fee_tokens = message.feeTokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.fee_tokens = []; + obj.fee_tokens = message.feeTokens; } return obj; }, @@ -339,7 +339,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -449,8 +449,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); - obj.spot_price = padDecimal(message.spotPrice); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.spot_price = padDecimal(message.spotPrice) === "" ? undefined : padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -544,7 +544,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -638,7 +638,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -805,7 +805,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = omitDefault(message.baseDenom); + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts index ef92c5513d..80b81a4138 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; /** Request type for UserValidatorPreferences. */ export interface UserValidatorPreferencesRequest { @@ -96,7 +96,7 @@ export const UserValidatorPreferencesRequest = { }, toAmino(message: UserValidatorPreferencesRequest): UserValidatorPreferencesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: UserValidatorPreferencesRequestAminoMsg): UserValidatorPreferencesRequest { @@ -199,7 +199,7 @@ export const UserValidatorPreferencesResponse = { if (message.preferences) { obj.preferences = message.preferences.map(e => e ? ValidatorPreference.toAmino(e) : undefined); } else { - obj.preferences = []; + obj.preferences = message.preferences; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts index 645dc117c6..58c2e7dd5b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/state.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; /** * ValidatorPreference defines the message structure for @@ -141,8 +141,8 @@ export const ValidatorPreference = { }, toAmino(message: ValidatorPreference): ValidatorPreferenceAmino { const obj: any = {}; - obj.val_oper_address = omitDefault(message.valOperAddress); - obj.weight = padDecimal(message.weight); + obj.val_oper_address = message.valOperAddress === "" ? undefined : message.valOperAddress; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: ValidatorPreferenceAminoMsg): ValidatorPreference { @@ -245,7 +245,7 @@ export const ValidatorSetPreferences = { if (message.preferences) { obj.preferences = message.preferences.map(e => e ? ValidatorPreference.toAmino(e) : undefined); } else { - obj.preferences = []; + obj.preferences = message.preferences; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index 9a7d7c2a41..27b3782018 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -78,7 +78,7 @@ export const AminoConverter = { }: MsgSetValidatorSetPreferenceAminoType["value"]): MsgSetValidatorSetPreference => { return { delegator, - preferences: preferences.map(el0 => ({ + preferences: preferences.map?.(el0 => ({ valOperAddress: el0.val_oper_address, weight: el0.weight })) @@ -105,7 +105,7 @@ export const AminoConverter = { }: MsgDelegateToValidatorSetAminoType["value"]): MsgDelegateToValidatorSet => { return { delegator, - coin: { + coin: coin == null ? coin : { denom: coin.denom, amount: coin.amount } @@ -132,7 +132,7 @@ export const AminoConverter = { }: MsgUndelegateFromValidatorSetAminoType["value"]): MsgUndelegateFromValidatorSet => { return { delegator, - coin: { + coin: coin == null ? coin : { denom: coin.denom, amount: coin.amount } @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgRedelegateValidatorSetAminoType["value"]): MsgRedelegateValidatorSet => { return { delegator, - preferences: preferences.map(el0 => ({ + preferences: preferences.map?.(el0 => ({ valOperAddress: el0.val_oper_address, weight: el0.weight })) @@ -200,7 +200,7 @@ export const AminoConverter = { }: MsgDelegateBondedTokensAminoType["value"]): MsgDelegateBondedTokens => { return { delegator, - lockID: BigInt(lockID) + lockID: lockID == null ? lockID : BigInt(lockID) }; } } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts index 7b5d81c8fb..6526b20f1b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.valsetpref.v1beta1"; /** MsgCreateValidatorSetPreference is a list that holds validator-set. */ export interface MsgSetValidatorSetPreference { @@ -250,11 +250,11 @@ export const MsgSetValidatorSetPreference = { }, toAmino(message: MsgSetValidatorSetPreference): MsgSetValidatorSetPreferenceAmino { const obj: any = {}; - obj.delegator = omitDefault(message.delegator); + obj.delegator = message.delegator === "" ? undefined : message.delegator; if (message.preferences) { obj.preferences = message.preferences.map(e => e ? ValidatorPreference.toAmino(e) : undefined); } else { - obj.preferences = []; + obj.preferences = message.preferences; } return obj; }, @@ -438,7 +438,7 @@ export const MsgDelegateToValidatorSet = { }, toAmino(message: MsgDelegateToValidatorSet): MsgDelegateToValidatorSetAmino { const obj: any = {}; - obj.delegator = omitDefault(message.delegator); + obj.delegator = message.delegator === "" ? undefined : message.delegator; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; return obj; }, @@ -622,7 +622,7 @@ export const MsgUndelegateFromValidatorSet = { }, toAmino(message: MsgUndelegateFromValidatorSet): MsgUndelegateFromValidatorSetAmino { const obj: any = {}; - obj.delegator = omitDefault(message.delegator); + obj.delegator = message.delegator === "" ? undefined : message.delegator; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; return obj; }, @@ -812,11 +812,11 @@ export const MsgRedelegateValidatorSet = { }, toAmino(message: MsgRedelegateValidatorSet): MsgRedelegateValidatorSetAmino { const obj: any = {}; - obj.delegator = omitDefault(message.delegator); + obj.delegator = message.delegator === "" ? undefined : message.delegator; if (message.preferences) { obj.preferences = message.preferences.map(e => e ? ValidatorPreference.toAmino(e) : undefined); } else { - obj.preferences = []; + obj.preferences = message.preferences; } return obj; }, @@ -984,7 +984,7 @@ export const MsgWithdrawDelegationRewards = { }, toAmino(message: MsgWithdrawDelegationRewards): MsgWithdrawDelegationRewardsAmino { const obj: any = {}; - obj.delegator = omitDefault(message.delegator); + obj.delegator = message.delegator === "" ? undefined : message.delegator; return obj; }, fromAminoMsg(object: MsgWithdrawDelegationRewardsAminoMsg): MsgWithdrawDelegationRewards { @@ -1167,8 +1167,8 @@ export const MsgDelegateBondedTokens = { }, toAmino(message: MsgDelegateBondedTokens): MsgDelegateBondedTokensAmino { const obj: any = {}; - obj.delegator = omitDefault(message.delegator); - obj.lockID = omitDefault(message.lockID); + obj.delegator = message.delegator === "" ? undefined : message.delegator; + obj.lockID = message.lockID ? message.lockID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgDelegateBondedTokensAminoMsg): MsgDelegateBondedTokens { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts index 255f74a330..4a2ed2dec4 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts @@ -1312,7 +1312,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1499,7 +1499,7 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; return obj; @@ -1605,8 +1605,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -1781,12 +1781,12 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; @@ -1926,9 +1926,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.path = message.path; + obj.path = message.path === "" ? undefined : message.path; obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.prove = message.prove === false ? undefined : message.prove; return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2076,7 +2076,7 @@ export const RequestBeginBlock = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } return obj; }, @@ -2175,14 +2175,14 @@ export const RequestCheckTx = { message.tx = bytesFromBase64(object.tx); } if (object.type !== undefined && object.type !== null) { - message.type = checkTxTypeFromJSON(object.type); + message.type = object.type; } return message; }, toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.type = checkTxTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2718,8 +2718,8 @@ export const RequestLoadSnapshotChunk = { toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -2839,9 +2839,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3272,7 +3272,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3360,7 +3360,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3579,8 +3579,8 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; @@ -3703,9 +3703,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -3835,7 +3835,7 @@ export const ResponseInitChain = { if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; @@ -4053,15 +4053,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.index = message.index ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4158,7 +4158,7 @@ export const ResponseBeginBlock = { if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4365,18 +4365,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4582,18 +4582,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4728,13 +4728,13 @@ export const ResponseEndBlock = { if (message.validatorUpdates) { obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validator_updates = []; + obj.validator_updates = message.validatorUpdates; } obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4937,7 +4937,7 @@ export const ResponseListSnapshots = { if (message.snapshots) { obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); } else { - obj.snapshots = []; + obj.snapshots = message.snapshots; } return obj; }, @@ -5020,13 +5020,13 @@ export const ResponseOfferSnapshot = { fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = responseOfferSnapshot_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -5247,7 +5247,7 @@ export const ResponseApplySnapshotChunk = { fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); if (object.result !== undefined && object.result !== null) { - message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + message.result = object.result; } message.refetchChunks = object.refetch_chunks?.map(e => e) || []; message.rejectSenders = object.reject_senders?.map(e => e) || []; @@ -5255,16 +5255,16 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { - obj.refetch_chunks = []; + obj.refetch_chunks = message.refetchChunks; } if (message.rejectSenders) { obj.reject_senders = message.rejectSenders.map(e => e); } else { - obj.reject_senders = []; + obj.reject_senders = message.rejectSenders; } return obj; }, @@ -5619,11 +5619,11 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, @@ -5734,11 +5734,11 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -5861,7 +5861,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.index = message.index; + obj.index = message.index === false ? undefined : message.index; return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -5998,7 +5998,7 @@ export const TxResult = { toAmino(message: TxResult): TxResultAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -6315,7 +6315,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6449,7 +6449,7 @@ export const Evidence = { fromAmino(object: EvidenceAmino): Evidence { const message = createBaseEvidence(); if (object.type !== undefined && object.type !== null) { - message.type = evidenceTypeFromJSON(object.type); + message.type = object.type; } if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); @@ -6467,7 +6467,7 @@ export const Evidence = { }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = evidenceTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; @@ -6624,8 +6624,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; return obj; diff --git a/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts index 18fbbbef19..f1e5065d68 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts @@ -210,7 +210,7 @@ export const Proof = { if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); } else { - obj.aunts = []; + obj.aunts = message.aunts; } return obj; }, @@ -436,9 +436,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -558,7 +558,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -657,7 +657,7 @@ export const ProofOps = { if (message.ops) { obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); } else { - obj.ops = []; + obj.ops = message.ops; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts index c6f7a6b6c7..a9137583ff 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -113,11 +113,11 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = omitDefault(message.bits); + obj.bits = message.bits ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { - obj.elems = []; + obj.elems = message.elems; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts index c960099f3b..0b99e48fc4 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts @@ -386,12 +386,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = message.nodeId === "" ? undefined : message.nodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; - obj.moniker = message.moniker; + obj.moniker = message.moniker === "" ? undefined : message.moniker; obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -496,8 +496,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -623,11 +623,11 @@ export const PeerInfo = { }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { - obj.address_info = []; + obj.address_info = message.addressInfo; } obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; return obj; @@ -765,10 +765,10 @@ export const PeerAddressInfo = { }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; - obj.dial_failures = message.dialFailures; + obj.dial_failures = message.dialFailures === 0 ? undefined : message.dialFailures; return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts index de7f78431e..61e21d689c 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts @@ -471,7 +471,7 @@ export const LightClientAttackEvidence = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -571,7 +571,7 @@ export const EvidenceList = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts index ed4d1497b8..1d9f99501c 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -382,9 +382,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = omitDefault(message.maxBytes); - obj.max_gas = omitDefault(message.maxGas); - obj.time_iota_ms = omitDefault(message.timeIotaMs); + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -504,9 +504,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); + obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = omitDefault(message.maxBytes); + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -603,7 +603,7 @@ export const ValidatorParams = { if (message.pubKeyTypes) { obj.pub_key_types = message.pubKeyTypes.map(e => e); } else { - obj.pub_key_types = []; + obj.pub_key_types = message.pubKeyTypes; } return obj; }, @@ -692,7 +692,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = omitDefault(message.appVersion); + obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -796,8 +796,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = omitDefault(message.blockMaxBytes); - obj.block_max_gas = omitDefault(message.blockMaxGas); + obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts index 59956853fd..a83b356513 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts @@ -433,7 +433,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = message.total === 0 ? undefined : message.total; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, @@ -554,7 +554,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -958,7 +958,7 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; @@ -1067,7 +1067,7 @@ export const Data = { if (message.txs) { obj.txs = message.txs.map(e => base64FromBytes(e)); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, @@ -1241,7 +1241,7 @@ export const Vote = { fromAmino(object: VoteAmino): Vote { const message = createBaseVote(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1268,13 +1268,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; - obj.validator_index = message.validatorIndex; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -1418,12 +1418,12 @@ export const Commit = { toAmino(message: Commit): CommitAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1545,7 +1545,7 @@ export const CommitSig = { fromAmino(object: CommitSigAmino): CommitSig { const message = createBaseCommitSig(); if (object.block_id_flag !== undefined && object.block_id_flag !== null) { - message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + message.blockIdFlag = object.block_id_flag; } if (object.validator_address !== undefined && object.validator_address !== null) { message.validatorAddress = bytesFromBase64(object.validator_address); @@ -1560,7 +1560,7 @@ export const CommitSig = { }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; @@ -1723,7 +1723,7 @@ export const Proposal = { fromAmino(object: ProposalAmino): Proposal { const message = createBaseProposal(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1747,10 +1747,10 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts index 6e49b155f3..e3a1ffbaf7 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -154,10 +154,10 @@ export const ValidatorSet = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -295,8 +295,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); - obj.proposer_priority = omitDefault(message.proposerPriority); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -401,7 +401,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts index df46a6fc6b..e4b3f8b347 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -130,8 +130,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = omitDefault(message.protocol); - obj.software = omitDefault(message.software); + obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.software = message.software === "" ? undefined : message.software; return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -235,8 +235,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = omitDefault(message.block); - obj.app = omitDefault(message.app); + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts index 4fe3392676..f273193c75 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts @@ -241,12 +241,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -330,12 +330,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -400,7 +400,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -474,12 +474,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -563,12 +563,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -702,12 +702,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts index c7f395568c..75c2c1b455 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts @@ -241,12 +241,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -330,12 +330,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -400,7 +400,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -474,12 +474,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -563,12 +563,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -702,12 +702,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts index 4dec8cd349..07509ab649 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts @@ -67,7 +67,7 @@ export const GenesisState = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.ts index 6f17722bb2..4821ccfc6b 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/query.ts @@ -196,7 +196,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -272,8 +272,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -414,7 +414,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -489,8 +489,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -566,7 +566,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = message.auditor === "" ? undefined : message.auditor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts index 6abb3b6519..8bd1d886d1 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts @@ -148,8 +148,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -222,12 +222,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -302,11 +302,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta1/endpoint.ts index 72262895a5..c2a6eb4a35 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta1/endpoint.ts @@ -94,13 +94,13 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } return message; }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); + obj.kind = message.kind === 0 ? undefined : message.kind; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts index dc4470b6b0..cb4999381b 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts @@ -170,7 +170,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -245,11 +245,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -324,11 +324,11 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -435,7 +435,7 @@ export const ResourceUnits = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts index 0bda8ef1cf..c989ece6bf 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts @@ -148,8 +148,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -222,12 +222,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -302,11 +302,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts index 0e1bcfecf1..bbc058e325 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts @@ -112,7 +112,7 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.sequence_number !== undefined && object.sequence_number !== null) { message.sequenceNumber = object.sequence_number; @@ -121,8 +121,8 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); - obj.sequence_number = message.sequenceNumber; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.sequence_number = message.sequenceNumber ?? 0; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts index 54835288f8..4f89d3a89d 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts @@ -134,7 +134,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -209,11 +209,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -299,12 +299,12 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.name = message.name; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.name = message.name ?? ""; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts index 35d441ae32..5f15ef50c0 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts @@ -123,12 +123,12 @@ export const ResourceUnits = { if (message.storage) { obj.storage = message.storage.map(e => e ? Storage.toAmino(e) : undefined); } else { - obj.storage = []; + obj.storage = message.storage; } if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts index 567bb2cc3d..1a2cb550ab 100644 --- a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts @@ -247,8 +247,8 @@ export const CertificateID = { }, toAmino(message: CertificateID): CertificateIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateIDAminoMsg): CertificateID { @@ -321,7 +321,7 @@ export const Certificate = { fromAmino(object: CertificateAmino): Certificate { const message = createBaseCertificate(); if (object.state !== undefined && object.state !== null) { - message.state = certificate_StateFromJSON(object.state); + message.state = object.state; } if (object.cert !== undefined && object.cert !== null) { message.cert = bytesFromBase64(object.cert); @@ -333,9 +333,9 @@ export const Certificate = { }, toAmino(message: Certificate): CertificateAmino { const obj: any = {}; - obj.state = certificate_StateToJSON(message.state); - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.state = message.state ?? 0; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: CertificateAminoMsg): Certificate { @@ -420,9 +420,9 @@ export const CertificateFilter = { }, toAmino(message: CertificateFilter): CertificateFilterAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: CertificateFilterAminoMsg): CertificateFilter { @@ -507,9 +507,9 @@ export const MsgCreateCertificate = { }, toAmino(message: MsgCreateCertificate): MsgCreateCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.owner = message.owner ?? ""; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: MsgCreateCertificateAminoMsg): MsgCreateCertificate { @@ -624,7 +624,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : undefined; + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts index 1ee13f96a5..e45f7ee3be 100644 --- a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts @@ -102,8 +102,8 @@ export const GenesisCertificate = { }, toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; + obj.owner = message.owner ?? ""; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { @@ -167,7 +167,7 @@ export const GenesisState = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts index c9e2dbf0ba..84eea06a9e 100644 --- a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts @@ -129,8 +129,8 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; - obj.serial = message.serial; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateResponseAminoMsg): CertificateResponse { @@ -286,7 +286,7 @@ export const QueryCertificatesResponse = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts index 308856d3ba..a61da08414 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts @@ -85,7 +85,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts index 8831def7ea..5fe1ad51e3 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts @@ -178,8 +178,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -267,7 +267,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -279,9 +279,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -369,9 +369,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts index 1a05267361..198a9ed0a2 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts @@ -255,15 +255,15 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; - obj.depositor = message.depositor; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -402,9 +402,9 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; - obj.depositor = message.depositor; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -530,8 +530,8 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -646,7 +646,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts index d4db99bab5..f8e57c6429 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts @@ -105,11 +105,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -187,9 +187,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts index b62ffe4bd9..eb194dc201 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts @@ -159,7 +159,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -171,9 +171,9 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts index 59147f49bf..8d6dc518bb 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts @@ -95,9 +95,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts index 7084a9b3a1..784438a380 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts @@ -150,7 +150,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -265,7 +265,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -380,7 +380,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts index 20257d9e07..79cecb5c24 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts @@ -95,12 +95,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts index 2cdb05a212..a3ba56bae8 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts @@ -68,7 +68,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts index 238e0ea1fa..150f80537e 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts @@ -275,7 +275,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -429,11 +429,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts index fb5389eb9c..cb1314511f 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts @@ -99,9 +99,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts index a8853b0f98..24eb9edf33 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts @@ -79,12 +79,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.ts index 11f103be10..9c64d955bc 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/query.ts @@ -206,10 +206,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -287,7 +287,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -409,11 +409,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -491,7 +491,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts index 8482697e33..00d9890dcc 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts @@ -263,8 +263,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -375,7 +375,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = Coin.fromAmino(object.balance); @@ -390,12 +390,12 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -517,7 +517,7 @@ export const Payment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = payment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = Coin.fromAmino(object.rate); @@ -532,13 +532,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = payment_StateToJSON(message.state); - obj.rate = message.rate ? Coin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts index deedc5eddc..7ef7c18b3d 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts @@ -79,12 +79,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.ts index 011a266694..00879fc84f 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/query.ts @@ -206,10 +206,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -287,7 +287,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -409,11 +409,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -491,7 +491,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts index 5152653856..a142b1f62c 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts @@ -287,8 +287,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -417,7 +417,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = DecCoin.fromAmino(object.balance); @@ -438,14 +438,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; - obj.depositor = message.depositor; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; + obj.depositor = message.depositor ?? ""; + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -567,7 +567,7 @@ export const FractionalPayment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = fractionalPayment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = DecCoin.fromAmino(object.rate); @@ -582,13 +582,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = fractionalPayment_StateToJSON(message.state); - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts index bcab7355a4..9ee6751c01 100644 --- a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts @@ -68,7 +68,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts index 9a9d18a7b9..69018a69a7 100644 --- a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial, Exact } from "../../../helpers"; +import { DeepPartial, Exact, padDecimal } from "../../../helpers"; export const protobufPackage = "akash.inflation.v1beta2"; /** Params defines the parameters for the x/deployment package */ export interface Params { @@ -112,9 +112,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = message.inflationDecayFactor; - obj.initial_inflation = message.initialInflation; - obj.variance = message.variance; + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor) ?? ""; + obj.initial_inflation = padDecimal(message.initialInflation) ?? ""; + obj.variance = padDecimal(message.variance) ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts index cbc37f047e..627ed47dcf 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts @@ -324,10 +324,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : undefined; - obj.provider = message.provider; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.provider = message.provider ?? ""; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -442,7 +442,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -601,11 +601,11 @@ export const BidID = { }, toAmino(message: BidID): BidIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: BidIDAminoMsg): BidID { @@ -695,7 +695,7 @@ export const Bid = { message.bidId = BidID.fromAmino(object.bid_id); } if (object.state !== undefined && object.state !== null) { - message.state = bid_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -707,9 +707,9 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; - obj.state = bid_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -830,12 +830,12 @@ export const BidFilters = { }, toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: BidFiltersAminoMsg): BidFilters { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts index aa95b9d351..c93771aa8d 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts @@ -97,14 +97,14 @@ export const GenesisState = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } if (message.leases) { obj.leases = message.leases.map(e => e ? Lease.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts index d13155b25f..5755bc4dd4 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts @@ -343,11 +343,11 @@ export const LeaseID = { }, toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: LeaseIDAminoMsg): LeaseID { @@ -447,7 +447,7 @@ export const Lease = { message.leaseId = LeaseID.fromAmino(object.lease_id); } if (object.state !== undefined && object.state !== null) { - message.state = lease_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -462,9 +462,9 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; - obj.state = lease_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; return obj; @@ -586,12 +586,12 @@ export const LeaseFilters = { }, toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: LeaseFiltersAminoMsg): LeaseFilters { @@ -656,7 +656,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -771,7 +771,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -886,7 +886,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts index cc141c8e3d..132ef5bd1d 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts @@ -220,10 +220,10 @@ export const OrderID = { }, toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; return obj; }, fromAminoMsg(object: OrderIDAminoMsg): OrderID { @@ -313,7 +313,7 @@ export const Order = { message.orderId = OrderID.fromAmino(object.order_id); } if (object.state !== undefined && object.state !== null) { - message.state = order_StateFromJSON(object.state); + message.state = object.state; } if (object.spec !== undefined && object.spec !== null) { message.spec = GroupSpec.fromAmino(object.spec); @@ -325,9 +325,9 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; - obj.state = order_StateToJSON(message.state); - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.state = message.state ?? 0; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -437,11 +437,11 @@ export const OrderFilters = { }, toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: OrderFiltersAminoMsg): OrderFilters { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts index b6c05e316e..57cd4603d4 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts @@ -82,8 +82,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : undefined; - obj.order_max_bids = message.orderMaxBids; + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.ts index b35129074f..76611e8de7 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/query.ts @@ -407,7 +407,7 @@ export const QueryOrdersResponse = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -695,7 +695,7 @@ export const QueryBidsResponse = { if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toAmino(e) : undefined); } else { - obj.bids = []; + obj.bids = message.bids; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -997,7 +997,7 @@ export const QueryLeasesResponse = { if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts index a1bc7d968b..3d588c7297 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts @@ -229,8 +229,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -326,14 +326,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -479,14 +479,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -599,7 +599,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -745,14 +745,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts index b9872431fb..8d356a90f4 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts @@ -67,7 +67,7 @@ export const GenesisState = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts index 58a60f9cc5..59435fb758 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts @@ -229,8 +229,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -326,14 +326,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -479,14 +479,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -599,7 +599,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -745,14 +745,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.ts index 479d877378..aedb74dd80 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/query.ts @@ -209,7 +209,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -274,7 +274,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputsign/confio/proofs.ts b/__fixtures__/v-next/outputsign/confio/proofs.ts index 6439fa54ec..32d65557ef 100644 --- a/__fixtures__/v-next/outputsign/confio/proofs.ts +++ b/__fixtures__/v-next/outputsign/confio/proofs.ts @@ -837,7 +837,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1125,16 +1125,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1143,10 +1143,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1220,7 +1220,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1232,7 +1232,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1336,8 +1336,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1456,7 +1456,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1465,13 +1465,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { @@ -1535,7 +1535,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1688,12 +1688,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -1884,7 +1884,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/config.ts index 13c76ce647..6e8fbb4e22 100644 --- a/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/config.ts @@ -148,7 +148,7 @@ export const Config = { if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e) : undefined); } else { - obj.modules = []; + obj.modules = message.modules; } return obj; }, @@ -231,7 +231,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/module.ts index 025ea49eea..ef4df32cbf 100644 --- a/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputsign/cosmos/app/v1alpha1/module.ts @@ -269,16 +269,16 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = message.goImport; + obj.go_import = message.goImport === "" ? undefined : message.goImport; if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { - obj.use_package = []; + obj.use_package = message.usePackage; } if (message.canMigrateFrom) { obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); } else { - obj.can_migrate_from = []; + obj.can_migrate_from = message.canMigrateFrom; } return obj; }, @@ -359,8 +359,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = message.name; - obj.revision = message.revision; + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -429,7 +429,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = message.module; + obj.module = message.module === "" ? undefined : message.module; return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts index 21dade1f16..2ae8e31382 100644 --- a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts @@ -184,7 +184,7 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; @@ -279,11 +279,11 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { - obj.permissions = []; + obj.permissions = message.permissions; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/genesis.ts index 769a7cb3e4..214c9f175b 100644 --- a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/genesis.ts @@ -89,7 +89,7 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.ts index fcab4e01ea..9d580bffbc 100644 --- a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/query.ts @@ -434,7 +434,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -505,7 +505,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -829,7 +829,7 @@ export const QueryModuleAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, @@ -955,7 +955,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = message.bech32Prefix; + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1093,7 +1093,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1162,7 +1162,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = message.addressString; + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/authz.ts index 8f15ef9979..ce0ec51d7c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/authz.ts @@ -180,7 +180,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -367,8 +367,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -440,7 +440,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/genesis.ts index 2b6c39ef6a..651872e807 100644 --- a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/genesis.ts @@ -67,7 +67,7 @@ export const GenesisState = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.ts index f1ce2a1d16..5e78eef49a 100644 --- a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/query.ts @@ -246,9 +246,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -332,7 +332,7 @@ export const QueryGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -416,7 +416,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -500,7 +500,7 @@ export const QueryGranterGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -584,7 +584,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -668,7 +668,7 @@ export const QueryGranteeGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.ts index 7e8f0560ea..0b7cf6c127 100644 --- a/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/authz/v1beta1/tx.ts @@ -234,8 +234,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -306,7 +306,7 @@ export const MsgExecResponse = { if (message.results) { obj.results = message.results.map(e => base64FromBytes(e)); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -385,11 +385,11 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -537,9 +537,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/authz.ts index afc043ab36..835be2a105 100644 --- a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/authz.ts @@ -82,7 +82,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/bank.ts index 613fb885b3..38a30354c4 100644 --- a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/bank.ts @@ -353,9 +353,9 @@ export const Params = { if (message.sendEnabled) { obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); } else { - obj.send_enabled = []; + obj.send_enabled = message.sendEnabled; } - obj.default_send_enabled = message.defaultSendEnabled; + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -435,8 +435,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = message.denom; - obj.enabled = message.enabled; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -514,11 +514,11 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -597,11 +597,11 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -672,7 +672,7 @@ export const Supply = { if (message.total) { obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -762,12 +762,12 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = message.denom; - obj.exponent = message.exponent; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } return obj; }, @@ -912,18 +912,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { - obj.denom_units = []; - } - obj.base = message.base; - obj.display = message.display; - obj.name = message.name; - obj.symbol = message.symbol; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.denom_units = message.denomUnits; + } + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/genesis.ts index bf9e9c43e2..7ebd30f797 100644 --- a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/genesis.ts @@ -159,17 +159,17 @@ export const GenesisState = { if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } if (message.denomMetadata) { obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.denom_metadata = []; + obj.denom_metadata = message.denomMetadata; } return obj; }, @@ -248,11 +248,11 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.ts index 248f216a3e..dd61975979 100644 --- a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/query.ts @@ -618,8 +618,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -772,7 +772,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -856,7 +856,7 @@ export const QueryAllBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -940,7 +940,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1024,7 +1024,7 @@ export const QuerySpendableBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1180,7 +1180,7 @@ export const QueryTotalSupplyResponse = { if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1251,7 +1251,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1603,7 +1603,7 @@ export const QueryDenomsMetadataResponse = { if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.metadatas = []; + obj.metadatas = message.metadatas; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1674,7 +1674,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -1827,7 +1827,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1910,7 +1910,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, @@ -1994,7 +1994,7 @@ export const QueryDenomOwnersResponse = { if (message.denomOwners) { obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); } else { - obj.denom_owners = []; + obj.denom_owners = message.denomOwners; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.ts index 3d003a2947..2e0e81bcec 100644 --- a/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/bank/v1beta1/tx.ts @@ -144,12 +144,12 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -285,12 +285,12 @@ export const MsgMultiSend = { if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); } else { - obj.inputs = []; + obj.inputs = message.inputs; } if (message.outputs) { obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); } else { - obj.outputs = []; + obj.outputs = message.outputs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts index 6e7192de5d..30ad603024 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts @@ -653,25 +653,25 @@ export const TxResponse = { toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -761,12 +761,12 @@ export const ABCIMessageLog = { }, toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; - obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -845,11 +845,11 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -930,8 +930,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1115,16 +1115,16 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1290,7 +1290,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1370,12 +1370,12 @@ export const TxMsgData = { if (message.data) { obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1516,7 +1516,7 @@ export const SearchTxsResult = { if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputsign/cosmos/base/kv/v1beta1/kv.ts index b164a19667..2b657dfce2 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/kv/v1beta1/kv.ts @@ -89,7 +89,7 @@ export const Pairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts index 018af8de22..9173ec4cef 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts @@ -267,8 +267,8 @@ export const PageRequest = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.offset = message.offset ? message.offset.toString() : undefined; obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.ts index 22d1873a3a..9ce58a5ff4 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v1beta1/reflection.ts @@ -198,7 +198,7 @@ export const ListAllInterfacesResponse = { if (message.interfaceNames) { obj.interface_names = message.interfaceNames.map(e => e); } else { - obj.interface_names = []; + obj.interface_names = message.interfaceNames; } return obj; }, @@ -268,7 +268,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = message.interfaceName; + obj.interface_name = message.interfaceName === "" ? undefined : message.interfaceName; return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { @@ -338,7 +338,7 @@ export const ListImplementationsResponse = { if (message.implementationMessageNames) { obj.implementation_message_names = message.implementationMessageNames.map(e => e); } else { - obj.implementation_message_names = []; + obj.implementation_message_names = message.implementationMessageNames; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.ts index 7da697b545..443d38d415 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/reflection/v2alpha1/reflection.ts @@ -895,11 +895,11 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -970,7 +970,7 @@ export const AuthnDescriptor = { if (message.signModes) { obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); } else { - obj.sign_modes = []; + obj.sign_modes = message.signModes; } return obj; }, @@ -1062,9 +1062,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1133,7 +1133,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1203,7 +1203,7 @@ export const CodecDescriptor = { if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); } else { - obj.interfaces = []; + obj.interfaces = message.interfaces; } return obj; }, @@ -1291,16 +1291,16 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { - obj.interface_accepting_messages = []; + obj.interface_accepting_messages = message.interfaceAcceptingMessages; } if (message.interfaceImplementers) { obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); } else { - obj.interface_implementers = []; + obj.interface_implementers = message.interfaceImplementers; } return obj; }, @@ -1381,8 +1381,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.type_url = message.typeUrl; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1460,11 +1460,11 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { - obj.field_descriptor_names = []; + obj.field_descriptor_names = message.fieldDescriptorNames; } return obj; }, @@ -1534,7 +1534,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix; + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1603,7 +1603,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = message.msgTypeUrl; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -2435,7 +2435,7 @@ export const QueryServicesDescriptor = { if (message.queryServices) { obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); } else { - obj.query_services = []; + obj.query_services = message.queryServices; } return obj; }, @@ -2525,12 +2525,12 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = message.fullname; - obj.is_module = message.isModule; + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } return obj; }, @@ -2611,8 +2611,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.full_query_path = message.fullQueryPath; + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts index b1200c240d..de5921491e 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -322,8 +322,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -395,7 +395,7 @@ export const Metadata = { if (message.chunkHashes) { obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); } else { - obj.chunk_hashes = []; + obj.chunk_hashes = message.chunkHashes; } return obj; }, @@ -606,7 +606,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -713,7 +713,7 @@ export const SnapshotIAVLItem = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.height = message.height === 0 ? undefined : message.height; return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -793,8 +793,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { @@ -1014,7 +1014,7 @@ export const SnapshotSchema = { if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e)); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts index f6185675bd..a0abd17fef 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts @@ -156,7 +156,7 @@ export const CommitInfo = { if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { - obj.store_infos = []; + obj.store_infos = message.storeInfos; } return obj; }, @@ -239,7 +239,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/listening.ts index e32956be99..33f261efc5 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/listening.ts @@ -129,8 +129,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts index a50943b75a..8ea8f7bc9d 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts @@ -521,7 +521,7 @@ export const GetValidatorSetByHeightResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -691,7 +691,7 @@ export const GetLatestValidatorSetResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -801,7 +801,7 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; @@ -1226,7 +1226,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = message.syncing === false ? undefined : message.syncing; return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1511,18 +1511,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = message.name === "" ? undefined : message.name; + obj.app_name = message.appName === "" ? undefined : message.appName; + obj.version = message.version === "" ? undefined : message.version; + obj.git_commit = message.gitCommit === "" ? undefined : message.gitCommit; + obj.build_tags = message.buildTags === "" ? undefined : message.buildTags; + obj.go_version = message.goVersion === "" ? undefined : message.goVersion; if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { - obj.build_deps = []; + obj.build_deps = message.buildDeps; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = message.cosmosSdkVersion === "" ? undefined : message.cosmosSdkVersion; return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1613,9 +1613,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = message.path === "" ? undefined : message.path; + obj.version = message.version === "" ? undefined : message.version; + obj.sum = message.sum === "" ? undefined : message.sum; return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts index d6cbec17e8..fa7fa77bca 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/v1beta1/coin.ts @@ -172,8 +172,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -253,8 +253,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -323,7 +323,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = message.int; + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -392,7 +392,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = message.dec; + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts index aee939e26e..ddb9068488 100644 --- a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts @@ -217,8 +217,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = message.module; - obj.name = message.name; + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { @@ -288,7 +288,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts index e9014a508b..5422161ba2 100644 --- a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts @@ -206,7 +206,7 @@ export const GenesisState = { if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.ts index 76c31d6392..95c291ba38 100644 --- a/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/crisis/v1beta1/tx.ts @@ -107,9 +107,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = message.sender; - obj.invariant_module_name = message.invariantModuleName; - obj.invariant_route = message.invariantRoute; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.invariant_module_name = message.invariantModuleName === "" ? undefined : message.invariantModuleName; + obj.invariant_route = message.invariantRoute === "" ? undefined : message.invariantRoute; return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputsign/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputsign/cosmos/crypto/hd/v1/hd.ts index eea5209e1d..45468ca166 100644 --- a/__fixtures__/v-next/outputsign/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputsign/cosmos/crypto/hd/v1/hd.ts @@ -137,11 +137,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = message.purpose; - obj.coin_type = message.coinType; - obj.account = message.account; - obj.change = message.change; - obj.address_index = message.addressIndex; + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputsign/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputsign/cosmos/crypto/keyring/v1/record.ts index 4b42d6a91a..1deea3f4f0 100644 --- a/__fixtures__/v-next/outputsign/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputsign/cosmos/crypto/keyring/v1/record.ts @@ -239,7 +239,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -327,7 +327,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = message.privKeyType === "" ? undefined : message.privKeyType; return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/keys.ts index 29fa1e95f5..c68f7a29cf 100644 --- a/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/keys.ts @@ -90,11 +90,11 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === 0 ? undefined : message.threshold; if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.public_keys = []; + obj.public_keys = message.publicKeys; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/v1beta1/multisig.ts index 53363158ff..7b210521b7 100644 --- a/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputsign/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -116,7 +116,7 @@ export const MultiSignature = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -197,7 +197,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts index 6afe9c7dc4..335df440c6 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -503,10 +503,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = message.communityTax; - obj.base_proposer_reward = message.baseProposerReward; - obj.bonus_proposer_reward = message.bonusProposerReward; - obj.withdraw_addr_enabled = message.withdrawAddrEnabled; + obj.community_tax = padDecimal(message.communityTax) === "" ? undefined : padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward) === "" ? undefined : padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward) === "" ? undefined : padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -587,9 +587,9 @@ export const ValidatorHistoricalRewards = { if (message.cumulativeRewardRatio) { obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.cumulative_reward_ratio = []; + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; } - obj.reference_count = message.referenceCount; + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -672,7 +672,7 @@ export const ValidatorCurrentRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } obj.period = message.period ? message.period.toString() : undefined; return obj; @@ -744,7 +744,7 @@ export const ValidatorAccumulatedCommission = { if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.commission = []; + obj.commission = message.commission; } return obj; }, @@ -815,7 +815,7 @@ export const ValidatorOutstandingRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -899,7 +899,7 @@ export const ValidatorSlashEvent = { toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; - obj.fraction = message.fraction; + obj.fraction = padDecimal(message.fraction) === "" ? undefined : padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -969,7 +969,7 @@ export const ValidatorSlashEvents = { if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, @@ -1040,7 +1040,7 @@ export const FeePool = { if (message.communityPool) { obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.community_pool = []; + obj.community_pool = message.communityPool; } return obj; }, @@ -1141,13 +1141,13 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1244,8 +1244,8 @@ export const DelegatorStartingInfo = { toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; - obj.stake = message.stake; - obj.height = message.height ? message.height.toString() : undefined; + obj.stake = padDecimal(message.stake) === "" ? undefined : padDecimal(message.stake); + obj.height = message.height ? message.height.toString() : "0"; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1323,11 +1323,11 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.reward = []; + obj.reward = message.reward; } return obj; }, @@ -1441,11 +1441,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.recipient = message.recipient; - obj.amount = message.amount; - obj.deposit = message.deposit; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts index f1414f459f..fb6508ff92 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts @@ -364,8 +364,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -443,11 +443,11 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } return obj; }, @@ -530,7 +530,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -626,7 +626,7 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.period = message.period ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; @@ -710,7 +710,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -804,8 +804,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -914,7 +914,7 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.height = message.height ? message.height.toString() : undefined; obj.period = message.period ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; @@ -1080,38 +1080,38 @@ export const GenesisState = { if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); } else { - obj.delegator_withdraw_infos = []; + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } if (message.validatorAccumulatedCommissions) { obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); } else { - obj.validator_accumulated_commissions = []; + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; } if (message.validatorHistoricalRewards) { obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_historical_rewards = []; + obj.validator_historical_rewards = message.validatorHistoricalRewards; } if (message.validatorCurrentRewards) { obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_current_rewards = []; + obj.validator_current_rewards = message.validatorCurrentRewards; } if (message.delegatorStartingInfos) { obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); } else { - obj.delegator_starting_infos = []; + obj.delegator_starting_infos = message.delegatorStartingInfos; } if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts index 0f54a2f281..f7bf3eb404 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts @@ -727,7 +727,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -867,7 +867,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1046,7 +1046,7 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; @@ -1132,7 +1132,7 @@ export const QueryValidatorSlashesResponse = { if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.slashes = []; + obj.slashes = message.slashes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1214,8 +1214,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1285,7 +1285,7 @@ export const QueryDelegationRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1355,7 +1355,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1434,12 +1434,12 @@ export const QueryDelegationTotalRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } if (message.total) { obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -1509,7 +1509,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1579,7 +1579,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e); } else { - obj.validators = []; + obj.validators = message.validators; } return obj; }, @@ -1649,7 +1649,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -1718,7 +1718,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { @@ -1844,7 +1844,7 @@ export const QueryCommunityPoolResponse = { if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.pool = []; + obj.pool = message.pool; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.ts index 1c56606356..46efb37705 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/tx.ts @@ -250,8 +250,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -387,8 +387,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -458,7 +458,7 @@ export const MsgWithdrawDelegatorRewardResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -528,7 +528,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -598,7 +598,7 @@ export const MsgWithdrawValidatorCommissionResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -680,9 +680,9 @@ export const MsgFundCommunityPool = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts index 6796c13d31..0e6de839c7 100644 --- a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts @@ -124,7 +124,7 @@ export const Equivocation = { obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/genesis.ts index f5d4faca5a..638fb9e03d 100644 --- a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/genesis.ts @@ -69,7 +69,7 @@ export const GenesisState = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.ts index 8903dd17b6..f06c2f1ee8 100644 --- a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/query.ts @@ -383,7 +383,7 @@ export const QueryAllEvidenceResponse = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.ts index 668a9e8434..1991e1a58a 100644 --- a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/tx.ts @@ -113,7 +113,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = message.submitter === "" ? undefined : message.submitter; obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/feegrant.ts index 41bd9b92ff..ea80e8f326 100644 --- a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/feegrant.ts @@ -235,7 +235,7 @@ export const BasicAllowance = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -355,12 +355,12 @@ export const PeriodicAllowance = { if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_spend_limit = []; + obj.period_spend_limit = message.periodSpendLimit; } if (message.periodCanSpend) { obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_can_spend = []; + obj.period_can_spend = message.periodCanSpend; } obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; return obj; @@ -446,7 +446,7 @@ export const AllowedMsgAllowance = { if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { - obj.allowed_messages = []; + obj.allowed_messages = message.allowedMessages; } return obj; }, @@ -540,8 +540,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/genesis.ts index b5a05cdc52..67012d8865 100644 --- a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/genesis.ts @@ -67,7 +67,7 @@ export const GenesisState = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.ts index b37d5efdf2..98f1c1de0b 100644 --- a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/query.ts @@ -211,8 +211,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -365,7 +365,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -449,7 +449,7 @@ export const QueryAllowancesResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -533,7 +533,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -617,7 +617,7 @@ export const QueryAllowancesByGranterResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.ts index 70f182a7d8..f4f793b9ef 100644 --- a/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/feegrant/v1beta1/tx.ts @@ -166,8 +166,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, @@ -304,8 +304,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts index 0144f038c0..4ed8f79637 100644 --- a/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts @@ -68,7 +68,7 @@ export const GenesisState = { if (message.genTxs) { obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); } else { - obj.gen_txs = []; + obj.gen_txs = message.genTxs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts index 077400e0f3..5a2f7024b3 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts @@ -170,17 +170,17 @@ export const GenesisState = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts index 6418d9d315..4e5aca8097 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts @@ -470,7 +470,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -479,8 +479,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -572,11 +572,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -720,7 +720,7 @@ export const Proposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -749,20 +749,20 @@ export const Proposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -864,10 +864,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -970,13 +970,13 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1059,7 +1059,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -1223,9 +1223,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts index fc170b0bf5..c61f31318d 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts @@ -1,4 +1,4 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; @@ -630,7 +630,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -645,9 +645,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -731,7 +731,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -816,7 +816,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1055,7 +1055,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1126,7 +1126,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1308,7 +1308,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1547,7 +1547,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts index 778a40156d..b0cafe4f7b 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; @@ -316,15 +316,15 @@ export const MsgSubmitProposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -478,7 +478,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -629,7 +629,7 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -638,10 +638,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -799,14 +799,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -953,12 +953,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts index 7be9632721..24e06bd099 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts @@ -170,17 +170,17 @@ export const GenesisState = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts index 3cb6b2c690..07733d186a 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts @@ -4,7 +4,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/pro import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -523,7 +523,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -532,8 +532,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -613,8 +613,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -706,11 +706,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -850,7 +850,7 @@ export const Proposal = { message.content = Any.fromAmino(object.content); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -874,14 +874,14 @@ export const Proposal = { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; @@ -986,10 +986,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1084,20 +1084,20 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; return message; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1181,7 +1181,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts index b4bf6f9912..32e9998efb 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts @@ -1,4 +1,4 @@ -import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType, proposalStatusFromJSON, proposalStatusToJSON } from "./gov"; +import { ProposalStatus, ProposalStatusSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType, Deposit, DepositAmino, DepositSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./gov"; import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; @@ -630,7 +630,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -645,9 +645,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -731,7 +731,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -816,7 +816,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1055,7 +1055,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1126,7 +1126,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1308,7 +1308,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1547,7 +1547,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts index b8e69a5265..6e5f6ec48c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; -import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./gov"; +import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionAmino, WeightedVoteOptionSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; @@ -273,9 +273,9 @@ export const MsgSubmitProposal = { if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -346,7 +346,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -433,15 +433,15 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -588,12 +588,12 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -741,12 +741,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts index 89ad439ee5..80b3becab3 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts @@ -1,4 +1,4 @@ -import { ProposalExecutorResult, ProposalExecutorResultSDKType, proposalExecutorResultFromJSON, proposalExecutorResultToJSON } from "./types"; +import { ProposalExecutorResult, ProposalExecutorResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; @@ -396,7 +396,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -465,7 +465,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -754,14 +754,14 @@ export const EventExec = { message.proposalId = BigInt(object.proposal_id); } if (object.result !== undefined && object.result !== null) { - message.result = proposalExecutorResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = proposalExecutorResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -844,7 +844,7 @@ export const EventLeaveGroup = { toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts index 1eeb6ef0b0..190ce70c9a 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts @@ -198,29 +198,29 @@ export const GenesisState = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } if (message.groupMembers) { obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.group_members = []; + obj.group_members = message.groupMembers; } obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts index fd906b3a9c..3a3b69dfed 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts @@ -846,7 +846,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -1085,7 +1085,7 @@ export const QueryGroupMembersResponse = { if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1169,7 +1169,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1253,7 +1253,7 @@ export const QueryGroupsByAdminResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1423,7 +1423,7 @@ export const QueryGroupPoliciesByGroupResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1507,7 +1507,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1591,7 +1591,7 @@ export const QueryGroupPoliciesByAdminResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1817,7 +1817,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1901,7 +1901,7 @@ export const QueryProposalsByGroupPolicyResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1986,7 +1986,7 @@ export const QueryVoteByProposalVoterRequest = { toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2225,7 +2225,7 @@ export const QueryVotesByProposalResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2309,7 +2309,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2393,7 +2393,7 @@ export const QueryVotesByVoterResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2477,7 +2477,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2561,7 +2561,7 @@ export const QueryGroupsByMemberResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts index 09bd1e03d0..38209a3667 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts @@ -1,4 +1,4 @@ -import { Member, MemberAmino, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./types"; +import { Member, MemberAmino, MemberSDKType, VoteOption, VoteOptionSDKType } from "./types"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial } from "../../../helpers"; @@ -842,13 +842,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -1010,12 +1010,12 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.member_updates = []; + obj.member_updates = message.memberUpdates; } return obj; }, @@ -1165,9 +1165,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1316,9 +1316,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1480,9 +1480,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1552,7 +1552,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1643,9 +1643,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -1769,15 +1769,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1861,7 +1861,7 @@ export const MsgCreateGroupWithPolicyResponse = { toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2010,8 +2010,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -2159,9 +2159,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2320,25 +2320,25 @@ export const MsgSubmitProposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.exec = execToJSON(message.exec); + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2492,7 +2492,7 @@ export const MsgWithdrawProposal = { toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -2651,23 +2651,23 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; - obj.exec = execToJSON(message.exec); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -2806,7 +2806,7 @@ export const MsgExec = { toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -2944,7 +2944,7 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts index 998d4fa795..daf100bcaa 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts @@ -831,9 +831,9 @@ export const Member = { }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; return obj; }, @@ -904,7 +904,7 @@ export const Members = { if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } return obj; }, @@ -987,7 +987,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === "" ? undefined : message.threshold; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1070,7 +1070,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = message.percentage === "" ? undefined : message.percentage; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1285,10 +1285,10 @@ export const GroupInfo = { toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1515,10 +1515,10 @@ export const GroupPolicyInfo = { }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; @@ -1707,10 +1707,10 @@ export const Proposal = { message.groupPolicyVersion = BigInt(object.group_policy_version); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.result !== undefined && object.result !== null) { - message.result = proposalResultFromJSON(object.result); + message.result = object.result; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -1719,7 +1719,7 @@ export const Proposal = { message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); } if (object.executor_result !== undefined && object.executor_result !== null) { - message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; return message; @@ -1727,25 +1727,25 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = proposalStatusToJSON(message.status); - obj.result = proposalResultToJSON(message.result); + obj.status = message.status === 0 ? undefined : message.status; + obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; - obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -1848,10 +1848,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1954,7 +1954,7 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -1967,9 +1967,9 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts index 877e221a02..edddbfac49 100644 --- a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -131,8 +131,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = message.inflation; - obj.annual_provisions = message.annualProvisions; + obj.inflation = padDecimal(message.inflation) === "" ? undefined : padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions) === "" ? undefined : padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -258,11 +258,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.inflation_rate_change = message.inflationRateChange; - obj.inflation_max = message.inflationMax; - obj.inflation_min = message.inflationMin; - obj.goal_bonded = message.goalBonded; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = padDecimal(message.inflationRateChange) === "" ? undefined : padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax) === "" ? undefined : padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin) === "" ? undefined : padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded) === "" ? undefined : padDecimal(message.goalBonded); obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/event.ts index 6e46ad4b51..a37903ced1 100644 --- a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/event.ts @@ -159,10 +159,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -253,9 +253,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -346,9 +346,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/genesis.ts index 17e6064b63..81da93c3e9 100644 --- a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/genesis.ts @@ -108,12 +108,12 @@ export const GenesisState = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } if (message.entries) { obj.entries = message.entries.map(e => e ? Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -192,11 +192,11 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/nft.ts index 417aeb6205..f363ebeb12 100644 --- a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/nft.ts @@ -208,12 +208,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = message.id === "" ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.description = message.description === "" ? undefined : message.description; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -329,10 +329,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts index cef52a33f7..6064849d71 100644 --- a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts @@ -361,8 +361,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -513,8 +513,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -583,7 +583,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -652,7 +652,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -816,8 +816,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -901,7 +901,7 @@ export const QueryNFTsResponse = { if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -983,8 +983,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1124,7 +1124,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { @@ -1349,7 +1349,7 @@ export const QueryClassesResponse = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.ts index 679e84df78..8886a6c57e 100644 --- a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/tx.ts @@ -129,10 +129,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputsign/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputsign/cosmos/orm/v1/orm.ts index 30d86a2853..a32389a0db 100644 --- a/__fixtures__/v-next/outputsign/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputsign/cosmos/orm/v1/orm.ts @@ -298,9 +298,9 @@ export const TableDescriptor = { if (message.index) { obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e) : undefined); } else { - obj.index = []; + obj.index = message.index; } - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -380,8 +380,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.auto_increment = message.autoIncrement; + obj.fields = message.fields === "" ? undefined : message.fields; + obj.auto_increment = message.autoIncrement === false ? undefined : message.autoIncrement; return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -472,9 +472,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = message.fields; - obj.id = message.id; - obj.unique = message.unique; + obj.fields = message.fields === "" ? undefined : message.fields; + obj.id = message.id === 0 ? undefined : message.id; + obj.unique = message.unique === false ? undefined : message.unique; return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -543,7 +543,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputsign/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputsign/cosmos/orm/v1alpha1/schema.ts index 73dbd8bbe2..20404fd7cf 100644 --- a/__fixtures__/v-next/outputsign/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputsign/cosmos/orm/v1alpha1/schema.ts @@ -227,7 +227,7 @@ export const ModuleSchemaDescriptor = { if (message.schemaFile) { obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); } else { - obj.schema_file = []; + obj.schema_file = message.schemaFile; } obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; @@ -314,15 +314,15 @@ export const ModuleSchemaDescriptor_FileEntry = { message.protoFileName = object.proto_file_name; } if (object.storage_type !== undefined && object.storage_type !== null) { - message.storageType = storageTypeFromJSON(object.storage_type); + message.storageType = object.storage_type; } return message; }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = storageTypeToJSON(message.storageType); + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/params.ts index 8807d744c2..49c179aecc 100644 --- a/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/params.ts @@ -126,12 +126,12 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { - obj.changes = []; + obj.changes = message.changes; } return obj; }, @@ -223,9 +223,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; - obj.value = message.value; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.ts index 1d4f464d8e..d4913a6de7 100644 --- a/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/params/v1beta1/query.ts @@ -190,8 +190,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = message.subspace; - obj.key = message.key; + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -388,7 +388,7 @@ export const QuerySubspacesResponse = { if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); } else { - obj.subspaces = []; + obj.subspaces = message.subspaces; } return obj; }, @@ -467,11 +467,11 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = message.subspace; + obj.subspace = message.subspace === "" ? undefined : message.subspace; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts index d252c94f0d..75cc537c12 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts @@ -204,12 +204,12 @@ export const GenesisState = { if (message.signingInfos) { obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e) : undefined); } else { - obj.signing_infos = []; + obj.signing_infos = message.signingInfos; } if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -292,7 +292,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -371,11 +371,11 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -459,7 +459,7 @@ export const MissedBlock = { toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.missed = message.missed === false ? undefined : message.missed; return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.ts index 90a641340a..9ca5b944bb 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/query.ts @@ -333,7 +333,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = message.consAddress; + obj.cons_address = message.consAddress === "" ? undefined : message.consAddress; return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { @@ -558,7 +558,7 @@ export const QuerySigningInfosResponse = { if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e) : undefined); } else { - obj.info = []; + obj.info = message.info; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts index a8149264d1..3899ffd52c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts @@ -214,11 +214,11 @@ export const ValidatorSigningInfo = { }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; - obj.tombstoned = message.tombstoned; + obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts index 864aa5e180..105bec6f30 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts @@ -79,7 +79,7 @@ export const MsgUnjail = { }, toAmino(message: MsgUnjail): MsgUnjailAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr ?? ""; return obj; }, fromAminoMsg(object: MsgUnjailAminoMsg): MsgUnjail { diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/authz.ts index b21e5502d4..7cba3b9331 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/authz.ts @@ -213,7 +213,7 @@ export const StakeAuthorization = { message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); } if (object.authorization_type !== undefined && object.authorization_type !== null) { - message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + message.authorizationType = object.authorization_type; } return message; }, @@ -222,7 +222,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { @@ -292,7 +292,7 @@ export const StakeAuthorization_Validators = { if (message.address) { obj.address = message.address.map(e => e); } else { - obj.address = []; + obj.address = message.address; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts index 190092b82f..b42d253f23 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts @@ -214,29 +214,29 @@ export const GenesisState = { if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); } else { - obj.last_validator_powers = []; + obj.last_validator_powers = message.lastValidatorPowers; } if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } if (message.delegations) { obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); } else { - obj.delegations = []; + obj.delegations = message.delegations; } if (message.unbondingDelegations) { obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_delegations = []; + obj.unbonding_delegations = message.unbondingDelegations; } if (message.redelegations) { obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); } else { - obj.redelegations = []; + obj.redelegations = message.redelegations; } - obj.exported = message.exported; + obj.exported = message.exported === false ? undefined : message.exported; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -318,7 +318,7 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.power = message.power ? message.power.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts index 30cf1ab938..8def391e81 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts @@ -909,7 +909,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = message.status === "" ? undefined : message.status; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -993,7 +993,7 @@ export const QueryValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1064,7 +1064,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1217,7 +1217,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1301,7 +1301,7 @@ export const QueryValidatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1385,7 +1385,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1469,7 +1469,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1551,8 +1551,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1703,8 +1703,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -1857,7 +1857,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1941,7 +1941,7 @@ export const QueryDelegatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2025,7 +2025,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2109,7 +2109,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2215,9 +2215,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2301,7 +2301,7 @@ export const QueryRedelegationsResponse = { if (message.redelegationResponses) { obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); } else { - obj.redelegation_responses = []; + obj.redelegation_responses = message.redelegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2385,7 +2385,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2469,7 +2469,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2551,8 +2551,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts index 71dda9519b..cf6f9847bc 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -885,7 +885,7 @@ export const HistoricalInfo = { if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.valset = []; + obj.valset = message.valset; } return obj; }, @@ -977,9 +977,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate) === "" ? undefined : padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate) === "" ? undefined : padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate) === "" ? undefined : padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1175,11 +1175,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1339,7 +1339,7 @@ export const Validator = { message.jailed = object.jailed; } if (object.status !== undefined && object.status !== null) { - message.status = bondStatusFromJSON(object.status); + message.status = object.status; } if (object.tokens !== undefined && object.tokens !== null) { message.tokens = object.tokens; @@ -1366,17 +1366,17 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = bondStatusToJSON(message.status); - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = padDecimal(message.delegatorShares) === "" ? undefined : padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1446,7 +1446,7 @@ export const ValAddresses = { if (message.addresses) { obj.addresses = message.addresses.map(e => e); } else { - obj.addresses = []; + obj.addresses = message.addresses; } return obj; }, @@ -1527,8 +1527,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1598,7 +1598,7 @@ export const DVPairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, @@ -1690,9 +1690,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -1762,7 +1762,7 @@ export const DVVTriplets = { if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); } else { - obj.triplets = []; + obj.triplets = message.triplets; } return obj; }, @@ -1854,9 +1854,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -1945,12 +1945,12 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2057,8 +2057,8 @@ export const UnbondingDelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2164,8 +2164,8 @@ export const RedelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = padDecimal(message.sharesDst) === "" ? undefined : padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2265,13 +2265,13 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2399,11 +2399,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = padDecimal(message.minCommissionRate) === "" ? undefined : padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2571,7 +2571,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { @@ -2655,7 +2655,7 @@ export const RedelegationResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2736,8 +2736,8 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.not_bonded_tokens = message.notBondedTokens; - obj.bonded_tokens = message.bondedTokens; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts index 6caa794646..b2e4808b8e 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -396,9 +396,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -561,9 +561,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = padDecimal(message.commissionRate) === "" ? undefined : padDecimal(message.commissionRate); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -712,8 +712,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -874,9 +874,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1039,8 +1039,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts index 7486fee6e0..9bdb78689d 100644 --- a/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts @@ -289,7 +289,7 @@ export const SignatureDescriptors = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -545,7 +545,7 @@ export const SignatureDescriptor_Data_Single = { fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); @@ -554,7 +554,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -639,7 +639,7 @@ export const SignatureDescriptor_Data_Multi = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts index 6aaa055586..196812a7cb 100644 --- a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts @@ -545,7 +545,7 @@ export const GetTxsEventRequest = { message.pagination = PageRequest.fromAmino(object.pagination); } if (object.order_by !== undefined && object.order_by !== null) { - message.orderBy = orderByFromJSON(object.order_by); + message.orderBy = object.order_by; } return message; }, @@ -554,10 +554,10 @@ export const GetTxsEventRequest = { if (message.events) { obj.events = message.events.map(e => e); } else { - obj.events = []; + obj.events = message.events; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = orderByToJSON(message.orderBy); + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -649,12 +649,12 @@ export const GetTxsEventResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } if (message.txResponses) { obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.tx_responses = []; + obj.tx_responses = message.txResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -730,14 +730,14 @@ export const BroadcastTxRequest = { message.txBytes = bytesFromBase64(object.tx_bytes); } if (object.mode !== undefined && object.mode !== null) { - message.mode = broadcastModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; - obj.mode = broadcastModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1045,7 +1045,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1324,7 +1324,7 @@ export const GetBlockWithTxsResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.block = message.block ? Block.toAmino(message.block) : undefined; diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts index 84676da8c4..e6d0cdf1f3 100644 --- a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; -import { SignMode, SignModeSDKType, signModeFromJSON, signModeToJSON } from "../signing/v1beta1/signing"; +import { SignMode, SignModeSDKType } from "../signing/v1beta1/signing"; import { CompactBitArray, CompactBitArrayAmino, CompactBitArraySDKType } from "../../crypto/multisig/v1beta1/multisig"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; @@ -831,7 +831,7 @@ export const Tx = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -926,7 +926,7 @@ export const TxRaw = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1033,7 +1033,7 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; return obj; }, @@ -1168,7 +1168,7 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1283,19 +1283,19 @@ export const TxBody = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extension_options = []; + obj.extension_options = message.extensionOptions; } if (message.nonCriticalExtensionOptions) { obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.non_critical_extension_options = []; + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; } return obj; }, @@ -1392,7 +1392,7 @@ export const AuthInfo = { if (message.signerInfos) { obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); } else { - obj.signer_infos = []; + obj.signer_infos = message.signerInfos; } obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1642,13 +1642,13 @@ export const ModeInfo_Single = { fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { const message = createBaseModeInfo_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -1732,7 +1732,7 @@ export const ModeInfo_Multi = { if (message.modeInfos) { obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); } else { - obj.mode_infos = []; + obj.mode_infos = message.modeInfos; } return obj; }, @@ -1838,11 +1838,11 @@ export const Fee = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -1923,9 +1923,9 @@ export const Tip = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.tipper = message.tipper; + obj.tipper = message.tipper === "" ? undefined : message.tipper; return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2020,7 +2020,7 @@ export const AuxSignerData = { message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -2029,9 +2029,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts index bc0996e5f2..ff78dcda4c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts @@ -503,7 +503,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -783,7 +783,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = message.moduleName; + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -853,7 +853,7 @@ export const QueryModuleVersionsResponse = { if (message.moduleVersions) { obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); } else { - obj.module_versions = []; + obj.module_versions = message.moduleVersions; } return obj; }, @@ -979,7 +979,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.ts index 2df244db2c..dd103d1354 100644 --- a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/tx.ts @@ -184,7 +184,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -310,7 +310,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts index 8d639b3d4e..3201a6beb0 100644 --- a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts @@ -311,10 +311,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -408,8 +408,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -490,8 +490,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -573,7 +573,7 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.version = message.version ? message.version.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts index 1e643d1fc2..c10ccb3a83 100644 --- a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts @@ -256,15 +256,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.end_time = message.endTime ? message.endTime.toString() : undefined; - obj.delayed = message.delayed; + obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -409,12 +409,12 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -573,13 +573,13 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts index dfbc9aeb6b..2f534ff04d 100644 --- a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts @@ -294,17 +294,17 @@ export const BaseVestingAccount = { if (message.originalVesting) { obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.original_vesting = []; + obj.original_vesting = message.originalVesting; } if (message.delegatedFree) { obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_free = []; + obj.delegated_free = message.delegatedFree; } if (message.delegatedVesting) { obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_vesting = []; + obj.delegated_vesting = message.delegatedVesting; } obj.end_time = message.endTime ? message.endTime.toString() : undefined; return obj; @@ -546,7 +546,7 @@ export const Period = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -645,7 +645,7 @@ export const PeriodicVestingAccount = { if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputsign/cosmos_proto/cosmos.ts index e9ed7f8b0a..0d87beca01 100644 --- a/__fixtures__/v-next/outputsign/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputsign/cosmos_proto/cosmos.ts @@ -230,8 +230,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -318,17 +318,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts index 850be8ea5d..c9f20c3a0b 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts @@ -236,22 +236,22 @@ export const GenesisState = { if (message.codes) { obj.codes = message.codes.map(e => e ? Code.toAmino(e) : undefined); } else { - obj.codes = []; + obj.codes = message.codes; } if (message.contracts) { obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e) : undefined); } else { - obj.contracts = []; + obj.contracts = message.contracts; } if (message.sequences) { obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e) : undefined); } else { - obj.sequences = []; + obj.sequences = message.sequences; } if (message.genMsgs) { obj.gen_msgs = message.genMsgs.map(e => e ? GenesisState_GenMsgs.toAmino(e) : undefined); } else { - obj.gen_msgs = []; + obj.gen_msgs = message.genMsgs; } return obj; }, @@ -460,7 +460,7 @@ export const Code = { obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; - obj.pinned = message.pinned; + obj.pinned = message.pinned === false ? undefined : message.pinned; return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -551,12 +551,12 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.contract_state = []; + obj.contract_state = message.contractState; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts index 8fd667e0bd..f7b89af6f9 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts @@ -157,7 +157,7 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -229,7 +229,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts index e569fb952f..eaf994b901 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts @@ -497,9 +497,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -647,17 +647,17 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.admin = message.admin; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -773,9 +773,9 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -879,9 +879,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1004,15 +1004,15 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.run_as = message.runAs; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1115,10 +1115,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1209,9 +1209,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1309,12 +1309,12 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -1413,12 +1413,12 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts index 2bf31dd821..d53cd60680 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts @@ -644,7 +644,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -726,7 +726,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -809,7 +809,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -893,7 +893,7 @@ export const QueryContractHistoryResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1063,7 +1063,7 @@ export const QueryContractsByCodeResponse = { if (message.contracts) { obj.contracts = message.contracts.map(e => e); } else { - obj.contracts = []; + obj.contracts = message.contracts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1147,7 +1147,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1231,7 +1231,7 @@ export const QueryAllContractStateResponse = { if (message.models) { obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.models = []; + obj.models = message.models; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1313,7 +1313,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1463,7 +1463,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1697,8 +1697,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; return obj; }, @@ -1782,7 +1782,7 @@ export const QueryCodeResponse = { toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { const obj: any = {}; obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; - obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; return obj; }, fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { @@ -1936,7 +1936,7 @@ export const QueryCodesResponse = { if (message.codeInfos) { obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); } else { - obj.code_infos = []; + obj.code_infos = message.codeInfos; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2101,7 +2101,7 @@ export const QueryPinnedCodesResponse = { if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts index e740a11520..267d005a43 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts @@ -426,7 +426,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -623,15 +623,15 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -712,7 +712,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -813,13 +813,13 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -993,8 +993,8 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1156,9 +1156,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1294,8 +1294,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts index dcd196220e..7b93cc4486 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts @@ -406,13 +406,13 @@ export const AccessTypeParam = { fromAmino(object: AccessTypeParamAmino): AccessTypeParam { const message = createBaseAccessTypeParam(); if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); + message.value = object.value; } return message; }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = accessTypeToJSON(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -483,7 +483,7 @@ export const AccessConfig = { fromAmino(object: AccessConfigAmino): AccessConfig { const message = createBaseAccessConfig(); if (object.permission !== undefined && object.permission !== null) { - message.permission = accessTypeFromJSON(object.permission); + message.permission = object.permission; } if (object.address !== undefined && object.address !== null) { message.address = object.address; @@ -492,8 +492,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = accessTypeToJSON(message.permission); - obj.address = message.address; + obj.permission = message.permission === 0 ? undefined : message.permission; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -579,7 +579,7 @@ export const Params = { message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); } if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { - message.instantiateDefaultPermission = accessTypeFromJSON(object.instantiate_default_permission); + message.instantiateDefaultPermission = object.instantiate_default_permission; } if (object.max_wasm_code_size !== undefined && object.max_wasm_code_size !== null) { message.maxWasmCodeSize = BigInt(object.max_wasm_code_size); @@ -589,7 +589,7 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = accessTypeToJSON(message.instantiateDefaultPermission); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; return obj; }, @@ -684,7 +684,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -827,11 +827,11 @@ export const ContractInfo = { toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; obj.extension = message.extension ? Any.toAmino(message.extension) : undefined; return obj; }, @@ -923,7 +923,7 @@ export const ContractCodeHistoryEntry = { fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); if (object.operation !== undefined && object.operation !== null) { - message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + message.operation = object.operation; } if (object.code_id !== undefined && object.code_id !== null) { message.codeId = BigInt(object.code_id); @@ -938,7 +938,7 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + obj.operation = message.operation === 0 ? undefined : message.operation; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; diff --git a/__fixtures__/v-next/outputsign/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputsign/evmos/claims/v1/claims.ts index 76cffda8da..9b81e92a5c 100644 --- a/__fixtures__/v-next/outputsign/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputsign/evmos/claims/v1/claims.ts @@ -220,7 +220,7 @@ export const Claim = { fromAmino(object: ClaimAmino): Claim { const message = createBaseClaim(); if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } if (object.completed !== undefined && object.completed !== null) { message.completed = object.completed; @@ -232,9 +232,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = actionToJSON(message.action); - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = message.action === 0 ? undefined : message.action; + obj.completed = message.completed === false ? undefined : message.completed; + obj.claimable_amount = message.claimableAmount === "" ? undefined : message.claimableAmount; return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -326,12 +326,12 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = message.address === "" ? undefined : message.address; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, @@ -413,11 +413,11 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/claims/v1/genesis.ts index e3333b84ac..ef5f59817b 100644 --- a/__fixtures__/v-next/outputsign/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/claims/v1/genesis.ts @@ -148,7 +148,7 @@ export const GenesisState = { if (message.claimsRecords) { obj.claims_records = message.claimsRecords.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims_records = []; + obj.claims_records = message.claimsRecords; } return obj; }, @@ -278,20 +278,20 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = message.enableClaims === false ? undefined : message.enableClaims; obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = message.claimsDenom === "" ? undefined : message.claimsDenom; if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { - obj.authorized_channels = []; + obj.authorized_channels = message.authorizedChannels; } if (message.evmChannels) { obj.evm_channels = message.evmChannels.map(e => e); } else { - obj.evm_channels = []; + obj.evm_channels = message.evmChannels; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/claims/v1/query.ts index 1f5dc63143..e3ebbda5d2 100644 --- a/__fixtures__/v-next/outputsign/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/claims/v1/query.ts @@ -324,7 +324,7 @@ export const QueryTotalUnclaimedResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -582,7 +582,7 @@ export const QueryClaimsRecordsResponse = { if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -647,7 +647,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -719,11 +719,11 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts index a4c923a5a6..d7d3ed3ac0 100644 --- a/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts @@ -174,12 +174,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -244,7 +244,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts index a340c3e4d4..6bf375da71 100644 --- a/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts @@ -197,7 +197,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -262,7 +262,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { diff --git a/__fixtures__/v-next/outputsign/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputsign/evmos/erc20/v1/erc20.ts index 0aa03156f0..295521f9c9 100644 --- a/__fixtures__/v-next/outputsign/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputsign/evmos/erc20/v1/erc20.ts @@ -290,16 +290,16 @@ export const TokenPair = { message.enabled = object.enabled; } if (object.contract_owner !== undefined && object.contract_owner !== null) { - message.contractOwner = ownerFromJSON(object.contract_owner); + message.contractOwner = object.contract_owner; } return message; }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = ownerToJSON(message.contractOwner); + obj.erc20_address = message.erc20Address === "" ? undefined : message.erc20Address; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.contract_owner = message.contractOwner === 0 ? undefined : message.contractOwner; return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -386,8 +386,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -473,9 +473,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.erc20address = message.erc20address === "" ? undefined : message.erc20address; return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -560,9 +560,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputsign/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/erc20/v1/genesis.ts index 962673d34e..f79d65d01e 100644 --- a/__fixtures__/v-next/outputsign/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/erc20/v1/genesis.ts @@ -123,7 +123,7 @@ export const GenesisState = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } return obj; }, @@ -198,8 +198,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = message.enableErc20; - obj.enable_evm_hook = message.enableEvmHook; + obj.enable_erc20 = message.enableErc20 === false ? undefined : message.enableErc20; + obj.enable_evm_hook = message.enableEvmHook === false ? undefined : message.enableEvmHook; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.ts index ecc6979cae..f8e49f95c1 100644 --- a/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/erc20/v1/query.ts @@ -292,7 +292,7 @@ export const QueryTokenPairsResponse = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -357,7 +357,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = message.token; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.ts index ca4928d8c8..73e4705d19 100644 --- a/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/evmos/erc20/v1/tx.ts @@ -183,8 +183,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -330,10 +330,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/fees.ts index 828fac2e37..7ac6ed471c 100644 --- a/__fixtures__/v-next/outputsign/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/fees.ts @@ -114,9 +114,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts index 99b1de5117..409072b4a9 100644 --- a/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -149,7 +149,7 @@ export const GenesisState = { if (message.devFeeInfos) { obj.dev_fee_infos = message.devFeeInfos.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.dev_fee_infos = []; + obj.dev_fee_infos = message.devFeeInfos; } return obj; }, @@ -259,11 +259,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = message.enableFees; - obj.developer_shares = message.developerShares; - obj.validator_shares = message.validatorShares; + obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; + obj.developer_shares = padDecimal(message.developerShares) === "" ? undefined : padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares) === "" ? undefined : padDecimal(message.validatorShares); obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; - obj.min_gas_price = message.minGasPrice; + obj.min_gas_price = padDecimal(message.minGasPrice) === "" ? undefined : padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/query.ts index 948f895f3a..f910214b43 100644 --- a/__fixtures__/v-next/outputsign/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/query.ts @@ -365,7 +365,7 @@ export const QueryDevFeeInfosResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -430,7 +430,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -686,7 +686,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -764,7 +764,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.ts index e040231e90..54d5687f30 100644 --- a/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/tx.ts @@ -264,13 +264,13 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -395,8 +395,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -531,9 +531,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts index 255bf453a7..70e12d558c 100644 --- a/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -140,12 +140,12 @@ export const GenesisState = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } return obj; }, @@ -242,10 +242,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = message.enableIncentives; - obj.allocation_limit = message.allocationLimit; - obj.incentives_epoch_identifier = message.incentivesEpochIdentifier; - obj.reward_scaler = message.rewardScaler; + obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; + obj.allocation_limit = padDecimal(message.allocationLimit) === "" ? undefined : padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; + obj.reward_scaler = padDecimal(message.rewardScaler) === "" ? undefined : padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts index aa0d890ba3..d26162b8c2 100644 --- a/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts @@ -248,13 +248,13 @@ export const Incentive = { }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; return obj; @@ -343,8 +343,8 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; return obj; }, @@ -450,15 +450,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -543,9 +543,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts index 8793ec0a76..fe2b4f0f6d 100644 --- a/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts @@ -546,7 +546,7 @@ export const QueryIncentivesResponse = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -611,7 +611,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -752,7 +752,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -830,7 +830,7 @@ export const QueryGasMetersResponse = { if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -906,8 +906,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1114,7 +1114,7 @@ export const QueryAllocationMetersResponse = { if (message.allocationMeters) { obj.allocation_meters = message.allocationMeters.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocation_meters = []; + obj.allocation_meters = message.allocationMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1179,7 +1179,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts index 1ad94284c3..49434f595a 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts @@ -179,7 +179,7 @@ export const GenesisState = { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; @@ -281,10 +281,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = message.enableInflation === false ? undefined : message.enableInflation; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts index 77713df17f..c4f1f4c574 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/inflation.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** * InflationDistribution defines the distribution in which inflation is @@ -202,9 +202,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = message.stakingRewards; - obj.usage_incentives = message.usageIncentives; - obj.community_pool = message.communityPool; + obj.staking_rewards = padDecimal(message.stakingRewards) === "" ? undefined : padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives) === "" ? undefined : padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -311,11 +311,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = message.a; - obj.r = message.r; - obj.c = message.c; - obj.bonding_target = message.bondingTarget; - obj.max_variance = message.maxVariance; + obj.a = padDecimal(message.a) === "" ? undefined : padDecimal(message.a); + obj.r = padDecimal(message.r) === "" ? undefined : padDecimal(message.r); + obj.c = padDecimal(message.c) === "" ? undefined : padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget) === "" ? undefined : padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance) === "" ? undefined : padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts index 030d801a44..148928eea7 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -846,7 +846,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = message.inflationRate; + obj.inflation_rate = padDecimal(message.inflationRate) === "" ? undefined : padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputsign/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/recovery/v1/genesis.ts index 7426c3be6b..f2c63d4d02 100644 --- a/__fixtures__/v-next/outputsign/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/recovery/v1/genesis.ts @@ -173,7 +173,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = message.enableRecovery === false ? undefined : message.enableRecovery; obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.ts index c1168085d6..6b37d74561 100644 --- a/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/vesting/v1/query.ts @@ -109,7 +109,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { @@ -191,17 +191,17 @@ export const QueryBalancesResponse = { if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.locked = []; + obj.locked = message.locked; } if (message.unvested) { obj.unvested = message.unvested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.unvested = []; + obj.unvested = message.unvested; } if (message.vested) { obj.vested = message.vested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.vested = []; + obj.vested = message.vested; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.ts index 111770b181..ef5b73ee12 100644 --- a/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/evmos/vesting/v1/tx.ts @@ -249,20 +249,20 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } - obj.merge = message.merge; + obj.merge = message.merge === false ? undefined : message.merge; return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -397,9 +397,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + obj.dest_address = message.destAddress === "" ? undefined : message.destAddress; return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputsign/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputsign/evmos/vesting/v1/vesting.ts index 2b9ec61fef..a3efaed7d9 100644 --- a/__fixtures__/v-next/outputsign/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputsign/evmos/vesting/v1/vesting.ts @@ -153,17 +153,17 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/auth.ts b/__fixtures__/v-next/outputsign/google/api/auth.ts index 530775d907..ed96874cc8 100644 --- a/__fixtures__/v-next/outputsign/google/api/auth.ts +++ b/__fixtures__/v-next/outputsign/google/api/auth.ts @@ -645,12 +645,12 @@ export const Authentication = { if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } if (message.providers) { obj.providers = message.providers.map(e => e ? AuthProvider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, @@ -747,13 +747,13 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = message.allowWithoutCredential === false ? undefined : message.allowWithoutCredential; if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { - obj.requirements = []; + obj.requirements = message.requirements; } return obj; }, @@ -839,9 +839,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = message.header === null ? undefined : message.header; + obj.query = message.query === null ? undefined : message.query; + obj.value_prefix = message.valuePrefix === "" ? undefined : message.valuePrefix; return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -957,15 +957,15 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = message.id === "" ? undefined : message.id; + obj.issuer = message.issuer === "" ? undefined : message.issuer; + obj.jwks_uri = message.jwksUri === "" ? undefined : message.jwksUri; + obj.audiences = message.audiences === "" ? undefined : message.audiences; + obj.authorization_url = message.authorizationUrl === "" ? undefined : message.authorizationUrl; if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { - obj.jwt_locations = []; + obj.jwt_locations = message.jwtLocations; } return obj; }, @@ -1029,7 +1029,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = message.canonicalScopes === "" ? undefined : message.canonicalScopes; return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1103,8 +1103,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = message.providerId === "" ? undefined : message.providerId; + obj.audiences = message.audiences === "" ? undefined : message.audiences; return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputsign/google/api/backend.ts b/__fixtures__/v-next/outputsign/google/api/backend.ts index 06c4d08906..c9a25a242d 100644 --- a/__fixtures__/v-next/outputsign/google/api/backend.ts +++ b/__fixtures__/v-next/outputsign/google/api/backend.ts @@ -359,7 +359,7 @@ export const Backend = { if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -496,7 +496,7 @@ export const BackendRule = { message.operationDeadline = object.operation_deadline; } if (object.path_translation !== undefined && object.path_translation !== null) { - message.pathTranslation = backendRule_PathTranslationFromJSON(object.path_translation); + message.pathTranslation = object.path_translation; } if (object.jwt_audience !== undefined && object.jwt_audience !== null) { message.jwtAudience = object.jwt_audience; @@ -511,15 +511,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = backendRule_PathTranslationToJSON(message.pathTranslation); - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.address = message.address === "" ? undefined : message.address; + obj.deadline = message.deadline === 0 ? undefined : message.deadline; + obj.min_deadline = message.minDeadline === 0 ? undefined : message.minDeadline; + obj.operation_deadline = message.operationDeadline === 0 ? undefined : message.operationDeadline; + obj.path_translation = message.pathTranslation === 0 ? undefined : message.pathTranslation; + obj.jwt_audience = message.jwtAudience === null ? undefined : message.jwtAudience; + obj.disable_auth = message.disableAuth === null ? undefined : message.disableAuth; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputsign/google/api/billing.ts b/__fixtures__/v-next/outputsign/google/api/billing.ts index c11895b3c8..bb734746a0 100644 --- a/__fixtures__/v-next/outputsign/google/api/billing.ts +++ b/__fixtures__/v-next/outputsign/google/api/billing.ts @@ -225,7 +225,7 @@ export const Billing = { if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -298,11 +298,11 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/config_change.ts b/__fixtures__/v-next/outputsign/google/api/config_change.ts index 34d63fe29e..a3a4f581c1 100644 --- a/__fixtures__/v-next/outputsign/google/api/config_change.ts +++ b/__fixtures__/v-next/outputsign/google/api/config_change.ts @@ -279,21 +279,21 @@ export const ConfigChange = { message.newValue = object.new_value; } if (object.change_type !== undefined && object.change_type !== null) { - message.changeType = changeTypeFromJSON(object.change_type); + message.changeType = object.change_type; } message.advices = object.advices?.map(e => Advice.fromAmino(e)) || []; return message; }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = changeTypeToJSON(message.changeType); + obj.element = message.element === "" ? undefined : message.element; + obj.old_value = message.oldValue === "" ? undefined : message.oldValue; + obj.new_value = message.newValue === "" ? undefined : message.newValue; + obj.change_type = message.changeType === 0 ? undefined : message.changeType; if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { - obj.advices = []; + obj.advices = message.advices; } return obj; }, @@ -357,7 +357,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputsign/google/api/consumer.ts b/__fixtures__/v-next/outputsign/google/api/consumer.ts index b0bf65b279..4a25f0f461 100644 --- a/__fixtures__/v-next/outputsign/google/api/consumer.ts +++ b/__fixtures__/v-next/outputsign/google/api/consumer.ts @@ -240,7 +240,7 @@ export const ProjectProperties = { if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toAmino(e) : undefined); } else { - obj.properties = []; + obj.properties = message.properties; } return obj; }, @@ -317,7 +317,7 @@ export const Property = { message.name = object.name; } if (object.type !== undefined && object.type !== null) { - message.type = property_PropertyTypeFromJSON(object.type); + message.type = object.type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -326,9 +326,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = property_PropertyTypeToJSON(message.type); - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === 0 ? undefined : message.type; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputsign/google/api/context.ts b/__fixtures__/v-next/outputsign/google/api/context.ts index 65c5aafd9f..b01b4a19aa 100644 --- a/__fixtures__/v-next/outputsign/google/api/context.ts +++ b/__fixtures__/v-next/outputsign/google/api/context.ts @@ -258,7 +258,7 @@ export const Context = { if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -358,26 +358,26 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; if (message.requested) { obj.requested = message.requested.map(e => e); } else { - obj.requested = []; + obj.requested = message.requested; } if (message.provided) { obj.provided = message.provided.map(e => e); } else { - obj.provided = []; + obj.provided = message.provided; } if (message.allowedRequestExtensions) { obj.allowed_request_extensions = message.allowedRequestExtensions.map(e => e); } else { - obj.allowed_request_extensions = []; + obj.allowed_request_extensions = message.allowedRequestExtensions; } if (message.allowedResponseExtensions) { obj.allowed_response_extensions = message.allowedResponseExtensions.map(e => e); } else { - obj.allowed_response_extensions = []; + obj.allowed_response_extensions = message.allowedResponseExtensions; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/control.ts b/__fixtures__/v-next/outputsign/google/api/control.ts index 2832ea9867..1782c07cf7 100644 --- a/__fixtures__/v-next/outputsign/google/api/control.ts +++ b/__fixtures__/v-next/outputsign/google/api/control.ts @@ -85,7 +85,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = message.environment; + obj.environment = message.environment === "" ? undefined : message.environment; return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputsign/google/api/distribution.ts b/__fixtures__/v-next/outputsign/google/api/distribution.ts index cabafbefbf..91bab34f10 100644 --- a/__fixtures__/v-next/outputsign/google/api/distribution.ts +++ b/__fixtures__/v-next/outputsign/google/api/distribution.ts @@ -669,19 +669,19 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -756,8 +756,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = message.min === 0 ? undefined : message.min; + obj.max = message.max === 0 ? undefined : message.max; return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -935,9 +935,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1022,9 +1022,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1097,7 +1097,7 @@ export const Distribution_BucketOptions_Explicit = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, @@ -1181,12 +1181,12 @@ export const Distribution_Exemplar = { }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.attachments = []; + obj.attachments = message.attachments; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/documentation.ts b/__fixtures__/v-next/outputsign/google/api/documentation.ts index 2f09600a56..7954fddf3e 100644 --- a/__fixtures__/v-next/outputsign/google/api/documentation.ts +++ b/__fixtures__/v-next/outputsign/google/api/documentation.ts @@ -498,20 +498,20 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = message.summary; + obj.summary = message.summary === "" ? undefined : message.summary; if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.pages = []; + obj.pages = message.pages; } if (message.rules) { obj.rules = message.rules.map(e => e ? DocumentationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.documentation_root_url = message.documentationRootUrl; - obj.service_root_url = message.serviceRootUrl; - obj.overview = message.overview; + obj.documentation_root_url = message.documentationRootUrl === "" ? undefined : message.documentationRootUrl; + obj.service_root_url = message.serviceRootUrl === "" ? undefined : message.serviceRootUrl; + obj.overview = message.overview === "" ? undefined : message.overview; return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -596,9 +596,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.description = message.description; - obj.deprecation_description = message.deprecationDescription; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.description = message.description === "" ? undefined : message.description; + obj.deprecation_description = message.deprecationDescription === "" ? undefined : message.deprecationDescription; return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -681,12 +681,12 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = message.name; - obj.content = message.content; + obj.name = message.name === "" ? undefined : message.name; + obj.content = message.content === "" ? undefined : message.content; if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.subpages = []; + obj.subpages = message.subpages; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/endpoint.ts b/__fixtures__/v-next/outputsign/google/api/endpoint.ts index 1da508bb35..db4b95e4fe 100644 --- a/__fixtures__/v-next/outputsign/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputsign/google/api/endpoint.ts @@ -209,14 +209,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } - obj.target = message.target; - obj.allow_cors = message.allowCors; + obj.target = message.target === "" ? undefined : message.target; + obj.allow_cors = message.allowCors === false ? undefined : message.allowCors; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts index c730b02679..e5995a8d89 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -434,10 +434,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -515,7 +515,7 @@ export const ParseResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -616,10 +616,10 @@ export const CheckRequest = { if (message.typeEnv) { obj.type_env = message.typeEnv.map(e => e ? Decl.toAmino(e) : undefined); } else { - obj.type_env = []; + obj.type_env = message.typeEnv; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = message.container === "" ? undefined : message.container; + obj.no_std_env = message.noStdEnv === false ? undefined : message.noStdEnv; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -697,7 +697,7 @@ export const CheckResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -773,7 +773,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -894,7 +894,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -972,7 +972,7 @@ export const EvalResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -1050,7 +1050,7 @@ export const IssueDetails = { fromAmino(object: IssueDetailsAmino): IssueDetails { const message = createBaseIssueDetails(); if (object.severity !== undefined && object.severity !== null) { - message.severity = issueDetails_SeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.position !== undefined && object.position !== null) { message.position = SourcePosition.fromAmino(object.position); @@ -1062,7 +1062,7 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = issueDetails_SeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; obj.id = message.id ? message.id.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts index 73e52b3782..db0694a8de 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts @@ -1,6 +1,6 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType, Expr, ExprAmino, ExprSDKType, Constant, ConstantAmino, ConstantSDKType } from "./syntax"; import { Empty, EmptyAmino, EmptySDKType } from "../../../protobuf/empty"; -import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; +import { NullValue, NullValueSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; @@ -1183,7 +1183,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1354,16 +1354,16 @@ export const Type = { message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1394,15 +1394,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1627,7 +1627,7 @@ export const Type_FunctionType = { if (message.argTypes) { obj.arg_types = message.argTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.arg_types = []; + obj.arg_types = message.argTypes; } return obj; }, @@ -1700,11 +1700,11 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.parameter_types = []; + obj.parameter_types = message.parameterTypes; } return obj; }, @@ -1794,7 +1794,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -1887,7 +1887,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -1951,7 +1951,7 @@ export const Decl_FunctionDecl = { if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toAmino(e) : undefined); } else { - obj.overloads = []; + obj.overloads = message.overloads; } return obj; }, @@ -2068,20 +2068,20 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2166,11 +2166,11 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { - obj.overload_id = []; + obj.overload_id = message.overloadId; } obj.value = message.value ? Constant.toAmino(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts index eeb2793d84..1c1945a7d0 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts @@ -317,12 +317,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -559,7 +559,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -633,7 +633,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e.toString()); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts index f0185bd869..7495904f35 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts @@ -144,12 +144,12 @@ export const Explain = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.exprSteps) { obj.expr_steps = message.exprSteps.map(e => e ? Explain_ExprStep.toAmino(e) : undefined); } else { - obj.expr_steps = []; + obj.expr_steps = message.exprSteps; } return obj; }, @@ -227,7 +227,7 @@ export const Explain_ExprStep = { toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.value_index = message.valueIndex; + obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts index cd581d9243..d4f88c785b 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts @@ -1,4 +1,4 @@ -import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; +import { NullValue, NullValueSDKType } from "../../../protobuf/struct"; import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../../binary"; @@ -1183,7 +1183,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1271,8 +1271,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1358,11 +1358,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1427,7 +1427,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1500,11 +1500,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = message.messageName === "" ? undefined : message.messageName; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1608,7 +1608,7 @@ export const Expr_CreateStruct_Entry = { toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1749,9 +1749,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1882,7 +1882,7 @@ export const Constant = { fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1912,12 +1912,12 @@ export const Constant = { }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -1996,7 +1996,7 @@ export const SourceInfo_PositionsEntry = { toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2212,12 +2212,12 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2326,10 +2326,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts index 75bcf1567a..e6b818937d 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts @@ -1,4 +1,4 @@ -import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; +import { NullValue, NullValueSDKType } from "../../../protobuf/struct"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; @@ -381,7 +381,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -420,18 +420,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -505,8 +505,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -570,7 +570,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -635,7 +635,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/decl.ts index 481a3216e6..a4c169f563 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/decl.ts @@ -248,9 +248,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = message.id === 0 ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.doc = message.doc === "" ? undefined : message.doc; obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -335,12 +335,12 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = message.id === 0 ? undefined : message.id; + obj.type = message.type === "" ? undefined : message.type; if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } return obj; }, @@ -508,10 +508,10 @@ export const FunctionDecl = { if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = message.receiverFunction === false ? undefined : message.receiverFunction; return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/eval.ts index 9c8e23372d..c2abbe147a 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/eval.ts @@ -339,12 +339,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -422,7 +422,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -579,7 +579,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -644,7 +644,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -708,7 +708,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts index 6cacd2d637..ea6788d76c 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts @@ -1,5 +1,5 @@ import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source"; -import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; +import { NullValue, NullValueSDKType } from "../../../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; @@ -742,7 +742,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -896,7 +896,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -966,7 +966,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1054,8 +1054,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1141,11 +1141,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1210,7 +1210,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1283,11 +1283,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1388,8 +1388,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = message.id === 0 ? undefined : message.id; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1530,9 +1530,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1645,7 +1645,7 @@ export const Literal = { fromAmino(object: LiteralAmino): Literal { const message = createBaseLiteral(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1669,12 +1669,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/source.ts index 46fe26bd11..12ad164359 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/source.ts @@ -192,8 +192,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === 0 ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -297,11 +297,11 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -404,10 +404,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts index 653c02b245..08d43ed728 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts @@ -1,4 +1,4 @@ -import { NullValue, NullValueSDKType, nullValueFromJSON, nullValueToJSON } from "../../../protobuf/struct"; +import { NullValue, NullValueSDKType } from "../../../protobuf/struct"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; @@ -381,7 +381,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -420,18 +420,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -505,8 +505,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -570,7 +570,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -635,7 +635,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/http.ts b/__fixtures__/v-next/outputsign/google/api/http.ts index 1a4856a636..136394d59f 100644 --- a/__fixtures__/v-next/outputsign/google/api/http.ts +++ b/__fixtures__/v-next/outputsign/google/api/http.ts @@ -1082,9 +1082,9 @@ export const Http = { if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -1246,19 +1246,19 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.additional_bindings = []; + obj.additional_bindings = message.additionalBindings; } return obj; }, @@ -1333,8 +1333,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputsign/google/api/httpbody.ts b/__fixtures__/v-next/outputsign/google/api/httpbody.ts index 6d0887692c..600da24584 100644 --- a/__fixtures__/v-next/outputsign/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputsign/google/api/httpbody.ts @@ -236,12 +236,12 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = message.contentType === "" ? undefined : message.contentType; obj.data = message.data ? base64FromBytes(message.data) : undefined; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/label.ts b/__fixtures__/v-next/outputsign/google/api/label.ts index 16d5e0a3d9..acc482d6f9 100644 --- a/__fixtures__/v-next/outputsign/google/api/label.ts +++ b/__fixtures__/v-next/outputsign/google/api/label.ts @@ -132,7 +132,7 @@ export const LabelDescriptor = { message.key = object.key; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = labelDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -141,9 +141,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = labelDescriptor_ValueTypeToJSON(message.valueType); - obj.description = message.description; + obj.key = message.key === "" ? undefined : message.key; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputsign/google/api/log.ts b/__fixtures__/v-next/outputsign/google/api/log.ts index a8aba5cef7..fb38a1879d 100644 --- a/__fixtures__/v-next/outputsign/google/api/log.ts +++ b/__fixtures__/v-next/outputsign/google/api/log.ts @@ -171,14 +171,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.description = message.description; - obj.display_name = message.displayName; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputsign/google/api/logging.ts b/__fixtures__/v-next/outputsign/google/api/logging.ts index fff3eb6b69..bc90c7dda6 100644 --- a/__fixtures__/v-next/outputsign/google/api/logging.ts +++ b/__fixtures__/v-next/outputsign/google/api/logging.ts @@ -244,12 +244,12 @@ export const Logging = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -322,11 +322,11 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.logs) { obj.logs = message.logs.map(e => e); } else { - obj.logs = []; + obj.logs = message.logs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/metric.ts b/__fixtures__/v-next/outputsign/google/api/metric.ts index 6407e52bb3..fe0bb5b6dd 100644 --- a/__fixtures__/v-next/outputsign/google/api/metric.ts +++ b/__fixtures__/v-next/outputsign/google/api/metric.ts @@ -1,4 +1,4 @@ -import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; +import { LaunchStage, LaunchStageSDKType } from "./launch_stage"; import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; @@ -749,10 +749,10 @@ export const MetricDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.metric_kind !== undefined && object.metric_kind !== null) { - message.metricKind = metricDescriptor_MetricKindFromJSON(object.metric_kind); + message.metricKind = object.metric_kind; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = metricDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.unit !== undefined && object.unit !== null) { message.unit = object.unit; @@ -767,31 +767,31 @@ export const MetricDescriptor = { message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromAmino(object.metadata); } if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } message.monitoredResourceTypes = object.monitored_resource_types?.map(e => e) || []; return message; }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.metric_kind = metricDescriptor_MetricKindToJSON(message.metricKind); - obj.value_type = metricDescriptor_ValueTypeToJSON(message.valueType); - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = message.metricKind === 0 ? undefined : message.metricKind; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { - obj.monitored_resource_types = []; + obj.monitored_resource_types = message.monitoredResourceTypes; } return obj; }, @@ -869,7 +869,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromAmino(object: MetricDescriptor_MetricDescriptorMetadataAmino): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } if (object.sample_period !== undefined && object.sample_period !== null) { message.samplePeriod = Duration.fromAmino(object.sample_period); @@ -881,7 +881,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -956,8 +956,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1043,7 +1043,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputsign/google/api/monitored_resource.ts b/__fixtures__/v-next/outputsign/google/api/monitored_resource.ts index eb39036ce6..d944575645 100644 --- a/__fixtures__/v-next/outputsign/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputsign/google/api/monitored_resource.ts @@ -1,5 +1,5 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; -import { LaunchStage, LaunchStageSDKType, launchStageFromJSON, launchStageToJSON } from "./launch_stage"; +import { LaunchStage, LaunchStageSDKType } from "./launch_stage"; import { Struct, StructAmino, StructSDKType } from "../protobuf/struct"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial } from "../../helpers"; @@ -423,22 +423,22 @@ export const MonitoredResourceDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } return message; }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.display_name = message.displayName === "" ? undefined : message.displayName; + obj.description = message.description === "" ? undefined : message.description; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -511,8 +511,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -598,7 +598,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -677,8 +677,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputsign/google/api/monitoring.ts b/__fixtures__/v-next/outputsign/google/api/monitoring.ts index 96d7c3e218..c07d4a9a34 100644 --- a/__fixtures__/v-next/outputsign/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputsign/google/api/monitoring.ts @@ -317,12 +317,12 @@ export const Monitoring = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -395,11 +395,11 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = message.monitoredResource; + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/quota.ts b/__fixtures__/v-next/outputsign/google/api/quota.ts index 103fa727ee..8e091cd8b6 100644 --- a/__fixtures__/v-next/outputsign/google/api/quota.ts +++ b/__fixtures__/v-next/outputsign/google/api/quota.ts @@ -563,12 +563,12 @@ export const Quota = { if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toAmino(e) : undefined); } else { - obj.limits = []; + obj.limits = message.limits; } if (message.metricRules) { obj.metric_rules = message.metricRules.map(e => e ? MetricRule.toAmino(e) : undefined); } else { - obj.metric_rules = []; + obj.metric_rules = message.metricRules; } return obj; }, @@ -644,7 +644,7 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? message.value.toString() : undefined; return obj; }, @@ -731,7 +731,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -812,7 +812,7 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? message.value.toString() : undefined; return obj; }, @@ -993,21 +993,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; - obj.duration = message.duration; - obj.metric = message.metric; - obj.unit = message.unit; + obj.duration = message.duration === "" ? undefined : message.duration; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputsign/google/api/resource.ts b/__fixtures__/v-next/outputsign/google/api/resource.ts index 8a387636ac..ff7a50a98d 100644 --- a/__fixtures__/v-next/outputsign/google/api/resource.ts +++ b/__fixtures__/v-next/outputsign/google/api/resource.ts @@ -631,7 +631,7 @@ export const ResourceDescriptor = { message.nameField = object.name_field; } if (object.history !== undefined && object.history !== null) { - message.history = resourceDescriptor_HistoryFromJSON(object.history); + message.history = object.history; } if (object.plural !== undefined && object.plural !== null) { message.plural = object.plural; @@ -639,25 +639,25 @@ export const ResourceDescriptor = { if (object.singular !== undefined && object.singular !== null) { message.singular = object.singular; } - message.style = object.style?.map(e => resourceDescriptor_StyleFromJSON(e)) || []; + message.style = object.style?.map(e => e) || []; return message; }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { - obj.pattern = []; + obj.pattern = message.pattern; } - obj.name_field = message.nameField; - obj.history = resourceDescriptor_HistoryToJSON(message.history); - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = message.nameField === "" ? undefined : message.nameField; + obj.history = message.history === 0 ? undefined : message.history; + obj.plural = message.plural === "" ? undefined : message.plural; + obj.singular = message.singular === "" ? undefined : message.singular; if (message.style) { - obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); + obj.style = message.style.map(e => e); } else { - obj.style = []; + obj.style = message.style; } return obj; }, @@ -732,8 +732,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = message.type === "" ? undefined : message.type; + obj.child_type = message.childType === "" ? undefined : message.childType; return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputsign/google/api/routing.ts b/__fixtures__/v-next/outputsign/google/api/routing.ts index 56893b9108..e30be4e3a2 100644 --- a/__fixtures__/v-next/outputsign/google/api/routing.ts +++ b/__fixtures__/v-next/outputsign/google/api/routing.ts @@ -1299,7 +1299,7 @@ export const RoutingRule = { if (message.routingParameters) { obj.routing_parameters = message.routingParameters.map(e => e ? RoutingParameter.toAmino(e) : undefined); } else { - obj.routing_parameters = []; + obj.routing_parameters = message.routingParameters; } return obj; }, @@ -1374,8 +1374,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = message.field; - obj.path_template = message.pathTemplate; + obj.field = message.field === "" ? undefined : message.field; + obj.path_template = message.pathTemplate === "" ? undefined : message.pathTemplate; return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputsign/google/api/service.ts b/__fixtures__/v-next/outputsign/google/api/service.ts index 4330465c7a..a3c3d4f959 100644 --- a/__fixtures__/v-next/outputsign/google/api/service.ts +++ b/__fixtures__/v-next/outputsign/google/api/service.ts @@ -647,24 +647,24 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; - obj.producer_project_id = message.producerProjectId; - obj.id = message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.id = message.id === "" ? undefined : message.id; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } if (message.types) { obj.types = message.types.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.types = []; + obj.types = message.types; } if (message.enums) { obj.enums = message.enums.map(e => e ? Enum.toAmino(e) : undefined); } else { - obj.enums = []; + obj.enums = message.enums; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.backend = message.backend ? Backend.toAmino(message.backend) : undefined; @@ -676,23 +676,23 @@ export const Service = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } obj.control = message.control ? Control.toAmino(message.control) : undefined; if (message.logs) { obj.logs = message.logs.map(e => e ? LogDescriptor.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } if (message.metrics) { obj.metrics = message.metrics.map(e => e ? MetricDescriptor.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.billing = message.billing ? Billing.toAmino(message.billing) : undefined; obj.logging = message.logging ? Logging.toAmino(message.logging) : undefined; diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/check_error.ts index 278d27fdd4..8717428cd8 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/check_error.ts @@ -323,7 +323,7 @@ export const CheckError = { fromAmino(object: CheckErrorAmino): CheckError { const message = createBaseCheckError(); if (object.code !== undefined && object.code !== null) { - message.code = checkError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -338,9 +338,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = checkError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.detail = message.detail === "" ? undefined : message.detail; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts index d236ea794d..80f6e09544 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts @@ -465,14 +465,14 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.minimum = message.minimum; - obj.maximum = message.maximum; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.minimum = message.minimum === 0 ? undefined : message.minimum; + obj.maximum = message.maximum === 0 ? undefined : message.maximum; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } obj.linear_buckets = message.linearBuckets ? Distribution_LinearBuckets.toAmino(message.linearBuckets) : undefined; obj.exponential_buckets = message.exponentialBuckets ? Distribution_ExponentialBuckets.toAmino(message.exponentialBuckets) : undefined; @@ -480,7 +480,7 @@ export const Distribution = { if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -566,9 +566,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -653,9 +653,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { @@ -728,7 +728,7 @@ export const Distribution_ExplicitBuckets = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts index 8264d615bb..633dc51486 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts @@ -392,21 +392,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; + obj.status = message.status === 0 ? undefined : message.status; obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts index 97d9fbac9f..b5e0b060ec 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts @@ -1,5 +1,5 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../protobuf/timestamp"; -import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../../../logging/type/log_severity"; +import { LogSeverity, LogSeveritySDKType } from "../../../logging/type/log_severity"; import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "./http_request"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../protobuf/any"; import { Struct, StructAmino, StructSDKType } from "../../../protobuf/struct"; @@ -362,8 +362,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -531,7 +531,7 @@ export const LogEntry = { message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -569,12 +569,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -582,7 +582,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -681,10 +681,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -771,9 +771,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts index 72c3e25d06..f9246ee289 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts @@ -209,8 +209,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -374,10 +374,10 @@ export const MetricValue = { } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.bool_value = message.boolValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -450,11 +450,11 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { - obj.metric_values = []; + obj.metric_values = message.metricValues; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/operation.ts index 7567a980d8..7a62e4b7cd 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/operation.ts @@ -308,8 +308,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -470,16 +470,16 @@ export const Operation = { message.metricValueSets = object.metric_value_sets?.map(e => MetricValueSet.fromAmino(e)) || []; message.logEntries = object.log_entries?.map(e => LogEntry.fromAmino(e)) || []; if (object.importance !== undefined && object.importance !== null) { - message.importance = operation_ImportanceFromJSON(object.importance); + message.importance = object.importance; } message.extensions = object.extensions?.map(e => Any.fromAmino(e)) || []; return message; }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.operation_name = message.operationName === "" ? undefined : message.operationName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.labels = {}; @@ -491,18 +491,18 @@ export const Operation = { if (message.metricValueSets) { obj.metric_value_sets = message.metricValueSets.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.metric_value_sets = []; + obj.metric_value_sets = message.metricValueSets; } if (message.logEntries) { obj.log_entries = message.logEntries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.log_entries = []; + obj.log_entries = message.logEntries; } - obj.importance = operation_ImportanceToJSON(message.importance); + obj.importance = message.importance === 0 ? undefined : message.importance; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/quota_controller.ts index 54786290fa..0ac4e43cd1 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/quota_controller.ts @@ -564,9 +564,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -639,8 +639,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -762,15 +762,15 @@ export const QuotaOperation = { }, {}); message.quotaMetrics = object.quota_metrics?.map(e => MetricValueSet.fromAmino(e)) || []; if (object.quota_mode !== undefined && object.quota_mode !== null) { - message.quotaMode = quotaOperation_QuotaModeFromJSON(object.quota_mode); + message.quotaMode = object.quota_mode; } return message; }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.method_name = message.methodName === "" ? undefined : message.methodName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -780,9 +780,9 @@ export const QuotaOperation = { if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.quota_mode = quotaOperation_QuotaModeToJSON(message.quotaMode); + obj.quota_mode = message.quotaMode === 0 ? undefined : message.quotaMode; return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -874,18 +874,18 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { - obj.allocate_errors = []; + obj.allocate_errors = message.allocateErrors; } if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -968,7 +968,7 @@ export const QuotaError = { fromAmino(object: QuotaErrorAmino): QuotaError { const message = createBaseQuotaError(); if (object.code !== undefined && object.code !== null) { - message.code = quotaError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -983,9 +983,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = quotaError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.description = message.description; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts index 8c4f0ea492..5779c5de03 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts @@ -542,9 +542,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -651,14 +651,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { - obj.check_errors = []; + obj.check_errors = message.checkErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -736,7 +736,7 @@ export const CheckResponse_CheckInfo = { if (message.unusedArguments) { obj.unused_arguments = message.unusedArguments.map(e => e); } else { - obj.unused_arguments = []; + obj.unused_arguments = message.unusedArguments; } obj.consumer_info = message.consumerInfo ? CheckResponse_ConsumerInfo.toAmino(message.consumerInfo) : undefined; return obj; @@ -818,7 +818,7 @@ export const CheckResponse_ConsumerInfo = { message.projectNumber = BigInt(object.project_number); } if (object.type !== undefined && object.type !== null) { - message.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + message.type = object.type; } if (object.consumer_number !== undefined && object.consumer_number !== null) { message.consumerNumber = BigInt(object.consumer_number); @@ -828,7 +828,7 @@ export const CheckResponse_ConsumerInfo = { toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; return obj; }, @@ -912,13 +912,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1004,10 +1004,10 @@ export const ReportResponse = { if (message.reportErrors) { obj.report_errors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toAmino(e) : undefined); } else { - obj.report_errors = []; + obj.report_errors = message.reportErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1083,7 +1083,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v2/service_controller.ts index 5c7884215c..7af623a9f6 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v2/service_controller.ts @@ -375,15 +375,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } - obj.flags = message.flags; + obj.flags = message.flags === "" ? undefined : message.flags; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -490,11 +490,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.permission = message.permission === "" ? undefined : message.permission; + obj.container = message.container === "" ? undefined : message.container; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -567,8 +567,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -745,12 +745,12 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/resources.ts index 720797f8a3..b9701ace13 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/resources.ts @@ -888,8 +888,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -984,14 +984,14 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } if (message.steps) { obj.steps = message.steps.map(e => e ? OperationMetadata_Step.toAmino(e) : undefined); } else { - obj.steps = []; + obj.steps = message.steps; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = message.progressPercentage === 0 ? undefined : message.progressPercentage; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -1060,14 +1060,14 @@ export const OperationMetadata_Step = { message.description = object.description; } if (object.status !== undefined && object.status !== null) { - message.status = operationMetadata_StatusFromJSON(object.status); + message.status = object.status; } return message; }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = operationMetadata_StatusToJSON(message.status); + obj.description = message.description === "" ? undefined : message.description; + obj.status = message.status === 0 ? undefined : message.status; return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1143,7 +1143,7 @@ export const Diagnostic = { message.location = object.location; } if (object.kind !== undefined && object.kind !== null) { - message.kind = diagnostic_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.message !== undefined && object.message !== null) { message.message = object.message; @@ -1152,9 +1152,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = diagnostic_KindToJSON(message.kind); - obj.message = message.message; + obj.location = message.location === "" ? undefined : message.location; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1226,11 +1226,11 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { - obj.files = []; + obj.files = message.files; } return obj; }, @@ -1310,15 +1310,15 @@ export const ConfigFile = { message.fileContents = bytesFromBase64(object.file_contents); } if (object.file_type !== undefined && object.file_type !== null) { - message.fileType = configFile_FileTypeFromJSON(object.file_type); + message.fileType = object.file_type; } return message; }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = message.filePath === "" ? undefined : message.filePath; obj.file_contents = message.fileContents ? base64FromBytes(message.fileContents) : undefined; - obj.file_type = configFile_FileTypeToJSON(message.fileType); + obj.file_type = message.fileType === 0 ? undefined : message.fileType; return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1381,7 +1381,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1445,7 +1445,7 @@ export const ChangeReport = { if (message.configChanges) { obj.config_changes = message.configChanges.map(e => e ? ConfigChange.toAmino(e) : undefined); } else { - obj.config_changes = []; + obj.config_changes = message.configChanges; } return obj; }, @@ -1564,7 +1564,7 @@ export const Rollout = { message.createdBy = object.created_by; } if (object.status !== undefined && object.status !== null) { - message.status = rollout_RolloutStatusFromJSON(object.status); + message.status = object.status; } if (object.traffic_percent_strategy !== undefined && object.traffic_percent_strategy !== null) { message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy); @@ -1579,13 +1579,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; - obj.created_by = message.createdBy; - obj.status = rollout_RolloutStatusToJSON(message.status); + obj.created_by = message.createdBy === "" ? undefined : message.createdBy; + obj.status = message.status === 0 ? undefined : message.status; obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1658,8 +1658,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/servicemanager.ts index 699d9ee4d6..2ef10484b0 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicemanagement/v1/servicemanager.ts @@ -827,10 +827,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -905,9 +905,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -970,7 +970,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1098,7 +1098,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1161,7 +1161,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1305,15 +1305,15 @@ export const GetServiceConfigRequest = { message.configId = object.config_id; } if (object.view !== undefined && object.view !== null) { - message.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = getServiceConfigRequest_ConfigViewToJSON(message.view); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.config_id = message.configId === "" ? undefined : message.configId; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1398,9 +1398,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1475,9 +1475,9 @@ export const ListServiceConfigsResponse = { if (message.serviceConfigs) { obj.service_configs = message.serviceConfigs.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.service_configs = []; + obj.service_configs = message.serviceConfigs; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1553,7 +1553,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1641,9 +1641,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = message.validateOnly === false ? undefined : message.validateOnly; return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -1784,7 +1784,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -1881,10 +1881,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -1959,9 +1959,9 @@ export const ListServiceRolloutsResponse = { if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toAmino(e) : undefined); } else { - obj.rollouts = []; + obj.rollouts = message.rollouts; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2035,8 +2035,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2207,17 +2207,17 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.id = message.id === "" ? undefined : message.id; if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { - obj.change_reports = []; + obj.change_reports = message.changeReports; } if (message.diagnostics) { obj.diagnostics = message.diagnostics.map(e => e ? Diagnostic.toAmino(e) : undefined); } else { - obj.diagnostics = []; + obj.diagnostics = message.diagnostics; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/resources.ts index 361c0d97e1..3791d3798d 100644 --- a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/resources.ts @@ -333,16 +333,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -508,12 +508,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -522,12 +522,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -593,7 +593,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/serviceusage.ts index afc1bd5513..97366d4b65 100644 --- a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1/serviceusage.ts @@ -615,7 +615,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -759,15 +759,15 @@ export const DisableServiceRequest = { message.disableDependentServices = object.disable_dependent_services; } if (object.check_if_service_has_usage !== undefined && object.check_if_service_has_usage !== null) { - message.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage); + message.checkIfServiceHasUsage = object.check_if_service_has_usage; } return message; }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = disableServiceRequest_CheckIfServiceHasUsageToJSON(message.checkIfServiceHasUsage); + obj.name = message.name === "" ? undefined : message.name; + obj.disable_dependent_services = message.disableDependentServices === false ? undefined : message.disableDependentServices; + obj.check_if_service_has_usage = message.checkIfServiceHasUsage === 0 ? undefined : message.checkIfServiceHasUsage; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -895,7 +895,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -991,10 +991,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1069,9 +1069,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1143,11 +1143,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1221,12 +1221,12 @@ export const BatchEnableServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } if (message.failures) { obj.failures = message.failures.map(e => e ? BatchEnableServicesResponse_EnableFailure.toAmino(e) : undefined); } else { - obj.failures = []; + obj.failures = message.failures; } return obj; }, @@ -1301,8 +1301,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = message.serviceId === "" ? undefined : message.serviceId; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1374,11 +1374,11 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.names) { obj.names = message.names.map(e => e); } else { - obj.names = []; + obj.names = message.names; } return obj; }, @@ -1443,7 +1443,7 @@ export const BatchGetServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts index 19ee4cd7df..bb7f696f5d 100644 --- a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts @@ -1147,16 +1147,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1322,12 +1322,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -1336,12 +1336,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -1407,7 +1407,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1522,20 +1522,20 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.display_name = message.displayName === "" ? undefined : message.displayName; if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.consumer_quota_limits = []; + obj.consumer_quota_limits = message.consumerQuotaLimits; } if (message.descendantConsumerQuotaLimits) { obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.descendant_consumer_quota_limits = []; + obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits; } - obj.unit = message.unit; + obj.unit = message.unit === "" ? undefined : message.unit; return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1651,15 +1651,15 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.is_precise = message.isPrecise === false ? undefined : message.isPrecise; + obj.allows_admin_overrides = message.allowsAdminOverrides === false ? undefined : message.allowsAdminOverrides; if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { - obj.quota_buckets = []; + obj.quota_buckets = message.quotaBuckets; } return obj; }, @@ -1733,8 +1733,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -1957,8 +1957,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2090,7 +2090,7 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2098,9 +2098,9 @@ export const QuotaOverride = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.admin_override_ancestor = message.adminOverrideAncestor === "" ? undefined : message.adminOverrideAncestor; return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2164,7 +2164,7 @@ export const OverrideInlineSource = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2238,8 +2238,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2371,7 +2371,7 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2379,9 +2379,9 @@ export const AdminQuotaPolicy = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2455,8 +2455,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = message.email === "" ? undefined : message.email; + obj.unique_id = message.uniqueId === "" ? undefined : message.uniqueId; return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/serviceusage.ts index a9de7d8089..0ce59acd24 100644 --- a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1,4 +1,4 @@ -import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideAmino, QuotaOverrideSDKType, QuotaSafetyCheck, QuotaSafetyCheckSDKType, OverrideInlineSource, OverrideInlineSourceAmino, OverrideInlineSourceSDKType, Service, ServiceAmino, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricAmino, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicyAmino, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentityAmino, ServiceIdentitySDKType, quotaViewFromJSON, quotaViewToJSON, quotaSafetyCheckFromJSON, quotaSafetyCheckToJSON } from "./resources"; +import { QuotaView, QuotaViewSDKType, QuotaOverride, QuotaOverrideAmino, QuotaOverrideSDKType, QuotaSafetyCheck, QuotaSafetyCheckSDKType, OverrideInlineSource, OverrideInlineSourceAmino, OverrideInlineSourceSDKType, Service, ServiceAmino, ServiceSDKType, ConsumerQuotaMetric, ConsumerQuotaMetricAmino, ConsumerQuotaMetricSDKType, AdminQuotaPolicy, AdminQuotaPolicyAmino, AdminQuotaPolicySDKType, ServiceIdentity, ServiceIdentityAmino, ServiceIdentitySDKType } from "./resources"; import { FieldMask, FieldMaskAmino, FieldMaskSDKType } from "../../../protobuf/field_mask"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial } from "../../../../helpers"; @@ -1609,7 +1609,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1672,7 +1672,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1735,7 +1735,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1831,10 +1831,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1909,9 +1909,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1983,11 +1983,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -2078,16 +2078,16 @@ export const ListConsumerQuotaMetricsRequest = { message.pageToken = object.page_token; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = quotaViewToJSON(message.view); + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -2162,9 +2162,9 @@ export const ListConsumerQuotaMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -2232,14 +2232,14 @@ export const GetConsumerQuotaMetricRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -2307,14 +2307,14 @@ export const GetConsumerQuotaLimitRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2414,18 +2414,18 @@ export const CreateAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2539,19 +2539,19 @@ export const UpdateAdminOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2639,17 +2639,17 @@ export const DeleteAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2735,9 +2735,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -2812,9 +2812,9 @@ export const ListAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -2878,7 +2878,7 @@ export const BatchCreateAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2979,18 +2979,18 @@ export const ImportAdminOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3055,7 +3055,7 @@ export const ImportAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3206,18 +3206,18 @@ export const CreateConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3331,19 +3331,19 @@ export const UpdateConsumerOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3431,17 +3431,17 @@ export const DeleteConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3527,9 +3527,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -3604,9 +3604,9 @@ export const ListConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -3670,7 +3670,7 @@ export const BatchCreateConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3771,18 +3771,18 @@ export const ImportConsumerOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3847,7 +3847,7 @@ export const ImportConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3962,7 +3962,7 @@ export const ImportAdminQuotaPoliciesResponse = { if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toAmino(e) : undefined); } else { - obj.policies = []; + obj.policies = message.policies; } return obj; }, @@ -4226,7 +4226,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -4296,14 +4296,14 @@ export const GetServiceIdentityResponse = { message.identity = ServiceIdentity.fromAmino(object.identity); } if (object.state !== undefined && object.state !== null) { - message.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputsign/google/api/source_info.ts b/__fixtures__/v-next/outputsign/google/api/source_info.ts index b82fd7b9e4..fe44a45039 100644 --- a/__fixtures__/v-next/outputsign/google/api/source_info.ts +++ b/__fixtures__/v-next/outputsign/google/api/source_info.ts @@ -69,7 +69,7 @@ export const SourceInfo = { if (message.sourceFiles) { obj.source_files = message.sourceFiles.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.source_files = []; + obj.source_files = message.sourceFiles; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/system_parameter.ts b/__fixtures__/v-next/outputsign/google/api/system_parameter.ts index e9682341ad..d8e2a8ee76 100644 --- a/__fixtures__/v-next/outputsign/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputsign/google/api/system_parameter.ts @@ -263,7 +263,7 @@ export const SystemParameters = { if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -336,11 +336,11 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { - obj.parameters = []; + obj.parameters = message.parameters; } return obj; }, @@ -426,9 +426,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = message.name; - obj.http_header = message.httpHeader; - obj.url_query_parameter = message.urlQueryParameter; + obj.name = message.name === "" ? undefined : message.name; + obj.http_header = message.httpHeader === "" ? undefined : message.httpHeader; + obj.url_query_parameter = message.urlQueryParameter === "" ? undefined : message.urlQueryParameter; return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputsign/google/api/usage.ts b/__fixtures__/v-next/outputsign/google/api/usage.ts index afafc53a3e..b7aac24eae 100644 --- a/__fixtures__/v-next/outputsign/google/api/usage.ts +++ b/__fixtures__/v-next/outputsign/google/api/usage.ts @@ -280,14 +280,14 @@ export const Usage = { if (message.requirements) { obj.requirements = message.requirements.map(e => e); } else { - obj.requirements = []; + obj.requirements = message.requirements; } if (message.rules) { obj.rules = message.rules.map(e => e ? UsageRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.producer_notification_channel = message.producerNotificationChannel; + obj.producer_notification_channel = message.producerNotificationChannel === "" ? undefined : message.producerNotificationChannel; return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -372,9 +372,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.allow_unregistered_calls = message.allowUnregisteredCalls; - obj.skip_service_control = message.skipServiceControl; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.allow_unregistered_calls = message.allowUnregisteredCalls === false ? undefined : message.allowUnregisteredCalls; + obj.skip_service_control = message.skipServiceControl === false ? undefined : message.skipServiceControl; return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputsign/google/api/visibility.ts b/__fixtures__/v-next/outputsign/google/api/visibility.ts index 16f0ff9ba8..61f7f65fb0 100644 --- a/__fixtures__/v-next/outputsign/google/api/visibility.ts +++ b/__fixtures__/v-next/outputsign/google/api/visibility.ts @@ -221,7 +221,7 @@ export const Visibility = { if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -296,8 +296,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.restriction = message.restriction; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.restriction = message.restriction === "" ? undefined : message.restriction; return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts b/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts index 91e0e515d0..96a97c70c1 100644 --- a/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts @@ -396,21 +396,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; + obj.status = message.status === 0 ? undefined : message.status; obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts index f8bbdcbb45..36339064a0 100644 --- a/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts @@ -2,7 +2,7 @@ import { MonitoredResource, MonitoredResourceAmino, MonitoredResourceSDKType } f import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../protobuf/any"; import { Struct, StructAmino, StructSDKType } from "../../protobuf/struct"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../protobuf/timestamp"; -import { LogSeverity, LogSeveritySDKType, logSeverityFromJSON, logSeverityToJSON } from "../type/log_severity"; +import { LogSeverity, LogSeveritySDKType } from "../type/log_severity"; import { HttpRequest, HttpRequestAmino, HttpRequestSDKType } from "../type/http_request"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; @@ -594,8 +594,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -822,7 +822,7 @@ export const LogEntry = { message.receiveTimestamp = fromTimestamp(Timestamp.fromAmino(object.receive_timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.insert_id !== undefined && object.insert_id !== null) { message.insertId = object.insert_id; @@ -860,15 +860,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.receive_timestamp = message.receiveTimestamp ? Timestamp.toAmino(toTimestamp(message.receiveTimestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); - obj.insert_id = message.insertId; + obj.severity = message.severity === 0 ? undefined : message.severity; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -877,9 +877,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.span_id = message.spanId === "" ? undefined : message.spanId; + obj.trace_sampled = message.traceSampled === false ? undefined : message.traceSampled; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -977,10 +977,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1067,9 +1067,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1154,9 +1154,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = message.uid === "" ? undefined : message.uid; + obj.index = message.index === 0 ? undefined : message.index; + obj.total_splits = message.totalSplits === 0 ? undefined : message.totalSplits; return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputsign/google/logging/v2/logging.ts b/__fixtures__/v-next/outputsign/google/logging/v2/logging.ts index c6c9c07a04..ea1c265724 100644 --- a/__fixtures__/v-next/outputsign/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputsign/google/logging/v2/logging.ts @@ -995,7 +995,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -1068,8 +1068,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -1199,7 +1199,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -1210,10 +1210,10 @@ export const WriteLogEntriesRequest = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = message.partialSuccess === false ? undefined : message.partialSuccess; + obj.dry_run = message.dryRun === false ? undefined : message.dryRun; return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1338,7 +1338,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === 0 ? undefined : message.key; obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1527,12 +1527,12 @@ export const ListLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.order_by = message.orderBy === "" ? undefined : message.orderBy; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1607,9 +1607,9 @@ export const ListLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1683,8 +1683,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -1759,9 +1759,9 @@ export const ListMonitoredResourceDescriptorsResponse = { if (message.resourceDescriptors) { obj.resource_descriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.resource_descriptors = []; + obj.resource_descriptors = message.resourceDescriptors; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -1855,13 +1855,13 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1937,9 +1937,9 @@ export const ListLogsResponse = { if (message.logNames) { obj.log_names = message.logNames.map(e => e); } else { - obj.log_names = []; + obj.log_names = message.logNames; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2027,9 +2027,9 @@ export const TailLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2103,12 +2103,12 @@ export const TailLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.suppressionInfo) { obj.suppression_info = message.suppressionInfo.map(e => e ? TailLogEntriesResponse_SuppressionInfo.toAmino(e) : undefined); } else { - obj.suppression_info = []; + obj.suppression_info = message.suppressionInfo; } return obj; }, @@ -2174,7 +2174,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { fromAmino(object: TailLogEntriesResponse_SuppressionInfoAmino): TailLogEntriesResponse_SuppressionInfo { const message = createBaseTailLogEntriesResponse_SuppressionInfo(); if (object.reason !== undefined && object.reason !== null) { - message.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + message.reason = object.reason; } if (object.suppressed_count !== undefined && object.suppressed_count !== null) { message.suppressedCount = object.suppressed_count; @@ -2183,8 +2183,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason); - obj.suppressed_count = message.suppressedCount; + obj.reason = message.reason === 0 ? undefined : message.reason; + obj.suppressed_count = message.suppressedCount === 0 ? undefined : message.suppressedCount; return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts index 8d60efe76c..2a78b5a79e 100644 --- a/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts @@ -3155,7 +3155,7 @@ export const LogBucket = { message.locked = object.locked; } if (object.lifecycle_state !== undefined && object.lifecycle_state !== null) { - message.lifecycleState = lifecycleStateFromJSON(object.lifecycle_state); + message.lifecycleState = object.lifecycle_state; } message.restrictedFields = object.restricted_fields?.map(e => e) || []; if (object.cmek_settings !== undefined && object.cmek_settings !== null) { @@ -3165,17 +3165,17 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = lifecycleStateToJSON(message.lifecycleState); + obj.retention_days = message.retentionDays === 0 ? undefined : message.retentionDays; + obj.locked = message.locked === false ? undefined : message.locked; + obj.lifecycle_state = message.lifecycleState === 0 ? undefined : message.lifecycleState; if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { - obj.restricted_fields = []; + obj.restricted_fields = message.restrictedFields; } obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; return obj; @@ -3284,11 +3284,11 @@ export const LogView = { }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -3451,7 +3451,7 @@ export const LogSink = { } message.exclusions = object.exclusions?.map(e => LogExclusion.fromAmino(e)) || []; if (object.output_version_format !== undefined && object.output_version_format !== null) { - message.outputVersionFormat = logSink_VersionFormatFromJSON(object.output_version_format); + message.outputVersionFormat = object.output_version_format; } if (object.writer_identity !== undefined && object.writer_identity !== null) { message.writerIdentity = object.writer_identity; @@ -3472,19 +3472,19 @@ export const LogSink = { }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.destination = message.destination === "" ? undefined : message.destination; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.description = message.description === "" ? undefined : message.description; + obj.disabled = message.disabled === false ? undefined : message.disabled; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.output_version_format = logSink_VersionFormatToJSON(message.outputVersionFormat); - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = message.outputVersionFormat === 0 ? undefined : message.outputVersionFormat; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; + obj.include_children = message.includeChildren === false ? undefined : message.includeChildren; obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; @@ -3561,8 +3561,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = message.usePartitionedTables === false ? undefined : message.usePartitionedTables; + obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning === false ? undefined : message.usesTimestampColumnPartitioning; return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -3647,9 +3647,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -3724,9 +3724,9 @@ export const ListBucketsResponse = { if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toAmino(e) : undefined); } else { - obj.buckets = []; + obj.buckets = message.buckets; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -3813,8 +3813,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.bucket_id = message.bucketId === "" ? undefined : message.bucketId; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -3904,7 +3904,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3969,7 +3969,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -4032,7 +4032,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -4095,7 +4095,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -4180,9 +4180,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -4257,9 +4257,9 @@ export const ListViewsResponse = { if (message.views) { obj.views = message.views.map(e => e ? LogView.toAmino(e) : undefined); } else { - obj.views = []; + obj.views = message.views; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -4346,8 +4346,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.view_id = message.viewId === "" ? undefined : message.viewId; obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -4437,7 +4437,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -4502,7 +4502,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -4565,7 +4565,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -4650,9 +4650,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -4727,9 +4727,9 @@ export const ListSinksResponse = { if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toAmino(e) : undefined); } else { - obj.sinks = []; + obj.sinks = message.sinks; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -4792,7 +4792,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -4879,9 +4879,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -4981,9 +4981,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -5047,7 +5047,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -5165,10 +5165,10 @@ export const LogExclusion = { }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; return obj; @@ -5255,9 +5255,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -5332,9 +5332,9 @@ export const ListExclusionsResponse = { if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -5397,7 +5397,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -5473,7 +5473,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -5563,7 +5563,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5628,7 +5628,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -5691,7 +5691,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -5780,7 +5780,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5867,9 +5867,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.service_account_id = message.serviceAccountId === "" ? undefined : message.serviceAccountId; return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -5932,7 +5932,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -6021,7 +6021,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6130,11 +6130,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.kms_service_account_id = message.kmsServiceAccountId === "" ? undefined : message.kmsServiceAccountId; + obj.storage_location = message.storageLocation === "" ? undefined : message.storageLocation; + obj.disable_default_sink = message.disableDefaultSink === false ? undefined : message.disableDefaultSink; return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -6219,9 +6219,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.destination = message.destination === "" ? undefined : message.destination; return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -6334,7 +6334,7 @@ export const CopyLogEntriesMetadata = { message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); } if (object.state !== undefined && object.state !== null) { - message.state = operationStateFromJSON(object.state); + message.state = object.state; } if (object.cancellation_requested !== undefined && object.cancellation_requested !== null) { message.cancellationRequested = object.cancellation_requested; @@ -6354,11 +6354,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.state = operationStateToJSON(message.state); - obj.cancellation_requested = message.cancellationRequested; + obj.state = message.state === 0 ? undefined : message.state; + obj.cancellation_requested = message.cancellationRequested === false ? undefined : message.cancellationRequested; obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = message.progress === 0 ? undefined : message.progress; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { diff --git a/__fixtures__/v-next/outputsign/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputsign/google/logging/v2/logging_metrics.ts index 6b8066f5e2..7db1751796 100644 --- a/__fixtures__/v-next/outputsign/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputsign/google/logging/v2/logging_metrics.ts @@ -659,8 +659,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -843,18 +843,18 @@ export const LogMetric = { message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); } if (object.version !== undefined && object.version !== null) { - message.version = logMetric_ApiVersionFromJSON(object.version); + message.version = object.version; } return message; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = message.valueExtractor === "" ? undefined : message.valueExtractor; obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -864,7 +864,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.version = logMetric_ApiVersionToJSON(message.version); + obj.version = message.version === 0 ? undefined : message.version; return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -949,9 +949,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -1026,9 +1026,9 @@ export const ListLogMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1091,7 +1091,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1167,7 +1167,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1244,7 +1244,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1308,7 +1308,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputsign/google/longrunning/operations.ts b/__fixtures__/v-next/outputsign/google/longrunning/operations.ts index 454557c3a0..9cc4ab8c73 100644 --- a/__fixtures__/v-next/outputsign/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputsign/google/longrunning/operations.ts @@ -455,9 +455,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = message.done; + obj.done = message.done === false ? undefined : message.done; obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -522,7 +522,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -618,10 +618,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -696,9 +696,9 @@ export const ListOperationsResponse = { if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -761,7 +761,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -824,7 +824,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -900,7 +900,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -975,8 +975,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = message.responseType === "" ? undefined : message.responseType; + obj.metadata_type = message.metadataType === "" ? undefined : message.metadataType; return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputsign/google/protobuf/api.ts b/__fixtures__/v-next/outputsign/google/protobuf/api.ts index 133c7c7c4c..6d7c91ca96 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/api.ts @@ -1,4 +1,4 @@ -import { Option, OptionAmino, OptionSDKType, Syntax, SyntaxSDKType, syntaxFromJSON, syntaxToJSON } from "./type"; +import { Option, OptionAmino, OptionSDKType, Syntax, SyntaxSDKType } from "./type"; import { SourceContext, SourceContextAmino, SourceContextSDKType } from "./source_context"; import { BinaryReader, BinaryWriter } from "../../binary"; import { DeepPartial } from "../../helpers"; @@ -559,31 +559,31 @@ export const Api = { } message.mixins = object.mixins?.map(e => Mixin.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { - obj.mixins = []; + obj.mixins = message.mixins; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -704,23 +704,23 @@ export const Method = { } message.options = object.options?.map(e => Option.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = message.name === "" ? undefined : message.name; + obj.request_type_url = message.requestTypeUrl === "" ? undefined : message.requestTypeUrl; + obj.request_streaming = message.requestStreaming === false ? undefined : message.requestStreaming; + obj.response_type_url = message.responseTypeUrl === "" ? undefined : message.responseTypeUrl; + obj.response_streaming = message.responseStreaming === false ? undefined : message.responseStreaming; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -794,8 +794,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = message.name === "" ? undefined : message.name; + obj.root = message.root === "" ? undefined : message.root; return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputsign/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputsign/google/protobuf/compiler/plugin.ts index db3c8c866e..bb56e69649 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/compiler/plugin.ts @@ -366,10 +366,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = message.major; - obj.minor = message.minor; - obj.patch = message.patch; - obj.suffix = message.suffix; + obj.major = message.major === 0 ? undefined : message.major; + obj.minor = message.minor === 0 ? undefined : message.minor; + obj.patch = message.patch === 0 ? undefined : message.patch; + obj.suffix = message.suffix === "" ? undefined : message.suffix; return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -466,13 +466,13 @@ export const CodeGeneratorRequest = { if (message.fileToGenerate) { obj.file_to_generate = message.fileToGenerate.map(e => e); } else { - obj.file_to_generate = []; + obj.file_to_generate = message.fileToGenerate; } - obj.parameter = message.parameter; + obj.parameter = message.parameter === "" ? undefined : message.parameter; if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.proto_file = []; + obj.proto_file = message.protoFile; } obj.compiler_version = message.compilerVersion ? Version.toAmino(message.compilerVersion) : undefined; return obj; @@ -546,11 +546,11 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -636,9 +636,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = message.name; - obj.insertion_point = message.insertionPoint; - obj.content = message.content; + obj.name = message.name === "" ? undefined : message.name; + obj.insertion_point = message.insertionPoint === "" ? undefined : message.insertionPoint; + obj.content = message.content === "" ? undefined : message.content; return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts index dc9476bbe4..f2a1dffc34 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts @@ -2242,7 +2242,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2435,46 +2435,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2622,47 +2622,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2750,8 +2750,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2826,8 +2826,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2891,7 +2891,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3029,10 +3029,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3056,15 +3056,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3141,7 +3141,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3245,22 +3245,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3335,8 +3335,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3423,8 +3423,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3510,11 +3510,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -3636,12 +3636,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3873,7 +3873,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -3922,30 +3922,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4051,14 +4051,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4164,13 +4164,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4186,16 +4186,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4260,7 +4260,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4344,12 +4344,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4422,11 +4422,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4499,11 +4499,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4580,19 +4580,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4727,14 +4727,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -4808,8 +4808,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -4873,7 +4873,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -4996,19 +4996,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -5073,7 +5073,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -5180,11 +5180,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputsign/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputsign/google/protobuf/field_mask.ts index 9013273157..81b0bd1024 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/field_mask.ts @@ -668,7 +668,7 @@ export const FieldMask = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/protobuf/source_context.ts b/__fixtures__/v-next/outputsign/google/protobuf/source_context.ts index b46e12efec..b5de1d7e69 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/source_context.ts @@ -82,7 +82,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = message.fileName; + obj.file_name = message.fileName === "" ? undefined : message.fileName; return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputsign/google/protobuf/struct.ts b/__fixtures__/v-next/outputsign/google/protobuf/struct.ts index 411b32984d..96ded1b1dd 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/struct.ts @@ -267,7 +267,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -449,7 +449,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.number_value !== undefined && object.number_value !== null) { message.numberValue = object.number_value; @@ -470,10 +470,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.number_value = message.numberValue === null ? undefined : message.numberValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; @@ -539,7 +539,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/protobuf/type.ts b/__fixtures__/v-next/outputsign/google/protobuf/type.ts index 2adfe481b0..f14b5dc170 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/type.ts @@ -586,30 +586,30 @@ export const Type = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { - obj.fields = []; + obj.fields = message.fields; } if (message.oneofs) { obj.oneofs = message.oneofs.map(e => e); } else { - obj.oneofs = []; + obj.oneofs = message.oneofs; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -738,10 +738,10 @@ export const Field = { fromAmino(object: FieldAmino): Field { const message = createBaseField(); if (object.kind !== undefined && object.kind !== null) { - message.kind = field_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.cardinality !== undefined && object.cardinality !== null) { - message.cardinality = field_CardinalityFromJSON(object.cardinality); + message.cardinality = object.cardinality; } if (object.number !== undefined && object.number !== null) { message.number = object.number; @@ -769,20 +769,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = field_KindToJSON(message.kind); - obj.cardinality = field_CardinalityToJSON(message.cardinality); - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.cardinality = message.cardinality === 0 ? undefined : message.cardinality; + obj.number = message.number === 0 ? undefined : message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.packed = message.packed === false ? undefined : message.packed; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -881,25 +881,25 @@ export const Enum = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { - obj.enumvalue = []; + obj.enumvalue = message.enumvalue; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -982,12 +982,12 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1064,7 +1064,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts index 01989ad297..4a379210db 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts @@ -351,7 +351,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -414,7 +414,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -607,7 +607,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -670,7 +670,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -733,7 +733,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === false ? undefined : message.value; return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -796,7 +796,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts index fda192bdbe..095070f906 100644 --- a/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts @@ -1148,7 +1148,7 @@ export const AttributeContext = { if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, @@ -1222,8 +1222,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1344,7 +1344,7 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; + obj.ip = message.ip === "" ? undefined : message.ip; obj.port = message.port ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { @@ -1352,8 +1352,8 @@ export const AttributeContext_Peer = { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = message.principal === "" ? undefined : message.principal; + obj.region_code = message.regionCode === "" ? undefined : message.regionCode; return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1449,10 +1449,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = message.service === "" ? undefined : message.service; + obj.operation = message.operation === "" ? undefined : message.operation; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1557,18 +1557,18 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = message.principal === "" ? undefined : message.principal; if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { - obj.audiences = []; + obj.audiences = message.audiences; } - obj.presenter = message.presenter; + obj.presenter = message.presenter === "" ? undefined : message.presenter; obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); } else { - obj.access_levels = []; + obj.access_levels = message.accessLevels; } return obj; }, @@ -1642,8 +1642,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -1843,22 +1843,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = message.id === "" ? undefined : message.id; + obj.method = message.method === "" ? undefined : message.method; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = message.path === "" ? undefined : message.path; + obj.host = message.host === "" ? undefined : message.host; + obj.scheme = message.scheme === "" ? undefined : message.scheme; + obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -1932,8 +1932,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2140,8 +2140,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2208,8 +2208,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2423,28 +2423,28 @@ export const AttributeContext_Resource = { }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = message.service === "" ? undefined : message.service; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = message.uid === "" ? undefined : message.uid; obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; obj.delete_time = message.deleteTime ? Timestamp.toAmino(toTimestamp(message.deleteTime)) : undefined; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = message.etag === "" ? undefined : message.etag; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputsign/google/rpc/error_details.ts b/__fixtures__/v-next/outputsign/google/rpc/error_details.ts index 333ee77b26..34f587a075 100644 --- a/__fixtures__/v-next/outputsign/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputsign/google/rpc/error_details.ts @@ -899,9 +899,9 @@ export const DebugInfo = { if (message.stackEntries) { obj.stack_entries = message.stackEntries.map(e => e); } else { - obj.stack_entries = []; + obj.stack_entries = message.stackEntries; } - obj.detail = message.detail; + obj.detail = message.detail === "" ? undefined : message.detail; return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -965,7 +965,7 @@ export const QuotaFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? QuotaFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1040,8 +1040,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = message.subject; - obj.description = message.description; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -1114,8 +1114,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1212,8 +1212,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = message.reason; - obj.domain = message.domain; + obj.reason = message.reason === "" ? undefined : message.reason; + obj.domain = message.domain === "" ? undefined : message.domain; obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1283,7 +1283,7 @@ export const PreconditionFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1369,9 +1369,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = message.type; - obj.subject = message.subject; - obj.description = message.description; + obj.type = message.type === "" ? undefined : message.type; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1435,7 +1435,7 @@ export const BadRequest = { if (message.fieldViolations) { obj.field_violations = message.fieldViolations.map(e => e ? BadRequest_FieldViolation.toAmino(e) : undefined); } else { - obj.field_violations = []; + obj.field_violations = message.fieldViolations; } return obj; }, @@ -1510,8 +1510,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = message.field; - obj.description = message.description; + obj.field = message.field === "" ? undefined : message.field; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1585,8 +1585,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = message.requestId; - obj.serving_data = message.servingData; + obj.request_id = message.requestId === "" ? undefined : message.requestId; + obj.serving_data = message.servingData === "" ? undefined : message.servingData; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1682,10 +1682,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = message.resourceType; - obj.resource_name = message.resourceName; - obj.owner = message.owner; - obj.description = message.description; + obj.resource_type = message.resourceType === "" ? undefined : message.resourceType; + obj.resource_name = message.resourceName === "" ? undefined : message.resourceName; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -1749,7 +1749,7 @@ export const Help = { if (message.links) { obj.links = message.links.map(e => e ? Help_Link.toAmino(e) : undefined); } else { - obj.links = []; + obj.links = message.links; } return obj; }, @@ -1824,8 +1824,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = message.description; - obj.url = message.url; + obj.description = message.description === "" ? undefined : message.description; + obj.url = message.url === "" ? undefined : message.url; return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -1899,8 +1899,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = message.locale; - obj.message = message.message; + obj.locale = message.locale === "" ? undefined : message.locale; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputsign/google/rpc/status.ts b/__fixtures__/v-next/outputsign/google/rpc/status.ts index e92d6596a9..7950a0ad7d 100644 --- a/__fixtures__/v-next/outputsign/google/rpc/status.ts +++ b/__fixtures__/v-next/outputsign/google/rpc/status.ts @@ -136,12 +136,12 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = message.code; - obj.message = message.message; + obj.code = message.code === 0 ? undefined : message.code; + obj.message = message.message === "" ? undefined : message.message; if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.details = []; + obj.details = message.details; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/helpers.ts b/__fixtures__/v-next/outputsign/helpers.ts index cea27311af..ca8bc2ac0f 100644 --- a/__fixtures__/v-next/outputsign/helpers.ts +++ b/__fixtures__/v-next/outputsign/helpers.ts @@ -5,6 +5,8 @@ */ +import { Dec } from "@keplr-wallet/unit"; + declare var self: any | undefined; declare var window: any | undefined; declare var global: any | undefined; @@ -46,7 +48,7 @@ export interface AminoHeight { readonly revision_height?: string; } -export function omitDefault( +export function omitDefault( input: T ): T | undefined { if (typeof input === 'string') { @@ -57,6 +59,10 @@ export function omitDefault( return input === 0 ? undefined : input; } + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + if (typeof input === 'bigint') { return input === BigInt(0) ? undefined : input; } @@ -248,3 +254,7 @@ export function fromJsonTimestamp(o: any): Timestamp { function numberToLong(number: number) { return BigInt(Math.trunc(number)); } + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/genesis.ts index a88b54ea68..25e9d86d2d 100644 --- a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/genesis.ts @@ -94,11 +94,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.ts index 1ad53dd2ae..c63c9b3d99 100644 --- a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/query.ts @@ -212,7 +212,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { @@ -437,7 +437,7 @@ export const QueryDenomTracesResponse = { if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/transfer.ts index e17d159caf..aa68a510b7 100644 --- a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/transfer.ts @@ -152,8 +152,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = message.path; - obj.base_denom = message.baseDenom; + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -233,8 +233,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = message.sendEnabled; - obj.receive_enabled = message.receiveEnabled; + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts index 7eb83a8dd9..987030508f 100644 --- a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts @@ -209,11 +209,11 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v2/packet.ts index 0983c99175..f1d0762c97 100644 --- a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v2/packet.ts @@ -127,10 +127,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = message.denom; - obj.amount = message.amount; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts index 91dc88fb8e..ac1f6bef7a 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts @@ -502,10 +502,10 @@ export const Channel = { fromAmino(object: ChannelAmino): Channel { const message = createBaseChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -518,15 +518,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -639,10 +639,10 @@ export const IdentifiedChannel = { fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { const message = createBaseIdentifiedChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -661,17 +661,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -751,8 +751,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -905,10 +905,10 @@ export const Packet = { toAmino(message: Packet): PacketAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; @@ -1015,8 +1015,8 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1099,7 +1099,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result ? base64FromBytes(message.result) : undefined; - obj.error = message.error; + obj.error = message.error === null ? undefined : message.error; return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts index 53bba7e4e4..c331b9f0d9 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts @@ -192,37 +192,37 @@ export const GenesisState = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } if (message.receipts) { obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.receipts = []; + obj.receipts = message.receipts; } if (message.sendSequences) { obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.send_sequences = []; + obj.send_sequences = message.sendSequences; } if (message.recvSequences) { obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.recv_sequences = []; + obj.recv_sequences = message.recvSequences; } if (message.ackSequences) { obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.ack_sequences = []; + obj.ack_sequences = message.ackSequences; } obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; return obj; @@ -317,8 +317,8 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts index 08facd76f0..3df90e45dd 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts @@ -1082,8 +1082,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1347,7 +1347,7 @@ export const QueryChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1432,7 +1432,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = message.connection === "" ? undefined : message.connection; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1529,7 +1529,7 @@ export const QueryConnectionChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1612,8 +1612,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -1816,8 +1816,8 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1926,7 +1926,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2021,8 +2021,8 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2211,8 +2211,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2309,7 +2309,7 @@ export const QueryPacketCommitmentsResponse = { if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -2405,8 +2405,8 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2500,7 +2500,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = message.received === false ? undefined : message.received; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2595,8 +2595,8 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2803,13 +2803,13 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -2906,7 +2906,7 @@ export const QueryPacketAcknowledgementsResponse = { if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -3007,12 +3007,12 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3105,7 +3105,7 @@ export const QueryUnreceivedPacketsResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3205,12 +3205,12 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { - obj.packet_ack_sequences = []; + obj.packet_ack_sequences = message.packetAckSequences; } return obj; }, @@ -3303,7 +3303,7 @@ export const QueryUnreceivedAcksResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3385,8 +3385,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts index f65ff15546..db4f6d15ef 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts @@ -611,9 +611,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -808,13 +808,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -1007,13 +1007,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1184,11 +1184,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1335,9 +1335,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1508,11 +1508,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1677,7 +1677,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -1856,7 +1856,7 @@ export const MsgTimeout = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2047,7 +2047,7 @@ export const MsgTimeoutOnClose = { obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2224,7 +2224,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts index 2b73b40b0d..9a3d8c0c8e 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts @@ -362,7 +362,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -526,11 +526,11 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } return obj; }, @@ -633,10 +633,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -742,8 +742,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -896,7 +896,7 @@ export const Params = { if (message.allowedClients) { obj.allowed_clients = message.allowedClients.map(e => e); } else { - obj.allowed_clients = []; + obj.allowed_clients = message.allowedClients; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts index f663a3e8ff..8e88ae8a66 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts @@ -215,20 +215,20 @@ export const GenesisState = { if (message.clients) { obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.clients = []; + obj.clients = message.clients; } if (message.clientsConsensus) { obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); } else { - obj.clients_consensus = []; + obj.clients_consensus = message.clientsConsensus; } if (message.clientsMetadata) { obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); } else { - obj.clients_metadata = []; + obj.clients_metadata = message.clientsMetadata; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = message.createLocalhost; + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; return obj; }, @@ -388,11 +388,11 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { - obj.client_metadata = []; + obj.client_metadata = message.clientMetadata; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts index d554bf9610..d1a19942ea 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts @@ -580,7 +580,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -831,7 +831,7 @@ export const QueryClientStatesResponse = { if (message.clientStates) { obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.client_states = []; + obj.client_states = message.clientStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -939,10 +939,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1121,7 +1121,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1205,7 +1205,7 @@ export const QueryConsensusStatesResponse = { if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1276,7 +1276,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1345,7 +1345,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = message.status === "" ? undefined : message.status; return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.ts index 5d49da0716..c872d076ba 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/tx.ts @@ -321,7 +321,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -470,9 +470,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -656,12 +656,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -810,9 +810,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputsign/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputsign/ibc/core/commitment/v1/commitment.ts index 7bb365b08e..0fc9bfb2e2 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/commitment/v1/commitment.ts @@ -316,7 +316,7 @@ export const MerklePath = { if (message.keyPath) { obj.key_path = message.keyPath.map(e => e); } else { - obj.key_path = []; + obj.key_path = message.keyPath; } return obj; }, @@ -387,7 +387,7 @@ export const MerkleProof = { if (message.proofs) { obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); } else { - obj.proofs = []; + obj.proofs = message.proofs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts index 938d345c70..73e524d540 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts @@ -427,7 +427,7 @@ export const ConnectionEnd = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -439,13 +439,13 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -561,7 +561,7 @@ export const IdentifiedConnection = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -573,14 +573,14 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -675,8 +675,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -747,7 +747,7 @@ export const ClientPaths = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -826,11 +826,11 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -909,11 +909,11 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; if (message.features) { obj.features = message.features.map(e => e); } else { - obj.features = []; + obj.features = message.features; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts index c9935c8c4e..fae342fb16 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts @@ -113,12 +113,12 @@ export const GenesisState = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } if (message.clientConnectionPaths) { obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); } else { - obj.client_connection_paths = []; + obj.client_connection_paths = message.clientConnectionPaths; } obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts index bb5a77e207..455f4904da 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts @@ -421,7 +421,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -685,7 +685,7 @@ export const QueryConnectionsResponse = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -757,7 +757,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -851,7 +851,7 @@ export const QueryClientConnectionsResponse = { if (message.connectionPaths) { obj.connection_paths = message.connectionPaths.map(e => e); } else { - obj.connection_paths = []; + obj.connection_paths = message.connectionPaths; } obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -923,7 +923,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1115,7 +1115,7 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1224,7 +1224,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts index f955dcedac..61acf963ab 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts @@ -403,11 +403,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -661,22 +661,22 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.counterparty_versions = []; + obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -908,8 +908,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -917,7 +917,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1077,10 +1077,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.ts index bd598919f5..99431b6457 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/port/v1/query.ts @@ -1,4 +1,4 @@ -import { Order, OrderSDKType, Counterparty, CounterpartyAmino, CounterpartySDKType, orderFromJSON, orderToJSON } from "../../channel/v1/channel"; +import { Order, OrderSDKType, Counterparty, CounterpartyAmino, CounterpartySDKType } from "../../channel/v1/channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.port.v1"; @@ -149,7 +149,7 @@ export const QueryAppVersionRequest = { message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -161,11 +161,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -245,8 +245,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/localhost/v1/localhost.ts index 26c293de7b..3f637cb136 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/localhost/v1/localhost.ts @@ -95,7 +95,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts index a7c6db5aeb..5ee5c0a650 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts @@ -733,7 +733,7 @@ export const ClientState = { obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -829,7 +829,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -953,7 +953,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1061,7 +1061,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1156,7 +1156,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1169,7 +1169,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1362,7 +1362,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1373,8 +1373,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1458,7 +1458,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts index d4df74dd43..824daa1bd3 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts @@ -729,9 +729,9 @@ export const ClientState = { toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -827,7 +827,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -951,7 +951,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1059,7 +1059,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1154,7 +1154,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1167,7 +1167,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1360,7 +1360,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1371,8 +1371,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1456,7 +1456,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts index b7a07ef1e5..5353130c8e 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts @@ -452,7 +452,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -462,15 +462,15 @@ export const ClientState = { if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -660,7 +660,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/claim.ts index 8edfb815df..8ab10b084c 100644 --- a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/claim.ts @@ -155,16 +155,16 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_claimable_amount = []; + obj.initial_claimable_amount = message.initialClaimableAmount; } if (message.actionCompleted) { obj.action_completed = message.actionCompleted.map(e => e); } else { - obj.action_completed = []; + obj.action_completed = message.actionCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/genesis.ts index c3c1346dfd..76800dbd94 100644 --- a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/genesis.ts @@ -109,7 +109,7 @@ export const GenesisState = { if (message.claimRecords) { obj.claim_records = message.claimRecords.map(e => e ? ClaimRecord.toAmino(e) : undefined); } else { - obj.claim_records = []; + obj.claim_records = message.claimRecords; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/params.ts index a84146c6c6..e93e26b37f 100644 --- a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/params.ts @@ -118,7 +118,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = message.claimDenom === "" ? undefined : message.claimDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.ts index c25cc303ec..8be21c224d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/claim/v1beta1/query.ts @@ -1,4 +1,4 @@ -import { Action, ActionSDKType, ClaimRecord, ClaimRecordAmino, ClaimRecordSDKType, actionFromJSON, actionToJSON } from "./claim"; +import { Action, ActionSDKType, ClaimRecord, ClaimRecordAmino, ClaimRecordSDKType } from "./claim"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; @@ -282,7 +282,7 @@ export const QueryModuleAccountBalanceResponse = { if (message.moduleAccountBalance) { obj.moduleAccountBalance = message.moduleAccountBalance.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.moduleAccountBalance = []; + obj.moduleAccountBalance = message.moduleAccountBalance; } return obj; }, @@ -479,7 +479,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -624,14 +624,14 @@ export const QueryClaimableForActionRequest = { message.address = object.address; } if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } return message; }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = actionToJSON(message.action); + obj.address = message.address === "" ? undefined : message.address; + obj.action = message.action === 0 ? undefined : message.action; return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -701,7 +701,7 @@ export const QueryClaimableForActionResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -771,7 +771,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { @@ -841,7 +841,7 @@ export const QueryTotalClaimableResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts index ae76c5067f..a3a724a8bf 100644 --- a/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts @@ -276,12 +276,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -352,7 +352,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts b/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts index ccc919c128..9facacc51f 100644 --- a/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts @@ -165,7 +165,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, @@ -235,7 +235,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts index 1d6dc82695..e1a3308922 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../../google/ import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, DeepPartial, padDecimal } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -346,12 +346,12 @@ export const SmoothWeightChangeParams = { if (message.initialPoolWeights) { obj.initial_pool_weights = message.initialPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.initial_pool_weights = []; + obj.initial_pool_weights = message.initialPoolWeights; } if (message.targetPoolWeights) { obj.target_pool_weights = message.targetPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.target_pool_weights = []; + obj.target_pool_weights = message.targetPoolWeights; } return obj; }, @@ -445,8 +445,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -530,7 +530,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -669,17 +669,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts index 9fb78e3e29..d93c651f31 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -128,14 +128,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index a0f5ba64d5..96fbd9bf8c 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial } from "../../../../helpers"; +import { DeepPartial, padDecimal } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -165,8 +165,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -323,22 +323,22 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_liquidity = []; + obj.pool_liquidity = message.poolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts index a4f0533a38..8c9e45a487 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts @@ -210,20 +210,20 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_pool_liquidity = []; + obj.initial_pool_liquidity = message.initialPoolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -394,12 +394,12 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts index 8d55e29c9c..4e9a0a5352 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts @@ -96,7 +96,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -193,7 +193,7 @@ export const GenesisState = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts index d29decb864..a21af8660d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts @@ -903,7 +903,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1172,7 +1172,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = message.poolType === "" ? undefined : message.poolType; return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1256,7 +1256,7 @@ export const QueryCalcJoinPoolSharesRequest = { if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -1335,11 +1335,11 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1423,7 +1423,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1493,7 +1493,7 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1777,7 +1777,7 @@ export const QueryTotalPoolLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -2004,7 +2004,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -2086,9 +2086,9 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } - obj.shares_out = message.sharesOut; + obj.shares_out = message.sharesOut === "" ? undefined : message.sharesOut; return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2182,8 +2182,8 @@ export const QuerySpotPriceRequest = { toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2277,9 +2277,9 @@ export const QueryPoolsWithFilterRequest = { if (message.minLiquidity) { obj.min_liquidity = message.minLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_liquidity = []; + obj.min_liquidity = message.minLiquidity; } - obj.pool_type = message.poolType; + obj.pool_type = message.poolType === "" ? undefined : message.poolType; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2363,7 +2363,7 @@ export const QueryPoolsWithFilterResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2434,7 +2434,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -2536,13 +2536,13 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -2612,7 +2612,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -2714,14 +2714,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = message.tokenOut; + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -2790,7 +2790,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { @@ -2916,7 +2916,7 @@ export const QueryTotalLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts index 41194bb771..da213136ef 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts @@ -514,13 +514,13 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -599,11 +599,11 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in = []; + obj.token_in = message.tokenIn; } return obj; }, @@ -706,13 +706,13 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out_mins = []; + obj.token_out_mins = message.tokenOutMins; } return obj; }, @@ -783,7 +783,7 @@ export const MsgExitPoolResponse = { if (message.tokenOut) { obj.token_out = message.tokenOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out = []; + obj.token_out = message.tokenOut; } return obj; }, @@ -867,7 +867,7 @@ export const SwapAmountInRoute = { toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -969,14 +969,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1045,7 +1045,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1128,7 +1128,7 @@ export const SwapAmountOutRoute = { toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1230,13 +1230,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1306,7 +1306,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1412,10 +1412,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1484,7 +1484,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1599,11 +1599,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -1672,7 +1672,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -1787,11 +1787,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -1860,7 +1860,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -1966,10 +1966,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2038,7 +2038,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts index 0ea251e6ee..4e35cc4c6a 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts @@ -136,8 +136,8 @@ export const QuerySpotPriceRequest = { toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -206,7 +206,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/params.ts index 648efff247..b7d55e8f00 100644 --- a/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -65,7 +65,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts index 2315a63b7c..2bb2650714 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts @@ -255,12 +255,12 @@ export const Gauge = { toAmino(message: Gauge): GaugeAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -268,7 +268,7 @@ export const Gauge = { if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.distributed_coins = []; + obj.distributed_coins = message.distributedCoins; } return obj; }, @@ -339,7 +339,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts index 5bfe0aadff..f94657aa6b 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts @@ -143,12 +143,12 @@ export const GenesisState = { if (message.gauges) { obj.gauges = message.gauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.gauges = []; + obj.gauges = message.gauges; } if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/params.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/params.ts index 6ecfb55814..e1cae8b39a 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/params.ts @@ -73,7 +73,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = message.distrEpochIdentifier; + obj.distr_epoch_identifier = message.distrEpochIdentifier === "" ? undefined : message.distrEpochIdentifier; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts index cf803c9aa3..ecedae78f4 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts @@ -489,7 +489,7 @@ export const ModuleToDistributeCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -786,7 +786,7 @@ export const GaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -942,7 +942,7 @@ export const ActiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1026,7 +1026,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1110,7 +1110,7 @@ export const ActiveGaugesPerDenomResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1266,7 +1266,7 @@ export const UpcomingGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1350,7 +1350,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1434,7 +1434,7 @@ export const UpcomingGaugesPerDenomResponse = { if (message.upcomingGauges) { obj.upcoming_gauges = message.upcomingGauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.upcoming_gauges = []; + obj.upcoming_gauges = message.upcomingGauges; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1536,11 +1536,11 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { - obj.lock_ids = []; + obj.lock_ids = message.lockIds; } obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; return obj; @@ -1612,7 +1612,7 @@ export const RewardsEstResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1739,7 +1739,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts index fa257cfafb..cb3bd2d362 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts @@ -230,13 +230,13 @@ export const MsgCreateGauge = { }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; + obj.owner = message.owner === "" ? undefined : message.owner; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -386,12 +386,12 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts index ec001b4bc6..a36aaaca3f 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts @@ -96,12 +96,12 @@ export const GenesisState = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts index e99b0411c3..8166061138 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts @@ -360,13 +360,13 @@ export const PeriodLock = { toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -456,7 +456,7 @@ export const QueryCondition = { fromAmino(object: QueryConditionAmino): QueryCondition { const message = createBaseQueryCondition(); if (object.lock_query_type !== undefined && object.lock_query_type !== null) { - message.lockQueryType = lockQueryTypeFromJSON(object.lock_query_type); + message.lockQueryType = object.lock_query_type; } if (object.denom !== undefined && object.denom !== null) { message.denom = object.denom; @@ -471,8 +471,8 @@ export const QueryCondition = { }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = lockQueryTypeToJSON(message.lockQueryType); - obj.denom = message.denom; + obj.lock_query_type = message.lockQueryType === 0 ? undefined : message.lockQueryType; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; @@ -581,7 +581,7 @@ export const SyntheticLock = { toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/params.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/params.ts index f37aad017e..536360b7dc 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/params.ts @@ -63,7 +63,7 @@ export const Params = { if (message.forceUnlockAllowedAddresses) { obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses.map(e => e); } else { - obj.force_unlock_allowed_addresses = []; + obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts index a3f8fd92b8..879a82d006 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts @@ -700,7 +700,7 @@ export const ModuleBalanceResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -827,7 +827,7 @@ export const ModuleLockedAmountResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -897,7 +897,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -967,7 +967,7 @@ export const AccountUnlockableCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1037,7 +1037,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1107,7 +1107,7 @@ export const AccountUnlockingCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1177,7 +1177,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1247,7 +1247,7 @@ export const AccountLockedCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1328,7 +1328,7 @@ export const AccountLockedPastTimeRequest = { }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1399,7 +1399,7 @@ export const AccountLockedPastTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1480,7 +1480,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1551,7 +1551,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1632,7 +1632,7 @@ export const AccountUnlockedBeforeTimeRequest = { }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1703,7 +1703,7 @@ export const AccountUnlockedBeforeTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1795,9 +1795,9 @@ export const AccountLockedPastTimeDenomRequest = { }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -1867,7 +1867,7 @@ export const AccountLockedPastTimeDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1950,7 +1950,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2020,7 +2020,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2303,7 +2303,7 @@ export const SyntheticLockupsByLockupIDResponse = { if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2386,7 +2386,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2457,7 +2457,7 @@ export const AccountLockedLongerDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2540,7 +2540,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2611,7 +2611,7 @@ export const AccountLockedDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2694,7 +2694,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2765,7 +2765,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2859,9 +2859,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { @@ -2931,7 +2931,7 @@ export const AccountLockedLongerDurationDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts index f96ca327cf..1787859302 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts @@ -300,12 +300,12 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -446,7 +446,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -516,7 +516,7 @@ export const MsgBeginUnlockingAllResponse = { if (message.unlocks) { obj.unlocks = message.unlocks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.unlocks = []; + obj.unlocks = message.unlocks; } return obj; }, @@ -608,12 +608,12 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -683,7 +683,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -778,7 +778,7 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; @@ -849,7 +849,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -940,12 +940,12 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1015,7 +1015,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts index 0266bab464..0ce5d2f092 100644 --- a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -269,7 +269,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions) === "" ? undefined : padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -349,8 +349,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -452,10 +452,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking) === "" ? undefined : padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives) === "" ? undefined : padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards) === "" ? undefined : padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -605,16 +605,16 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions) === "" ? undefined : padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.reduction_factor = padDecimal(message.reductionFactor) === "" ? undefined : padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { - obj.weighted_developer_rewards_receivers = []; + obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/genesis.ts index c0357c0de9..3e7a43ca93 100644 --- a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/genesis.ts @@ -119,7 +119,7 @@ export const GenesisState = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.distr_info = message.distrInfo ? DistrInfo.toAmino(message.distrInfo) : undefined; obj.pool_to_gauges = message.poolToGauges ? PoolToGauges.toAmino(message.poolToGauges) : undefined; diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/gov.ts index 309b800f5d..75bc7026d2 100644 --- a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/gov.ts @@ -166,12 +166,12 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -261,12 +261,12 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts index b9734a249c..a0cd20741b 100644 --- a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts @@ -172,7 +172,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = message.mintedDenom === "" ? undefined : message.mintedDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -242,7 +242,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -321,11 +321,11 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -409,7 +409,7 @@ export const DistrRecord = { toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -578,7 +578,7 @@ export const PoolToGauges = { if (message.poolToGauge) { obj.pool_to_gauge = message.poolToGauge.map(e => e ? PoolToGauge.toAmino(e) : undefined); } else { - obj.pool_to_gauge = []; + obj.pool_to_gauge = message.poolToGauge; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts index 6ab9350a83..1e4a300519 100644 --- a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts @@ -340,7 +340,7 @@ export const QueryGaugeIdsResponse = { if (message.gaugeIdsWithDuration) { obj.gauge_ids_with_duration = message.gaugeIdsWithDuration.map(e => e ? QueryGaugeIdsResponse_GaugeIdWithDuration.toAmino(e) : undefined); } else { - obj.gauge_ids_with_duration = []; + obj.gauge_ids_with_duration = message.gaugeIdsWithDuration; } return obj; }, @@ -438,7 +438,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { const obj: any = {}; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -818,7 +818,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -1044,7 +1044,7 @@ export const QueryIncentivizedPoolsResponse = { if (message.incentivizedPools) { obj.incentivized_pools = message.incentivizedPools.map(e => e ? IncentivizedPool.toAmino(e) : undefined); } else { - obj.incentivized_pools = []; + obj.incentivized_pools = message.incentivizedPools; } return obj; }, @@ -1171,7 +1171,7 @@ export const QueryExternalIncentiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputsign/osmosis/sumtree/v1beta1/tree.ts index 5cedbe8aa1..fd538ff0a2 100644 --- a/__fixtures__/v-next/outputsign/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputsign/osmosis/sumtree/v1beta1/tree.ts @@ -100,7 +100,7 @@ export const Node = { if (message.children) { obj.children = message.children.map(e => e ? Child.toAmino(e) : undefined); } else { - obj.children = []; + obj.children = message.children; } return obj; }, @@ -182,7 +182,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index ? base64FromBytes(message.index) : undefined; - obj.accumulation = message.accumulation; + obj.accumulation = message.accumulation === "" ? undefined : message.accumulation; return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/genesis.ts index 38d4919046..aa46eeb28d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/genesis.ts @@ -145,22 +145,22 @@ export const GenesisState = { if (message.superfluidAssets) { obj.superfluid_assets = message.superfluidAssets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.superfluid_assets = []; + obj.superfluid_assets = message.superfluidAssets; } if (message.osmoEquivalentMultipliers) { obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers.map(e => e ? OsmoEquivalentMultiplierRecord.toAmino(e) : undefined); } else { - obj.osmo_equivalent_multipliers = []; + obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers; } if (message.intermediaryAccounts) { obj.intermediary_accounts = message.intermediaryAccounts.map(e => e ? SuperfluidIntermediaryAccount.toAmino(e) : undefined); } else { - obj.intermediary_accounts = []; + obj.intermediary_accounts = message.intermediaryAccounts; } if (message.intemediaryAccountConnections) { obj.intemediary_account_connections = message.intemediaryAccountConnections.map(e => e ? LockIdIntermediaryAccountConnection.toAmino(e) : undefined); } else { - obj.intemediary_account_connections = []; + obj.intemediary_account_connections = message.intemediaryAccountConnections; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts index 621219d24e..4a9a586dbd 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/params.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../binary"; import { Decimal } from "@cosmjs/math"; -import { DeepPartial } from "../../helpers"; +import { DeepPartial, padDecimal } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; /** Params holds parameters for the superfluid module */ export interface Params { @@ -78,7 +78,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = message.minimumRiskFactor; + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor) === "" ? undefined : padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts index 53d42ff855..0f33e0af37 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts @@ -1,6 +1,6 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../cosmos/base/query/v1beta1/pagination"; import { Params, ParamsAmino, ParamsSDKType } from "./params"; -import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordAmino, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordAmino, SuperfluidDelegationRecordSDKType, superfluidAssetTypeFromJSON, superfluidAssetTypeToJSON } from "./superfluid"; +import { SuperfluidAssetType, SuperfluidAssetTypeSDKType, SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType, OsmoEquivalentMultiplierRecord, OsmoEquivalentMultiplierRecordAmino, OsmoEquivalentMultiplierRecordSDKType, SuperfluidDelegationRecord, SuperfluidDelegationRecordAmino, SuperfluidDelegationRecordSDKType } from "./superfluid"; import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "../lockup/lock"; import { DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType } from "../../cosmos/staking/v1beta1/staking"; @@ -754,7 +754,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -817,13 +817,13 @@ export const AssetTypeResponse = { fromAmino(object: AssetTypeResponseAmino): AssetTypeResponse { const message = createBaseAssetTypeResponse(); if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -949,7 +949,7 @@ export const AllAssetsResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1019,7 +1019,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1194,10 +1194,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1351,7 +1351,7 @@ export const AllIntermediaryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? SuperfluidIntermediaryAccountInfo.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1564,7 +1564,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1634,7 +1634,7 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? Delegations.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1726,9 +1726,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; + obj.amount_sfsd = message.amountSfsd === "" ? undefined : message.amountSfsd; + obj.osmo_equivalent = message.osmoEquivalent === "" ? undefined : message.osmoEquivalent; return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -1853,7 +1853,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = message.totalDelegations === "" ? undefined : message.totalDelegations; return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -1944,9 +1944,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2016,7 +2016,7 @@ export const SuperfluidDelegationAmountResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -2086,7 +2086,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2178,12 +2178,12 @@ export const SuperfluidDelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -2265,8 +2265,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2354,17 +2354,17 @@ export const SuperfluidUndelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalUndelegatedCoins) { obj.total_undelegated_coins = message.totalUndelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_undelegated_coins = []; + obj.total_undelegated_coins = message.totalUndelegatedCoins; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2445,8 +2445,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -2516,7 +2516,7 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } return obj; }, @@ -2597,8 +2597,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -2668,7 +2668,7 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } return obj; }, @@ -2738,7 +2738,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { @@ -2839,17 +2839,17 @@ export const QueryTotalDelegationByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.delegationResponse) { obj.delegation_response = message.delegationResponse.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_response = []; + obj.delegation_response = message.delegationResponse; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -2986,7 +2986,7 @@ export const QueryUnpoolWhitelistResponse = { if (message.poolIds) { obj.pool_ids = message.poolIds.map(e => e.toString()); } else { - obj.pool_ids = []; + obj.pool_ids = message.poolIds; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts index ddd1d8e45e..7d8a57fc3d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial } from "../../helpers"; +import { DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -303,14 +303,14 @@ export const SuperfluidAsset = { message.denom = object.denom; } if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -403,8 +403,8 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, @@ -499,8 +499,8 @@ export const OsmoEquivalentMultiplierRecord = { toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.multiplier = padDecimal(message.multiplier) === "" ? undefined : padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -606,8 +606,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -692,7 +692,7 @@ export const LockIdIntermediaryAccountConnection = { toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { @@ -771,7 +771,7 @@ export const UnpoolWhitelistedPools = { if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts index ed16a14f31..c941fb2bb2 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts @@ -288,9 +288,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.val_addr = message.valAddr; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -428,7 +428,7 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, @@ -567,7 +567,7 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, @@ -713,13 +713,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } - obj.val_addr = message.valAddr; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -872,7 +872,7 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, @@ -952,7 +952,7 @@ export const MsgUnPoolWhitelistedPoolResponse = { if (message.exitedLockIds) { obj.exited_lock_ids = message.exitedLockIds.map(e => e.toString()); } else { - obj.exited_lock_ids = []; + obj.exited_lock_ids = message.exitedLockIds; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/v1beta1/gov.ts index 441fec78dd..69da138b40 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/v1beta1/gov.ts @@ -174,12 +174,12 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -269,12 +269,12 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { - obj.superfluid_asset_denoms = []; + obj.superfluid_asset_denoms = message.superfluidAssetDenoms; } return obj; }, @@ -384,14 +384,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } - obj.is_overwrite = message.isOverwrite; + obj.is_overwrite = message.isOverwrite === false ? undefined : message.isOverwrite; return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index c7b44a2369..11ba9cf656 100644 --- a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -79,7 +79,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/genesis.ts index 102a746cd4..dba5ba56f9 100644 --- a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/genesis.ts @@ -122,7 +122,7 @@ export const GenesisState = { if (message.factoryDenoms) { obj.factory_denoms = message.factoryDenoms.map(e => e ? GenesisDenom.toAmino(e) : undefined); } else { - obj.factory_denoms = []; + obj.factory_denoms = message.factoryDenoms; } return obj; }, @@ -205,7 +205,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/params.ts index 6a59d99d71..43c9f3e89d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/params.ts @@ -67,7 +67,7 @@ export const Params = { if (message.denomCreationFee) { obj.denom_creation_fee = message.denomCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.denom_creation_fee = []; + obj.denom_creation_fee = message.denomCreationFee; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.ts index b2fbead8b3..6bc2883b45 100644 --- a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/query.ts @@ -326,7 +326,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -466,7 +466,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { @@ -536,7 +536,7 @@ export const QueryDenomsFromCreatorResponse = { if (message.denoms) { obj.denoms = message.denoms.map(e => e); } else { - obj.denoms = []; + obj.denoms = message.denoms; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.ts index 2895ae61ff..ddc4a3a555 100644 --- a/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/tokenfactory/v1beta1/tx.ts @@ -341,8 +341,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.subdenom = message.subdenom === "" ? undefined : message.subdenom; return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -411,7 +411,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = message.newTokenDenom === "" ? undefined : message.newTokenDenom; return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -493,7 +493,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -632,7 +632,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -780,9 +780,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -920,7 +920,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/genesis.ts index a6a1b670c5..7f914fbd98 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/genesis.ts @@ -110,7 +110,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = message.pruneEpochIdentifier === "" ? undefined : message.pruneEpochIdentifier; obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, @@ -194,7 +194,7 @@ export const GenesisState = { if (message.twaps) { obj.twaps = message.twaps.map(e => e ? TwapRecord.toAmino(e) : undefined); } else { - obj.twaps = []; + obj.twaps = message.twaps; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts index 89e4426603..610c49f2a7 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -212,8 +212,8 @@ export const ArithmeticTwapRequest = { toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; return obj; @@ -284,7 +284,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -389,8 +389,8 @@ export const ArithmeticTwapToNowRequest = { toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -460,7 +460,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts index a320e5ff99..ab702b3f3d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -254,14 +254,14 @@ export const TwapRecord = { toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; + obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; + obj.height = message.height ? message.height.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice) === "" ? undefined : padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice) === "" ? undefined : padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts index 07d9ec3a89..9a6782a8e7 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts @@ -96,7 +96,7 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/genesis.ts index 836dbde3fd..baab1167fe 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/genesis.ts @@ -78,11 +78,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = message.basedenom; + obj.basedenom = message.basedenom === "" ? undefined : message.basedenom; if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.feetokens = []; + obj.feetokens = message.feetokens; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/gov.ts index e6dd79006c..4f7593cefd 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/gov.ts @@ -114,8 +114,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts index d4247f09af..bd469f12aa 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial } from "../../../helpers"; +import { DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -255,7 +255,7 @@ export const QueryFeeTokensResponse = { if (message.feeTokens) { obj.fee_tokens = message.feeTokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.fee_tokens = []; + obj.fee_tokens = message.feeTokens; } return obj; }, @@ -325,7 +325,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -408,7 +408,7 @@ export const QueryDenomSpotPriceResponse = { toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; obj.poolID = message.poolID ? message.poolID.toString() : undefined; - obj.spot_price = message.spotPrice; + obj.spot_price = padDecimal(message.spotPrice) === "" ? undefined : padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -477,7 +477,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -673,7 +673,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = message.baseDenom; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputsign/tendermint/abci/types.ts b/__fixtures__/v-next/outputsign/tendermint/abci/types.ts index 75079b29ab..f64d45825b 100644 --- a/__fixtures__/v-next/outputsign/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/abci/types.ts @@ -1691,7 +1691,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1830,7 +1830,7 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; return obj; @@ -1906,8 +1906,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -2028,12 +2028,12 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; @@ -2135,9 +2135,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.path = message.path; + obj.path = message.path === "" ? undefined : message.path; obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.prove = message.prove === false ? undefined : message.prove; return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2241,7 +2241,7 @@ export const RequestBeginBlock = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } return obj; }, @@ -2310,14 +2310,14 @@ export const RequestCheckTx = { message.tx = bytesFromBase64(object.tx); } if (object.type !== undefined && object.type !== null) { - message.type = checkTxTypeFromJSON(object.type); + message.type = object.type; } return message; }, toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.type = checkTxTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2710,8 +2710,8 @@ export const RequestLoadSnapshotChunk = { toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -2796,9 +2796,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3136,7 +3136,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3199,7 +3199,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3360,8 +3360,8 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; @@ -3449,9 +3449,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -3540,7 +3540,7 @@ export const ResponseInitChain = { if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; @@ -3699,15 +3699,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.index = message.index ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -3771,7 +3771,7 @@ export const ResponseBeginBlock = { if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -3914,18 +3914,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4067,18 +4067,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4164,13 +4164,13 @@ export const ResponseEndBlock = { if (message.validatorUpdates) { obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validator_updates = []; + obj.validator_updates = message.validatorUpdates; } obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4312,7 +4312,7 @@ export const ResponseListSnapshots = { if (message.snapshots) { obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); } else { - obj.snapshots = []; + obj.snapshots = message.snapshots; } return obj; }, @@ -4370,13 +4370,13 @@ export const ResponseOfferSnapshot = { fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = responseOfferSnapshot_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -4521,7 +4521,7 @@ export const ResponseApplySnapshotChunk = { fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); if (object.result !== undefined && object.result !== null) { - message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + message.result = object.result; } message.refetchChunks = object.refetch_chunks?.map(e => e) || []; message.rejectSenders = object.reject_senders?.map(e => e) || []; @@ -4529,16 +4529,16 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { - obj.refetch_chunks = []; + obj.refetch_chunks = message.refetchChunks; } if (message.rejectSenders) { obj.reject_senders = message.rejectSenders.map(e => e); } else { - obj.reject_senders = []; + obj.reject_senders = message.rejectSenders; } return obj; }, @@ -4797,11 +4797,11 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, @@ -4874,11 +4874,11 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -4966,7 +4966,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.index = message.index; + obj.index = message.index === false ? undefined : message.index; return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -5067,7 +5067,7 @@ export const TxResult = { toAmino(message: TxResult): TxResultAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -5302,7 +5302,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -5397,7 +5397,7 @@ export const Evidence = { fromAmino(object: EvidenceAmino): Evidence { const message = createBaseEvidence(); if (object.type !== undefined && object.type !== null) { - message.type = evidenceTypeFromJSON(object.type); + message.type = object.type; } if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); @@ -5415,7 +5415,7 @@ export const Evidence = { }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = evidenceTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; @@ -5529,8 +5529,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; return obj; diff --git a/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts index 47c7d7e27c..3e0f7f7f4c 100644 --- a/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts @@ -217,7 +217,7 @@ export const Proof = { if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); } else { - obj.aunts = []; + obj.aunts = message.aunts; } return obj; }, @@ -380,9 +380,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -467,7 +467,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -533,7 +533,7 @@ export const ProofOps = { if (message.ops) { obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); } else { - obj.ops = []; + obj.ops = message.ops; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts index 6e28f1d483..a3df52b35a 100644 --- a/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts @@ -89,7 +89,7 @@ export const BitArray = { if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { - obj.elems = []; + obj.elems = message.elems; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts b/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts index f4d7ea731f..b1287e0b6f 100644 --- a/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts @@ -351,12 +351,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = message.nodeId === "" ? undefined : message.nodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; - obj.moniker = message.moniker; + obj.moniker = message.moniker === "" ? undefined : message.moniker; obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -431,8 +431,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -515,11 +515,11 @@ export const PeerInfo = { }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { - obj.address_info = []; + obj.address_info = message.addressInfo; } obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; return obj; @@ -617,10 +617,10 @@ export const PeerAddressInfo = { }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; - obj.dial_failures = message.dialFailures; + obj.dial_failures = message.dialFailures === 0 ? undefined : message.dialFailures; return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts b/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts index 1b15528d9b..dfc1350bfb 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts @@ -400,7 +400,7 @@ export const LightClientAttackEvidence = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -467,7 +467,7 @@ export const EvidenceList = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/tendermint/types/params.ts b/__fixtures__/v-next/outputsign/tendermint/types/params.ts index cf21dae310..c3e3253935 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/params.ts @@ -578,7 +578,7 @@ export const ValidatorParams = { if (message.pubKeyTypes) { obj.pub_key_types = message.pubKeyTypes.map(e => e); } else { - obj.pub_key_types = []; + obj.pub_key_types = message.pubKeyTypes; } return obj; }, diff --git a/__fixtures__/v-next/outputsign/tendermint/types/types.ts b/__fixtures__/v-next/outputsign/tendermint/types/types.ts index 7929c94219..f3b89d682d 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/types.ts @@ -565,7 +565,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = message.total === 0 ? undefined : message.total; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, @@ -653,7 +653,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -945,7 +945,7 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; @@ -1021,7 +1021,7 @@ export const Data = { if (message.txs) { obj.txs = message.txs.map(e => base64FromBytes(e)); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, @@ -1139,7 +1139,7 @@ export const Vote = { fromAmino(object: VoteAmino): Vote { const message = createBaseVote(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1166,13 +1166,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; - obj.validator_index = message.validatorIndex; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -1272,12 +1272,12 @@ export const Commit = { toAmino(message: Commit): CommitAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1359,7 +1359,7 @@ export const CommitSig = { fromAmino(object: CommitSigAmino): CommitSig { const message = createBaseCommitSig(); if (object.block_id_flag !== undefined && object.block_id_flag !== null) { - message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + message.blockIdFlag = object.block_id_flag; } if (object.validator_address !== undefined && object.validator_address !== null) { message.validatorAddress = bytesFromBase64(object.validator_address); @@ -1374,7 +1374,7 @@ export const CommitSig = { }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; @@ -1486,7 +1486,7 @@ export const Proposal = { fromAmino(object: ProposalAmino): Proposal { const message = createBaseProposal(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1510,10 +1510,10 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; diff --git a/__fixtures__/v-next/outputsign/tendermint/types/validator.ts b/__fixtures__/v-next/outputsign/tendermint/types/validator.ts index 9958a56bbd..c5be185f38 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/validator.ts @@ -142,7 +142,7 @@ export const ValidatorSet = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; diff --git a/__fixtures__/v-next/outputsign/tendermint/version/types.ts b/__fixtures__/v-next/outputsign/tendermint/version/types.ts index ba686782f5..e260450ea1 100644 --- a/__fixtures__/v-next/outputsign/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/version/types.ts @@ -129,7 +129,7 @@ export const App = { toAmino(message: App): AppAmino { const obj: any = {}; obj.protocol = message.protocol ? message.protocol.toString() : undefined; - obj.software = message.software; + obj.software = message.software === "" ? undefined : message.software; return obj; }, fromAminoMsg(object: AppAminoMsg): App { diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts index 7cb567addc..f6b1eedc31 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts @@ -277,12 +277,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -402,12 +402,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -500,7 +500,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -614,12 +614,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -739,12 +739,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -929,12 +929,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts index dcb8ab847d..c0b24decea 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts @@ -277,12 +277,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -402,12 +402,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -500,7 +500,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -614,12 +614,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -739,12 +739,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -929,12 +929,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts index 8ae5dc1c8e..b806dca987 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts @@ -95,7 +95,7 @@ export const GenesisState = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts index b8fc7125eb..be3c67d14d 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -228,7 +228,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -328,8 +328,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); - obj.owner = omitDefault(message.owner); + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -514,7 +514,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -613,8 +613,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); - obj.owner = omitDefault(message.owner); + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -714,7 +714,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); + obj.auditor = message.auditor === "" ? undefined : message.auditor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts index 243f3b4e06..3af50b0a6c 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -172,8 +172,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -286,12 +286,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -398,11 +398,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts index 1f81398149..06eb8ae413 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/endpoint.ts @@ -114,13 +114,13 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } return message; }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); + obj.kind = message.kind === 0 ? undefined : message.kind; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts index 552725ebce..6a85b3b7f9 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts @@ -202,7 +202,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -309,11 +309,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -420,11 +420,11 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -571,7 +571,7 @@ export const ResourceUnits = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts index 091e7cf043..481ddc13bb 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -172,8 +172,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -286,12 +286,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -398,11 +398,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts index a25795060a..57b616fcbb 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts @@ -136,7 +136,7 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.sequence_number !== undefined && object.sequence_number !== null) { message.sequenceNumber = object.sequence_number; @@ -145,8 +145,8 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); - obj.sequence_number = message.sequenceNumber; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.sequence_number = message.sequenceNumber ?? 0; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts index 342718685c..48bfe0b37f 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts @@ -166,7 +166,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -273,11 +273,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -399,12 +399,12 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.name = message.name; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.name = message.name ?? ""; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts index 941481d78d..3897a7735d 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts @@ -171,12 +171,12 @@ export const ResourceUnits = { if (message.storage) { obj.storage = message.storage.map(e => e ? Storage.toAmino(e) : undefined); } else { - obj.storage = []; + obj.storage = message.storage; } if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts index 9a6091e7c0..904f2dfae7 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts @@ -271,8 +271,8 @@ export const CertificateID = { }, toAmino(message: CertificateID): CertificateIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateIDAminoMsg): CertificateID { @@ -373,7 +373,7 @@ export const Certificate = { fromAmino(object: CertificateAmino): Certificate { const message = createBaseCertificate(); if (object.state !== undefined && object.state !== null) { - message.state = certificate_StateFromJSON(object.state); + message.state = object.state; } if (object.cert !== undefined && object.cert !== null) { message.cert = bytesFromBase64(object.cert); @@ -385,9 +385,9 @@ export const Certificate = { }, toAmino(message: Certificate): CertificateAmino { const obj: any = {}; - obj.state = certificate_StateToJSON(message.state); - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.state = message.state ?? 0; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: CertificateAminoMsg): Certificate { @@ -500,9 +500,9 @@ export const CertificateFilter = { }, toAmino(message: CertificateFilter): CertificateFilterAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: CertificateFilterAminoMsg): CertificateFilter { @@ -615,9 +615,9 @@ export const MsgCreateCertificate = { }, toAmino(message: MsgCreateCertificate): MsgCreateCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.owner = message.owner ?? ""; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: MsgCreateCertificateAminoMsg): MsgCreateCertificate { @@ -767,7 +767,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : undefined; + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts index 4d48608458..0ef6e7e0d1 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts @@ -126,8 +126,8 @@ export const GenesisCertificate = { }, toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; + obj.owner = message.owner ?? ""; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { @@ -219,7 +219,7 @@ export const GenesisState = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts index 444986a501..c904a36c00 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts @@ -153,8 +153,8 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; - obj.serial = message.serial; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateResponseAminoMsg): CertificateResponse { @@ -366,7 +366,7 @@ export const QueryCertificatesResponse = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts index 9f402e93b2..76b2a42d40 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts @@ -108,7 +108,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts index a24a0affcd..106d6f7bc6 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts @@ -398,14 +398,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -572,8 +572,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -759,13 +759,13 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -915,7 +915,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1080,8 +1080,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1201,7 +1201,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -1213,9 +1213,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1331,9 +1331,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts index f66d9c07d5..031371ac51 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts @@ -137,11 +137,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -251,9 +251,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts index 070446960d..3ca58fd5f2 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsAmino, PlacementRequirement import { ResourceUnits, ResourceUnitsAmino, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -335,7 +335,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -485,7 +485,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -635,7 +635,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -815,9 +815,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { @@ -938,12 +938,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, @@ -1066,7 +1066,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -1078,10 +1078,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1198,9 +1198,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? Coin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts index f9bc595098..ac8f240e3c 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts @@ -88,7 +88,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts index 095a27ca6a..78bef69d4d 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts @@ -330,7 +330,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -540,11 +540,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts index d5ac37efb6..4416fdb3e9 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts @@ -108,7 +108,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts index 29a79b8ca6..fbe64b1778 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts @@ -202,8 +202,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -323,7 +323,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -335,9 +335,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -453,9 +453,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts index c7d45c01a2..c83e8edf99 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts @@ -299,15 +299,15 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; - obj.depositor = message.depositor; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -489,9 +489,9 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; - obj.depositor = message.depositor; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -656,8 +656,8 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -807,7 +807,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts index ac33d3e704..dc1a284ce8 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts @@ -137,11 +137,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -251,9 +251,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts index 832441cc1d..b9c3d5cb81 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDAmino, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -191,7 +191,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -203,10 +203,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts index 1e18d5cc8a..e37e23a986 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts @@ -123,9 +123,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts index c3239bc9ef..47efeed728 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts @@ -170,7 +170,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -320,7 +320,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -470,7 +470,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts index 7e78a68dfa..c86a85af30 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts @@ -131,12 +131,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts index 0dea1e669f..2c46b6fd3e 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts @@ -88,7 +88,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts index 50676f4e78..65933475d9 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts @@ -331,7 +331,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -541,11 +541,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts index 447adfed6e..0e80620fd0 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts @@ -127,9 +127,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts index f874e1d624..82656d4c02 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts @@ -119,12 +119,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts index 320c2eb36a..9813d28d32 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, Payment, PaymentAmino, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -242,10 +242,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -355,7 +355,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -517,11 +517,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -631,7 +631,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts index 6259e1819a..6622871352 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts @@ -287,8 +287,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -439,7 +439,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = Coin.fromAmino(object.balance); @@ -454,12 +454,12 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -625,7 +625,7 @@ export const Payment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = payment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = Coin.fromAmino(object.rate); @@ -640,13 +640,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = payment_StateToJSON(message.state); - obj.rate = message.rate ? Coin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts index 58a193ca15..0ac9339ec6 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts @@ -119,12 +119,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts index 63ff32879e..e64f5f1338 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountAmino, AccountSDKType, FractionalPayment, FractionalPaymentAmino, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -242,10 +242,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -355,7 +355,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -517,11 +517,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -631,7 +631,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts index 57bf67ca18..6f851a60be 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts @@ -311,8 +311,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -489,7 +489,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = DecCoin.fromAmino(object.balance); @@ -510,14 +510,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt; - obj.depositor = message.depositor; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; + obj.depositor = message.depositor ?? ""; + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -683,7 +683,7 @@ export const FractionalPayment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = fractionalPayment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = DecCoin.fromAmino(object.rate); @@ -698,13 +698,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = fractionalPayment_StateToJSON(message.state); - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts index 4d42e63441..de9610332e 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts @@ -88,7 +88,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts index 92699caf0f..945e563b43 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts @@ -140,9 +140,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); - obj.initial_inflation = padDecimal(message.initialInflation); - obj.variance = padDecimal(message.variance); + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor) ?? ""; + obj.initial_inflation = padDecimal(message.initialInflation) ?? ""; + obj.variance = padDecimal(message.variance) ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts index f72fa43fbf..f11740c177 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDAmino, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -356,10 +356,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : undefined; - obj.provider = message.provider; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.provider = message.provider ?? ""; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -509,7 +509,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -719,11 +719,11 @@ export const BidID = { }, toAmino(message: BidID): BidIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: BidIDAminoMsg): BidID { @@ -845,7 +845,7 @@ export const Bid = { message.bidId = BidID.fromAmino(object.bid_id); } if (object.state !== undefined && object.state !== null) { - message.state = bid_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -857,10 +857,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; - obj.state = bid_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -1020,12 +1020,12 @@ export const BidFilters = { }, toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: BidFiltersAminoMsg): BidFilters { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts index 625477c2c3..c8e064c164 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts @@ -141,14 +141,14 @@ export const GenesisState = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } if (message.leases) { obj.leases = message.leases.map(e => e ? Lease.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts index 8addd9be11..6c6bab64eb 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDAmino, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -379,11 +379,11 @@ export const LeaseID = { }, toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: LeaseIDAminoMsg): LeaseID { @@ -519,7 +519,7 @@ export const Lease = { message.leaseId = LeaseID.fromAmino(object.lease_id); } if (object.state !== undefined && object.state !== null) { - message.state = lease_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -534,11 +534,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; - obj.state = lease_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = omitDefault(message.createdAt); - obj.closed_on = omitDefault(message.closedOn); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -698,12 +698,12 @@ export const LeaseFilters = { }, toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: LeaseFiltersAminoMsg): LeaseFilters { @@ -788,7 +788,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -938,7 +938,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1088,7 +1088,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts index 5377b3893f..ff83d346f5 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecAmino, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -252,10 +252,10 @@ export const OrderID = { }, toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; return obj; }, fromAminoMsg(object: OrderIDAminoMsg): OrderID { @@ -377,7 +377,7 @@ export const Order = { message.orderId = OrderID.fromAmino(object.order_id); } if (object.state !== undefined && object.state !== null) { - message.state = order_StateFromJSON(object.state); + message.state = object.state; } if (object.spec !== undefined && object.spec !== null) { message.spec = GroupSpec.fromAmino(object.spec); @@ -389,10 +389,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; - obj.state = order_StateToJSON(message.state); - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.state = message.state ?? 0; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -537,11 +537,11 @@ export const OrderFilters = { }, toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: OrderFiltersAminoMsg): OrderFilters { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts index 04691f77a5..142dc403f4 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts @@ -106,8 +106,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : undefined; - obj.order_max_bids = message.orderMaxBids; + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts index 11b9d24da8..d841bbb5f7 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/query.ts @@ -463,7 +463,7 @@ export const QueryOrdersResponse = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -847,7 +847,7 @@ export const QueryBidsResponse = { if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toAmino(e) : undefined); } else { - obj.bids = []; + obj.bids = message.bids; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1249,7 +1249,7 @@ export const QueryLeasesResponse = { if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts index 63bbc9d130..987fba1577 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts @@ -253,8 +253,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -390,14 +390,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -598,14 +598,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -753,7 +753,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -954,14 +954,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts index 101c453585..6b6fb4bfd9 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts @@ -95,7 +95,7 @@ export const GenesisState = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts index 7e35e88034..f7536fad95 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts @@ -253,8 +253,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -390,14 +390,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -598,14 +598,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -753,7 +753,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -954,14 +954,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts index 4e23a2bc4f..eb1129dc1a 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -261,7 +261,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -346,7 +346,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputv2/confio/proofs.ts b/__fixtures__/v-next/outputv2/confio/proofs.ts index 6c6933e5fd..30b2b82f2f 100644 --- a/__fixtures__/v-next/outputv2/confio/proofs.ts +++ b/__fixtures__/v-next/outputv2/confio/proofs.ts @@ -877,7 +877,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1261,16 +1261,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1279,10 +1279,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1384,7 +1384,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1396,7 +1396,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1532,8 +1532,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1700,7 +1700,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1709,13 +1709,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { @@ -1807,7 +1807,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2024,12 +2024,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -2284,7 +2284,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts index a7c6d7f1ea..1c8ea49d93 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -177,7 +177,7 @@ export const Config = { if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e) : undefined); } else { - obj.modules = []; + obj.modules = message.modules; } return obj; }, @@ -285,7 +285,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts index b9e3ee3438..a9c5f92b9b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv2/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -314,16 +314,16 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = omitDefault(message.goImport); + obj.go_import = message.goImport === "" ? undefined : message.goImport; if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { - obj.use_package = []; + obj.use_package = message.usePackage; } if (message.canMigrateFrom) { obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); } else { - obj.can_migrate_from = []; + obj.can_migrate_from = message.canMigrateFrom; } return obj; }, @@ -429,8 +429,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.revision = omitDefault(message.revision); + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -520,7 +520,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = omitDefault(message.module); + obj.module = message.module === "" ? undefined : message.module; return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts index a282a7c0db..1355710673 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -222,10 +222,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = omitDefault(message.accountNumber); - obj.sequence = omitDefault(message.sequence); + obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -355,11 +355,11 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { - obj.permissions = []; + obj.permissions = message.permissions; } return obj; }, @@ -520,11 +520,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = omitDefault(message.maxMemoCharacters); - obj.tx_sig_limit = omitDefault(message.txSigLimit); - obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); - obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); - obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); + obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts index c6c7391881..88458f3aec 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/genesis.ts @@ -122,7 +122,7 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts index ddcfe6dc7d..a07f5ec83e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -497,7 +497,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? AccountI_ToAmino((e as Any)) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -589,7 +589,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -1016,7 +1016,7 @@ export const QueryModuleAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? ModuleAccountI_ToAmino((e as Any)) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, @@ -1179,7 +1179,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = omitDefault(message.bech32Prefix); + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1359,7 +1359,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1449,7 +1449,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { @@ -1574,7 +1574,7 @@ export const AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Bas return data; } }; -export const AccountI_FromAmino = (content: AnyAmino) => { +export const AccountI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BaseAccount": return Any.fromPartial({ @@ -1606,7 +1606,7 @@ export const ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const ModuleAccountI_FromAmino = (content: AnyAmino) => { +export const ModuleAccountI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ModuleAccount": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts index 069920c709..252bf3bcd1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/authz.ts @@ -218,7 +218,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -463,8 +463,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any)) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -565,7 +565,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, @@ -609,7 +609,7 @@ export const Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const Authorization_FromAmino = (content: AnyAmino) => { +export const Authorization_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts index 86cf59c44c..646ea1abe8 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/genesis.ts @@ -96,7 +96,7 @@ export const GenesisState = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts index 335d85c2f5..c06e9fbba1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType, GrantAuthorization, GrantAuthorizationAmino, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -279,9 +279,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -398,7 +398,7 @@ export const QueryGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -507,7 +507,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -624,7 +624,7 @@ export const QueryGranterGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -733,7 +733,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -850,7 +850,7 @@ export const QueryGranteeGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts index 125fe0c93a..f0113b683d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantAmino, GrantSDKType } from "./authz"; import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -271,8 +271,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -372,7 +372,7 @@ export const MsgExecResponse = { if (message.results) { obj.results = message.results.map(e => base64FromBytes(e)); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -484,11 +484,11 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Sdk_MsgauthzAuthorization_ToAmino((e as Any)) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -681,9 +681,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { @@ -788,7 +788,7 @@ export const Sdk_Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any return data; } }; -export const Sdk_Msg_FromAmino = (content: AnyAmino) => { +export const Sdk_Msg_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const Sdk_Msg_ToAmino = (content: Any) => { @@ -802,7 +802,7 @@ export const Authz_Authorization_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Authz_Authorization_FromAmino = (content: AnyAmino) => { +export const Authz_Authorization_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const Authz_Authorization_ToAmino = (content: Any) => { diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts index 4aa18d0bcc..ff6b5e2834 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/authz.ts @@ -114,7 +114,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts index cc07004b5a..ae07ab3b6f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -388,9 +388,9 @@ export const Params = { if (message.sendEnabled) { obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); } else { - obj.send_enabled = []; + obj.send_enabled = message.sendEnabled; } - obj.default_send_enabled = omitDefault(message.defaultSendEnabled); + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -495,8 +495,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.enabled = omitDefault(message.enabled); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -607,11 +607,11 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -723,11 +723,11 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -828,7 +828,7 @@ export const Supply = { if (message.total) { obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -955,12 +955,12 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.exponent = omitDefault(message.exponent); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } return obj; }, @@ -1162,18 +1162,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = omitDefault(message.description); + obj.description = message.description === "" ? undefined : message.description; if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { - obj.denom_units = []; + obj.denom_units = message.denomUnits; } - obj.base = omitDefault(message.base); - obj.display = omitDefault(message.display); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts index 258fac24b2..d80952dba4 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -216,17 +216,17 @@ export const GenesisState = { if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } if (message.denomMetadata) { obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.denom_metadata = []; + obj.denom_metadata = message.denomMetadata; } return obj; }, @@ -338,11 +338,11 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts index 9b8016cd94..bd0f83107b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -643,8 +643,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.denom = omitDefault(message.denom); + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -843,7 +843,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -960,7 +960,7 @@ export const QueryAllBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1069,7 +1069,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1186,7 +1186,7 @@ export const QuerySpendableBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1396,7 +1396,7 @@ export const QueryTotalSupplyResponse = { if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1488,7 +1488,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1952,7 +1952,7 @@ export const QueryDenomsMetadataResponse = { if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.metadatas = []; + obj.metadatas = message.metadatas; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2044,7 +2044,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -2243,7 +2243,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2351,7 +2351,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, @@ -2468,7 +2468,7 @@ export const QueryDenomOwnersResponse = { if (message.denomOwners) { obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); } else { - obj.denom_owners = []; + obj.denom_owners = message.denomOwners; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts index b254eb2c17..149b49a087 100644 --- a/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -181,12 +181,12 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -379,12 +379,12 @@ export const MsgMultiSend = { if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); } else { - obj.inputs = []; + obj.inputs = message.inputs; } if (message.outputs) { obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); } else { - obj.outputs = []; + obj.outputs = message.outputs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts index e7fd30a46e..2c49c0d6d1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts @@ -738,25 +738,25 @@ export const TxResponse = { toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -883,12 +883,12 @@ export const ABCIMessageLog = { }, toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; - obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -1000,11 +1000,11 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -1110,8 +1110,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1369,16 +1369,16 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1594,7 +1594,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1715,12 +1715,12 @@ export const TxMsgData = { if (message.data) { obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1910,7 +1910,7 @@ export const SearchTxsResult = { if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts index eb41056ffb..113f42438d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/kv/v1beta1/kv.ts @@ -118,7 +118,7 @@ export const Pairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts index 814f1a40ee..a5f7e2b642 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts @@ -304,8 +304,8 @@ export const PageRequest = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.offset = message.offset ? message.offset.toString() : undefined; obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts index 00dbb4feb1..ecf4b43bf3 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -243,7 +243,7 @@ export const ListAllInterfacesResponse = { if (message.interfaceNames) { obj.interface_names = message.interfaceNames.map(e => e); } else { - obj.interface_names = []; + obj.interface_names = message.interfaceNames; } return obj; }, @@ -334,7 +334,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = omitDefault(message.interfaceName); + obj.interface_name = message.interfaceName === "" ? undefined : message.interfaceName; return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { @@ -433,7 +433,7 @@ export const ListImplementationsResponse = { if (message.implementationMessageNames) { obj.implementation_message_names = message.implementationMessageNames.map(e => e); } else { - obj.implementation_message_names = []; + obj.implementation_message_names = message.implementationMessageNames; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts index ed1b2f8c89..a7961fac7f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -969,11 +969,11 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -1073,7 +1073,7 @@ export const AuthnDescriptor = { if (message.signModes) { obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); } else { - obj.sign_modes = []; + obj.sign_modes = message.signModes; } return obj; }, @@ -1194,9 +1194,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.number = omitDefault(message.number); - obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1286,7 +1286,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1385,7 +1385,7 @@ export const CodecDescriptor = { if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); } else { - obj.interfaces = []; + obj.interfaces = message.interfaces; } return obj; }, @@ -1518,16 +1518,16 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { - obj.interface_accepting_messages = []; + obj.interface_accepting_messages = message.interfaceAcceptingMessages; } if (message.interfaceImplementers) { obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); } else { - obj.interface_implementers = []; + obj.interface_implementers = message.interfaceImplementers; } return obj; }, @@ -1633,8 +1633,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.type_url = omitDefault(message.typeUrl); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1745,11 +1745,11 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { - obj.field_descriptor_names = []; + obj.field_descriptor_names = message.fieldDescriptorNames; } return obj; }, @@ -1840,7 +1840,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1930,7 +1930,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -3013,7 +3013,7 @@ export const QueryServicesDescriptor = { if (message.queryServices) { obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); } else { - obj.query_services = []; + obj.query_services = message.queryServices; } return obj; }, @@ -3140,12 +3140,12 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.is_module = omitDefault(message.isModule); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } return obj; }, @@ -3251,8 +3251,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.full_query_path = omitDefault(message.fullQueryPath); + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts index 914e7193ae..9528a9649d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -359,8 +359,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -461,7 +461,7 @@ export const Metadata = { if (message.chunkHashes) { obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); } else { - obj.chunk_hashes = []; + obj.chunk_hashes = message.chunkHashes; } return obj; }, @@ -734,7 +734,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -874,7 +874,7 @@ export const SnapshotIAVLItem = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.height = message.height === 0 ? undefined : message.height; return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -979,8 +979,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { @@ -1275,7 +1275,7 @@ export const SnapshotSchema = { if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e)); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts index fb2acf27c3..a383c3a9dc 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts @@ -189,7 +189,7 @@ export const CommitInfo = { if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { - obj.store_infos = []; + obj.store_infos = message.storeInfos; } return obj; }, @@ -297,7 +297,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts index da789df45b..a8165a08e2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/listening.ts @@ -162,8 +162,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts index f20819db93..09fb5e3091 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDAmino, BlockIDSDKType } from "../../../../tendermint/ty import { Block, BlockAmino, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoAmino, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -448,7 +448,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -579,11 +579,11 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = omitDefault(message.blockHeight); + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -807,11 +807,11 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = omitDefault(message.blockHeight); + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -954,10 +954,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); - obj.proposer_priority = omitDefault(message.proposerPriority); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1049,7 +1049,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1503,7 +1503,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = omitDefault(message.syncing); + obj.syncing = message.syncing === false ? undefined : message.syncing; return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1886,18 +1886,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.app_name = omitDefault(message.appName); - obj.version = omitDefault(message.version); - obj.git_commit = omitDefault(message.gitCommit); - obj.build_tags = omitDefault(message.buildTags); - obj.go_version = omitDefault(message.goVersion); + obj.name = message.name === "" ? undefined : message.name; + obj.app_name = message.appName === "" ? undefined : message.appName; + obj.version = message.version === "" ? undefined : message.version; + obj.git_commit = message.gitCommit === "" ? undefined : message.gitCommit; + obj.build_tags = message.buildTags === "" ? undefined : message.buildTags; + obj.go_version = message.goVersion === "" ? undefined : message.goVersion; if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { - obj.build_deps = []; + obj.build_deps = message.buildDeps; } - obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); + obj.cosmos_sdk_version = message.cosmosSdkVersion === "" ? undefined : message.cosmosSdkVersion; return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -2017,9 +2017,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.version = omitDefault(message.version); - obj.sum = omitDefault(message.sum); + obj.path = message.path === "" ? undefined : message.path; + obj.version = message.version === "" ? undefined : message.version; + obj.sum = message.sum === "" ? undefined : message.sum; return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts index 01140374b1..697e1f0067 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -197,8 +197,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -303,8 +303,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -394,7 +394,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = omitDefault(message.int); + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -484,7 +484,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = omitDefault(message.dec); + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts index 81c9e40411..246713ac57 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -158,7 +158,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -263,8 +263,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = omitDefault(message.module); - obj.name = omitDefault(message.name); + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { @@ -363,7 +363,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts index 974c0c433c..7e359de60d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersAmino, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -146,7 +146,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -260,11 +260,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts index 4cd0477946..ba83e22d96 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -136,9 +136,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.invariant_module_name = omitDefault(message.invariantModuleName); - obj.invariant_route = omitDefault(message.invariantRoute); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.invariant_module_name = message.invariantModuleName === "" ? undefined : message.invariantModuleName; + obj.invariant_route = message.invariantRoute === "" ? undefined : message.invariantRoute; return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts index 08bdc12ee9..50556b63b2 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -174,11 +174,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = omitDefault(message.purpose); - obj.coin_type = omitDefault(message.coinType); - obj.account = omitDefault(message.account); - obj.change = omitDefault(message.change); - obj.address_index = omitDefault(message.addressIndex); + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts index cf8dada9e0..1a571b0777 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsAmino, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -280,7 +280,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -393,7 +393,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = omitDefault(message.privKeyType); + obj.priv_key_type = message.privKeyType === "" ? undefined : message.privKeyType; return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts index 92965587f4..6a26baab97 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -123,11 +123,11 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = omitDefault(message.threshold); + obj.threshold = message.threshold === 0 ? undefined : message.threshold; if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.public_keys = []; + obj.public_keys = message.publicKeys; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts index 4cb8099005..dd2588a0c5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv2/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -145,7 +145,7 @@ export const MultiSignature = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -251,7 +251,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts index fbcbd8e3a2..f907a1956c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -536,10 +536,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = padDecimal(message.communityTax); - obj.base_proposer_reward = padDecimal(message.baseProposerReward); - obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); - obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); + obj.community_tax = padDecimal(message.communityTax) === "" ? undefined : padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward) === "" ? undefined : padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward) === "" ? undefined : padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -653,9 +653,9 @@ export const ValidatorHistoricalRewards = { if (message.cumulativeRewardRatio) { obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.cumulative_reward_ratio = []; + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; } - obj.reference_count = omitDefault(message.referenceCount); + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -771,9 +771,9 @@ export const ValidatorCurrentRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -872,7 +872,7 @@ export const ValidatorAccumulatedCommission = { if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.commission = []; + obj.commission = message.commission; } return obj; }, @@ -972,7 +972,7 @@ export const ValidatorOutstandingRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1080,8 +1080,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = omitDefault(message.validatorPeriod); - obj.fraction = padDecimal(message.fraction); + obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.fraction = padDecimal(message.fraction) === "" ? undefined : padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1180,7 +1180,7 @@ export const ValidatorSlashEvents = { if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, @@ -1280,7 +1280,7 @@ export const FeePool = { if (message.communityPool) { obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.community_pool = []; + obj.community_pool = message.communityPool; } return obj; }, @@ -1422,13 +1422,13 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1553,9 +1553,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = omitDefault(message.previousPeriod); - obj.stake = padDecimal(message.stake); - obj.height = message.height; + obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.stake = padDecimal(message.stake) === "" ? undefined : padDecimal(message.stake); + obj.height = message.height ? message.height.toString() : "0"; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1666,11 +1666,11 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.reward = []; + obj.reward = message.reward; } return obj; }, @@ -1821,11 +1821,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); - obj.amount = omitDefault(message.amount); - obj.deposit = omitDefault(message.deposit); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts index 7828f009aa..e9f64d1fed 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsAmino, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsAmino, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoAmino, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, Params, ParamsAmino, ParamsSDKType, FeePool, FeePoolAmino, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -389,8 +389,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -501,11 +501,11 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } return obj; }, @@ -613,7 +613,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -738,8 +738,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.period = omitDefault(message.period); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.period = message.period ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -847,7 +847,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -970,8 +970,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -1113,9 +1113,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.height = omitDefault(message.height); - obj.period = omitDefault(message.period); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.height = message.height ? message.height.toString() : undefined; + obj.period = message.period ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1392,38 +1392,38 @@ export const GenesisState = { if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); } else { - obj.delegator_withdraw_infos = []; + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; } - obj.previous_proposer = omitDefault(message.previousProposer); + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } if (message.validatorAccumulatedCommissions) { obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); } else { - obj.validator_accumulated_commissions = []; + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; } if (message.validatorHistoricalRewards) { obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_historical_rewards = []; + obj.validator_historical_rewards = message.validatorHistoricalRewards; } if (message.validatorCurrentRewards) { obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_current_rewards = []; + obj.validator_current_rewards = message.validatorCurrentRewards; } if (message.delegatorStartingInfos) { obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); } else { - obj.delegator_starting_infos = []; + obj.delegator_starting_infos = message.delegatorStartingInfos; } if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts index e36d5c8278..4d216d111c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Params, ParamsAmino, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsAmino, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionAmino, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventAmino, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardAmino, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -785,7 +785,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -967,7 +967,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1200,9 +1200,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.starting_height = omitDefault(message.startingHeight); - obj.ending_height = omitDefault(message.endingHeight); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1319,7 +1319,7 @@ export const QueryValidatorSlashesResponse = { if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.slashes = []; + obj.slashes = message.slashes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1426,8 +1426,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1526,7 +1526,7 @@ export const QueryDelegationRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1617,7 +1617,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1737,12 +1737,12 @@ export const QueryDelegationTotalRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } if (message.total) { obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -1833,7 +1833,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1932,7 +1932,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e); } else { - obj.validators = []; + obj.validators = message.validators; } return obj; }, @@ -2023,7 +2023,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -2113,7 +2113,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { @@ -2284,7 +2284,7 @@ export const QueryCommunityPoolResponse = { if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.pool = []; + obj.pool = message.pool; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts index 5e7219ec59..82d7617805 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -275,8 +275,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -453,8 +453,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -553,7 +553,7 @@ export const MsgWithdrawDelegatorRewardResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -644,7 +644,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -743,7 +743,7 @@ export const MsgWithdrawValidatorCommissionResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -858,9 +858,9 @@ export const MsgFundCommunityPool = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.depositor = omitDefault(message.depositor); + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts index 42c079fcca..04441d0f5d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts @@ -157,7 +157,7 @@ export const Equivocation = { obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts index 2bbef64430..09d7cfa980 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/genesis.ts @@ -98,7 +98,7 @@ export const GenesisState = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts index e7fc3e25b9..9911498135 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/query.ts @@ -479,7 +479,7 @@ export const QueryAllEvidenceResponse = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts index a4ec88c90c..ddd0f97855 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -141,7 +141,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = omitDefault(message.submitter); + obj.submitter = message.submitter === "" ? undefined : message.submitter; obj.evidence = message.evidence ? Evidence_ToAmino((message.evidence as Any)) : undefined; return obj; }, @@ -265,7 +265,7 @@ export const Evidence_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any return data; } }; -export const Evidence_FromAmino = (content: AnyAmino) => { +export const Evidence_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const Evidence_ToAmino = (content: Any) => { diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts index ed3d676a63..f30d36968c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/feegrant.ts @@ -281,7 +281,7 @@ export const BasicAllowance = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -455,12 +455,12 @@ export const PeriodicAllowance = { if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_spend_limit = []; + obj.period_spend_limit = message.periodSpendLimit; } if (message.periodCanSpend) { obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_can_spend = []; + obj.period_can_spend = message.periodCanSpend; } obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; return obj; @@ -580,7 +580,7 @@ export const AllowedMsgAllowance = { if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { - obj.allowed_messages = []; + obj.allowed_messages = message.allowedMessages; } return obj; }, @@ -703,8 +703,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, @@ -744,7 +744,7 @@ export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const FeeAllowanceI_FromAmino = (content: AnyAmino) => { +export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BasicAllowance": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts index 12b23b7660..2d2419cfdb 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/genesis.ts @@ -96,7 +96,7 @@ export const GenesisState = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts index 52eb5fde85..427f5f6676 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantAmino, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -236,8 +236,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -436,7 +436,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -553,7 +553,7 @@ export const QueryAllowancesResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -662,7 +662,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -779,7 +779,7 @@ export const QueryAllowancesByGranterResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts index ef61969a3a..fdd7d60fe3 100644 --- a/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/feegrant/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BasicAllowance, BasicAllowanceProtoMsg, BasicAllowanceSDKType, PeriodicAllowance, PeriodicAllowanceProtoMsg, PeriodicAllowanceSDKType, AllowedMsgAllowance, AllowedMsgAllowanceProtoMsg, AllowedMsgAllowanceSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -199,8 +199,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any)) : undefined; return obj; }, @@ -378,8 +378,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { @@ -490,7 +490,7 @@ export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const FeeAllowanceI_FromAmino = (content: AnyAmino) => { +export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BasicAllowance": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts index 0b307ccb46..08e077ac34 100644 --- a/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts @@ -97,7 +97,7 @@ export const GenesisState = { if (message.genTxs) { obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); } else { - obj.gen_txs = []; + obj.gen_txs = message.genTxs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts index 58fb1bc0c2..0eb4d12ad0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -235,21 +235,21 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts index bc16e31cc3..799adb5d32 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts @@ -495,7 +495,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -504,8 +504,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -634,11 +634,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -855,7 +855,7 @@ export const Proposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -884,20 +884,20 @@ export const Proposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -1032,10 +1032,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1179,13 +1179,13 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1301,7 +1301,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -1515,9 +1515,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts index 86eb6c0472..3bf8d0694f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts @@ -705,7 +705,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -720,9 +720,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -839,7 +839,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -949,7 +949,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1267,7 +1267,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1359,7 +1359,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1595,7 +1595,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1913,7 +1913,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts index ded53b828e..ce873832e9 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts @@ -377,15 +377,15 @@ export const MsgSubmitProposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? ProposalContentI_ToAmino((e as Any)) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -585,7 +585,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -785,7 +785,7 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -794,10 +794,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -1012,14 +1012,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1219,12 +1219,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1350,7 +1350,7 @@ export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Arr return data; } }; -export const ProposalContentI_FromAmino = (content: AnyAmino) => { +export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/v1/TextProposal": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts index 9b81d0d1aa..c53cb304c5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -235,21 +235,21 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts index 39b53cb0ef..8bed57b03a 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts @@ -9,7 +9,7 @@ import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSu import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -558,7 +558,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -567,8 +567,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -674,8 +674,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -804,11 +804,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1009,7 +1009,7 @@ export const Proposal = { message.content = ProposalContentI_FromAmino(object.content); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -1033,14 +1033,14 @@ export const Proposal = { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; @@ -1178,10 +1178,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1317,20 +1317,20 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; return message; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1447,7 +1447,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -1716,7 +1716,7 @@ export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Arr return data; } }; -export const ProposalContentI_FromAmino = (content: AnyAmino) => { +export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/TextProposal": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts index 10ef8b1180..981d890b48 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts @@ -705,7 +705,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -720,9 +720,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -839,7 +839,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -949,7 +949,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1267,7 +1267,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1359,7 +1359,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1595,7 +1595,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1913,7 +1913,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts index 45862cfc30..2601c12ef0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts @@ -318,9 +318,9 @@ export const MsgSubmitProposal = { if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -412,7 +412,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -528,15 +528,15 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -736,12 +736,12 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -942,12 +942,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1073,7 +1073,7 @@ export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Arr return data; } }; -export const ProposalContentI_FromAmino = (content: AnyAmino) => { +export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/TextProposal": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts index 51d60aa8d1..32cafd489f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts @@ -459,7 +459,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -549,7 +549,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -926,14 +926,14 @@ export const EventExec = { message.proposalId = BigInt(object.proposal_id); } if (object.result !== undefined && object.result !== null) { - message.result = proposalExecutorResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = proposalExecutorResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -1041,7 +1041,7 @@ export const EventLeaveGroup = { toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts index dba2bc9f75..4721972b81 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -283,33 +283,33 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = omitDefault(message.groupSeq); + obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } if (message.groupMembers) { obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.group_members = []; + obj.group_members = message.groupMembers; } - obj.group_policy_seq = omitDefault(message.groupPolicySeq); + obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } - obj.proposal_seq = omitDefault(message.proposalSeq); + obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts index eca8cde6c3..399210d791 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType, TallyResult, TallyResultAmino, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -727,7 +727,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -909,7 +909,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -1110,7 +1110,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1227,7 +1227,7 @@ export const QueryGroupMembersResponse = { if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1336,7 +1336,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1453,7 +1453,7 @@ export const QueryGroupsByAdminResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1564,7 +1564,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1681,7 +1681,7 @@ export const QueryGroupPoliciesByGroupResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1790,7 +1790,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1907,7 +1907,7 @@ export const QueryGroupPoliciesByAdminResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2001,7 +2001,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2200,7 +2200,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2317,7 +2317,7 @@ export const QueryProposalsByGroupPolicyResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2426,8 +2426,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); - obj.voter = omitDefault(message.voter); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2628,7 +2628,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2745,7 +2745,7 @@ export const QueryVotesByProposalResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2854,7 +2854,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = omitDefault(message.voter); + obj.voter = message.voter === "" ? undefined : message.voter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2971,7 +2971,7 @@ export const QueryVotesByVoterResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3080,7 +3080,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3197,7 +3197,7 @@ export const QueryGroupsByMemberResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3291,7 +3291,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts index cedd524867..fefec91f52 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts @@ -888,13 +888,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -1114,12 +1114,12 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.member_updates = []; + obj.member_updates = message.memberUpdates; } return obj; }, @@ -1314,9 +1314,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1510,9 +1510,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1723,9 +1723,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -1816,7 +1816,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1936,9 +1936,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -2111,15 +2111,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -2228,7 +2228,7 @@ export const MsgCreateGroupWithPolicyResponse = { toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2422,8 +2422,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; }, @@ -2616,9 +2616,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2846,25 +2846,25 @@ export const MsgSubmitProposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.exec = execToJSON(message.exec); + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -3064,7 +3064,7 @@ export const MsgWithdrawProposal = { toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -3276,23 +3276,23 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; - obj.exec = execToJSON(message.exec); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3472,7 +3472,7 @@ export const MsgExec = { toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3651,7 +3651,7 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, @@ -3761,7 +3761,7 @@ export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const DecisionPolicy_FromAmino = (content: AnyAmino) => { +export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ThresholdDecisionPolicy": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts index 93dfab7f3b..5c730f9f6c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts @@ -871,9 +871,9 @@ export const Member = { }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; return obj; }, @@ -973,7 +973,7 @@ export const Members = { if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } return obj; }, @@ -1082,7 +1082,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === "" ? undefined : message.threshold; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1191,7 +1191,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = message.percentage === "" ? undefined : message.percentage; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1472,10 +1472,10 @@ export const GroupInfo = { toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1772,10 +1772,10 @@ export const GroupPolicyInfo = { }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; @@ -2049,10 +2049,10 @@ export const Proposal = { message.groupPolicyVersion = BigInt(object.group_policy_version); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.result !== undefined && object.result !== null) { - message.result = proposalResultFromJSON(object.result); + message.result = object.result; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -2061,7 +2061,7 @@ export const Proposal = { message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); } if (object.executor_result !== undefined && object.executor_result !== null) { - message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; return message; @@ -2069,25 +2069,25 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = proposalStatusToJSON(message.status); - obj.result = proposalResultToJSON(message.result); + obj.status = message.status === 0 ? undefined : message.status; + obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; - obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -2223,10 +2223,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2366,7 +2366,7 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -2379,9 +2379,9 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; return obj; }, @@ -2419,7 +2419,7 @@ export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const DecisionPolicy_FromAmino = (content: AnyAmino) => { +export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ThresholdDecisionPolicy": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts index e893dcfc19..405094b8a5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -156,8 +156,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = padDecimal(message.inflation); - obj.annual_provisions = padDecimal(message.annualProvisions); + obj.inflation = padDecimal(message.inflation) === "" ? undefined : padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions) === "" ? undefined : padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -324,12 +324,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.inflation_rate_change = padDecimal(message.inflationRateChange); - obj.inflation_max = padDecimal(message.inflationMax); - obj.inflation_min = padDecimal(message.inflationMin); - obj.goal_bonded = padDecimal(message.goalBonded); - obj.blocks_per_year = omitDefault(message.blocksPerYear); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = padDecimal(message.inflationRateChange) === "" ? undefined : padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax) === "" ? undefined : padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin) === "" ? undefined : padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded) === "" ? undefined : padDecimal(message.goalBonded); + obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts index 737ac7a900..87a1bfcbb5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -192,10 +192,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -315,9 +315,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -437,9 +437,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts index dcf57602cf..1fd06cb742 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -149,12 +149,12 @@ export const GenesisState = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } if (message.entries) { obj.entries = message.entries.map(e => e ? Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -266,11 +266,11 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts index 61d2288dec..0fbb3d6486 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -253,12 +253,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.description = omitDefault(message.description); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.id = message.id === "" ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.description = message.description === "" ? undefined : message.description; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -411,10 +411,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts index 6b9893586a..c53827c0d7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTAmino, NFTSDKType, Class, ClassAmino, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -386,8 +386,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -479,7 +479,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = omitDefault(message.amount); + obj.amount = message.amount ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -584,8 +584,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -675,7 +675,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -765,7 +765,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -857,7 +857,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = omitDefault(message.amount); + obj.amount = message.amount ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -979,8 +979,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1097,7 +1097,7 @@ export const QueryNFTsResponse = { if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1204,8 +1204,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1387,7 +1387,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { @@ -1687,7 +1687,7 @@ export const QueryClassesResponse = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts index 1b5391cdca..1131b9985d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -162,10 +162,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts index 90f52af929..881a0aa78d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -335,9 +335,9 @@ export const TableDescriptor = { if (message.index) { obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e) : undefined); } else { - obj.index = []; + obj.index = message.index; } - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -442,8 +442,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.auto_increment = omitDefault(message.autoIncrement); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.auto_increment = message.autoIncrement === false ? undefined : message.autoIncrement; return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -563,9 +563,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.id = omitDefault(message.id); - obj.unique = omitDefault(message.unique); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.id = message.id === 0 ? undefined : message.id; + obj.unique = message.unique === false ? undefined : message.unique; return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -655,7 +655,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts index c0b58eb579..b207e23c77 100644 --- a/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv2/cosmos/orm/v1alpha1/schema.ts @@ -260,7 +260,7 @@ export const ModuleSchemaDescriptor = { if (message.schemaFile) { obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); } else { - obj.schema_file = []; + obj.schema_file = message.schemaFile; } obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; @@ -376,15 +376,15 @@ export const ModuleSchemaDescriptor_FileEntry = { message.protoFileName = object.proto_file_name; } if (object.storage_type !== undefined && object.storage_type !== null) { - message.storageType = storageTypeFromJSON(object.storage_type); + message.storageType = object.storage_type; } return message; }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = storageTypeToJSON(message.storageType); + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts index 132c6544de..3252c9cc13 100644 --- a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -163,12 +163,12 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { - obj.changes = []; + obj.changes = message.changes; } return obj; }, @@ -289,9 +289,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts index 70aa5df5d4..f5e99776c6 100644 --- a/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -215,8 +215,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -479,7 +479,7 @@ export const QuerySubspacesResponse = { if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); } else { - obj.subspaces = []; + obj.subspaces = message.subspaces; } return obj; }, @@ -591,11 +591,11 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); + obj.subspace = message.subspace === "" ? undefined : message.subspace; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts index 4925db445c..37699ead0c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -249,12 +249,12 @@ export const GenesisState = { if (message.signingInfos) { obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e) : undefined); } else { - obj.signing_infos = []; + obj.signing_infos = message.signingInfos; } if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -362,7 +362,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -474,11 +474,11 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -586,8 +586,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = omitDefault(message.index); - obj.missed = omitDefault(message.missed); + obj.index = message.index ? message.index.toString() : undefined; + obj.missed = message.missed === false ? undefined : message.missed; return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts index ef01007f06..34634c28ff 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -391,7 +391,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = omitDefault(message.consAddress); + obj.cons_address = message.consAddress === "" ? undefined : message.consAddress; return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { @@ -691,7 +691,7 @@ export const QuerySigningInfosResponse = { if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e) : undefined); } else { - obj.info = []; + obj.info = message.info; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts index 123d8a917d..3cb713495c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts @@ -255,11 +255,11 @@ export const ValidatorSigningInfo = { }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; - obj.tombstoned = message.tombstoned; + obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts index 23f326c34b..5c277423db 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts @@ -100,7 +100,7 @@ export const MsgUnjail = { }, toAmino(message: MsgUnjail): MsgUnjailAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr ?? ""; return obj; }, fromAminoMsg(object: MsgUnjailAminoMsg): MsgUnjail { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts index 4b1d4c4fd5..2898e30cf5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/authz.ts @@ -249,7 +249,7 @@ export const StakeAuthorization = { message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); } if (object.authorization_type !== undefined && object.authorization_type !== null) { - message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + message.authorizationType = object.authorization_type; } return message; }, @@ -258,7 +258,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { @@ -357,7 +357,7 @@ export const StakeAuthorization_Validators = { if (message.address) { obj.address = message.address.map(e => e); } else { - obj.address = []; + obj.address = message.address; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts index 17d4d273ed..612e2fc449 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -303,29 +303,29 @@ export const GenesisState = { if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); } else { - obj.last_validator_powers = []; + obj.last_validator_powers = message.lastValidatorPowers; } if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } if (message.delegations) { obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); } else { - obj.delegations = []; + obj.delegations = message.delegations; } if (message.unbondingDelegations) { obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_delegations = []; + obj.unbonding_delegations = message.unbondingDelegations; } if (message.redelegations) { obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); } else { - obj.redelegations = []; + obj.redelegations = message.redelegations; } - obj.exported = omitDefault(message.exported); + obj.exported = message.exported === false ? undefined : message.exported; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -432,8 +432,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.power = omitDefault(message.power); + obj.address = message.address === "" ? undefined : message.address; + obj.power = message.power ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts index 4ade49bce9..cd40db820c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorAmino, ValidatorSDKType, DelegationResponse, DelegationResponseAmino, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseAmino, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoAmino, HistoricalInfoSDKType, Pool, PoolAmino, PoolSDKType, Params, ParamsAmino, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -934,7 +934,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = omitDefault(message.status); + obj.status = message.status === "" ? undefined : message.status; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1051,7 +1051,7 @@ export const QueryValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1143,7 +1143,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1342,7 +1342,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1459,7 +1459,7 @@ export const QueryValidatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1568,7 +1568,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1685,7 +1685,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1792,8 +1792,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1990,8 +1990,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -2190,7 +2190,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2307,7 +2307,7 @@ export const QueryDelegatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2416,7 +2416,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2533,7 +2533,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2672,9 +2672,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.src_validator_addr = omitDefault(message.srcValidatorAddr); - obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2791,7 +2791,7 @@ export const QueryRedelegationsResponse = { if (message.redelegationResponses) { obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); } else { - obj.redelegation_responses = []; + obj.redelegation_responses = message.redelegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2900,7 +2900,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3017,7 +3017,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3124,8 +3124,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -3309,7 +3309,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts index fecd08353f..0e9f11a569 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Pubkey } from "@cosmjs/amino"; @@ -922,7 +922,7 @@ export const HistoricalInfo = { if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.valset = []; + obj.valset = message.valset; } return obj; }, @@ -1043,9 +1043,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate) === "" ? undefined : padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate) === "" ? undefined : padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate) === "" ? undefined : padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1303,11 +1303,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1528,7 +1528,7 @@ export const Validator = { message.jailed = object.jailed; } if (object.status !== undefined && object.status !== null) { - message.status = bondStatusFromJSON(object.status); + message.status = object.status; } if (object.tokens !== undefined && object.tokens !== null) { message.tokens = object.tokens; @@ -1555,17 +1555,17 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = bondStatusToJSON(message.status); - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = padDecimal(message.delegatorShares) === "" ? undefined : padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1664,7 +1664,7 @@ export const ValAddresses = { if (message.addresses) { obj.addresses = message.addresses.map(e => e); } else { - obj.addresses = []; + obj.addresses = message.addresses; } return obj; }, @@ -1770,8 +1770,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1870,7 +1870,7 @@ export const DVPairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, @@ -1991,9 +1991,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -2092,7 +2092,7 @@ export const DVVTriplets = { if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); } else { - obj.triplets = []; + obj.triplets = message.triplets; } return obj; }, @@ -2213,9 +2213,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2341,12 +2341,12 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2486,8 +2486,8 @@ export const UnbondingDelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2626,8 +2626,8 @@ export const RedelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = padDecimal(message.sharesDst) === "" ? undefined : padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2768,13 +2768,13 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2943,11 +2943,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = padDecimal(message.minCommissionRate) === "" ? undefined : padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -3165,7 +3165,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { @@ -3282,7 +3282,7 @@ export const RedelegationResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -3388,8 +3388,8 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.not_bonded_tokens = message.notBondedTokens; - obj.bonded_tokens = message.bondedTokens; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { @@ -3422,7 +3422,7 @@ export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => { +export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { return encodePubkey(content); }; export const Cosmos_cryptoPubKey_ToAmino = (content: Any): Pubkey | null => { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts index 7b33e51ec3..27000cfa2b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; import { Pubkey } from "@cosmjs/amino"; @@ -445,9 +445,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -659,9 +659,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = padDecimal(message.commissionRate) === "" ? undefined : padDecimal(message.commissionRate); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -855,8 +855,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1066,9 +1066,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1281,8 +1281,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1406,7 +1406,7 @@ export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => { +export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { return encodePubkey(content); }; export const Cosmos_cryptoPubKey_ToAmino = (content: Any): Pubkey | null => { diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts index 7d3a3af5a9..27059952ee 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts @@ -318,7 +318,7 @@ export const SignatureDescriptors = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -653,7 +653,7 @@ export const SignatureDescriptor_Data_Single = { fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); @@ -662,7 +662,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -780,7 +780,7 @@ export const SignatureDescriptor_Data_Multi = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts index c680d960ce..93665043e9 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts @@ -582,7 +582,7 @@ export const GetTxsEventRequest = { message.pagination = PageRequest.fromAmino(object.pagination); } if (object.order_by !== undefined && object.order_by !== null) { - message.orderBy = orderByFromJSON(object.order_by); + message.orderBy = object.order_by; } return message; }, @@ -591,10 +591,10 @@ export const GetTxsEventRequest = { if (message.events) { obj.events = message.events.map(e => e); } else { - obj.events = []; + obj.events = message.events; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = orderByToJSON(message.orderBy); + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -731,12 +731,12 @@ export const GetTxsEventResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } if (message.txResponses) { obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.tx_responses = []; + obj.tx_responses = message.txResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -837,14 +837,14 @@ export const BroadcastTxRequest = { message.txBytes = bytesFromBase64(object.tx_bytes); } if (object.mode !== undefined && object.mode !== null) { - message.mode = broadcastModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; - obj.mode = broadcastModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1244,7 +1244,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1614,7 +1614,7 @@ export const GetBlockWithTxsResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.block = message.block ? Block.toAmino(message.block) : undefined; diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts index 93d84b071e..508c77d764 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts @@ -868,7 +868,7 @@ export const Tx = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1000,7 +1000,7 @@ export const TxRaw = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1140,7 +1140,7 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; return obj; }, @@ -1316,7 +1316,7 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1492,19 +1492,19 @@ export const TxBody = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extension_options = []; + obj.extension_options = message.extensionOptions; } if (message.nonCriticalExtensionOptions) { obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.non_critical_extension_options = []; + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; } return obj; }, @@ -1638,7 +1638,7 @@ export const AuthInfo = { if (message.signerInfos) { obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); } else { - obj.signer_infos = []; + obj.signer_infos = message.signerInfos; } obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1963,13 +1963,13 @@ export const ModeInfo_Single = { fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { const message = createBaseModeInfo_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -2086,7 +2086,7 @@ export const ModeInfo_Multi = { if (message.modeInfos) { obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); } else { - obj.mode_infos = []; + obj.mode_infos = message.modeInfos; } return obj; }, @@ -2233,11 +2233,11 @@ export const Fee = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -2351,9 +2351,9 @@ export const Tip = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.tipper = message.tipper; + obj.tipper = message.tipper === "" ? undefined : message.tipper; return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2481,7 +2481,7 @@ export const AuxSignerData = { message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -2490,9 +2490,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts index 946986b1cd..042744cebb 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -561,7 +561,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -653,7 +653,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -745,7 +745,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = omitDefault(message.lastHeight); + obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -925,7 +925,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = omitDefault(message.moduleName); + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -1024,7 +1024,7 @@ export const QueryModuleVersionsResponse = { if (message.moduleVersions) { obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); } else { - obj.module_versions = []; + obj.module_versions = message.moduleVersions; } return obj; }, @@ -1187,7 +1187,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts index 4b81497aff..f85558ee4b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -209,7 +209,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = omitDefault(message.authority); + obj.authority = message.authority === "" ? undefined : message.authority; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -372,7 +372,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = omitDefault(message.authority); + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts index 2daeaf336d..66b23c50cb 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts @@ -348,10 +348,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -474,8 +474,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -581,8 +581,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -689,7 +689,7 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.version = message.version ? message.version.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts index aebdf183db..b8f7636a3c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -301,15 +301,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.end_time = omitDefault(message.endTime); - obj.delayed = omitDefault(message.delayed); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -507,12 +507,12 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -728,13 +728,13 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); - obj.start_time = omitDefault(message.startTime); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts index dca8155368..6ee2200030 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountAmino, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -355,19 +355,19 @@ export const BaseVestingAccount = { if (message.originalVesting) { obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.original_vesting = []; + obj.original_vesting = message.originalVesting; } if (message.delegatedFree) { obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_free = []; + obj.delegated_free = message.delegatedFree; } if (message.delegatedVesting) { obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_vesting = []; + obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = omitDefault(message.endTime); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -477,7 +477,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = omitDefault(message.startTime); + obj.start_time = message.startTime ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -682,11 +682,11 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = omitDefault(message.length); + obj.length = message.length ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -818,11 +818,11 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = omitDefault(message.startTime); + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts index c6d22058d9..1d551b4f57 100644 --- a/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv2/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, omitDefault } from "../helpers"; +import { isSet, DeepPartial } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -254,8 +254,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -378,17 +378,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts index 88658333ef..9ee2053442 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts @@ -305,22 +305,22 @@ export const GenesisState = { if (message.codes) { obj.codes = message.codes.map(e => e ? Code.toAmino(e) : undefined); } else { - obj.codes = []; + obj.codes = message.codes; } if (message.contracts) { obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e) : undefined); } else { - obj.contracts = []; + obj.contracts = message.contracts; } if (message.sequences) { obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e) : undefined); } else { - obj.sequences = []; + obj.sequences = message.sequences; } if (message.genMsgs) { obj.gen_msgs = message.genMsgs.map(e => e ? GenesisState_GenMsgs.toAmino(e) : undefined); } else { - obj.gen_msgs = []; + obj.gen_msgs = message.genMsgs; } return obj; }, @@ -591,7 +591,7 @@ export const Code = { obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; - obj.pinned = message.pinned; + obj.pinned = message.pinned === false ? undefined : message.pinned; return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -719,12 +719,12 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.contract_state = []; + obj.contract_state = message.contractState; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts index f2f9145dd0..4fdabff2bc 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts @@ -190,7 +190,7 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -283,7 +283,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts index 6f134fa30d..dfab50cdb1 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -534,9 +534,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -741,17 +741,17 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.admin = omitDefault(message.admin); - obj.code_id = omitDefault(message.codeId); - obj.label = omitDefault(message.label); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -904,10 +904,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); - obj.code_id = omitDefault(message.codeId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1043,9 +1043,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1217,15 +1217,15 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1361,10 +1361,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.new_admin = omitDefault(message.newAdmin); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1484,9 +1484,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1621,12 +1621,12 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -1762,12 +1762,12 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts index 1834ffee49..e7fa7e5a3a 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts @@ -665,7 +665,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -772,7 +772,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -880,7 +880,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -997,7 +997,7 @@ export const QueryContractHistoryResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1225,7 +1225,7 @@ export const QueryContractsByCodeResponse = { if (message.contracts) { obj.contracts = message.contracts.map(e => e); } else { - obj.contracts = []; + obj.contracts = message.contracts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1334,7 +1334,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1451,7 +1451,7 @@ export const QueryAllContractStateResponse = { if (message.models) { obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.models = []; + obj.models = message.models; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1558,7 +1558,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1754,7 +1754,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -2059,8 +2059,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; return obj; }, @@ -2169,7 +2169,7 @@ export const QueryCodeResponse = { toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { const obj: any = {}; obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; - obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; return obj; }, fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { @@ -2377,7 +2377,7 @@ export const QueryCodesResponse = { if (message.codeInfos) { obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); } else { - obj.code_infos = []; + obj.code_infos = message.codeInfos; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2596,7 +2596,7 @@ export const QueryPinnedCodesResponse = { if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts index bf8348d70a..a0490fa54b 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts @@ -455,7 +455,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -722,15 +722,15 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -836,7 +836,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -978,13 +978,13 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1212,8 +1212,8 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1425,9 +1425,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1604,8 +1604,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts index 0a613f055f..1519313810 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts @@ -434,13 +434,13 @@ export const AccessTypeParam = { fromAmino(object: AccessTypeParamAmino): AccessTypeParam { const message = createBaseAccessTypeParam(); if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); + message.value = object.value; } return message; }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = accessTypeToJSON(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -536,7 +536,7 @@ export const AccessConfig = { fromAmino(object: AccessConfigAmino): AccessConfig { const message = createBaseAccessConfig(); if (object.permission !== undefined && object.permission !== null) { - message.permission = accessTypeFromJSON(object.permission); + message.permission = object.permission; } if (object.address !== undefined && object.address !== null) { message.address = object.address; @@ -545,8 +545,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = accessTypeToJSON(message.permission); - obj.address = message.address; + obj.permission = message.permission === 0 ? undefined : message.permission; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -661,7 +661,7 @@ export const Params = { message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); } if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { - message.instantiateDefaultPermission = accessTypeFromJSON(object.instantiate_default_permission); + message.instantiateDefaultPermission = object.instantiate_default_permission; } if (object.max_wasm_code_size !== undefined && object.max_wasm_code_size !== null) { message.maxWasmCodeSize = BigInt(object.max_wasm_code_size); @@ -671,7 +671,7 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = accessTypeToJSON(message.instantiateDefaultPermission); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; return obj; }, @@ -795,7 +795,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -983,11 +983,11 @@ export const ContractInfo = { toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; obj.extension = message.extension ? ContractInfoExtension_ToAmino((message.extension as Any)) : undefined; return obj; }, @@ -1112,7 +1112,7 @@ export const ContractCodeHistoryEntry = { fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); if (object.operation !== undefined && object.operation !== null) { - message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + message.operation = object.operation; } if (object.code_id !== undefined && object.code_id !== null) { message.codeId = BigInt(object.code_id); @@ -1127,7 +1127,7 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + obj.operation = message.operation === 0 ? undefined : message.operation; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; @@ -1379,7 +1379,7 @@ export const ContractInfoExtension_InterfaceDecoder = (input: BinaryReader | Uin return data; } }; -export const ContractInfoExtension_FromAmino = (content: AnyAmino) => { +export const ContractInfoExtension_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const ContractInfoExtension_ToAmino = (content: Any) => { diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts index 14df9856f2..3b791f66b4 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/claims.ts @@ -248,7 +248,7 @@ export const Claim = { fromAmino(object: ClaimAmino): Claim { const message = createBaseClaim(); if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } if (object.completed !== undefined && object.completed !== null) { message.completed = object.completed; @@ -260,9 +260,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = actionToJSON(message.action); - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = message.action === 0 ? undefined : message.action; + obj.completed = message.completed === false ? undefined : message.completed; + obj.claimable_amount = message.claimableAmount === "" ? undefined : message.claimableAmount; return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -390,12 +390,12 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = message.address === "" ? undefined : message.address; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, @@ -509,11 +509,11 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts index 0ae3f2ff4e..9586e49a7e 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/genesis.ts @@ -180,7 +180,7 @@ export const GenesisState = { if (message.claimsRecords) { obj.claims_records = message.claimsRecords.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims_records = []; + obj.claims_records = message.claimsRecords; } return obj; }, @@ -370,20 +370,20 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = message.enableClaims === false ? undefined : message.enableClaims; obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = message.claimsDenom === "" ? undefined : message.claimsDenom; if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { - obj.authorized_channels = []; + obj.authorized_channels = message.authorizedChannels; } if (message.evmChannels) { obj.evm_channels = message.evmChannels.map(e => e); } else { - obj.evm_channels = []; + obj.evm_channels = message.evmChannels; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts index 98bebf679d..ab3b4a0e62 100644 --- a/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKType, Claim, ClaimAmino, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -367,7 +367,7 @@ export const QueryTotalUnclaimedResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -712,7 +712,7 @@ export const QueryClaimsRecordsResponse = { if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -797,7 +797,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -901,11 +901,11 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts index d8e6f58c9a..6721b8a7f2 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts @@ -218,12 +218,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -316,7 +316,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts index c4dd54f0e0..3115ba5a89 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; @@ -249,7 +249,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -334,7 +334,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -419,7 +419,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts index 62fc8b7c6f..20cb294eb0 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/erc20.ts @@ -322,16 +322,16 @@ export const TokenPair = { message.enabled = object.enabled; } if (object.contract_owner !== undefined && object.contract_owner !== null) { - message.contractOwner = ownerFromJSON(object.contract_owner); + message.contractOwner = object.contract_owner; } return message; }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = ownerToJSON(message.contractOwner); + obj.erc20_address = message.erc20Address === "" ? undefined : message.erc20Address; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.contract_owner = message.contractOwner === 0 ? undefined : message.contractOwner; return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -446,8 +446,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -561,9 +561,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.erc20address = message.erc20address === "" ? undefined : message.erc20address; return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -676,9 +676,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts index cef7aa6af5..107a248a43 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -155,7 +155,7 @@ export const GenesisState = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } return obj; }, @@ -254,8 +254,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = omitDefault(message.enableErc20); - obj.enable_evm_hook = omitDefault(message.enableEvmHook); + obj.enable_erc20 = message.enableErc20 === false ? undefined : message.enableErc20; + obj.enable_evm_hook = message.enableEvmHook === false ? undefined : message.enableEvmHook; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts index 340e535e7b..aa118c5437 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -344,7 +344,7 @@ export const QueryTokenPairsResponse = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -429,7 +429,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = omitDefault(message.token); + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts index 8463488e0f..9554d5e0d9 100644 --- a/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -211,8 +211,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = omitDefault(message.receiver); - obj.sender = omitDefault(message.sender); + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -405,10 +405,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.amount = omitDefault(message.amount); - obj.receiver = omitDefault(message.receiver); - obj.sender = omitDefault(message.sender); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts index dc55d4a782..6e2cd57f25 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -142,9 +142,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts index b5d8b54d5a..b62f791121 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -181,7 +181,7 @@ export const GenesisState = { if (message.devFeeInfos) { obj.dev_fee_infos = message.devFeeInfos.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.dev_fee_infos = []; + obj.dev_fee_infos = message.devFeeInfos; } return obj; }, @@ -327,11 +327,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = omitDefault(message.enableFees); - obj.developer_shares = padDecimal(message.developerShares); - obj.validator_shares = padDecimal(message.validatorShares); - obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); - obj.min_gas_price = padDecimal(message.minGasPrice); + obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; + obj.developer_shares = padDecimal(message.developerShares) === "" ? undefined : padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares) === "" ? undefined : padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.min_gas_price = padDecimal(message.minGasPrice) === "" ? undefined : padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts index d826814d4f..1874097e0b 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -417,7 +417,7 @@ export const QueryDevFeeInfosResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -502,7 +502,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -837,7 +837,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = omitDefault(message.deployerAddress); + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -947,7 +947,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts index 41bd959089..84b4c6d85a 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -304,13 +304,13 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -474,8 +474,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -653,9 +653,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts index c4786e079c..78caef45da 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -184,12 +184,12 @@ export const GenesisState = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } return obj; }, @@ -318,10 +318,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = omitDefault(message.enableIncentives); - obj.allocation_limit = padDecimal(message.allocationLimit); - obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); - obj.reward_scaler = padDecimal(message.rewardScaler); + obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; + obj.allocation_limit = padDecimal(message.allocationLimit) === "" ? undefined : padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; + obj.reward_scaler = padDecimal(message.rewardScaler) === "" ? undefined : padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts index ce0e501365..59f3cad183 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts @@ -294,13 +294,13 @@ export const Incentive = { }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; return obj; @@ -417,8 +417,8 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; return obj; }, @@ -569,15 +569,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -690,9 +690,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts index 663fff1b3f..903fc6880f 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, G import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -598,7 +598,7 @@ export const QueryIncentivesResponse = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -683,7 +683,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -868,7 +868,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); + obj.contract = message.contract === "" ? undefined : message.contract; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -978,7 +978,7 @@ export const QueryGasMetersResponse = { if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1078,8 +1078,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); - obj.participant = omitDefault(message.participant); + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1164,7 +1164,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = omitDefault(message.gasMeter); + obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1358,7 +1358,7 @@ export const QueryAllocationMetersResponse = { if (message.allocationMeters) { obj.allocation_meters = message.allocationMeters.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocation_meters = []; + obj.allocation_meters = message.allocationMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1443,7 +1443,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts index a1d74e7931..86b8d82096 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationAmino, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionAmino, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -214,10 +214,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = omitDefault(message.period); - obj.epoch_identifier = omitDefault(message.epochIdentifier); - obj.epochs_per_period = omitDefault(message.epochsPerPeriod); - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.period = message.period ? message.period.toString() : undefined; + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; + obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -349,10 +349,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = omitDefault(message.enableInflation); + obj.enable_inflation = message.enableInflation === false ? undefined : message.enableInflation; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts index f5e2065944..065731a68a 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/inflation.ts @@ -230,9 +230,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = padDecimal(message.stakingRewards); - obj.usage_incentives = padDecimal(message.usageIncentives); - obj.community_pool = padDecimal(message.communityPool); + obj.staking_rewards = padDecimal(message.stakingRewards) === "" ? undefined : padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives) === "" ? undefined : padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -375,11 +375,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = padDecimal(message.a); - obj.r = padDecimal(message.r); - obj.c = padDecimal(message.c); - obj.bonding_target = padDecimal(message.bondingTarget); - obj.max_variance = padDecimal(message.maxVariance); + obj.a = padDecimal(message.a) === "" ? undefined : padDecimal(message.a); + obj.r = padDecimal(message.r) === "" ? undefined : padDecimal(message.r); + obj.c = padDecimal(message.c) === "" ? undefined : padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget) === "" ? undefined : padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance) === "" ? undefined : padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts index 9e8a9de419..38d8bf1b66 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -423,7 +423,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -723,7 +723,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -1021,7 +1021,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = padDecimal(message.inflationRate); + obj.inflation_rate = padDecimal(message.inflationRate) === "" ? undefined : padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts index fe60a140f9..b33780129c 100644 --- a/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -217,7 +217,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = omitDefault(message.enableRecovery); + obj.enable_recovery = message.enableRecovery === false ? undefined : message.enableRecovery; obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts index b44967130d..29121d546c 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -129,7 +129,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { @@ -263,17 +263,17 @@ export const QueryBalancesResponse = { if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.locked = []; + obj.locked = message.locked; } if (message.unvested) { obj.unvested = message.unvested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.unvested = []; + obj.unvested = message.unvested; } if (message.vested) { obj.vested = message.vested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.vested = []; + obj.vested = message.vested; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts index b30d093b68..1b1289e8de 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/tx.ts @@ -305,20 +305,20 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } - obj.merge = message.merge; + obj.merge = message.merge === false ? undefined : message.merge; return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -496,9 +496,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + obj.dest_address = message.destAddress === "" ? undefined : message.destAddress; return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts index ff06859150..adc9dd265f 100644 --- a/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv2/evmos/vesting/v1/vesting.ts @@ -205,17 +205,17 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/auth.ts b/__fixtures__/v-next/outputv2/google/api/auth.ts index 6e95631c8f..1c884a5e4b 100644 --- a/__fixtures__/v-next/outputv2/google/api/auth.ts +++ b/__fixtures__/v-next/outputv2/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -685,12 +685,12 @@ export const Authentication = { if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } if (message.providers) { obj.providers = message.providers.map(e => e ? AuthProvider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, @@ -827,13 +827,13 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = omitDefault(message.allowWithoutCredential); + obj.allow_without_credential = message.allowWithoutCredential === false ? undefined : message.allowWithoutCredential; if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { - obj.requirements = []; + obj.requirements = message.requirements; } return obj; }, @@ -947,9 +947,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = omitDefault(message.header); - obj.query = omitDefault(message.query); - obj.value_prefix = omitDefault(message.valuePrefix); + obj.header = message.header === null ? undefined : message.header; + obj.query = message.query === null ? undefined : message.query; + obj.value_prefix = message.valuePrefix === "" ? undefined : message.valuePrefix; return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -1113,15 +1113,15 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.issuer = omitDefault(message.issuer); - obj.jwks_uri = omitDefault(message.jwksUri); - obj.audiences = omitDefault(message.audiences); - obj.authorization_url = omitDefault(message.authorizationUrl); + obj.id = message.id === "" ? undefined : message.id; + obj.issuer = message.issuer === "" ? undefined : message.issuer; + obj.jwks_uri = message.jwksUri === "" ? undefined : message.jwksUri; + obj.audiences = message.audiences === "" ? undefined : message.audiences; + obj.authorization_url = message.authorizationUrl === "" ? undefined : message.authorizationUrl; if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { - obj.jwt_locations = []; + obj.jwt_locations = message.jwtLocations; } return obj; }, @@ -1205,7 +1205,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = omitDefault(message.canonicalScopes); + obj.canonical_scopes = message.canonicalScopes === "" ? undefined : message.canonicalScopes; return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1303,8 +1303,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = omitDefault(message.providerId); - obj.audiences = omitDefault(message.audiences); + obj.provider_id = message.providerId === "" ? undefined : message.providerId; + obj.audiences = message.audiences === "" ? undefined : message.audiences; return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputv2/google/api/backend.ts b/__fixtures__/v-next/outputv2/google/api/backend.ts index 0f1dfd6136..a224ddfaaa 100644 --- a/__fixtures__/v-next/outputv2/google/api/backend.ts +++ b/__fixtures__/v-next/outputv2/google/api/backend.ts @@ -387,7 +387,7 @@ export const Backend = { if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -576,7 +576,7 @@ export const BackendRule = { message.operationDeadline = object.operation_deadline; } if (object.path_translation !== undefined && object.path_translation !== null) { - message.pathTranslation = backendRule_PathTranslationFromJSON(object.path_translation); + message.pathTranslation = object.path_translation; } if (object.jwt_audience !== undefined && object.jwt_audience !== null) { message.jwtAudience = object.jwt_audience; @@ -591,15 +591,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = backendRule_PathTranslationToJSON(message.pathTranslation); - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.address = message.address === "" ? undefined : message.address; + obj.deadline = message.deadline === 0 ? undefined : message.deadline; + obj.min_deadline = message.minDeadline === 0 ? undefined : message.minDeadline; + obj.operation_deadline = message.operationDeadline === 0 ? undefined : message.operationDeadline; + obj.path_translation = message.pathTranslation === 0 ? undefined : message.pathTranslation; + obj.jwt_audience = message.jwtAudience === null ? undefined : message.jwtAudience; + obj.disable_auth = message.disableAuth === null ? undefined : message.disableAuth; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputv2/google/api/billing.ts b/__fixtures__/v-next/outputv2/google/api/billing.ts index 78df57278d..eb87d747e8 100644 --- a/__fixtures__/v-next/outputv2/google/api/billing.ts +++ b/__fixtures__/v-next/outputv2/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -253,7 +253,7 @@ export const Billing = { if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -358,11 +358,11 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/config_change.ts b/__fixtures__/v-next/outputv2/google/api/config_change.ts index 4246b3d341..8b64e582d4 100644 --- a/__fixtures__/v-next/outputv2/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv2/google/api/config_change.ts @@ -323,21 +323,21 @@ export const ConfigChange = { message.newValue = object.new_value; } if (object.change_type !== undefined && object.change_type !== null) { - message.changeType = changeTypeFromJSON(object.change_type); + message.changeType = object.change_type; } message.advices = object.advices?.map(e => Advice.fromAmino(e)) || []; return message; }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = changeTypeToJSON(message.changeType); + obj.element = message.element === "" ? undefined : message.element; + obj.old_value = message.oldValue === "" ? undefined : message.oldValue; + obj.new_value = message.newValue === "" ? undefined : message.newValue; + obj.change_type = message.changeType === 0 ? undefined : message.changeType; if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { - obj.advices = []; + obj.advices = message.advices; } return obj; }, @@ -421,7 +421,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputv2/google/api/consumer.ts b/__fixtures__/v-next/outputv2/google/api/consumer.ts index 25aaa57662..0bb95079bc 100644 --- a/__fixtures__/v-next/outputv2/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv2/google/api/consumer.ts @@ -268,7 +268,7 @@ export const ProjectProperties = { if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toAmino(e) : undefined); } else { - obj.properties = []; + obj.properties = message.properties; } return obj; }, @@ -373,7 +373,7 @@ export const Property = { message.name = object.name; } if (object.type !== undefined && object.type !== null) { - message.type = property_PropertyTypeFromJSON(object.type); + message.type = object.type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -382,9 +382,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = property_PropertyTypeToJSON(message.type); - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === 0 ? undefined : message.type; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputv2/google/api/context.ts b/__fixtures__/v-next/outputv2/google/api/context.ts index fbeab45f5b..b69e1b1baa 100644 --- a/__fixtures__/v-next/outputv2/google/api/context.ts +++ b/__fixtures__/v-next/outputv2/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -286,7 +286,7 @@ export const Context = { if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -454,26 +454,26 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.requested) { obj.requested = message.requested.map(e => e); } else { - obj.requested = []; + obj.requested = message.requested; } if (message.provided) { obj.provided = message.provided.map(e => e); } else { - obj.provided = []; + obj.provided = message.provided; } if (message.allowedRequestExtensions) { obj.allowed_request_extensions = message.allowedRequestExtensions.map(e => e); } else { - obj.allowed_request_extensions = []; + obj.allowed_request_extensions = message.allowedRequestExtensions; } if (message.allowedResponseExtensions) { obj.allowed_response_extensions = message.allowedResponseExtensions.map(e => e); } else { - obj.allowed_response_extensions = []; + obj.allowed_response_extensions = message.allowedResponseExtensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/control.ts b/__fixtures__/v-next/outputv2/google/api/control.ts index 487ac3e182..b5f920ac04 100644 --- a/__fixtures__/v-next/outputv2/google/api/control.ts +++ b/__fixtures__/v-next/outputv2/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -105,7 +105,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = omitDefault(message.environment); + obj.environment = message.environment === "" ? undefined : message.environment; return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputv2/google/api/distribution.ts b/__fixtures__/v-next/outputv2/google/api/distribution.ts index 4112cbd951..e761344e48 100644 --- a/__fixtures__/v-next/outputv2/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/distribution.ts @@ -729,19 +729,19 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -840,8 +840,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = message.min === 0 ? undefined : message.min; + obj.max = message.max === 0 ? undefined : message.max; return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -1075,9 +1075,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1190,9 +1190,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1293,7 +1293,7 @@ export const Distribution_BucketOptions_Explicit = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, @@ -1413,12 +1413,12 @@ export const Distribution_Exemplar = { }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.attachments = []; + obj.attachments = message.attachments; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/documentation.ts b/__fixtures__/v-next/outputv2/google/api/documentation.ts index 47fbc7f3cd..eec5516213 100644 --- a/__fixtures__/v-next/outputv2/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv2/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -554,20 +554,20 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = omitDefault(message.summary); + obj.summary = message.summary === "" ? undefined : message.summary; if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.pages = []; + obj.pages = message.pages; } if (message.rules) { obj.rules = message.rules.map(e => e ? DocumentationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.documentation_root_url = omitDefault(message.documentationRootUrl); - obj.service_root_url = omitDefault(message.serviceRootUrl); - obj.overview = omitDefault(message.overview); + obj.documentation_root_url = message.documentationRootUrl === "" ? undefined : message.documentationRootUrl; + obj.service_root_url = message.serviceRootUrl === "" ? undefined : message.serviceRootUrl; + obj.overview = message.overview === "" ? undefined : message.overview; return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -680,9 +680,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.description = omitDefault(message.description); - obj.deprecation_description = omitDefault(message.deprecationDescription); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.description = message.description === "" ? undefined : message.description; + obj.deprecation_description = message.deprecationDescription === "" ? undefined : message.deprecationDescription; return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -801,12 +801,12 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.content = message.content === "" ? undefined : message.content; if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.subpages = []; + obj.subpages = message.subpages; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/endpoint.ts b/__fixtures__/v-next/outputv2/google/api/endpoint.ts index d9aba4f2e1..ae0081c3cb 100644 --- a/__fixtures__/v-next/outputv2/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv2/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -249,14 +249,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } - obj.target = omitDefault(message.target); - obj.allow_cors = omitDefault(message.allowCors); + obj.target = message.target === "" ? undefined : message.target; + obj.allow_cors = message.allowCors === false ? undefined : message.allowCors; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts index 1a69b0d93d..df9432a437 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -466,10 +466,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -579,7 +579,7 @@ export const ParseResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -720,10 +720,10 @@ export const CheckRequest = { if (message.typeEnv) { obj.type_env = message.typeEnv.map(e => e ? Decl.toAmino(e) : undefined); } else { - obj.type_env = []; + obj.type_env = message.typeEnv; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = message.container === "" ? undefined : message.container; + obj.no_std_env = message.noStdEnv === false ? undefined : message.noStdEnv; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -833,7 +833,7 @@ export const CheckResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -933,7 +933,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -1106,7 +1106,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1216,7 +1216,7 @@ export const EvalResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -1322,7 +1322,7 @@ export const IssueDetails = { fromAmino(object: IssueDetailsAmino): IssueDetails { const message = createBaseIssueDetails(); if (object.severity !== undefined && object.severity !== null) { - message.severity = issueDetails_SeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.position !== undefined && object.position !== null) { message.position = SourcePosition.fromAmino(object.position); @@ -1334,7 +1334,7 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = issueDetails_SeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; obj.id = message.id ? message.id.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts index b1bffda3c8..7c22829012 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts @@ -1307,7 +1307,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1546,16 +1546,16 @@ export const Type = { message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1586,15 +1586,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1895,7 +1895,7 @@ export const Type_FunctionType = { if (message.argTypes) { obj.arg_types = message.argTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.arg_types = []; + obj.arg_types = message.argTypes; } return obj; }, @@ -2000,11 +2000,11 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.parameter_types = []; + obj.parameter_types = message.parameterTypes; } return obj; }, @@ -2122,7 +2122,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -2243,7 +2243,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2335,7 +2335,7 @@ export const Decl_FunctionDecl = { if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toAmino(e) : undefined); } else { - obj.overloads = []; + obj.overloads = message.overloads; } return obj; }, @@ -2508,20 +2508,20 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2642,11 +2642,11 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { - obj.overload_id = []; + obj.overload_id = message.overloadId; } obj.value = message.value ? Constant.toAmino(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts index 87f34c14d3..a113d90e13 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -357,12 +357,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -465,8 +465,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = omitDefault(message.expr); - obj.value = omitDefault(message.value); + obj.expr = message.expr ? message.expr.toString() : undefined; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -679,7 +679,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -781,7 +781,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e.toString()); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts index ef414e1ace..b6c73fbc6b 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -184,12 +184,12 @@ export const Explain = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.exprSteps) { obj.expr_steps = message.exprSteps.map(e => e ? Explain_ExprStep.toAmino(e) : undefined); } else { - obj.expr_steps = []; + obj.expr_steps = message.exprSteps; } return obj; }, @@ -290,8 +290,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.value_index = omitDefault(message.valueIndex); + obj.id = message.id ? message.id.toString() : undefined; + obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts index 0438ac4e3e..f3bdff3824 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts @@ -1275,7 +1275,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1391,8 +1391,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1514,11 +1514,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1611,7 +1611,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1716,11 +1716,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = message.messageName === "" ? undefined : message.messageName; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1856,7 +1856,7 @@ export const Expr_CreateStruct_Entry = { toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -2041,9 +2041,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -2230,7 +2230,7 @@ export const Constant = { fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -2260,12 +2260,12 @@ export const Constant = { }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -2368,7 +2368,7 @@ export const SourceInfo_PositionsEntry = { toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2692,12 +2692,12 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2838,10 +2838,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts index 1bafb22f1b..3fdcdf8cfb 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts @@ -449,7 +449,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -488,18 +488,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -597,8 +597,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -690,7 +690,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -783,7 +783,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts index 7132dc955e..266275bb30 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprAmino, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -284,9 +284,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.name = omitDefault(message.name); - obj.doc = omitDefault(message.doc); + obj.id = message.id === 0 ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.doc = message.doc === "" ? undefined : message.doc; obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -407,12 +407,12 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.type = omitDefault(message.type); + obj.id = message.id === 0 ? undefined : message.id; + obj.type = message.type === "" ? undefined : message.type; if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } return obj; }, @@ -640,10 +640,10 @@ export const FunctionDecl = { if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = omitDefault(message.receiverFunction); + obj.receiver_function = message.receiverFunction === false ? undefined : message.receiverFunction; return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts index 77288ec4a5..b68ee7a82e 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -379,12 +379,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -486,7 +486,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -699,7 +699,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -792,7 +792,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -876,7 +876,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts index 9866cd6abc..fe1c3f0fa2 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts @@ -770,7 +770,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -972,7 +972,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1062,7 +1062,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1178,8 +1178,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1301,11 +1301,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1398,7 +1398,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1503,11 +1503,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1640,8 +1640,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = message.id === 0 ? undefined : message.id; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1826,9 +1826,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1989,7 +1989,7 @@ export const Literal = { fromAmino(object: LiteralAmino): Literal { const message = createBaseLiteral(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -2013,12 +2013,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts index 7f20d515ec..3ed503ee7f 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -216,8 +216,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === 0 ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -377,11 +377,11 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = omitDefault(message.location); + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -516,10 +516,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = omitDefault(message.location); - obj.offset = omitDefault(message.offset); - obj.line = omitDefault(message.line); - obj.column = omitDefault(message.column); + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts index 01463557e2..9f85502f16 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts @@ -449,7 +449,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -488,18 +488,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -597,8 +597,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -690,7 +690,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -783,7 +783,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/http.ts b/__fixtures__/v-next/outputv2/google/api/http.ts index 07b9f4cbc5..8f57c8271c 100644 --- a/__fixtures__/v-next/outputv2/google/api/http.ts +++ b/__fixtures__/v-next/outputv2/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -1114,9 +1114,9 @@ export const Http = { if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -1342,19 +1342,19 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.get = omitDefault(message.get); - obj.put = omitDefault(message.put); - obj.post = omitDefault(message.post); - obj.delete = omitDefault(message.delete); - obj.patch = omitDefault(message.patch); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = omitDefault(message.body); - obj.response_body = omitDefault(message.responseBody); + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.additional_bindings = []; + obj.additional_bindings = message.additionalBindings; } return obj; }, @@ -1453,8 +1453,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = omitDefault(message.kind); - obj.path = omitDefault(message.path); + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputv2/google/api/httpbody.ts b/__fixtures__/v-next/outputv2/google/api/httpbody.ts index 17df108f65..593bce9a59 100644 --- a/__fixtures__/v-next/outputv2/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv2/google/api/httpbody.ts @@ -272,12 +272,12 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = message.contentType === "" ? undefined : message.contentType; obj.data = message.data ? base64FromBytes(message.data) : undefined; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/label.ts b/__fixtures__/v-next/outputv2/google/api/label.ts index 14ec642d3f..abc4ce89cf 100644 --- a/__fixtures__/v-next/outputv2/google/api/label.ts +++ b/__fixtures__/v-next/outputv2/google/api/label.ts @@ -160,7 +160,7 @@ export const LabelDescriptor = { message.key = object.key; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = labelDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -169,9 +169,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = labelDescriptor_ValueTypeToJSON(message.valueType); - obj.description = message.description; + obj.key = message.key === "" ? undefined : message.key; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputv2/google/api/log.ts b/__fixtures__/v-next/outputv2/google/api/log.ts index c4ff30a9fb..824760a552 100644 --- a/__fixtures__/v-next/outputv2/google/api/log.ts +++ b/__fixtures__/v-next/outputv2/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -211,14 +211,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.description = omitDefault(message.description); - obj.display_name = omitDefault(message.displayName); + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputv2/google/api/logging.ts b/__fixtures__/v-next/outputv2/google/api/logging.ts index 3c281ad124..13a9b26981 100644 --- a/__fixtures__/v-next/outputv2/google/api/logging.ts +++ b/__fixtures__/v-next/outputv2/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -284,12 +284,12 @@ export const Logging = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -394,11 +394,11 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.logs) { obj.logs = message.logs.map(e => e); } else { - obj.logs = []; + obj.logs = message.logs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/metric.ts b/__fixtures__/v-next/outputv2/google/api/metric.ts index e41e52709b..1de3496f0c 100644 --- a/__fixtures__/v-next/outputv2/google/api/metric.ts +++ b/__fixtures__/v-next/outputv2/google/api/metric.ts @@ -825,10 +825,10 @@ export const MetricDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.metric_kind !== undefined && object.metric_kind !== null) { - message.metricKind = metricDescriptor_MetricKindFromJSON(object.metric_kind); + message.metricKind = object.metric_kind; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = metricDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.unit !== undefined && object.unit !== null) { message.unit = object.unit; @@ -843,31 +843,31 @@ export const MetricDescriptor = { message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromAmino(object.metadata); } if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } message.monitoredResourceTypes = object.monitored_resource_types?.map(e => e) || []; return message; }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.metric_kind = metricDescriptor_MetricKindToJSON(message.metricKind); - obj.value_type = metricDescriptor_ValueTypeToJSON(message.valueType); - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = message.metricKind === 0 ? undefined : message.metricKind; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { - obj.monitored_resource_types = []; + obj.monitored_resource_types = message.monitoredResourceTypes; } return obj; }, @@ -973,7 +973,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromAmino(object: MetricDescriptor_MetricDescriptorMetadataAmino): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } if (object.sample_period !== undefined && object.sample_period !== null) { message.samplePeriod = Duration.fromAmino(object.sample_period); @@ -985,7 +985,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -1084,8 +1084,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1215,7 +1215,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts index 998207f573..8ca342961c 100644 --- a/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv2/google/api/monitored_resource.ts @@ -471,22 +471,22 @@ export const MonitoredResourceDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } return message; }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.display_name = message.displayName === "" ? undefined : message.displayName; + obj.description = message.description === "" ? undefined : message.description; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -583,8 +583,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -714,7 +714,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -817,8 +817,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputv2/google/api/monitoring.ts b/__fixtures__/v-next/outputv2/google/api/monitoring.ts index 3e8e9aad03..d9cecb3dd1 100644 --- a/__fixtures__/v-next/outputv2/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv2/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -357,12 +357,12 @@ export const Monitoring = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -467,11 +467,11 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/quota.ts b/__fixtures__/v-next/outputv2/google/api/quota.ts index c893829e28..f5a77b4453 100644 --- a/__fixtures__/v-next/outputv2/google/api/quota.ts +++ b/__fixtures__/v-next/outputv2/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; +import { DeepPartial, isSet, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -603,12 +603,12 @@ export const Quota = { if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toAmino(e) : undefined); } else { - obj.limits = []; + obj.limits = message.limits; } if (message.metricRules) { obj.metric_rules = message.metricRules.map(e => e ? MetricRule.toAmino(e) : undefined); } else { - obj.metric_rules = []; + obj.metric_rules = message.metricRules; } return obj; }, @@ -708,8 +708,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -839,7 +839,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -944,8 +944,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1201,21 +1201,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); - obj.default_limit = omitDefault(message.defaultLimit); - obj.max_limit = omitDefault(message.maxLimit); - obj.free_tier = omitDefault(message.freeTier); - obj.duration = omitDefault(message.duration); - obj.metric = omitDefault(message.metric); - obj.unit = omitDefault(message.unit); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.duration = message.duration === "" ? undefined : message.duration; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = omitDefault(message.displayName); + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputv2/google/api/resource.ts b/__fixtures__/v-next/outputv2/google/api/resource.ts index c60ef359ee..b4ae56439b 100644 --- a/__fixtures__/v-next/outputv2/google/api/resource.ts +++ b/__fixtures__/v-next/outputv2/google/api/resource.ts @@ -691,7 +691,7 @@ export const ResourceDescriptor = { message.nameField = object.name_field; } if (object.history !== undefined && object.history !== null) { - message.history = resourceDescriptor_HistoryFromJSON(object.history); + message.history = object.history; } if (object.plural !== undefined && object.plural !== null) { message.plural = object.plural; @@ -699,25 +699,25 @@ export const ResourceDescriptor = { if (object.singular !== undefined && object.singular !== null) { message.singular = object.singular; } - message.style = object.style?.map(e => resourceDescriptor_StyleFromJSON(e)) || []; + message.style = object.style?.map(e => e) || []; return message; }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { - obj.pattern = []; + obj.pattern = message.pattern; } - obj.name_field = message.nameField; - obj.history = resourceDescriptor_HistoryToJSON(message.history); - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = message.nameField === "" ? undefined : message.nameField; + obj.history = message.history === 0 ? undefined : message.history; + obj.plural = message.plural === "" ? undefined : message.plural; + obj.singular = message.singular === "" ? undefined : message.singular; if (message.style) { - obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); + obj.style = message.style.map(e => e); } else { - obj.style = []; + obj.style = message.style; } return obj; }, @@ -816,8 +816,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = message.type === "" ? undefined : message.type; + obj.child_type = message.childType === "" ? undefined : message.childType; return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputv2/google/api/routing.ts b/__fixtures__/v-next/outputv2/google/api/routing.ts index 316c649f33..70ba596532 100644 --- a/__fixtures__/v-next/outputv2/google/api/routing.ts +++ b/__fixtures__/v-next/outputv2/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -1327,7 +1327,7 @@ export const RoutingRule = { if (message.routingParameters) { obj.routing_parameters = message.routingParameters.map(e => e ? RoutingParameter.toAmino(e) : undefined); } else { - obj.routing_parameters = []; + obj.routing_parameters = message.routingParameters; } return obj; }, @@ -1426,8 +1426,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.path_template = omitDefault(message.pathTemplate); + obj.field = message.field === "" ? undefined : message.field; + obj.path_template = message.pathTemplate === "" ? undefined : message.pathTemplate; return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputv2/google/api/service.ts b/__fixtures__/v-next/outputv2/google/api/service.ts index c5d94b93b5..abb7aafc14 100644 --- a/__fixtures__/v-next/outputv2/google/api/service.ts +++ b/__fixtures__/v-next/outputv2/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersAmino, SystemParametersSDKType } from import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueAmino, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -819,24 +819,24 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.title = omitDefault(message.title); - obj.producer_project_id = omitDefault(message.producerProjectId); - obj.id = omitDefault(message.id); + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.id = message.id === "" ? undefined : message.id; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } if (message.types) { obj.types = message.types.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.types = []; + obj.types = message.types; } if (message.enums) { obj.enums = message.enums.map(e => e ? Enum.toAmino(e) : undefined); } else { - obj.enums = []; + obj.enums = message.enums; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.backend = message.backend ? Backend.toAmino(message.backend) : undefined; @@ -848,23 +848,23 @@ export const Service = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } obj.control = message.control ? Control.toAmino(message.control) : undefined; if (message.logs) { obj.logs = message.logs.map(e => e ? LogDescriptor.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } if (message.metrics) { obj.metrics = message.metrics.map(e => e ? MetricDescriptor.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.billing = message.billing ? Billing.toAmino(message.billing) : undefined; obj.logging = message.logging ? Logging.toAmino(message.logging) : undefined; diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts index cc5af6bba4..bc834d55a2 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/check_error.ts @@ -355,7 +355,7 @@ export const CheckError = { fromAmino(object: CheckErrorAmino): CheckError { const message = createBaseCheckError(); if (object.code !== undefined && object.code !== null) { - message.code = checkError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -370,9 +370,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = checkError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.detail = message.detail === "" ? undefined : message.detail; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts index cca9b9b627..0338bcee4a 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -536,15 +536,15 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = omitDefault(message.count); - obj.mean = omitDefault(message.mean); - obj.minimum = omitDefault(message.minimum); - obj.maximum = omitDefault(message.maximum); - obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); + obj.count = message.count ? message.count.toString() : undefined; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.minimum = message.minimum === 0 ? undefined : message.minimum; + obj.maximum = message.maximum === 0 ? undefined : message.maximum; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } obj.linear_buckets = message.linearBuckets ? Distribution_LinearBuckets.toAmino(message.linearBuckets) : undefined; obj.exponential_buckets = message.exponentialBuckets ? Distribution_ExponentialBuckets.toAmino(message.exponentialBuckets) : undefined; @@ -552,7 +552,7 @@ export const Distribution = { if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -666,9 +666,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.width = omitDefault(message.width); - obj.offset = omitDefault(message.offset); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -781,9 +781,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.growth_factor = omitDefault(message.growthFactor); - obj.scale = omitDefault(message.scale); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { @@ -884,7 +884,7 @@ export const Distribution_ExplicitBuckets = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts index 6cadb0ea89..63549de72e 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -468,21 +468,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = omitDefault(message.requestMethod); - obj.request_url = omitDefault(message.requestUrl); - obj.request_size = omitDefault(message.requestSize); - obj.status = omitDefault(message.status); - obj.response_size = omitDefault(message.responseSize); - obj.user_agent = omitDefault(message.userAgent); - obj.remote_ip = omitDefault(message.remoteIp); - obj.server_ip = omitDefault(message.serverIp); - obj.referer = omitDefault(message.referer); + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; + obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = omitDefault(message.cacheLookup); - obj.cache_hit = omitDefault(message.cacheHit); - obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); - obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); - obj.protocol = omitDefault(message.protocol); + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; + obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts index 9c4077beab..7b4a289acd 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts @@ -386,8 +386,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -639,7 +639,7 @@ export const LogEntry = { message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -677,12 +677,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -690,7 +690,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -821,10 +821,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -939,9 +939,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts index 49d15135e7..f70f423ef3 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts @@ -233,8 +233,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -468,10 +468,10 @@ export const MetricValue = { } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.bool_value = message.boolValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -576,11 +576,11 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { - obj.metric_values = []; + obj.metric_values = message.metricValues; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts index 7e3d8e189f..76197c6659 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/operation.ts @@ -332,8 +332,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -594,16 +594,16 @@ export const Operation = { message.metricValueSets = object.metric_value_sets?.map(e => MetricValueSet.fromAmino(e)) || []; message.logEntries = object.log_entries?.map(e => LogEntry.fromAmino(e)) || []; if (object.importance !== undefined && object.importance !== null) { - message.importance = operation_ImportanceFromJSON(object.importance); + message.importance = object.importance; } message.extensions = object.extensions?.map(e => Any.fromAmino(e)) || []; return message; }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.operation_name = message.operationName === "" ? undefined : message.operationName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.labels = {}; @@ -615,18 +615,18 @@ export const Operation = { if (message.metricValueSets) { obj.metric_value_sets = message.metricValueSets.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.metric_value_sets = []; + obj.metric_value_sets = message.metricValueSets; } if (message.logEntries) { obj.log_entries = message.logEntries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.log_entries = []; + obj.log_entries = message.logEntries; } - obj.importance = operation_ImportanceToJSON(message.importance); + obj.importance = message.importance === 0 ? undefined : message.importance; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts index c31ae1d424..e85ab2a660 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/quota_controller.ts @@ -592,9 +592,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -691,8 +691,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -882,15 +882,15 @@ export const QuotaOperation = { }, {}); message.quotaMetrics = object.quota_metrics?.map(e => MetricValueSet.fromAmino(e)) || []; if (object.quota_mode !== undefined && object.quota_mode !== null) { - message.quotaMode = quotaOperation_QuotaModeFromJSON(object.quota_mode); + message.quotaMode = object.quota_mode; } return message; }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.method_name = message.methodName === "" ? undefined : message.methodName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -900,9 +900,9 @@ export const QuotaOperation = { if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.quota_mode = quotaOperation_QuotaModeToJSON(message.quotaMode); + obj.quota_mode = message.quotaMode === 0 ? undefined : message.quotaMode; return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -1042,18 +1042,18 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { - obj.allocate_errors = []; + obj.allocate_errors = message.allocateErrors; } if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1168,7 +1168,7 @@ export const QuotaError = { fromAmino(object: QuotaErrorAmino): QuotaError { const message = createBaseQuotaError(); if (object.code !== undefined && object.code !== null) { - message.code = quotaError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -1183,9 +1183,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = quotaError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.description = message.description; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts index 68029f614d..df510da2cf 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts @@ -570,9 +570,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -723,14 +723,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { - obj.check_errors = []; + obj.check_errors = message.checkErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -840,7 +840,7 @@ export const CheckResponse_CheckInfo = { if (message.unusedArguments) { obj.unused_arguments = message.unusedArguments.map(e => e); } else { - obj.unused_arguments = []; + obj.unused_arguments = message.unusedArguments; } obj.consumer_info = message.consumerInfo ? CheckResponse_ConsumerInfo.toAmino(message.consumerInfo) : undefined; return obj; @@ -950,7 +950,7 @@ export const CheckResponse_ConsumerInfo = { message.projectNumber = BigInt(object.project_number); } if (object.type !== undefined && object.type !== null) { - message.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + message.type = object.type; } if (object.consumer_number !== undefined && object.consumer_number !== null) { message.consumerNumber = BigInt(object.consumer_number); @@ -960,7 +960,7 @@ export const CheckResponse_ConsumerInfo = { toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; return obj; }, @@ -1080,13 +1080,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1208,10 +1208,10 @@ export const ReportResponse = { if (message.reportErrors) { obj.report_errors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toAmino(e) : undefined); } else { - obj.report_errors = []; + obj.report_errors = message.reportErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1311,7 +1311,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts index 33af87a73a..27a42fdd9f 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextAmino, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -419,15 +419,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = omitDefault(message.serviceName); - obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } - obj.flags = omitDefault(message.flags); + obj.flags = message.flags === "" ? undefined : message.flags; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -570,11 +570,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.type = omitDefault(message.type); - obj.permission = omitDefault(message.permission); - obj.container = omitDefault(message.container); - obj.location = omitDefault(message.location); + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.permission = message.permission === "" ? undefined : message.permission; + obj.container = message.container === "" ? undefined : message.container; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -671,8 +671,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -929,12 +929,12 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = omitDefault(message.serviceName); - obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts index c90e56a52d..a6418a4ec5 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/resources.ts @@ -912,8 +912,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -1056,14 +1056,14 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } if (message.steps) { obj.steps = message.steps.map(e => e ? OperationMetadata_Step.toAmino(e) : undefined); } else { - obj.steps = []; + obj.steps = message.steps; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = message.progressPercentage === 0 ? undefined : message.progressPercentage; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -1156,14 +1156,14 @@ export const OperationMetadata_Step = { message.description = object.description; } if (object.status !== undefined && object.status !== null) { - message.status = operationMetadata_StatusFromJSON(object.status); + message.status = object.status; } return message; }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = operationMetadata_StatusToJSON(message.status); + obj.description = message.description === "" ? undefined : message.description; + obj.status = message.status === 0 ? undefined : message.status; return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1267,7 +1267,7 @@ export const Diagnostic = { message.location = object.location; } if (object.kind !== undefined && object.kind !== null) { - message.kind = diagnostic_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.message !== undefined && object.message !== null) { message.message = object.message; @@ -1276,9 +1276,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = diagnostic_KindToJSON(message.kind); - obj.message = message.message; + obj.location = message.location === "" ? undefined : message.location; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1382,11 +1382,11 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { - obj.files = []; + obj.files = message.files; } return obj; }, @@ -1494,15 +1494,15 @@ export const ConfigFile = { message.fileContents = bytesFromBase64(object.file_contents); } if (object.file_type !== undefined && object.file_type !== null) { - message.fileType = configFile_FileTypeFromJSON(object.file_type); + message.fileType = object.file_type; } return message; }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = message.filePath === "" ? undefined : message.filePath; obj.file_contents = message.fileContents ? base64FromBytes(message.fileContents) : undefined; - obj.file_type = configFile_FileTypeToJSON(message.fileType); + obj.file_type = message.fileType === 0 ? undefined : message.fileType; return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1585,7 +1585,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1677,7 +1677,7 @@ export const ChangeReport = { if (message.configChanges) { obj.config_changes = message.configChanges.map(e => e ? ConfigChange.toAmino(e) : undefined); } else { - obj.config_changes = []; + obj.config_changes = message.configChanges; } return obj; }, @@ -1840,7 +1840,7 @@ export const Rollout = { message.createdBy = object.created_by; } if (object.status !== undefined && object.status !== null) { - message.status = rollout_RolloutStatusFromJSON(object.status); + message.status = object.status; } if (object.traffic_percent_strategy !== undefined && object.traffic_percent_strategy !== null) { message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy); @@ -1855,13 +1855,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; - obj.created_by = message.createdBy; - obj.status = rollout_RolloutStatusToJSON(message.status); + obj.created_by = message.createdBy === "" ? undefined : message.createdBy; + obj.status = message.status === 0 ? undefined : message.status; obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1958,8 +1958,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts index fab991b5c9..70d1b40cec 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicemanagement/v1/servicemanager.ts @@ -859,10 +859,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -969,9 +969,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1054,7 +1054,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1222,7 +1222,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1305,7 +1305,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1497,15 +1497,15 @@ export const GetServiceConfigRequest = { message.configId = object.config_id; } if (object.view !== undefined && object.view !== null) { - message.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = getServiceConfigRequest_ConfigViewToJSON(message.view); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.config_id = message.configId === "" ? undefined : message.configId; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1618,9 +1618,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1727,9 +1727,9 @@ export const ListServiceConfigsResponse = { if (message.serviceConfigs) { obj.service_configs = message.serviceConfigs.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.service_configs = []; + obj.service_configs = message.serviceConfigs; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1829,7 +1829,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1945,9 +1945,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = message.validateOnly === false ? undefined : message.validateOnly; return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -2132,7 +2132,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -2261,10 +2261,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2371,9 +2371,9 @@ export const ListServiceRolloutsResponse = { if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toAmino(e) : undefined); } else { - obj.rollouts = []; + obj.rollouts = message.rollouts; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2471,8 +2471,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2715,17 +2715,17 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.id = message.id === "" ? undefined : message.id; if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { - obj.change_reports = []; + obj.change_reports = message.changeReports; } if (message.diagnostics) { obj.diagnostics = message.diagnostics.map(e => e ? Diagnostic.toAmino(e) : undefined); } else { - obj.diagnostics = []; + obj.diagnostics = message.diagnostics; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts index 31b450f846..1a21c7e3ef 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/resources.ts @@ -365,16 +365,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -620,12 +620,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -634,12 +634,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -733,7 +733,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts index ea94c0e588..59bfb563bf 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1/serviceusage.ts @@ -635,7 +635,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -827,15 +827,15 @@ export const DisableServiceRequest = { message.disableDependentServices = object.disable_dependent_services; } if (object.check_if_service_has_usage !== undefined && object.check_if_service_has_usage !== null) { - message.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage); + message.checkIfServiceHasUsage = object.check_if_service_has_usage; } return message; }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = disableServiceRequest_CheckIfServiceHasUsageToJSON(message.checkIfServiceHasUsage); + obj.name = message.name === "" ? undefined : message.name; + obj.disable_dependent_services = message.disableDependentServices === false ? undefined : message.disableDependentServices; + obj.check_if_service_has_usage = message.checkIfServiceHasUsage === 0 ? undefined : message.checkIfServiceHasUsage; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1003,7 +1003,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1131,10 +1131,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1241,9 +1241,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1347,11 +1347,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1465,12 +1465,12 @@ export const BatchEnableServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } if (message.failures) { obj.failures = message.failures.map(e => e ? BatchEnableServicesResponse_EnableFailure.toAmino(e) : undefined); } else { - obj.failures = []; + obj.failures = message.failures; } return obj; }, @@ -1569,8 +1569,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = message.serviceId === "" ? undefined : message.serviceId; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1674,11 +1674,11 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.names) { obj.names = message.names.map(e => e); } else { - obj.names = []; + obj.names = message.names; } return obj; }, @@ -1771,7 +1771,7 @@ export const BatchGetServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts index 6738515560..148c3ed9e2 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts @@ -1179,16 +1179,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1434,12 +1434,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -1448,12 +1448,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -1547,7 +1547,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1718,20 +1718,20 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.display_name = message.displayName === "" ? undefined : message.displayName; if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.consumer_quota_limits = []; + obj.consumer_quota_limits = message.consumerQuotaLimits; } if (message.descendantConsumerQuotaLimits) { obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.descendant_consumer_quota_limits = []; + obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits; } - obj.unit = message.unit; + obj.unit = message.unit === "" ? undefined : message.unit; return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1895,15 +1895,15 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.is_precise = message.isPrecise === false ? undefined : message.isPrecise; + obj.allows_admin_overrides = message.allowsAdminOverrides === false ? undefined : message.allowsAdminOverrides; if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { - obj.quota_buckets = []; + obj.quota_buckets = message.quotaBuckets; } return obj; }, @@ -2001,8 +2001,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -2309,8 +2309,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2502,7 +2502,7 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2510,9 +2510,9 @@ export const QuotaOverride = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.admin_override_ancestor = message.adminOverrideAncestor === "" ? undefined : message.adminOverrideAncestor; return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2604,7 +2604,7 @@ export const OverrideInlineSource = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2702,8 +2702,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2895,7 +2895,7 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2903,9 +2903,9 @@ export const AdminQuotaPolicy = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -3003,8 +3003,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = message.email === "" ? undefined : message.email; + obj.unique_id = message.uniqueId === "" ? undefined : message.uniqueId; return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts index 0ef1f470ad..2d7dc6d708 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1629,7 +1629,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1712,7 +1712,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1795,7 +1795,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1923,10 +1923,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -2033,9 +2033,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -2139,11 +2139,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -2266,16 +2266,16 @@ export const ListConsumerQuotaMetricsRequest = { message.pageToken = object.page_token; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = quotaViewToJSON(message.view); + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -2382,9 +2382,9 @@ export const ListConsumerQuotaMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -2476,14 +2476,14 @@ export const GetConsumerQuotaMetricRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -2575,14 +2575,14 @@ export const GetConsumerQuotaLimitRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2722,18 +2722,18 @@ export const CreateAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2891,19 +2891,19 @@ export const UpdateAdminOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3027,17 +3027,17 @@ export const DeleteAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3151,9 +3151,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -3260,9 +3260,9 @@ export const ListAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -3354,7 +3354,7 @@ export const BatchCreateAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3495,18 +3495,18 @@ export const ImportAdminOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3599,7 +3599,7 @@ export const ImportAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3805,18 +3805,18 @@ export const CreateConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3974,19 +3974,19 @@ export const UpdateConsumerOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4110,17 +4110,17 @@ export const DeleteConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4234,9 +4234,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -4343,9 +4343,9 @@ export const ListConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -4437,7 +4437,7 @@ export const BatchCreateConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4578,18 +4578,18 @@ export const ImportConsumerOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4682,7 +4682,7 @@ export const ImportConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4840,7 +4840,7 @@ export const ImportAdminQuotaPoliciesResponse = { if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toAmino(e) : undefined); } else { - obj.policies = []; + obj.policies = message.policies; } return obj; }, @@ -5184,7 +5184,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -5278,14 +5278,14 @@ export const GetServiceIdentityResponse = { message.identity = ServiceIdentity.fromAmino(object.identity); } if (object.state !== undefined && object.state !== null) { - message.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputv2/google/api/source_info.ts b/__fixtures__/v-next/outputv2/google/api/source_info.ts index bb3d340233..721c15b580 100644 --- a/__fixtures__/v-next/outputv2/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv2/google/api/source_info.ts @@ -97,7 +97,7 @@ export const SourceInfo = { if (message.sourceFiles) { obj.source_files = message.sourceFiles.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.source_files = []; + obj.source_files = message.sourceFiles; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/system_parameter.ts b/__fixtures__/v-next/outputv2/google/api/system_parameter.ts index 3ac99e0c17..5b120210f4 100644 --- a/__fixtures__/v-next/outputv2/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv2/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -291,7 +291,7 @@ export const SystemParameters = { if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -396,11 +396,11 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { - obj.parameters = []; + obj.parameters = message.parameters; } return obj; }, @@ -514,9 +514,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.http_header = omitDefault(message.httpHeader); - obj.url_query_parameter = omitDefault(message.urlQueryParameter); + obj.name = message.name === "" ? undefined : message.name; + obj.http_header = message.httpHeader === "" ? undefined : message.httpHeader; + obj.url_query_parameter = message.urlQueryParameter === "" ? undefined : message.urlQueryParameter; return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputv2/google/api/usage.ts b/__fixtures__/v-next/outputv2/google/api/usage.ts index 6dc4bf3946..867d3c2e9c 100644 --- a/__fixtures__/v-next/outputv2/google/api/usage.ts +++ b/__fixtures__/v-next/outputv2/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -324,14 +324,14 @@ export const Usage = { if (message.requirements) { obj.requirements = message.requirements.map(e => e); } else { - obj.requirements = []; + obj.requirements = message.requirements; } if (message.rules) { obj.rules = message.rules.map(e => e ? UsageRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); + obj.producer_notification_channel = message.producerNotificationChannel === "" ? undefined : message.producerNotificationChannel; return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -444,9 +444,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); - obj.skip_service_control = omitDefault(message.skipServiceControl); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.allow_unregistered_calls = message.allowUnregisteredCalls === false ? undefined : message.allowUnregisteredCalls; + obj.skip_service_control = message.skipServiceControl === false ? undefined : message.skipServiceControl; return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputv2/google/api/visibility.ts b/__fixtures__/v-next/outputv2/google/api/visibility.ts index e031fe3078..2a1cf53888 100644 --- a/__fixtures__/v-next/outputv2/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv2/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -249,7 +249,7 @@ export const Visibility = { if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -348,8 +348,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.restriction = omitDefault(message.restriction); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.restriction = message.restriction === "" ? undefined : message.restriction; return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts index 2d576fa47b..02dd3c583d 100644 --- a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -472,21 +472,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = omitDefault(message.requestMethod); - obj.request_url = omitDefault(message.requestUrl); - obj.request_size = omitDefault(message.requestSize); - obj.status = omitDefault(message.status); - obj.response_size = omitDefault(message.responseSize); - obj.user_agent = omitDefault(message.userAgent); - obj.remote_ip = omitDefault(message.remoteIp); - obj.server_ip = omitDefault(message.serverIp); - obj.referer = omitDefault(message.referer); + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; + obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = omitDefault(message.cacheLookup); - obj.cache_hit = omitDefault(message.cacheHit); - obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); - obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); - obj.protocol = omitDefault(message.protocol); + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; + obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts index a83cad8fac..45a3ebb597 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts @@ -618,8 +618,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -950,7 +950,7 @@ export const LogEntry = { message.receiveTimestamp = fromTimestamp(Timestamp.fromAmino(object.receive_timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.insert_id !== undefined && object.insert_id !== null) { message.insertId = object.insert_id; @@ -988,15 +988,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.receive_timestamp = message.receiveTimestamp ? Timestamp.toAmino(toTimestamp(message.receiveTimestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); - obj.insert_id = message.insertId; + obj.severity = message.severity === 0 ? undefined : message.severity; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -1005,9 +1005,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.span_id = message.spanId === "" ? undefined : message.spanId; + obj.trace_sampled = message.traceSampled === false ? undefined : message.traceSampled; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -1137,10 +1137,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1255,9 +1255,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1370,9 +1370,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = message.uid === "" ? undefined : message.uid; + obj.index = message.index === 0 ? undefined : message.index; + obj.total_splits = message.totalSplits === 0 ? undefined : message.totalSplits; return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts index 2cb9e5910a..8a57884024 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging.ts @@ -1015,7 +1015,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -1112,8 +1112,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -1311,7 +1311,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -1322,10 +1322,10 @@ export const WriteLogEntriesRequest = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = message.partialSuccess === false ? undefined : message.partialSuccess; + obj.dry_run = message.dryRun === false ? undefined : message.dryRun; return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1489,7 +1489,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === 0 ? undefined : message.key; obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1762,12 +1762,12 @@ export const ListLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.order_by = message.orderBy === "" ? undefined : message.orderBy; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1874,9 +1874,9 @@ export const ListLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1974,8 +1974,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -2082,9 +2082,9 @@ export const ListMonitoredResourceDescriptorsResponse = { if (message.resourceDescriptors) { obj.resource_descriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.resource_descriptors = []; + obj.resource_descriptors = message.resourceDescriptors; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -2218,13 +2218,13 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -2332,9 +2332,9 @@ export const ListLogsResponse = { if (message.logNames) { obj.log_names = message.logNames.map(e => e); } else { - obj.log_names = []; + obj.log_names = message.logNames; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2458,9 +2458,9 @@ export const TailLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2574,12 +2574,12 @@ export const TailLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.suppressionInfo) { obj.suppression_info = message.suppressionInfo.map(e => e ? TailLogEntriesResponse_SuppressionInfo.toAmino(e) : undefined); } else { - obj.suppression_info = []; + obj.suppression_info = message.suppressionInfo; } return obj; }, @@ -2669,7 +2669,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { fromAmino(object: TailLogEntriesResponse_SuppressionInfoAmino): TailLogEntriesResponse_SuppressionInfo { const message = createBaseTailLogEntriesResponse_SuppressionInfo(); if (object.reason !== undefined && object.reason !== null) { - message.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + message.reason = object.reason; } if (object.suppressed_count !== undefined && object.suppressed_count !== null) { message.suppressedCount = object.suppressed_count; @@ -2678,8 +2678,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason); - obj.suppressed_count = message.suppressedCount; + obj.reason = message.reason === 0 ? undefined : message.reason; + obj.suppressed_count = message.suppressedCount === 0 ? undefined : message.suppressedCount; return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts index 2b5c044522..5a98d87d45 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts @@ -3215,7 +3215,7 @@ export const LogBucket = { message.locked = object.locked; } if (object.lifecycle_state !== undefined && object.lifecycle_state !== null) { - message.lifecycleState = lifecycleStateFromJSON(object.lifecycle_state); + message.lifecycleState = object.lifecycle_state; } message.restrictedFields = object.restricted_fields?.map(e => e) || []; if (object.cmek_settings !== undefined && object.cmek_settings !== null) { @@ -3225,17 +3225,17 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = lifecycleStateToJSON(message.lifecycleState); + obj.retention_days = message.retentionDays === 0 ? undefined : message.retentionDays; + obj.locked = message.locked === false ? undefined : message.locked; + obj.lifecycle_state = message.lifecycleState === 0 ? undefined : message.lifecycleState; if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { - obj.restricted_fields = []; + obj.restricted_fields = message.restrictedFields; } obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; return obj; @@ -3380,11 +3380,11 @@ export const LogView = { }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -3619,7 +3619,7 @@ export const LogSink = { } message.exclusions = object.exclusions?.map(e => LogExclusion.fromAmino(e)) || []; if (object.output_version_format !== undefined && object.output_version_format !== null) { - message.outputVersionFormat = logSink_VersionFormatFromJSON(object.output_version_format); + message.outputVersionFormat = object.output_version_format; } if (object.writer_identity !== undefined && object.writer_identity !== null) { message.writerIdentity = object.writer_identity; @@ -3640,19 +3640,19 @@ export const LogSink = { }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.destination = message.destination === "" ? undefined : message.destination; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.description = message.description === "" ? undefined : message.description; + obj.disabled = message.disabled === false ? undefined : message.disabled; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.output_version_format = logSink_VersionFormatToJSON(message.outputVersionFormat); - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = message.outputVersionFormat === 0 ? undefined : message.outputVersionFormat; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; + obj.include_children = message.includeChildren === false ? undefined : message.includeChildren; obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; @@ -3753,8 +3753,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = message.usePartitionedTables === false ? undefined : message.usePartitionedTables; + obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning === false ? undefined : message.usesTimestampColumnPartitioning; return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -3867,9 +3867,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -3976,9 +3976,9 @@ export const ListBucketsResponse = { if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toAmino(e) : undefined); } else { - obj.buckets = []; + obj.buckets = message.buckets; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -4093,8 +4093,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.bucket_id = message.bucketId === "" ? undefined : message.bucketId; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -4212,7 +4212,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -4297,7 +4297,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -4380,7 +4380,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -4463,7 +4463,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -4576,9 +4576,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -4685,9 +4685,9 @@ export const ListViewsResponse = { if (message.views) { obj.views = message.views.map(e => e ? LogView.toAmino(e) : undefined); } else { - obj.views = []; + obj.views = message.views; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -4802,8 +4802,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.view_id = message.viewId === "" ? undefined : message.viewId; obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -4921,7 +4921,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5006,7 +5006,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -5089,7 +5089,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -5202,9 +5202,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -5311,9 +5311,9 @@ export const ListSinksResponse = { if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toAmino(e) : undefined); } else { - obj.sinks = []; + obj.sinks = message.sinks; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -5396,7 +5396,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -5511,9 +5511,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -5645,9 +5645,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -5731,7 +5731,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -5889,10 +5889,10 @@ export const LogExclusion = { }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; return obj; @@ -6007,9 +6007,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -6116,9 +6116,9 @@ export const ListExclusionsResponse = { if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -6201,7 +6201,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -6301,7 +6301,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -6419,7 +6419,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6504,7 +6504,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -6587,7 +6587,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -6704,7 +6704,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6819,9 +6819,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.service_account_id = message.serviceAccountId === "" ? undefined : message.serviceAccountId; return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -6904,7 +6904,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -7021,7 +7021,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -7166,11 +7166,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.kms_service_account_id = message.kmsServiceAccountId === "" ? undefined : message.kmsServiceAccountId; + obj.storage_location = message.storageLocation === "" ? undefined : message.storageLocation; + obj.disable_default_sink = message.disableDefaultSink === false ? undefined : message.disableDefaultSink; return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -7283,9 +7283,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.destination = message.destination === "" ? undefined : message.destination; return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -7442,7 +7442,7 @@ export const CopyLogEntriesMetadata = { message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); } if (object.state !== undefined && object.state !== null) { - message.state = operationStateFromJSON(object.state); + message.state = object.state; } if (object.cancellation_requested !== undefined && object.cancellation_requested !== null) { message.cancellationRequested = object.cancellation_requested; @@ -7462,11 +7462,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.state = operationStateToJSON(message.state); - obj.cancellation_requested = message.cancellationRequested; + obj.state = message.state === 0 ? undefined : message.state; + obj.cancellation_requested = message.cancellationRequested === false ? undefined : message.cancellationRequested; obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = message.progress === 0 ? undefined : message.progress; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts index 5c16a38ff3..8234c80079 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_metrics.ts @@ -683,8 +683,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -947,18 +947,18 @@ export const LogMetric = { message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); } if (object.version !== undefined && object.version !== null) { - message.version = logMetric_ApiVersionFromJSON(object.version); + message.version = object.version; } return message; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = message.valueExtractor === "" ? undefined : message.valueExtractor; obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -968,7 +968,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.version = logMetric_ApiVersionToJSON(message.version); + obj.version = message.version === 0 ? undefined : message.version; return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -1081,9 +1081,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -1190,9 +1190,9 @@ export const ListLogMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1275,7 +1275,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1375,7 +1375,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1476,7 +1476,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1560,7 +1560,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputv2/google/longrunning/operations.ts b/__fixtures__/v-next/outputv2/google/longrunning/operations.ts index 8ec62dc93c..c0ba07b598 100644 --- a/__fixtures__/v-next/outputv2/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv2/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { Status, StatusAmino, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -491,9 +491,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = omitDefault(message.done); + obj.done = message.done === false ? undefined : message.done; obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -578,7 +578,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -706,10 +706,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.filter = omitDefault(message.filter); - obj.page_size = omitDefault(message.pageSize); - obj.page_token = omitDefault(message.pageToken); + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -816,9 +816,9 @@ export const ListOperationsResponse = { if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.next_page_token = omitDefault(message.nextPageToken); + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -901,7 +901,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -984,7 +984,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -1084,7 +1084,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1183,8 +1183,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = omitDefault(message.responseType); - obj.metadata_type = omitDefault(message.metadataType); + obj.response_type = message.responseType === "" ? undefined : message.responseType; + obj.metadata_type = message.metadataType === "" ? undefined : message.metadataType; return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/api.ts b/__fixtures__/v-next/outputv2/google/protobuf/api.ts index 488d8dc75e..f607d612a3 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/api.ts @@ -627,31 +627,31 @@ export const Api = { } message.mixins = object.mixins?.map(e => Mixin.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { - obj.mixins = []; + obj.mixins = message.mixins; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -824,23 +824,23 @@ export const Method = { } message.options = object.options?.map(e => Option.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = message.name === "" ? undefined : message.name; + obj.request_type_url = message.requestTypeUrl === "" ? undefined : message.requestTypeUrl; + obj.request_streaming = message.requestStreaming === false ? undefined : message.requestStreaming; + obj.response_type_url = message.responseTypeUrl === "" ? undefined : message.responseTypeUrl; + obj.response_streaming = message.responseStreaming === false ? undefined : message.responseStreaming; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -938,8 +938,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = message.name === "" ? undefined : message.name; + obj.root = message.root === "" ? undefined : message.root; return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts index 43523f55ab..442f7f0f55 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -398,10 +398,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = omitDefault(message.major); - obj.minor = omitDefault(message.minor); - obj.patch = omitDefault(message.patch); - obj.suffix = omitDefault(message.suffix); + obj.major = message.major === 0 ? undefined : message.major; + obj.minor = message.minor === 0 ? undefined : message.minor; + obj.patch = message.patch === 0 ? undefined : message.patch; + obj.suffix = message.suffix === "" ? undefined : message.suffix; return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -546,13 +546,13 @@ export const CodeGeneratorRequest = { if (message.fileToGenerate) { obj.file_to_generate = message.fileToGenerate.map(e => e); } else { - obj.file_to_generate = []; + obj.file_to_generate = message.fileToGenerate; } - obj.parameter = omitDefault(message.parameter); + obj.parameter = message.parameter === "" ? undefined : message.parameter; if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.proto_file = []; + obj.proto_file = message.protoFile; } obj.compiler_version = message.compilerVersion ? Version.toAmino(message.compilerVersion) : undefined; return obj; @@ -658,11 +658,11 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = omitDefault(message.error); + obj.error = message.error === "" ? undefined : message.error; if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -776,9 +776,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.insertion_point = omitDefault(message.insertionPoint); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.insertion_point = message.insertionPoint === "" ? undefined : message.insertionPoint; + obj.content = message.content === "" ? undefined : message.content; return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts index 73fd2a121c..1057797b32 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts @@ -2270,7 +2270,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2583,46 +2583,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2890,47 +2890,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3046,8 +3046,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -3146,8 +3146,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -3239,7 +3239,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3433,10 +3433,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3460,15 +3460,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -3569,7 +3569,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3733,22 +3733,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3847,8 +3847,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3963,8 +3963,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -4086,11 +4086,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -4252,12 +4252,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -4597,7 +4597,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4646,30 +4646,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4819,14 +4819,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4984,13 +4984,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -5006,16 +5006,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5108,7 +5108,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5228,12 +5228,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5338,11 +5338,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5447,11 +5447,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5564,19 +5564,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5763,14 +5763,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5868,8 +5868,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5961,7 +5961,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -6144,19 +6144,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6249,7 +6249,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6396,11 +6396,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts index 552bd78d10..193508e16b 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/field_mask.ts @@ -696,7 +696,7 @@ export const FieldMask = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts index 8015edd6c0..c4b4953f5e 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -102,7 +102,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = omitDefault(message.fileName); + obj.file_name = message.fileName === "" ? undefined : message.fileName; return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/struct.ts b/__fixtures__/v-next/outputv2/google/protobuf/struct.ts index 2adea02389..440468d65a 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/struct.ts @@ -291,7 +291,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -553,7 +553,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.number_value !== undefined && object.number_value !== null) { message.numberValue = object.number_value; @@ -574,10 +574,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.number_value = message.numberValue === null ? undefined : message.numberValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; @@ -671,7 +671,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/protobuf/type.ts b/__fixtures__/v-next/outputv2/google/protobuf/type.ts index a29b6635e4..d35f3c810e 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/type.ts @@ -650,30 +650,30 @@ export const Type = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { - obj.fields = []; + obj.fields = message.fields; } if (message.oneofs) { obj.oneofs = message.oneofs.map(e => e); } else { - obj.oneofs = []; + obj.oneofs = message.oneofs; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -866,10 +866,10 @@ export const Field = { fromAmino(object: FieldAmino): Field { const message = createBaseField(); if (object.kind !== undefined && object.kind !== null) { - message.kind = field_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.cardinality !== undefined && object.cardinality !== null) { - message.cardinality = field_CardinalityFromJSON(object.cardinality); + message.cardinality = object.cardinality; } if (object.number !== undefined && object.number !== null) { message.number = object.number; @@ -897,20 +897,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = field_KindToJSON(message.kind); - obj.cardinality = field_CardinalityToJSON(message.cardinality); - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.cardinality = message.cardinality === 0 ? undefined : message.cardinality; + obj.number = message.number === 0 ? undefined : message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.packed = message.packed === false ? undefined : message.packed; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -1061,25 +1061,25 @@ export const Enum = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { - obj.enumvalue = []; + obj.enumvalue = message.enumvalue; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1198,12 +1198,12 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1304,7 +1304,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts index 062fd78a80..fbea471419 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -371,7 +371,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -454,7 +454,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -539,7 +539,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -624,7 +624,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -707,7 +707,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -790,7 +790,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -873,7 +873,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === false ? undefined : message.value; return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -956,7 +956,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts index a0d740db7c..1673540065 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts @@ -1204,7 +1204,7 @@ export const AttributeContext = { if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, @@ -1302,8 +1302,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1480,7 +1480,7 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; + obj.ip = message.ip === "" ? undefined : message.ip; obj.port = message.port ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { @@ -1488,8 +1488,8 @@ export const AttributeContext_Peer = { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = message.principal === "" ? undefined : message.principal; + obj.region_code = message.regionCode === "" ? undefined : message.regionCode; return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1617,10 +1617,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = message.service === "" ? undefined : message.service; + obj.operation = message.operation === "" ? undefined : message.operation; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1777,18 +1777,18 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = message.principal === "" ? undefined : message.principal; if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { - obj.audiences = []; + obj.audiences = message.audiences; } - obj.presenter = message.presenter; + obj.presenter = message.presenter === "" ? undefined : message.presenter; obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); } else { - obj.access_levels = []; + obj.access_levels = message.accessLevels; } return obj; }, @@ -1886,8 +1886,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -2171,22 +2171,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = message.id === "" ? undefined : message.id; + obj.method = message.method === "" ? undefined : message.method; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = message.path === "" ? undefined : message.path; + obj.host = message.host === "" ? undefined : message.host; + obj.scheme = message.scheme === "" ? undefined : message.scheme; + obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -2284,8 +2284,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2572,8 +2572,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2664,8 +2664,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2983,28 +2983,28 @@ export const AttributeContext_Resource = { }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = message.service === "" ? undefined : message.service; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = message.uid === "" ? undefined : message.uid; obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; obj.delete_time = message.deleteTime ? Timestamp.toAmino(toTimestamp(message.deleteTime)) : undefined; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = message.etag === "" ? undefined : message.etag; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputv2/google/rpc/error_details.ts b/__fixtures__/v-next/outputv2/google/rpc/error_details.ts index 0c36cc0ea8..7d96ca7211 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; +import { isSet, DeepPartial, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -951,9 +951,9 @@ export const DebugInfo = { if (message.stackEntries) { obj.stack_entries = message.stackEntries.map(e => e); } else { - obj.stack_entries = []; + obj.stack_entries = message.stackEntries; } - obj.detail = omitDefault(message.detail); + obj.detail = message.detail === "" ? undefined : message.detail; return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -1045,7 +1045,7 @@ export const QuotaFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? QuotaFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1144,8 +1144,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -1242,8 +1242,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1388,8 +1388,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = omitDefault(message.reason); - obj.domain = omitDefault(message.domain); + obj.reason = message.reason === "" ? undefined : message.reason; + obj.domain = message.domain === "" ? undefined : message.domain; obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1487,7 +1487,7 @@ export const PreconditionFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1601,9 +1601,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = omitDefault(message.type); - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.type = message.type === "" ? undefined : message.type; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1695,7 +1695,7 @@ export const BadRequest = { if (message.fieldViolations) { obj.field_violations = message.fieldViolations.map(e => e ? BadRequest_FieldViolation.toAmino(e) : undefined); } else { - obj.field_violations = []; + obj.field_violations = message.fieldViolations; } return obj; }, @@ -1794,8 +1794,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.description = omitDefault(message.description); + obj.field = message.field === "" ? undefined : message.field; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1893,8 +1893,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = omitDefault(message.requestId); - obj.serving_data = omitDefault(message.servingData); + obj.request_id = message.requestId === "" ? undefined : message.requestId; + obj.serving_data = message.servingData === "" ? undefined : message.servingData; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -2022,10 +2022,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = omitDefault(message.resourceType); - obj.resource_name = omitDefault(message.resourceName); - obj.owner = omitDefault(message.owner); - obj.description = omitDefault(message.description); + obj.resource_type = message.resourceType === "" ? undefined : message.resourceType; + obj.resource_name = message.resourceName === "" ? undefined : message.resourceName; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -2117,7 +2117,7 @@ export const Help = { if (message.links) { obj.links = message.links.map(e => e ? Help_Link.toAmino(e) : undefined); } else { - obj.links = []; + obj.links = message.links; } return obj; }, @@ -2216,8 +2216,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = omitDefault(message.description); - obj.url = omitDefault(message.url); + obj.description = message.description === "" ? undefined : message.description; + obj.url = message.url === "" ? undefined : message.url; return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -2315,8 +2315,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = omitDefault(message.locale); - obj.message = omitDefault(message.message); + obj.locale = message.locale === "" ? undefined : message.locale; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputv2/google/rpc/status.ts b/__fixtures__/v-next/outputv2/google/rpc/status.ts index 7e84984b56..34662ded0e 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -172,12 +172,12 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = omitDefault(message.code); - obj.message = omitDefault(message.message); + obj.code = message.code === 0 ? undefined : message.code; + obj.message = message.message === "" ? undefined : message.message; if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.details = []; + obj.details = message.details; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts index a368dd8bd2..0b3a350003 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -131,11 +131,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); + obj.port_id = message.portId === "" ? undefined : message.portId; if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts index 4cb18f1644..33af9a9633 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -233,7 +233,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = omitDefault(message.hash); + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { @@ -533,7 +533,7 @@ export const QueryDenomTracesResponse = { if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts index 871a858d92..22ea78785c 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -177,8 +177,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.base_denom = omitDefault(message.baseDenom); + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -283,8 +283,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = omitDefault(message.sendEnabled); - obj.receive_enabled = omitDefault(message.receiveEnabled); + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts index 8d9a705913..ffc7d3acb4 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -254,13 +254,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = omitDefault(message.sourcePort); - obj.source_channel = omitDefault(message.sourceChannel); + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); + obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts index eaea4ffd56..271712a346 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -160,10 +160,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts index 9930fa7dfb..c6b7e21e47 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts @@ -547,10 +547,10 @@ export const Channel = { fromAmino(object: ChannelAmino): Channel { const message = createBaseChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -563,15 +563,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -737,10 +737,10 @@ export const IdentifiedChannel = { fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { const message = createBaseIdentifiedChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -759,17 +759,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -874,8 +874,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -1077,10 +1077,10 @@ export const Packet = { toAmino(message: Packet): PacketAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; @@ -1220,8 +1220,8 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1329,7 +1329,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result ? base64FromBytes(message.result) : undefined; - obj.error = message.error; + obj.error = message.error === null ? undefined : message.error; return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts index b8b8da070c..1e20a5fe69 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -297,39 +297,39 @@ export const GenesisState = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } if (message.receipts) { obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.receipts = []; + obj.receipts = message.receipts; } if (message.sendSequences) { obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.send_sequences = []; + obj.send_sequences = message.sendSequences; } if (message.recvSequences) { obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.recv_sequences = []; + obj.recv_sequences = message.recvSequences; } if (message.ackSequences) { obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.ack_sequences = []; + obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = omitDefault(message.nextChannelSequence); + obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -451,9 +451,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.sequence = omitDefault(message.sequence); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts index 0ccd3b8c3f..8aad5fac7f 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts @@ -1107,8 +1107,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1459,7 +1459,7 @@ export const QueryChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1569,7 +1569,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = message.connection === "" ? undefined : message.connection; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1703,7 +1703,7 @@ export const QueryConnectionChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1811,8 +1811,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -2077,8 +2077,8 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -2220,7 +2220,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2344,8 +2344,8 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2592,8 +2592,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2727,7 +2727,7 @@ export const QueryPacketCommitmentsResponse = { if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -2852,8 +2852,8 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2976,7 +2976,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = message.received === false ? undefined : message.received; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -3100,8 +3100,8 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -3378,13 +3378,13 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3518,7 +3518,7 @@ export const QueryPacketAcknowledgementsResponse = { if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -3656,12 +3656,12 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3787,7 +3787,7 @@ export const QueryUnreceivedPacketsResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3924,12 +3924,12 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { - obj.packet_ack_sequences = []; + obj.packet_ack_sequences = message.packetAckSequences; } return obj; }, @@ -4055,7 +4055,7 @@ export const QueryUnreceivedAcksResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -4162,8 +4162,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts index ee0363e697..e404ebc66b 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts @@ -640,9 +640,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -898,13 +898,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -1158,13 +1158,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1388,11 +1388,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1584,9 +1584,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1810,11 +1810,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -2028,7 +2028,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -2260,7 +2260,7 @@ export const MsgTimeout = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2508,7 +2508,7 @@ export const MsgTimeoutOnClose = { obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2738,7 +2738,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts index 6bc023f8a4..c9aa5dd681 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanAmino, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -391,7 +391,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -613,11 +613,11 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } return obj; }, @@ -754,10 +754,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.subject_client_id = omitDefault(message.subjectClientId); - obj.substitute_client_id = omitDefault(message.substituteClientId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -897,8 +897,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -1005,8 +1005,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { @@ -1105,7 +1105,7 @@ export const Params = { if (message.allowedClients) { obj.allowed_clients = message.allowedClients.map(e => e); } else { - obj.allowed_clients = []; + obj.allowed_clients = message.allowedClients; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts index 1dc00432e0..1b17e7f239 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesAmino, ClientConsensusStatesSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -280,21 +280,21 @@ export const GenesisState = { if (message.clients) { obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.clients = []; + obj.clients = message.clients; } if (message.clientsConsensus) { obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); } else { - obj.clients_consensus = []; + obj.clients_consensus = message.clientsConsensus; } if (message.clientsMetadata) { obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); } else { - obj.clients_metadata = []; + obj.clients_metadata = message.clientsMetadata; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = omitDefault(message.createLocalhost); - obj.next_client_sequence = omitDefault(message.nextClientSequence); + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; + obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -511,11 +511,11 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { - obj.client_metadata = []; + obj.client_metadata = message.clientMetadata; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts index 0ee8af7c1c..e0f0c68fc1 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyAmino, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightAmino, HeightSDKType, IdentifiedClientState, IdentifiedClientStateAmino, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightAmino, ConsensusStateWithHeightSDKType, Params, ParamsAmino, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -601,7 +601,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -935,7 +935,7 @@ export const QueryClientStatesResponse = { if (message.clientStates) { obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.client_states = []; + obj.client_states = message.clientStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1076,10 +1076,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); - obj.latest_height = omitDefault(message.latestHeight); + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1312,7 +1312,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1429,7 +1429,7 @@ export const QueryConsensusStatesResponse = { if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1521,7 +1521,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1611,7 +1611,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = omitDefault(message.status); + obj.status = message.status === "" ? undefined : message.status; return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts index 77b03ccce8..0e76d91b4f 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/tx.ts @@ -350,7 +350,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -544,9 +544,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -787,12 +787,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -986,9 +986,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts index e55763baee..391cb3d31c 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/commitment/v1/commitment.ts @@ -387,7 +387,7 @@ export const MerklePath = { if (message.keyPath) { obj.key_path = message.keyPath.map(e => e); } else { - obj.key_path = []; + obj.key_path = message.keyPath; } return obj; }, @@ -487,7 +487,7 @@ export const MerkleProof = { if (message.proofs) { obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); } else { - obj.proofs = []; + obj.proofs = message.proofs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts index 164575077f..3167090512 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts @@ -472,7 +472,7 @@ export const ConnectionEnd = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -484,13 +484,13 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -655,7 +655,7 @@ export const IdentifiedConnection = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -667,14 +667,14 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -798,8 +798,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -899,7 +899,7 @@ export const ClientPaths = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -1011,11 +1011,11 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -1127,11 +1127,11 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; if (message.features) { obj.features = message.features.map(e => e); } else { - obj.features = []; + obj.features = message.features; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts index db0a936b63..b24ec1d1b0 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionAmino, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsAmino, ConnectionPathsSDKType, Params, ParamsAmino, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -162,14 +162,14 @@ export const GenesisState = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } if (message.clientConnectionPaths) { obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); } else { - obj.client_connection_paths = []; + obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); + obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts index 00dd7f6c08..9ad5300289 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts @@ -442,7 +442,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -793,7 +793,7 @@ export const QueryConnectionsResponse = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -886,7 +886,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -1017,7 +1017,7 @@ export const QueryClientConnectionsResponse = { if (message.connectionPaths) { obj.connection_paths = message.connectionPaths.map(e => e); } else { - obj.connection_paths = []; + obj.connection_paths = message.connectionPaths; } obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1110,7 +1110,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1360,7 +1360,7 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1502,7 +1502,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts index df234d2c57..28ce26262b 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts @@ -440,11 +440,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -787,22 +787,22 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.counterparty_versions = []; + obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -1107,8 +1107,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1116,7 +1116,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1325,10 +1325,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts index b4ce67ac7d..9033d7a80f 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/port/v1/query.ts @@ -186,7 +186,7 @@ export const QueryAppVersionRequest = { message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -198,11 +198,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -307,8 +307,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts index 441f901525..8d341796bf 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightAmino, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -120,7 +120,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = omitDefault(message.chainId); + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts index 21562ac0d3..55bdab7bcf 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts @@ -766,7 +766,7 @@ export const ClientState = { obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -891,7 +891,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -1052,7 +1052,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1193,7 +1193,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1321,7 +1321,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1334,7 +1334,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1589,7 +1589,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1600,8 +1600,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1710,7 +1710,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts index 3494cc099c..5ac62f77ae 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts @@ -762,9 +762,9 @@ export const ClientState = { toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -889,7 +889,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -1050,7 +1050,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1191,7 +1191,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1319,7 +1319,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1332,7 +1332,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1587,7 +1587,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1598,8 +1598,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1708,7 +1708,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts index 9a6349f370..80ddf5b8f6 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts @@ -529,7 +529,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -539,15 +539,15 @@ export const ClientState = { if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -795,7 +795,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts index b257888fd7..9a098fed00 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -200,16 +200,16 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_claimable_amount = []; + obj.initial_claimable_amount = message.initialClaimableAmount; } if (message.actionCompleted) { obj.action_completed = message.actionCompleted.map(e => e); } else { - obj.action_completed = []; + obj.action_completed = message.actionCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts index e5201490d1..5d9e255b28 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/genesis.ts @@ -146,7 +146,7 @@ export const GenesisState = { if (message.claimRecords) { obj.claim_records = message.claimRecords.map(e => e ? ClaimRecord.toAmino(e) : undefined); } else { - obj.claim_records = []; + obj.claim_records = message.claimRecords; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts index adb394f054..61fbf7d3c2 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/params.ts @@ -151,7 +151,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = message.claimDenom === "" ? undefined : message.claimDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts index 44481edc4f..da9f74b606 100644 --- a/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/claim/v1beta1/query.ts @@ -327,7 +327,7 @@ export const QueryModuleAccountBalanceResponse = { if (message.moduleAccountBalance) { obj.moduleAccountBalance = message.moduleAccountBalance.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.moduleAccountBalance = []; + obj.moduleAccountBalance = message.moduleAccountBalance; } return obj; }, @@ -582,7 +582,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -773,14 +773,14 @@ export const QueryClaimableForActionRequest = { message.address = object.address; } if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } return message; }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = actionToJSON(message.action); + obj.address = message.address === "" ? undefined : message.address; + obj.action = message.action === 0 ? undefined : message.action; return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -879,7 +879,7 @@ export const QueryClaimableForActionResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -970,7 +970,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { @@ -1069,7 +1069,7 @@ export const QueryTotalClaimableResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts index b8e5e2b0ac..a49fb005f3 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts @@ -321,12 +321,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -426,7 +426,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts index 0be8807585..39e5913ec7 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { @@ -210,7 +210,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, @@ -301,7 +301,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -393,7 +393,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts index 7a7d847f0e..071e5e86d5 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp } from "../../../../google/protobuf/timestamp"; import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -397,12 +397,12 @@ export const SmoothWeightChangeParams = { if (message.initialPoolWeights) { obj.initial_pool_weights = message.initialPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.initial_pool_weights = []; + obj.initial_pool_weights = message.initialPoolWeights; } if (message.targetPoolWeights) { obj.target_pool_weights = message.targetPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.target_pool_weights = []; + obj.target_pool_weights = message.targetPoolWeights; } return obj; }, @@ -525,8 +525,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -635,7 +635,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -828,17 +828,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts index a275e6dac6..99ad999173 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType, PoolAsset, PoolAssetAmino, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -169,14 +169,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -268,7 +268,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 66579f6cea..dd7e866ca4 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -192,8 +192,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = padDecimal(message.swapFee); - obj.exit_fee = padDecimal(message.exitFee); + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -416,22 +416,22 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.id = omitDefault(message.id); + obj.address = message.address === "" ? undefined : message.address; + obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_liquidity = []; + obj.pool_liquidity = message.poolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.scaling_factor_controller = omitDefault(message.scalingFactorController); + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts index 18ad0bf4af..43ba88bdfb 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsAmino, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -267,20 +267,20 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_pool_liquidity = []; + obj.initial_pool_liquidity = message.initialPoolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); - obj.scaling_factor_controller = omitDefault(message.scalingFactorController); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -372,7 +372,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -509,12 +509,12 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts index 0ceb1bc420..34784efc33 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts @@ -7,7 +7,7 @@ import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stableswap_pool"; import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -134,7 +134,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -268,9 +268,9 @@ export const GenesisState = { if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } - obj.next_pool_number = omitDefault(message.nextPoolNumber); + obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, @@ -308,7 +308,7 @@ export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 return data; } }; -export const PoolI_FromAmino = (content: AnyAmino) => { +export const PoolI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "osmosis/gamm/pool": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts index 143abdca80..468b305b15 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts @@ -9,7 +9,7 @@ import { Pool as Pool2 } from "../pool-models/stableswap/stableswap_pool"; import { PoolProtoMsg as Pool2ProtoMsg } from "../pool-models/stableswap/stableswap_pool"; import { PoolSDKType as Pool2SDKType } from "../pool-models/stableswap/stableswap_pool"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -714,7 +714,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -1014,7 +1014,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1180,7 +1180,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = omitDefault(message.numPools); + obj.num_pools = message.numPools ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1272,7 +1272,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1362,7 +1362,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = omitDefault(message.poolType); + obj.pool_type = message.poolType === "" ? undefined : message.poolType; return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1475,11 +1475,11 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -1591,11 +1591,11 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1703,8 +1703,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1803,7 +1803,7 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1896,7 +1896,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -2080,7 +2080,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2179,7 +2179,7 @@ export const QueryTotalPoolLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -2272,7 +2272,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2477,11 +2477,11 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -2596,9 +2596,9 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } - obj.shares_out = omitDefault(message.sharesOut); + obj.shares_out = message.sharesOut === "" ? undefined : message.sharesOut; return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2720,9 +2720,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2853,9 +2853,9 @@ export const QueryPoolsWithFilterRequest = { if (message.minLiquidity) { obj.min_liquidity = message.minLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_liquidity = []; + obj.min_liquidity = message.minLiquidity; } - obj.pool_type = omitDefault(message.poolType); + obj.pool_type = message.poolType === "" ? undefined : message.poolType; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2972,7 +2972,7 @@ export const QueryPoolsWithFilterResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3064,7 +3064,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -3207,13 +3207,13 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_in = omitDefault(message.tokenIn); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -3304,7 +3304,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3447,14 +3447,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = omitDefault(message.tokenOut); + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3544,7 +3544,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { @@ -3715,7 +3715,7 @@ export const QueryTotalLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -3753,7 +3753,7 @@ export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 return data; } }; -export const PoolI_FromAmino = (content: AnyAmino) => { +export const PoolI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "osmosis/gamm/pool": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts index 2c4f636860..858ed5bcbc 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -555,13 +555,13 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -673,11 +673,11 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in = []; + obj.token_in = message.tokenIn; } return obj; }, @@ -821,13 +821,13 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out_mins = []; + obj.token_out_mins = message.tokenOutMins; } return obj; }, @@ -927,7 +927,7 @@ export const MsgExitPoolResponse = { if (message.tokenOut) { obj.token_out = message.tokenOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out = []; + obj.token_out = message.tokenOut; } return obj; }, @@ -1035,8 +1035,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -1179,14 +1179,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1276,7 +1276,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1383,8 +1383,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1527,13 +1527,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1624,7 +1624,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1763,10 +1763,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); + obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1856,7 +1856,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -2008,11 +2008,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); - obj.share_out_amount = omitDefault(message.shareOutAmount); - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -2102,7 +2102,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2254,11 +2254,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); - obj.share_in_amount = omitDefault(message.shareInAmount); - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2348,7 +2348,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2487,10 +2487,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); + obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2580,7 +2580,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts index 654411560b..cf2c2455cb 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -164,9 +164,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -256,7 +256,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts index f3e6c64696..937e0bc18c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -86,7 +86,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts index 56ef1d2c92..90b346c20c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts @@ -320,12 +320,12 @@ export const Gauge = { toAmino(message: Gauge): GaugeAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -333,7 +333,7 @@ export const Gauge = { if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.distributed_coins = []; + obj.distributed_coins = message.distributedCoins; } return obj; }, @@ -433,7 +433,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts index f566c97295..40b43f5b60 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -192,14 +192,14 @@ export const GenesisState = { if (message.gauges) { obj.gauges = message.gauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.gauges = []; + obj.gauges = message.gauges; } if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = omitDefault(message.lastGaugeId); + obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts index 7bc3e2c8e2..bf648d6108 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -94,7 +94,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); + obj.distr_epoch_identifier = message.distrEpochIdentifier === "" ? undefined : message.distrEpochIdentifier; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts index a8463fca6b..8f2777285b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestProtoMsg { @@ -534,7 +534,7 @@ export const ModuleToDistributeCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -627,7 +627,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -927,7 +927,7 @@ export const GaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1137,7 +1137,7 @@ export const ActiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1246,7 +1246,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1363,7 +1363,7 @@ export const ActiveGaugesPerDenomResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1573,7 +1573,7 @@ export const UpcomingGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1682,7 +1682,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1799,7 +1799,7 @@ export const UpcomingGaugesPerDenomResponse = { if (message.upcomingGauges) { obj.upcoming_gauges = message.upcomingGauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.upcoming_gauges = []; + obj.upcoming_gauges = message.upcomingGauges; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1938,13 +1938,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { - obj.lock_ids = []; + obj.lock_ids = message.lockIds; } - obj.end_epoch = omitDefault(message.endEpoch); + obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { @@ -2043,7 +2043,7 @@ export const RewardsEstResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -2215,7 +2215,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts index e66eaf4cbf..9374e4655f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts @@ -279,13 +279,13 @@ export const MsgCreateGauge = { }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; + obj.owner = message.owner === "" ? undefined : message.owner; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -488,12 +488,12 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts index 448c1cdc64..56728b5e02 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -137,16 +137,16 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = omitDefault(message.lastLockId); + obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts index 3daa16e8d8..4f38386026 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts @@ -405,13 +405,13 @@ export const PeriodLock = { toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -534,7 +534,7 @@ export const QueryCondition = { fromAmino(object: QueryConditionAmino): QueryCondition { const message = createBaseQueryCondition(); if (object.lock_query_type !== undefined && object.lock_query_type !== null) { - message.lockQueryType = lockQueryTypeFromJSON(object.lock_query_type); + message.lockQueryType = object.lock_query_type; } if (object.denom !== undefined && object.denom !== null) { message.denom = object.denom; @@ -549,8 +549,8 @@ export const QueryCondition = { }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = lockQueryTypeToJSON(message.lockQueryType); - obj.denom = message.denom; + obj.lock_query_type = message.lockQueryType === 0 ? undefined : message.lockQueryType; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; @@ -692,7 +692,7 @@ export const SyntheticLock = { toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts index fca9e954e5..651a4c7012 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/params.ts @@ -92,7 +92,7 @@ export const Params = { if (message.forceUnlockAllowedAddresses) { obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses.map(e => e); } else { - obj.force_unlock_allowed_addresses = []; + obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts index 20304c3605..9ca90d5e36 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts @@ -745,7 +745,7 @@ export const ModuleBalanceResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -917,7 +917,7 @@ export const ModuleLockedAmountResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1008,7 +1008,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -1107,7 +1107,7 @@ export const AccountUnlockableCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1198,7 +1198,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1297,7 +1297,7 @@ export const AccountUnlockingCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1388,7 +1388,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1487,7 +1487,7 @@ export const AccountLockedCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1593,7 +1593,7 @@ export const AccountLockedPastTimeRequest = { }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1693,7 +1693,7 @@ export const AccountLockedPastTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1799,7 +1799,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1899,7 +1899,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2005,7 +2005,7 @@ export const AccountUnlockedBeforeTimeRequest = { }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -2105,7 +2105,7 @@ export const AccountUnlockedBeforeTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2226,9 +2226,9 @@ export const AccountLockedPastTimeDenomRequest = { }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2327,7 +2327,7 @@ export const AccountLockedPastTimeDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2435,7 +2435,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2526,7 +2526,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2901,7 +2901,7 @@ export const SyntheticLockupsByLockupIDResponse = { if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -3009,7 +3009,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3109,7 +3109,7 @@ export const AccountLockedLongerDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3217,7 +3217,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3317,7 +3317,7 @@ export const AccountLockedDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3425,7 +3425,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3525,7 +3525,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3648,9 +3648,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { @@ -3749,7 +3749,7 @@ export const AccountLockedLongerDurationDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts index a9e7b6a3ea..e59319c88f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockAmino, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -337,12 +337,12 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -435,7 +435,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -525,7 +525,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -624,7 +624,7 @@ export const MsgBeginUnlockingAllResponse = { if (message.unlocks) { obj.unlocks = message.unlocks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.unlocks = []; + obj.unlocks = message.unlocks; } return obj; }, @@ -753,12 +753,12 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -849,7 +849,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -973,8 +973,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1065,7 +1065,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1193,12 +1193,12 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1289,7 +1289,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts index 9be854cd9a..b0adc047a0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterAmino, MinterSDKType, Params, ParamsAmino, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -143,7 +143,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); + obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts index 02d8868aa1..c31b2a4f5d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -290,7 +290,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = padDecimal(message.epochProvisions); + obj.epoch_provisions = padDecimal(message.epochProvisions) === "" ? undefined : padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -395,8 +395,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.weight = padDecimal(message.weight); + obj.address = message.address === "" ? undefined : message.address; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -531,10 +531,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = padDecimal(message.staking); - obj.pool_incentives = padDecimal(message.poolIncentives); - obj.developer_rewards = padDecimal(message.developerRewards); - obj.community_pool = padDecimal(message.communityPool); + obj.staking = padDecimal(message.staking) === "" ? undefined : padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives) === "" ? undefined : padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards) === "" ? undefined : padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -741,18 +741,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); - obj.epoch_identifier = omitDefault(message.epochIdentifier); - obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); - obj.reduction_factor = padDecimal(message.reductionFactor); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions) === "" ? undefined : padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_factor = padDecimal(message.reductionFactor) === "" ? undefined : padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { - obj.weighted_developer_rewards_receivers = []; + obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts index 7ca2185f0b..33090d3fe5 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/genesis.ts @@ -160,7 +160,7 @@ export const GenesisState = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.distr_info = message.distrInfo ? DistrInfo.toAmino(message.distrInfo) : undefined; obj.pool_to_gauges = message.poolToGauges ? PoolToGauges.toAmino(message.poolToGauges) : undefined; diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts index 7ebcad2116..65341fa1f8 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordAmino, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -208,12 +208,12 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -341,12 +341,12 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts index 0cd666e303..5c5c2d8345 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -193,7 +193,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = omitDefault(message.mintedDenom); + obj.minted_denom = message.mintedDenom === "" ? undefined : message.mintedDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -292,7 +292,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -404,11 +404,11 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = omitDefault(message.totalWeight); + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -516,8 +516,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = omitDefault(message.gaugeId); - obj.weight = omitDefault(message.weight); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -643,8 +643,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.gauge_id = omitDefault(message.gaugeId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -744,7 +744,7 @@ export const PoolToGauges = { if (message.poolToGauge) { obj.pool_to_gauge = message.poolToGauge.map(e => e ? PoolToGauge.toAmino(e) : undefined); } else { - obj.pool_to_gauge = []; + obj.pool_to_gauge = message.poolToGauge; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts index 4bc4bdfdc2..09e4e85aeb 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protob import { DistrInfo, DistrInfoAmino, DistrInfoSDKType, Params, ParamsAmino, ParamsSDKType } from "./incentives"; import { Gauge, GaugeAmino, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -291,7 +291,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -390,7 +390,7 @@ export const QueryGaugeIdsResponse = { if (message.gaugeIdsWithDuration) { obj.gauge_ids_with_duration = message.gaugeIdsWithDuration.map(e => e ? QueryGaugeIdsResponse_GaugeIdWithDuration.toAmino(e) : undefined); } else { - obj.gauge_ids_with_duration = []; + obj.gauge_ids_with_duration = message.gaugeIdsWithDuration; } return obj; }, @@ -515,9 +515,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = omitDefault(message.gaugeId); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); + obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -1016,7 +1016,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -1215,9 +1215,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = omitDefault(message.gaugeId); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { @@ -1316,7 +1316,7 @@ export const QueryIncentivizedPoolsResponse = { if (message.incentivizedPools) { obj.incentivized_pools = message.incentivizedPools.map(e => e ? IncentivizedPool.toAmino(e) : undefined); } else { - obj.incentivized_pools = []; + obj.incentivized_pools = message.incentivizedPools; } return obj; }, @@ -1488,7 +1488,7 @@ export const QueryExternalIncentiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts index be7e6d9a28..e1d2dabe10 100644 --- a/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv2/osmosis/sumtree/v1beta1/tree.ts @@ -129,7 +129,7 @@ export const Node = { if (message.children) { obj.children = message.children.map(e => e ? Child.toAmino(e) : undefined); } else { - obj.children = []; + obj.children = message.children; } return obj; }, @@ -236,7 +236,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index ? base64FromBytes(message.index) : undefined; - obj.accumulation = message.accumulation; + obj.accumulation = message.accumulation === "" ? undefined : message.accumulation; return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts index 8c607fc0ca..b2e333f280 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/genesis.ts @@ -214,22 +214,22 @@ export const GenesisState = { if (message.superfluidAssets) { obj.superfluid_assets = message.superfluidAssets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.superfluid_assets = []; + obj.superfluid_assets = message.superfluidAssets; } if (message.osmoEquivalentMultipliers) { obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers.map(e => e ? OsmoEquivalentMultiplierRecord.toAmino(e) : undefined); } else { - obj.osmo_equivalent_multipliers = []; + obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers; } if (message.intermediaryAccounts) { obj.intermediary_accounts = message.intermediaryAccounts.map(e => e ? SuperfluidIntermediaryAccount.toAmino(e) : undefined); } else { - obj.intermediary_accounts = []; + obj.intermediary_accounts = message.intermediaryAccounts; } if (message.intemediaryAccountConnections) { obj.intemediary_account_connections = message.intemediaryAccountConnections.map(e => e ? LockIdIntermediaryAccountConnection.toAmino(e) : undefined); } else { - obj.intemediary_account_connections = []; + obj.intemediary_account_connections = message.intemediaryAccountConnections; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts index cc2faf6c0f..2dd9ef1e66 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/params.ts @@ -99,7 +99,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor) === "" ? undefined : padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts index 60c9aa3c55..3e6cb863aa 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts @@ -812,7 +812,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -896,13 +896,13 @@ export const AssetTypeResponse = { fromAmino(object: AssetTypeResponseAmino): AssetTypeResponse { const message = createBaseAssetTypeResponse(); if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -1073,7 +1073,7 @@ export const AllAssetsResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1164,7 +1164,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1393,10 +1393,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1604,7 +1604,7 @@ export const AllIntermediaryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? SuperfluidIntermediaryAccountInfo.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1880,7 +1880,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1979,7 +1979,7 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? Delegations.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -2100,9 +2100,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; + obj.amount_sfsd = message.amountSfsd === "" ? undefined : message.amountSfsd; + obj.osmo_equivalent = message.osmoEquivalent === "" ? undefined : message.osmoEquivalent; return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -2264,7 +2264,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = message.totalDelegations === "" ? undefined : message.totalDelegations; return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2384,9 +2384,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2485,7 +2485,7 @@ export const SuperfluidDelegationAmountResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -2576,7 +2576,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2713,12 +2713,12 @@ export const SuperfluidDelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -2825,8 +2825,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2967,17 +2967,17 @@ export const SuperfluidUndelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalUndelegatedCoins) { obj.total_undelegated_coins = message.totalUndelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_undelegated_coins = []; + obj.total_undelegated_coins = message.totalUndelegatedCoins; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -3083,8 +3083,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -3183,7 +3183,7 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } return obj; }, @@ -3289,8 +3289,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3389,7 +3389,7 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } return obj; }, @@ -3480,7 +3480,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { @@ -3638,17 +3638,17 @@ export const QueryTotalDelegationByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.delegationResponse) { obj.delegation_response = message.delegationResponse.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_response = []; + obj.delegation_response = message.delegationResponse; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -3830,7 +3830,7 @@ export const QueryUnpoolWhitelistResponse = { if (message.poolIds) { obj.pool_ids = message.poolIds.map(e => e.toString()); } else { - obj.pool_ids = []; + obj.pool_ids = message.poolIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts index cbe1515436..48f872d37c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -328,14 +328,14 @@ export const SuperfluidAsset = { message.denom = object.denom; } if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -457,8 +457,8 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, @@ -582,8 +582,8 @@ export const OsmoEquivalentMultiplierRecord = { toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.multiplier = padDecimal(message.multiplier) === "" ? undefined : padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -722,8 +722,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -833,7 +833,7 @@ export const LockIdIntermediaryAccountConnection = { toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { @@ -941,7 +941,7 @@ export const UnpoolWhitelistedPools = { if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts index 2df1c6002e..32c9643c7d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -317,9 +317,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); - obj.val_addr = omitDefault(message.valAddr); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -498,8 +498,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -678,8 +678,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -877,13 +877,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } - obj.val_addr = omitDefault(message.valAddr); + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -975,7 +975,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1082,8 +1082,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { @@ -1191,7 +1191,7 @@ export const MsgUnPoolWhitelistedPoolResponse = { if (message.exitedLockIds) { obj.exited_lock_ids = message.exitedLockIds.map(e => e.toString()); } else { - obj.exited_lock_ids = []; + obj.exited_lock_ids = message.exitedLockIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts index cded1b30f5..98d7b188ae 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -218,12 +218,12 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -351,12 +351,12 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { - obj.superfluid_asset_denoms = []; + obj.superfluid_asset_denoms = message.superfluidAssetDenoms; } return obj; }, @@ -508,14 +508,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } - obj.is_overwrite = omitDefault(message.isOverwrite); + obj.is_overwrite = message.isOverwrite === false ? undefined : message.isOverwrite; return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index 0b4a8a7e34..857186384f 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -100,7 +100,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts index f09dfde3d0..fe42a8634b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -155,7 +155,7 @@ export const GenesisState = { if (message.factoryDenoms) { obj.factory_denoms = message.factoryDenoms.map(e => e ? GenesisDenom.toAmino(e) : undefined); } else { - obj.factory_denoms = []; + obj.factory_denoms = message.factoryDenoms; } return obj; }, @@ -263,7 +263,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts index 80ffd2b53f..86643a593a 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/params.ts @@ -96,7 +96,7 @@ export const Params = { if (message.denomCreationFee) { obj.denom_creation_fee = message.denomCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.denom_creation_fee = []; + obj.denom_creation_fee = message.denomCreationFee; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts index 306586ff11..3ad1959faf 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -384,7 +384,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -566,7 +566,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = omitDefault(message.creator); + obj.creator = message.creator === "" ? undefined : message.creator; return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { @@ -665,7 +665,7 @@ export const QueryDenomsFromCreatorResponse = { if (message.denoms) { obj.denoms = message.denoms.map(e => e); } else { - obj.denoms = []; + obj.denoms = message.denoms; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts index 28739037e4..79b0c59566 100644 --- a/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataAmino, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -366,8 +366,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.subdenom = omitDefault(message.subdenom); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.subdenom = message.subdenom === "" ? undefined : message.subdenom; return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -457,7 +457,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = omitDefault(message.newTokenDenom); + obj.new_token_denom = message.newTokenDenom === "" ? undefined : message.newTokenDenom; return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -564,7 +564,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -744,7 +744,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -937,9 +937,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.denom = omitDefault(message.denom); - obj.new_admin = omitDefault(message.newAdmin); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -1118,7 +1118,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts index 9f2f33d96e..e0412f8ebb 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordAmino, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -135,7 +135,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); + obj.prune_epoch_identifier = message.pruneEpochIdentifier === "" ? undefined : message.pruneEpochIdentifier; obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, @@ -252,7 +252,7 @@ export const GenesisState = { if (message.twaps) { obj.twaps = message.twaps.map(e => e ? TwapRecord.toAmino(e) : undefined); } else { - obj.twaps = []; + obj.twaps = message.twaps; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts index 4e8bec56f5..92334d91a7 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -249,8 +249,8 @@ export const ArithmeticTwapRequest = { toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; return obj; @@ -342,7 +342,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -480,8 +480,8 @@ export const ArithmeticTwapToNowRequest = { toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -572,7 +572,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts index 16c781e3cc..e97161773c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -311,14 +311,14 @@ export const TwapRecord = { toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; + obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; + obj.height = message.height ? message.height.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice) === "" ? undefined : padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice) === "" ? undefined : padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts index 9b3b8401b9..e547811457 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -121,8 +121,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.poolID = omitDefault(message.poolID); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts index b1a2b080de..56d8d308a3 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -111,11 +111,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = omitDefault(message.basedenom); + obj.basedenom = message.basedenom === "" ? undefined : message.basedenom; if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.feetokens = []; + obj.feetokens = message.feetokens; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts index f4a1368b02..8d5c4085f0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -146,8 +146,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts index a5707b47d7..8d2d2765ff 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -300,7 +300,7 @@ export const QueryFeeTokensResponse = { if (message.feeTokens) { obj.fee_tokens = message.feeTokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.fee_tokens = []; + obj.fee_tokens = message.feeTokens; } return obj; }, @@ -391,7 +391,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -498,8 +498,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); - obj.spot_price = padDecimal(message.spotPrice); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.spot_price = padDecimal(message.spotPrice) === "" ? undefined : padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -589,7 +589,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -681,7 +681,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -843,7 +843,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = omitDefault(message.baseDenom); + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts index b5fb539e06..28e7dc0cfb 100644 --- a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts @@ -1787,7 +1787,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1969,7 +1969,7 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; return obj; @@ -2069,8 +2069,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -2239,12 +2239,12 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; @@ -2378,9 +2378,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.path = message.path; + obj.path = message.path === "" ? undefined : message.path; obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.prove = message.prove === false ? undefined : message.prove; return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2524,7 +2524,7 @@ export const RequestBeginBlock = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } return obj; }, @@ -2617,14 +2617,14 @@ export const RequestCheckTx = { message.tx = bytesFromBase64(object.tx); } if (object.type !== undefined && object.type !== null) { - message.type = checkTxTypeFromJSON(object.type); + message.type = object.type; } return message; }, toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.type = checkTxTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -3139,8 +3139,8 @@ export const RequestLoadSnapshotChunk = { toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -3253,9 +3253,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3693,7 +3693,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3776,7 +3776,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3988,8 +3988,8 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; @@ -4105,9 +4105,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -4232,7 +4232,7 @@ export const ResponseInitChain = { if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; @@ -4443,15 +4443,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.index = message.index ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4543,7 +4543,7 @@ export const ResponseBeginBlock = { if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4742,18 +4742,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4951,18 +4951,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -5092,13 +5092,13 @@ export const ResponseEndBlock = { if (message.validatorUpdates) { obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validator_updates = []; + obj.validator_updates = message.validatorUpdates; } obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -5292,7 +5292,7 @@ export const ResponseListSnapshots = { if (message.snapshots) { obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); } else { - obj.snapshots = []; + obj.snapshots = message.snapshots; } return obj; }, @@ -5370,13 +5370,13 @@ export const ResponseOfferSnapshot = { fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = responseOfferSnapshot_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -5585,7 +5585,7 @@ export const ResponseApplySnapshotChunk = { fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); if (object.result !== undefined && object.result !== null) { - message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + message.result = object.result; } message.refetchChunks = object.refetch_chunks?.map(e => e) || []; message.rejectSenders = object.reject_senders?.map(e => e) || []; @@ -5593,16 +5593,16 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { - obj.refetch_chunks = []; + obj.refetch_chunks = message.refetchChunks; } if (message.rejectSenders) { obj.reject_senders = message.rejectSenders.map(e => e); } else { - obj.reject_senders = []; + obj.reject_senders = message.rejectSenders; } return obj; }, @@ -5949,11 +5949,11 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, @@ -6058,11 +6058,11 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -6178,7 +6178,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.index = message.index; + obj.index = message.index === false ? undefined : message.index; return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -6311,7 +6311,7 @@ export const TxResult = { toAmino(message: TxResult): TxResultAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -6618,7 +6618,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6749,7 +6749,7 @@ export const Evidence = { fromAmino(object: EvidenceAmino): Evidence { const message = createBaseEvidence(); if (object.type !== undefined && object.type !== null) { - message.type = evidenceTypeFromJSON(object.type); + message.type = object.type; } if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); @@ -6767,7 +6767,7 @@ export const Evidence = { }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = evidenceTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; @@ -6917,8 +6917,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts index 4249f6a930..a44b6fb8bd 100644 --- a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts @@ -257,7 +257,7 @@ export const Proof = { if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); } else { - obj.aunts = []; + obj.aunts = message.aunts; } return obj; }, @@ -472,9 +472,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -587,7 +587,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -681,7 +681,7 @@ export const ProofOps = { if (message.ops) { obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); } else { - obj.ops = []; + obj.ops = message.ops; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts index 1c0ab40675..34b875f406 100644 --- a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -117,11 +117,11 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = omitDefault(message.bits); + obj.bits = message.bits ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { - obj.elems = []; + obj.elems = message.elems; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts index 781aba721c..a94a82fead 100644 --- a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts @@ -427,12 +427,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = message.nodeId === "" ? undefined : message.nodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; - obj.moniker = message.moniker; + obj.moniker = message.moniker === "" ? undefined : message.moniker; obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -531,8 +531,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -651,11 +651,11 @@ export const PeerInfo = { }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { - obj.address_info = []; + obj.address_info = message.addressInfo; } obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; return obj; @@ -785,10 +785,10 @@ export const PeerAddressInfo = { }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; - obj.dial_failures = message.dialFailures; + obj.dial_failures = message.dialFailures === 0 ? undefined : message.dialFailures; return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts index 847bca798f..97a4e4de14 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts @@ -504,7 +504,7 @@ export const LightClientAttackEvidence = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -599,7 +599,7 @@ export const EvidenceList = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputv2/tendermint/types/params.ts b/__fixtures__/v-next/outputv2/tendermint/types/params.ts index e210a571b1..90dfebda69 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -479,9 +479,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = omitDefault(message.maxBytes); - obj.max_gas = omitDefault(message.maxGas); - obj.time_iota_ms = omitDefault(message.timeIotaMs); + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -600,9 +600,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); + obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = omitDefault(message.maxBytes); + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -694,7 +694,7 @@ export const ValidatorParams = { if (message.pubKeyTypes) { obj.pub_key_types = message.pubKeyTypes.map(e => e); } else { - obj.pub_key_types = []; + obj.pub_key_types = message.pubKeyTypes; } return obj; }, @@ -780,7 +780,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = omitDefault(message.appVersion); + obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -882,8 +882,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = omitDefault(message.blockMaxBytes); - obj.block_max_gas = omitDefault(message.blockMaxGas); + obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/types.ts b/__fixtures__/v-next/outputv2/tendermint/types/types.ts index 8ae69dcdaa..932d44ed8a 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/types.ts @@ -589,7 +589,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = message.total === 0 ? undefined : message.total; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, @@ -705,7 +705,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -1093,7 +1093,7 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; @@ -1197,7 +1197,7 @@ export const Data = { if (message.txs) { obj.txs = message.txs.map(e => base64FromBytes(e)); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, @@ -1363,7 +1363,7 @@ export const Vote = { fromAmino(object: VoteAmino): Vote { const message = createBaseVote(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1390,13 +1390,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; - obj.validator_index = message.validatorIndex; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -1536,12 +1536,12 @@ export const Commit = { toAmino(message: Commit): CommitAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1655,7 +1655,7 @@ export const CommitSig = { fromAmino(object: CommitSigAmino): CommitSig { const message = createBaseCommitSig(); if (object.block_id_flag !== undefined && object.block_id_flag !== null) { - message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + message.blockIdFlag = object.block_id_flag; } if (object.validator_address !== undefined && object.validator_address !== null) { message.validatorAddress = bytesFromBase64(object.validator_address); @@ -1670,7 +1670,7 @@ export const CommitSig = { }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; @@ -1826,7 +1826,7 @@ export const Proposal = { fromAmino(object: ProposalAmino): Proposal { const message = createBaseProposal(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1850,10 +1850,10 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; diff --git a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts index d81ff8db2e..dcba6d6e5a 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeyAmino, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -178,10 +178,10 @@ export const ValidatorSet = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -317,8 +317,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); - obj.proposer_priority = omitDefault(message.proposerPriority); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -421,7 +421,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv2/tendermint/version/types.ts b/__fixtures__/v-next/outputv2/tendermint/version/types.ts index 70ba879f6d..9bd3530c88 100644 --- a/__fixtures__/v-next/outputv2/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -152,8 +152,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = omitDefault(message.protocol); - obj.software = omitDefault(message.software); + obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.software = message.software === "" ? undefined : message.software; return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -255,8 +255,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = omitDefault(message.block); - obj.app = omitDefault(message.app); + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts index 9ef6a55626..80aa6c2326 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts @@ -245,12 +245,12 @@ export const Provider = { }, toAmino(message: Provider, useInterfaces: boolean = true): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -367,12 +367,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes, useInterfaces: boolean = true): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -573,12 +573,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -695,12 +695,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes, useInterfaces: boolean = true): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -879,12 +879,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes, useInterfaces: boolean = true): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts index d2d721c641..4a1f25b93d 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts @@ -245,12 +245,12 @@ export const Provider = { }, toAmino(message: Provider, useInterfaces: boolean = true): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -367,12 +367,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes, useInterfaces: boolean = true): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -573,12 +573,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -695,12 +695,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes, useInterfaces: boolean = true): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -879,12 +879,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes, useInterfaces: boolean = true): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts index 508c44c34a..a8017aa5ad 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts @@ -91,7 +91,7 @@ export const GenesisState = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts index f46649c5d4..a7250297a1 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/query.ts @@ -204,7 +204,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e, useInterfaces) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -301,8 +301,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest, useInterfaces: boolean = true): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: QueryProviderRequestProtoMsg, useInterfaces: boolean = true): QueryProviderRequest { @@ -481,7 +481,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest, useInterfaces: boolean = true): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -577,8 +577,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest, useInterfaces: boolean = true): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; - obj.owner = message.owner; + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: QueryProviderAuditorRequestProtoMsg, useInterfaces: boolean = true): QueryProviderAuditorRequest { @@ -675,7 +675,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest, useInterfaces: boolean = true): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = message.auditor; + obj.auditor = message.auditor === "" ? undefined : message.auditor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts index 0395453af7..6cd452b816 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -160,8 +160,8 @@ export const Attribute = { }, toAmino(message: Attribute, useInterfaces: boolean = true): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeProtoMsg, useInterfaces: boolean = true): Attribute { @@ -271,12 +271,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -380,11 +380,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements, useInterfaces: boolean = true): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts index e7866f6cf3..2401795f8e 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/endpoint.ts @@ -110,13 +110,13 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } return message; }, toAmino(message: Endpoint, useInterfaces: boolean = true): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); + obj.kind = message.kind === 0 ? undefined : message.kind; return obj; }, fromProtoMsg(message: EndpointProtoMsg, useInterfaces: boolean = true): Endpoint { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts index 6a8e7d1858..792764fe39 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts @@ -186,7 +186,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -290,11 +290,11 @@ export const Memory = { }, toAmino(message: Memory, useInterfaces: boolean = true): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -398,11 +398,11 @@ export const Storage = { }, toAmino(message: Storage, useInterfaces: boolean = true): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -546,7 +546,7 @@ export const ResourceUnits = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e, useInterfaces) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts index e41e74f02f..650ca9e067 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -160,8 +160,8 @@ export const Attribute = { }, toAmino(message: Attribute, useInterfaces: boolean = true): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeProtoMsg, useInterfaces: boolean = true): Attribute { @@ -271,12 +271,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -380,11 +380,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements, useInterfaces: boolean = true): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts index 60c962ba16..f0648e84ce 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts @@ -132,7 +132,7 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.sequence_number !== undefined && object.sequence_number !== null) { message.sequenceNumber = object.sequence_number; @@ -141,8 +141,8 @@ export const Endpoint = { }, toAmino(message: Endpoint, useInterfaces: boolean = true): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); - obj.sequence_number = message.sequenceNumber; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.sequence_number = message.sequenceNumber ?? 0; return obj; }, fromProtoMsg(message: EndpointProtoMsg, useInterfaces: boolean = true): Endpoint { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts index 79c46ad50c..57473c28c6 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts @@ -154,7 +154,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -258,11 +258,11 @@ export const Memory = { }, toAmino(message: Memory, useInterfaces: boolean = true): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -381,12 +381,12 @@ export const Storage = { }, toAmino(message: Storage, useInterfaces: boolean = true): StorageAmino { const obj: any = {}; - obj.name = message.name; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : undefined; + obj.name = message.name ?? ""; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts index 0e0f7a2b34..4cf9fd95a0 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts @@ -167,12 +167,12 @@ export const ResourceUnits = { if (message.storage) { obj.storage = message.storage.map(e => e ? Storage.toAmino(e, useInterfaces) : undefined); } else { - obj.storage = []; + obj.storage = message.storage; } if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e, useInterfaces) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts index 168c5e69b9..c83dd11fae 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts @@ -243,8 +243,8 @@ export const CertificateID = { }, toAmino(message: CertificateID, useInterfaces: boolean = true): CertificateIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; return obj; }, fromProtoMsg(message: CertificateIDProtoMsg, useInterfaces: boolean = true): CertificateID { @@ -342,7 +342,7 @@ export const Certificate = { fromAmino(object: CertificateAmino): Certificate { const message = createBaseCertificate(); if (object.state !== undefined && object.state !== null) { - message.state = certificate_StateFromJSON(object.state); + message.state = object.state; } if (object.cert !== undefined && object.cert !== null) { message.cert = bytesFromBase64(object.cert); @@ -354,9 +354,9 @@ export const Certificate = { }, toAmino(message: Certificate, useInterfaces: boolean = true): CertificateAmino { const obj: any = {}; - obj.state = certificate_StateToJSON(message.state); - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.state = message.state ?? 0; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromProtoMsg(message: CertificateProtoMsg, useInterfaces: boolean = true): Certificate { @@ -466,9 +466,9 @@ export const CertificateFilter = { }, toAmino(message: CertificateFilter, useInterfaces: boolean = true): CertificateFilterAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; + obj.state = message.state ?? ""; return obj; }, fromProtoMsg(message: CertificateFilterProtoMsg, useInterfaces: boolean = true): CertificateFilter { @@ -578,9 +578,9 @@ export const MsgCreateCertificate = { }, toAmino(message: MsgCreateCertificate, useInterfaces: boolean = true): MsgCreateCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.owner = message.owner ?? ""; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromProtoMsg(message: MsgCreateCertificateProtoMsg, useInterfaces: boolean = true): MsgCreateCertificate { @@ -724,7 +724,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate, useInterfaces: boolean = true): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? CertificateID.toAmino(message.id, useInterfaces) : CertificateID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgRevokeCertificateProtoMsg, useInterfaces: boolean = true): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts index 36069c0ea5..0dd2f4df7d 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts @@ -118,8 +118,8 @@ export const GenesisCertificate = { }, toAmino(message: GenesisCertificate, useInterfaces: boolean = true): GenesisCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : undefined; + obj.owner = message.owner ?? ""; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : Certificate.fromPartial({}); return obj; }, fromProtoMsg(message: GenesisCertificateProtoMsg, useInterfaces: boolean = true): GenesisCertificate { @@ -208,7 +208,7 @@ export const GenesisState = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toAmino(e, useInterfaces) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts index b05f2cdca2..b07fc20b96 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts @@ -141,8 +141,8 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse, useInterfaces: boolean = true): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : undefined; - obj.serial = message.serial; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : Certificate.fromPartial({}); + obj.serial = message.serial ?? ""; return obj; }, fromProtoMsg(message: CertificateResponseProtoMsg, useInterfaces: boolean = true): CertificateResponse { @@ -348,7 +348,7 @@ export const QueryCertificatesResponse = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts index fc66bc9603..672c428a45 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts @@ -104,7 +104,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization, useInterfaces: boolean = true): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: DepositDeploymentAuthorizationProtoMsg, useInterfaces: boolean = true): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts index 85718795ac..06848123fd 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts @@ -354,14 +354,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment, useInterfaces: boolean = true): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCreateDeploymentProtoMsg, useInterfaces: boolean = true): MsgCreateDeployment { @@ -522,8 +522,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment, useInterfaces: boolean = true): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: MsgDepositDeploymentProtoMsg, useInterfaces: boolean = true): MsgDepositDeployment { @@ -703,13 +703,13 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment, useInterfaces: boolean = true): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromProtoMsg(message: MsgUpdateDeploymentProtoMsg, useInterfaces: boolean = true): MsgUpdateDeployment { @@ -853,7 +853,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment, useInterfaces: boolean = true): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCloseDeploymentProtoMsg, useInterfaces: boolean = true): MsgCloseDeployment { @@ -1012,8 +1012,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID, useInterfaces: boolean = true): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromProtoMsg(message: DeploymentIDProtoMsg, useInterfaces: boolean = true): DeploymentID { @@ -1130,7 +1130,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -1142,9 +1142,9 @@ export const Deployment = { }, toAmino(message: Deployment, useInterfaces: boolean = true): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1257,9 +1257,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters, useInterfaces: boolean = true): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromProtoMsg(message: DeploymentFiltersProtoMsg, useInterfaces: boolean = true): DeploymentFilters { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts index 17423e6cac..9734ee5751 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts @@ -129,11 +129,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment, useInterfaces: boolean = true): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -240,9 +240,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e, useInterfaces) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts index 211e971e25..b1e71c7111 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts @@ -295,7 +295,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup, useInterfaces: boolean = true): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCloseGroupProtoMsg, useInterfaces: boolean = true): MsgCloseGroup { @@ -439,7 +439,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup, useInterfaces: boolean = true): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgPauseGroupProtoMsg, useInterfaces: boolean = true): MsgPauseGroup { @@ -583,7 +583,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup, useInterfaces: boolean = true): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgStartGroupProtoMsg, useInterfaces: boolean = true): MsgStartGroup { @@ -757,9 +757,9 @@ export const GroupID = { }, toAmino(message: GroupID, useInterfaces: boolean = true): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromProtoMsg(message: GroupIDProtoMsg, useInterfaces: boolean = true): GroupID { @@ -877,12 +877,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec, useInterfaces: boolean = true): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e, useInterfaces) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, @@ -1002,7 +1002,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -1014,9 +1014,9 @@ export const Group = { }, toAmino(message: Group, useInterfaces: boolean = true): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : undefined; + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1131,9 +1131,9 @@ export const Resource = { }, toAmino(message: Resource, useInterfaces: boolean = true): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : undefined; - obj.count = message.count; - obj.price = message.price ? Coin.toAmino(message.price, useInterfaces) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? Coin.toAmino(message.price, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: ResourceProtoMsg, useInterfaces: boolean = true): Resource { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts index 881d3929f4..50fc66ccae 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts @@ -84,7 +84,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts index c207bc0dfb..3fd9500c67 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts @@ -303,7 +303,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -507,11 +507,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse, useInterfaces: boolean = true): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts index 3964ff2a7a..b5fd27ce83 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts @@ -104,7 +104,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization, useInterfaces: boolean = true): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: DepositDeploymentAuthorizationProtoMsg, useInterfaces: boolean = true): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts index 99aa6be82d..052af6a274 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts @@ -190,8 +190,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID, useInterfaces: boolean = true): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromProtoMsg(message: DeploymentIDProtoMsg, useInterfaces: boolean = true): DeploymentID { @@ -308,7 +308,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -320,9 +320,9 @@ export const Deployment = { }, toAmino(message: Deployment, useInterfaces: boolean = true): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -435,9 +435,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters, useInterfaces: boolean = true): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromProtoMsg(message: DeploymentFiltersProtoMsg, useInterfaces: boolean = true): DeploymentFilters { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts index e5966259ce..8c24cf85d3 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts @@ -267,15 +267,15 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment, useInterfaces: boolean = true): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : undefined; - obj.depositor = message.depositor; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromProtoMsg(message: MsgCreateDeploymentProtoMsg, useInterfaces: boolean = true): MsgCreateDeployment { @@ -451,9 +451,9 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment, useInterfaces: boolean = true): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; - obj.depositor = message.depositor; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromProtoMsg(message: MsgDepositDeploymentProtoMsg, useInterfaces: boolean = true): MsgDepositDeployment { @@ -612,8 +612,8 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment, useInterfaces: boolean = true): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromProtoMsg(message: MsgUpdateDeploymentProtoMsg, useInterfaces: boolean = true): MsgUpdateDeployment { @@ -757,7 +757,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment, useInterfaces: boolean = true): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCloseDeploymentProtoMsg, useInterfaces: boolean = true): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts index ac3d1e2809..cc183c52a8 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts @@ -129,11 +129,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment, useInterfaces: boolean = true): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -240,9 +240,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e, useInterfaces) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts index 69e3917126..03d505d0f2 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts @@ -187,7 +187,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -199,9 +199,9 @@ export const Group = { }, toAmino(message: Group, useInterfaces: boolean = true): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : undefined; + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts index d599707f97..a5d1ebc203 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts @@ -119,9 +119,9 @@ export const GroupID = { }, toAmino(message: GroupID, useInterfaces: boolean = true): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromProtoMsg(message: GroupIDProtoMsg, useInterfaces: boolean = true): GroupID { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts index 976830553c..b8a44b6748 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts @@ -146,7 +146,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup, useInterfaces: boolean = true): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCloseGroupProtoMsg, useInterfaces: boolean = true): MsgCloseGroup { @@ -290,7 +290,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup, useInterfaces: boolean = true): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgPauseGroupProtoMsg, useInterfaces: boolean = true): MsgPauseGroup { @@ -434,7 +434,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup, useInterfaces: boolean = true): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgStartGroupProtoMsg, useInterfaces: boolean = true): MsgStartGroup { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts index 4e82a44cce..9f20c67e4d 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts @@ -127,12 +127,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec, useInterfaces: boolean = true): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e, useInterfaces) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts index 07c5b7a8bf..41b40b0200 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts @@ -84,7 +84,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts index fce7e669f7..8211eb5930 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts @@ -304,7 +304,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -508,11 +508,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse, useInterfaces: boolean = true): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts index c9d31e4690..89bc6194d5 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts @@ -123,9 +123,9 @@ export const Resource = { }, toAmino(message: Resource, useInterfaces: boolean = true): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : undefined; - obj.count = message.count; - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); return obj; }, fromProtoMsg(message: ResourceProtoMsg, useInterfaces: boolean = true): Resource { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts index 9b7373141b..1794acb7c1 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts @@ -115,12 +115,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e, useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e, useInterfaces) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts index e73e475c41..fd9ba4e8c0 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/query.ts @@ -226,10 +226,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest, useInterfaces: boolean = true): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -336,7 +336,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e, useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -495,11 +495,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest, useInterfaces: boolean = true): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -606,7 +606,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e, useInterfaces) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts index 5e0bfa2fac..392606dd89 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts @@ -275,8 +275,8 @@ export const AccountID = { }, toAmino(message: AccountID, useInterfaces: boolean = true): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromProtoMsg(message: AccountIDProtoMsg, useInterfaces: boolean = true): AccountID { @@ -424,7 +424,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = Coin.fromAmino(object.balance); @@ -439,12 +439,12 @@ export const Account = { }, toAmino(message: Account, useInterfaces: boolean = true): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : undefined; - obj.transferred = message.transferred ? Coin.toAmino(message.transferred, useInterfaces) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; + obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : Coin.fromPartial({}); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred, useInterfaces) : Coin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, fromProtoMsg(message: AccountProtoMsg, useInterfaces: boolean = true): Account { @@ -607,7 +607,7 @@ export const Payment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = payment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = Coin.fromAmino(object.rate); @@ -622,13 +622,13 @@ export const Payment = { }, toAmino(message: Payment, useInterfaces: boolean = true): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = payment_StateToJSON(message.state); - obj.rate = message.rate ? Coin.toAmino(message.rate, useInterfaces) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? Coin.toAmino(message.rate, useInterfaces) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : Coin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: PaymentProtoMsg, useInterfaces: boolean = true): Payment { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts index 14a08613b9..5825874784 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts @@ -115,12 +115,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e, useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e, useInterfaces) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts index 7e19dac08f..598aaae55b 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/query.ts @@ -226,10 +226,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest, useInterfaces: boolean = true): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -336,7 +336,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e, useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -495,11 +495,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest, useInterfaces: boolean = true): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; - obj.id = message.id; - obj.owner = message.owner; - obj.state = message.state; + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -606,7 +606,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e, useInterfaces) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts index 3dbe5c535e..63b03387d5 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts @@ -299,8 +299,8 @@ export const AccountID = { }, toAmino(message: AccountID, useInterfaces: boolean = true): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromProtoMsg(message: AccountIDProtoMsg, useInterfaces: boolean = true): AccountID { @@ -474,7 +474,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = DecCoin.fromAmino(object.balance); @@ -495,14 +495,14 @@ export const Account = { }, toAmino(message: Account, useInterfaces: boolean = true): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : undefined; - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred, useInterfaces) : undefined; - obj.settled_at = message.settledAt ? message.settledAt.toString() : undefined; - obj.depositor = message.depositor; - obj.funds = message.funds ? DecCoin.toAmino(message.funds, useInterfaces) : undefined; + obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : DecCoin.fromPartial({}); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred, useInterfaces) : DecCoin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; + obj.depositor = message.depositor ?? ""; + obj.funds = message.funds ? DecCoin.toAmino(message.funds, useInterfaces) : DecCoin.fromPartial({}); return obj; }, fromProtoMsg(message: AccountProtoMsg, useInterfaces: boolean = true): Account { @@ -665,7 +665,7 @@ export const FractionalPayment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = fractionalPayment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = DecCoin.fromAmino(object.rate); @@ -680,13 +680,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment, useInterfaces: boolean = true): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = fractionalPayment_StateToJSON(message.state); - obj.rate = message.rate ? DecCoin.toAmino(message.rate, useInterfaces) : undefined; - obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? DecCoin.toAmino(message.rate, useInterfaces) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : DecCoin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: FractionalPaymentProtoMsg, useInterfaces: boolean = true): FractionalPayment { diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts index 7a009abb30..fbfb71b669 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts @@ -84,7 +84,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts index b4a2d1d9a9..d2e9860f6a 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts @@ -136,9 +136,9 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); - obj.initial_inflation = padDecimal(message.initialInflation); - obj.variance = padDecimal(message.variance); + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor) ?? ""; + obj.initial_inflation = padDecimal(message.initialInflation) ?? ""; + obj.variance = padDecimal(message.variance) ?? ""; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts index 8819f01af4..51dba1418c 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts @@ -328,10 +328,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid, useInterfaces: boolean = true): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order, useInterfaces) : undefined; - obj.provider = message.provider; - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : undefined; + obj.order = message.order ? OrderID.toAmino(message.order, useInterfaces) : OrderID.fromPartial({}); + obj.provider = message.provider ?? ""; + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCreateBidProtoMsg, useInterfaces: boolean = true): MsgCreateBid { @@ -475,7 +475,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid, useInterfaces: boolean = true): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCloseBidProtoMsg, useInterfaces: boolean = true): MsgCloseBid { @@ -679,11 +679,11 @@ export const BidID = { }, toAmino(message: BidID, useInterfaces: boolean = true): BidIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromProtoMsg(message: BidIDProtoMsg, useInterfaces: boolean = true): BidID { @@ -802,7 +802,7 @@ export const Bid = { message.bidId = BidID.fromAmino(object.bid_id); } if (object.state !== undefined && object.state !== null) { - message.state = bid_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -814,9 +814,9 @@ export const Bid = { }, toAmino(message: Bid, useInterfaces: boolean = true): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : undefined; - obj.state = bid_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -974,12 +974,12 @@ export const BidFilters = { }, toAmino(message: BidFilters, useInterfaces: boolean = true): BidFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromProtoMsg(message: BidFiltersProtoMsg, useInterfaces: boolean = true): BidFilters { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts index 9e860c8bfa..b6b364a90a 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts @@ -137,14 +137,14 @@ export const GenesisState = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e, useInterfaces) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } if (message.leases) { obj.leases = message.leases.map(e => e ? Lease.toAmino(e, useInterfaces) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts index 12004fe029..abace824ee 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts @@ -343,11 +343,11 @@ export const LeaseID = { }, toAmino(message: LeaseID, useInterfaces: boolean = true): LeaseIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromProtoMsg(message: LeaseIDProtoMsg, useInterfaces: boolean = true): LeaseID { @@ -480,7 +480,7 @@ export const Lease = { message.leaseId = LeaseID.fromAmino(object.lease_id); } if (object.state !== undefined && object.state !== null) { - message.state = lease_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -495,9 +495,9 @@ export const Lease = { }, toAmino(message: Lease, useInterfaces: boolean = true): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : undefined; - obj.state = lease_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : LeaseID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; return obj; @@ -656,12 +656,12 @@ export const LeaseFilters = { }, toAmino(message: LeaseFilters, useInterfaces: boolean = true): LeaseFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromProtoMsg(message: LeaseFiltersProtoMsg, useInterfaces: boolean = true): LeaseFilters { @@ -743,7 +743,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease, useInterfaces: boolean = true): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCreateLeaseProtoMsg, useInterfaces: boolean = true): MsgCreateLease { @@ -887,7 +887,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease, useInterfaces: boolean = true): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId, useInterfaces) : undefined; + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId, useInterfaces) : LeaseID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgWithdrawLeaseProtoMsg, useInterfaces: boolean = true): MsgWithdrawLease { @@ -1031,7 +1031,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease, useInterfaces: boolean = true): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : LeaseID.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCloseLeaseProtoMsg, useInterfaces: boolean = true): MsgCloseLease { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts index b185f2f394..2a93a12dc2 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts @@ -240,10 +240,10 @@ export const OrderID = { }, toAmino(message: OrderID, useInterfaces: boolean = true): OrderIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; return obj; }, fromProtoMsg(message: OrderIDProtoMsg, useInterfaces: boolean = true): OrderID { @@ -362,7 +362,7 @@ export const Order = { message.orderId = OrderID.fromAmino(object.order_id); } if (object.state !== undefined && object.state !== null) { - message.state = order_StateFromJSON(object.state); + message.state = object.state; } if (object.spec !== undefined && object.spec !== null) { message.spec = GroupSpec.fromAmino(object.spec); @@ -374,9 +374,9 @@ export const Order = { }, toAmino(message: Order, useInterfaces: boolean = true): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId, useInterfaces) : undefined; - obj.state = order_StateToJSON(message.state); - obj.spec = message.spec ? GroupSpec.toAmino(message.spec, useInterfaces) : undefined; + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId, useInterfaces) : OrderID.fromPartial({}); + obj.state = message.state ?? 0; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec, useInterfaces) : GroupSpec.fromPartial({}); obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -519,11 +519,11 @@ export const OrderFilters = { }, toAmino(message: OrderFilters, useInterfaces: boolean = true): OrderFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.state = message.state ?? ""; return obj; }, fromProtoMsg(message: OrderFiltersProtoMsg, useInterfaces: boolean = true): OrderFilters { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts index 57f8ad485c..790379625d 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts @@ -102,8 +102,8 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit, useInterfaces) : undefined; - obj.order_max_bids = message.orderMaxBids; + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit, useInterfaces) : Coin.fromPartial({}); + obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts index 929a4caede..61c686c881 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/query.ts @@ -412,7 +412,7 @@ export const QueryOrdersResponse = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e, useInterfaces) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -784,7 +784,7 @@ export const QueryBidsResponse = { if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.bids = []; + obj.bids = message.bids; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1174,7 +1174,7 @@ export const QueryLeasesResponse = { if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts index 632e61277c..7629164787 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts @@ -221,8 +221,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo, useInterfaces: boolean = true): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromProtoMsg(message: ProviderInfoProtoMsg, useInterfaces: boolean = true): ProviderInfo { @@ -355,14 +355,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider, useInterfaces: boolean = true): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCreateProviderProtoMsg, useInterfaces: boolean = true): MsgCreateProvider { @@ -557,14 +557,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider, useInterfaces: boolean = true): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); return obj; }, fromProtoMsg(message: MsgUpdateProviderProtoMsg, useInterfaces: boolean = true): MsgUpdateProvider { @@ -706,7 +706,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider, useInterfaces: boolean = true): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromProtoMsg(message: MsgDeleteProviderProtoMsg, useInterfaces: boolean = true): MsgDeleteProvider { @@ -901,14 +901,14 @@ export const Provider = { }, toAmino(message: Provider, useInterfaces: boolean = true): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); return obj; }, fromProtoMsg(message: ProviderProtoMsg, useInterfaces: boolean = true): Provider { diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts index ea3f3cc602..d4b266f51e 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts @@ -91,7 +91,7 @@ export const GenesisState = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e, useInterfaces) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts index f26ba9bcfe..d20f58d5b5 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts @@ -221,8 +221,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo, useInterfaces: boolean = true): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromProtoMsg(message: ProviderInfoProtoMsg, useInterfaces: boolean = true): ProviderInfo { @@ -355,14 +355,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider, useInterfaces: boolean = true): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); return obj; }, fromProtoMsg(message: MsgCreateProviderProtoMsg, useInterfaces: boolean = true): MsgCreateProvider { @@ -557,14 +557,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider, useInterfaces: boolean = true): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); return obj; }, fromProtoMsg(message: MsgUpdateProviderProtoMsg, useInterfaces: boolean = true): MsgUpdateProvider { @@ -706,7 +706,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider, useInterfaces: boolean = true): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromProtoMsg(message: MsgDeleteProviderProtoMsg, useInterfaces: boolean = true): MsgDeleteProvider { @@ -901,14 +901,14 @@ export const Provider = { }, toAmino(message: Provider, useInterfaces: boolean = true): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); return obj; }, fromProtoMsg(message: ProviderProtoMsg, useInterfaces: boolean = true): Provider { diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts index 0a098d7616..e699f21bce 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderAmino, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -242,7 +242,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e, useInterfaces) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -324,7 +324,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest, useInterfaces: boolean = true): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: QueryProviderRequestProtoMsg, useInterfaces: boolean = true): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputv3/confio/proofs.ts b/__fixtures__/v-next/outputv3/confio/proofs.ts index accfc3496d..57da071210 100644 --- a/__fixtures__/v-next/outputv3/confio/proofs.ts +++ b/__fixtures__/v-next/outputv3/confio/proofs.ts @@ -825,7 +825,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e, useInterfaces) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1200,16 +1200,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1218,10 +1218,10 @@ export const LeafOp = { }, toAmino(message: LeafOp, useInterfaces: boolean = true): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1320,7 +1320,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1332,7 +1332,7 @@ export const InnerOp = { }, toAmino(message: InnerOp, useInterfaces: boolean = true): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1465,8 +1465,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec, useInterfaces) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec, useInterfaces) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromProtoMsg(message: ProofSpecProtoMsg, useInterfaces: boolean = true): ProofSpec { @@ -1630,7 +1630,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1639,13 +1639,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromProtoMsg(message: InnerSpecProtoMsg, useInterfaces: boolean = true): InnerSpec { @@ -1734,7 +1734,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1945,12 +1945,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e, useInterfaces) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -2199,7 +2199,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts index b05158d742..b1355e16c8 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/config.ts @@ -169,7 +169,7 @@ export const Config = { if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e, useInterfaces) : undefined); } else { - obj.modules = []; + obj.modules = message.modules; } return obj; }, @@ -268,7 +268,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig, useInterfaces: boolean = true): ModuleConfigAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.config = message.config ? Any.toAmino(message.config, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts index cd8ff965ba..dcb7e04d72 100644 --- a/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv3/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -302,16 +302,16 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor, useInterfaces: boolean = true): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = omitDefault(message.goImport); + obj.go_import = message.goImport === "" ? undefined : message.goImport; if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e, useInterfaces) : undefined); } else { - obj.use_package = []; + obj.use_package = message.usePackage; } if (message.canMigrateFrom) { obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.can_migrate_from = []; + obj.can_migrate_from = message.canMigrateFrom; } return obj; }, @@ -408,8 +408,8 @@ export const PackageReference = { }, toAmino(message: PackageReference, useInterfaces: boolean = true): PackageReferenceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.revision = omitDefault(message.revision); + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; return obj; }, fromProtoMsg(message: PackageReferenceProtoMsg, useInterfaces: boolean = true): PackageReference { @@ -490,7 +490,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo, useInterfaces: boolean = true): MigrateFromInfoAmino { const obj: any = {}; - obj.module = omitDefault(message.module); + obj.module = message.module === "" ? undefined : message.module; return obj; }, fromProtoMsg(message: MigrateFromInfoProtoMsg, useInterfaces: boolean = true): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts index de7697f308..c29a11e980 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts @@ -210,7 +210,7 @@ export const BaseAccount = { }, toAmino(message: BaseAccount, useInterfaces: boolean = true): BaseAccountAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey, useInterfaces) : undefined; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; @@ -334,11 +334,11 @@ export const ModuleAccount = { toAmino(message: ModuleAccount, useInterfaces: boolean = true): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount, useInterfaces) : undefined; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { - obj.permissions = []; + obj.permissions = message.permissions; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts index 9f66d7f0d9..9922e38d17 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/genesis.ts @@ -118,7 +118,7 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts index b061fdbe76..197150c5bb 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsAmino, ParamsSDKType, BaseAccount, BaseAccountProtoMsg, BaseAccountSDKType, ModuleAccount, ModuleAccountProtoMsg, ModuleAccountSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -432,7 +432,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? AccountI_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -515,7 +515,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest, useInterfaces: boolean = true): QueryAccountRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryAccountRequestProtoMsg, useInterfaces: boolean = true): QueryAccountRequest { @@ -897,7 +897,7 @@ export const QueryModuleAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? ModuleAccountI_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, @@ -1042,7 +1042,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse, useInterfaces: boolean = true): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = omitDefault(message.bech32Prefix); + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; return obj; }, fromProtoMsg(message: Bech32PrefixResponseProtoMsg, useInterfaces: boolean = true): Bech32PrefixResponse { @@ -1204,7 +1204,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse, useInterfaces: boolean = true): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromProtoMsg(message: AddressBytesToStringResponseProtoMsg, useInterfaces: boolean = true): AddressBytesToStringResponse { @@ -1285,7 +1285,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest, useInterfaces: boolean = true): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromProtoMsg(message: AddressStringToBytesRequestProtoMsg, useInterfaces: boolean = true): AddressStringToBytesRequest { @@ -1392,7 +1392,7 @@ export const AccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Bas return data; } }; -export const AccountI_FromAmino = (content: AnyAmino) => { +export const AccountI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BaseAccount": return Any.fromPartial({ @@ -1424,7 +1424,7 @@ export const ModuleAccountI_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const ModuleAccountI_FromAmino = (content: AnyAmino) => { +export const ModuleAccountI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ModuleAccount": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts index 2903c1e51c..82be218cbf 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/authz.ts @@ -202,7 +202,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization, useInterfaces: boolean = true): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromProtoMsg(message: GenericAuthorizationProtoMsg, useInterfaces: boolean = true): GenericAuthorization { @@ -429,8 +429,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization, useInterfaces: boolean = true): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? Authorization_ToAmino((message.authorization as Any), useInterfaces) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -522,7 +522,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, @@ -557,7 +557,7 @@ export const Authorization_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const Authorization_FromAmino = (content: AnyAmino) => { +export const Authorization_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "/akash.deployment.v1beta1.DepositDeploymentAuthorization": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts index d4b18d51eb..ef75d039b7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e, useInterfaces) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts index e02499eecb..65e969324d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/query.ts @@ -255,9 +255,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest, useInterfaces: boolean = true): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -365,7 +365,7 @@ export const QueryGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toAmino(e, useInterfaces) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -465,7 +465,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest, useInterfaces: boolean = true): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -573,7 +573,7 @@ export const QueryGranterGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e, useInterfaces) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -673,7 +673,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest, useInterfaces: boolean = true): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -781,7 +781,7 @@ export const QueryGranteeGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e, useInterfaces) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts index 0349dfd7d3..b084ecd9ed 100644 --- a/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/authz/v1beta1/tx.ts @@ -247,8 +247,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant, useInterfaces: boolean = true): MsgGrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.grant = message.grant ? Grant.toAmino(message.grant, useInterfaces) : undefined; return obj; }, @@ -339,7 +339,7 @@ export const MsgExecResponse = { if (message.results) { obj.results = message.results.map(e => base64FromBytes(e)); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -442,11 +442,11 @@ export const MsgExec = { }, toAmino(message: MsgExec, useInterfaces: boolean = true): MsgExecAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Sdk_MsgauthzAuthorization_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -621,9 +621,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke, useInterfaces: boolean = true): MsgRevokeAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; - obj.msg_type_url = message.msgTypeUrl; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromProtoMsg(message: MsgRevokeProtoMsg, useInterfaces: boolean = true): MsgRevoke { @@ -710,7 +710,7 @@ export const Sdk_Msg_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any return data; } }; -export const Sdk_Msg_FromAmino = (content: AnyAmino) => { +export const Sdk_Msg_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const Sdk_Msg_ToAmino = (content: Any, useInterfaces: boolean = true) => { @@ -724,7 +724,7 @@ export const Authz_Authorization_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Authz_Authorization_FromAmino = (content: AnyAmino) => { +export const Authz_Authorization_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const Authz_Authorization_ToAmino = (content: Any, useInterfaces: boolean = true) => { diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts index 68c7869848..d31a627c45 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/authz.ts @@ -110,7 +110,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts index 44a90b166a..fa82edeaba 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -360,9 +360,9 @@ export const Params = { if (message.sendEnabled) { obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e, useInterfaces) : undefined); } else { - obj.send_enabled = []; + obj.send_enabled = message.sendEnabled; } - obj.default_send_enabled = omitDefault(message.defaultSendEnabled); + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -458,8 +458,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled, useInterfaces: boolean = true): SendEnabledAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.enabled = omitDefault(message.enabled); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromProtoMsg(message: SendEnabledProtoMsg, useInterfaces: boolean = true): SendEnabled { @@ -561,11 +561,11 @@ export const Input = { }, toAmino(message: Input, useInterfaces: boolean = true): InputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -668,11 +668,11 @@ export const Output = { }, toAmino(message: Output, useInterfaces: boolean = true): OutputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -764,7 +764,7 @@ export const Supply = { if (message.total) { obj.total = message.total.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -882,12 +882,12 @@ export const DenomUnit = { }, toAmino(message: DenomUnit, useInterfaces: boolean = true): DenomUnitAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.exponent = omitDefault(message.exponent); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } return obj; }, @@ -1080,18 +1080,18 @@ export const Metadata = { }, toAmino(message: Metadata, useInterfaces: boolean = true): MetadataAmino { const obj: any = {}; - obj.description = omitDefault(message.description); + obj.description = message.description === "" ? undefined : message.description; if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e, useInterfaces) : undefined); } else { - obj.denom_units = []; + obj.denom_units = message.denomUnits; } - obj.base = omitDefault(message.base); - obj.display = omitDefault(message.display); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; return obj; }, fromProtoMsg(message: MetadataProtoMsg, useInterfaces: boolean = true): Metadata { diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts index 0f579b5b4b..f622f6b3ac 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType, Metadata, MetadataAmino, MetadataSDKType } from "./bank"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -208,17 +208,17 @@ export const GenesisState = { if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e, useInterfaces) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } if (message.denomMetadata) { obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e, useInterfaces) : undefined); } else { - obj.denom_metadata = []; + obj.denom_metadata = message.denomMetadata; } return obj; }, @@ -321,11 +321,11 @@ export const Balance = { }, toAmino(message: Balance, useInterfaces: boolean = true): BalanceAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts index 777c48b740..f4ccc4b2ae 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/query.ts @@ -567,8 +567,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest, useInterfaces: boolean = true): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.denom = message.denom; + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryBalanceRequestProtoMsg, useInterfaces: boolean = true): QueryBalanceRequest { @@ -749,7 +749,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest, useInterfaces: boolean = true): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -857,7 +857,7 @@ export const QueryAllBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -957,7 +957,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest, useInterfaces: boolean = true): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1065,7 +1065,7 @@ export const QuerySpendableBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1257,7 +1257,7 @@ export const QueryTotalSupplyResponse = { if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1340,7 +1340,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest, useInterfaces: boolean = true): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QuerySupplyOfRequestProtoMsg, useInterfaces: boolean = true): QuerySupplyOfRequest { @@ -1759,7 +1759,7 @@ export const QueryDenomsMetadataResponse = { if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e, useInterfaces) : undefined); } else { - obj.metadatas = []; + obj.metadatas = message.metadatas; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1842,7 +1842,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest, useInterfaces: boolean = true): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryDenomMetadataRequestProtoMsg, useInterfaces: boolean = true): QueryDenomMetadataRequest { @@ -2023,7 +2023,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest, useInterfaces: boolean = true): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2122,7 +2122,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner, useInterfaces: boolean = true): DenomOwnerAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : undefined; return obj; }, @@ -2230,7 +2230,7 @@ export const QueryDenomOwnersResponse = { if (message.denomOwners) { obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e, useInterfaces) : undefined); } else { - obj.denom_owners = []; + obj.denom_owners = message.denomOwners; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts index 5a840ef2ef..6e05bb4ef4 100644 --- a/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputAmino, InputSDKType, Output, OutputAmino, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -165,12 +165,12 @@ export const MsgSend = { }, toAmino(message: MsgSend, useInterfaces: boolean = true): MsgSendAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -345,12 +345,12 @@ export const MsgMultiSend = { if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toAmino(e, useInterfaces) : undefined); } else { - obj.inputs = []; + obj.inputs = message.inputs; } if (message.outputs) { obj.outputs = message.outputs.map(e => e ? Output.toAmino(e, useInterfaces) : undefined); } else { - obj.outputs = []; + obj.outputs = message.outputs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts index ed858302a2..ea76e289c7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts @@ -698,25 +698,25 @@ export const TxResponse = { toAmino(message: TxResponse, useInterfaces: boolean = true): TxResponseAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e, useInterfaces) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx, useInterfaces) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -834,12 +834,12 @@ export const ABCIMessageLog = { }, toAmino(message: ABCIMessageLog, useInterfaces: boolean = true): ABCIMessageLogAmino { const obj: any = {}; - obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -942,11 +942,11 @@ export const StringEvent = { }, toAmino(message: StringEvent, useInterfaces: boolean = true): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -1043,8 +1043,8 @@ export const Attribute = { }, toAmino(message: Attribute, useInterfaces: boolean = true): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeProtoMsg, useInterfaces: boolean = true): Attribute { @@ -1284,16 +1284,16 @@ export const Result = { toAmino(message: Result, useInterfaces: boolean = true): ResultAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1491,7 +1491,7 @@ export const MsgData = { }, toAmino(message: MsgData, useInterfaces: boolean = true): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1603,12 +1603,12 @@ export const TxMsgData = { if (message.data) { obj.data = message.data.map(e => e ? MsgData.toAmino(e, useInterfaces) : undefined); } else { - obj.data = []; + obj.data = message.data; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1789,7 +1789,7 @@ export const SearchTxsResult = { if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts index aa0bf78fa8..103a0853aa 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/kv/v1beta1/kv.ts @@ -110,7 +110,7 @@ export const Pairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e, useInterfaces) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts index 5127a1a536..8048a8ca23 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts @@ -296,8 +296,8 @@ export const PageRequest = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.offset = message.offset ? message.offset.toString() : undefined; obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; }, fromProtoMsg(message: PageRequestProtoMsg, useInterfaces: boolean = true): PageRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts index a38d2336a7..de33d05fd0 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -218,7 +218,7 @@ export const ListAllInterfacesResponse = { if (message.interfaceNames) { obj.interface_names = message.interfaceNames.map(e => e); } else { - obj.interface_names = []; + obj.interface_names = message.interfaceNames; } return obj; }, @@ -300,7 +300,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest, useInterfaces: boolean = true): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = omitDefault(message.interfaceName); + obj.interface_name = message.interfaceName === "" ? undefined : message.interfaceName; return obj; }, fromProtoMsg(message: ListImplementationsRequestProtoMsg, useInterfaces: boolean = true): ListImplementationsRequest { @@ -390,7 +390,7 @@ export const ListImplementationsResponse = { if (message.implementationMessageNames) { obj.implementation_message_names = message.implementationMessageNames.map(e => e); } else { - obj.implementation_message_names = []; + obj.implementation_message_names = message.implementationMessageNames; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts index b97432494e..3a221f8f54 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -856,11 +856,11 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor, useInterfaces: boolean = true): TxDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -951,7 +951,7 @@ export const AuthnDescriptor = { if (message.signModes) { obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.sign_modes = []; + obj.sign_modes = message.signModes; } return obj; }, @@ -1063,9 +1063,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor, useInterfaces: boolean = true): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.number = omitDefault(message.number); - obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; return obj; }, fromProtoMsg(message: SigningModeDescriptorProtoMsg, useInterfaces: boolean = true): SigningModeDescriptor { @@ -1146,7 +1146,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor, useInterfaces: boolean = true): ChainDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromProtoMsg(message: ChainDescriptorProtoMsg, useInterfaces: boolean = true): ChainDescriptor { @@ -1236,7 +1236,7 @@ export const CodecDescriptor = { if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.interfaces = []; + obj.interfaces = message.interfaces; } return obj; }, @@ -1360,16 +1360,16 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor, useInterfaces: boolean = true): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.interface_accepting_messages = []; + obj.interface_accepting_messages = message.interfaceAcceptingMessages; } if (message.interfaceImplementers) { obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.interface_implementers = []; + obj.interface_implementers = message.interfaceImplementers; } return obj; }, @@ -1466,8 +1466,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor, useInterfaces: boolean = true): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.type_url = omitDefault(message.typeUrl); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; return obj; }, fromProtoMsg(message: InterfaceImplementerDescriptorProtoMsg, useInterfaces: boolean = true): InterfaceImplementerDescriptor { @@ -1569,11 +1569,11 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor, useInterfaces: boolean = true): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { - obj.field_descriptor_names = []; + obj.field_descriptor_names = message.fieldDescriptorNames; } return obj; }, @@ -1655,7 +1655,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor, useInterfaces: boolean = true): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; return obj; }, fromProtoMsg(message: ConfigurationDescriptorProtoMsg, useInterfaces: boolean = true): ConfigurationDescriptor { @@ -1736,7 +1736,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor, useInterfaces: boolean = true): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromProtoMsg(message: MsgDescriptorProtoMsg, useInterfaces: boolean = true): MsgDescriptor { @@ -2702,7 +2702,7 @@ export const QueryServicesDescriptor = { if (message.queryServices) { obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.query_services = []; + obj.query_services = message.queryServices; } return obj; }, @@ -2820,12 +2820,12 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor, useInterfaces: boolean = true): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.is_module = omitDefault(message.isModule); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } return obj; }, @@ -2922,8 +2922,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor, useInterfaces: boolean = true): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.full_query_path = omitDefault(message.fullQueryPath); + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; return obj; }, fromProtoMsg(message: QueryMethodDescriptorProtoMsg, useInterfaces: boolean = true): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts index 8239345be5..175cfa1893 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -323,8 +323,8 @@ export const Snapshot = { toAmino(message: Snapshot, useInterfaces: boolean = true): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata, useInterfaces) : undefined; return obj; @@ -416,7 +416,7 @@ export const Metadata = { if (message.chunkHashes) { obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); } else { - obj.chunk_hashes = []; + obj.chunk_hashes = message.chunkHashes; } return obj; }, @@ -671,7 +671,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem, useInterfaces: boolean = true): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: SnapshotStoreItemProtoMsg, useInterfaces: boolean = true): SnapshotStoreItem { @@ -802,7 +802,7 @@ export const SnapshotIAVLItem = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.height = message.height === 0 ? undefined : message.height; return obj; }, fromProtoMsg(message: SnapshotIAVLItemProtoMsg, useInterfaces: boolean = true): SnapshotIAVLItem { @@ -898,8 +898,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta, useInterfaces: boolean = true): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; return obj; }, fromProtoMsg(message: SnapshotExtensionMetaProtoMsg, useInterfaces: boolean = true): SnapshotExtensionMeta { @@ -1167,7 +1167,7 @@ export const SnapshotSchema = { if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e)); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts index 672cbfc44d..f0f44a1dfe 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts @@ -177,7 +177,7 @@ export const CommitInfo = { if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.store_infos = []; + obj.store_infos = message.storeInfos; } return obj; }, @@ -276,7 +276,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo, useInterfaces: boolean = true): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts index 085ebedf4c..193741954f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/listening.ts @@ -158,8 +158,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair, useInterfaces: boolean = true): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts index ddd23a3aa2..da8714c051 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts @@ -514,7 +514,7 @@ export const GetValidatorSetByHeightResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -724,7 +724,7 @@ export const GetLatestValidatorSetResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -858,7 +858,7 @@ export const Validator = { }, toAmino(message: Validator, useInterfaces: boolean = true): ValidatorAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey, useInterfaces) : undefined; obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; @@ -1353,7 +1353,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse, useInterfaces: boolean = true): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = message.syncing; + obj.syncing = message.syncing === false ? undefined : message.syncing; return obj; }, fromProtoMsg(message: GetSyncingResponseProtoMsg, useInterfaces: boolean = true): GetSyncingResponse { @@ -1709,18 +1709,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo, useInterfaces: boolean = true): VersionInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.app_name = message.appName; - obj.version = message.version; - obj.git_commit = message.gitCommit; - obj.build_tags = message.buildTags; - obj.go_version = message.goVersion; + obj.name = message.name === "" ? undefined : message.name; + obj.app_name = message.appName === "" ? undefined : message.appName; + obj.version = message.version === "" ? undefined : message.version; + obj.git_commit = message.gitCommit === "" ? undefined : message.gitCommit; + obj.build_tags = message.buildTags === "" ? undefined : message.buildTags; + obj.go_version = message.goVersion === "" ? undefined : message.goVersion; if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e, useInterfaces) : undefined); } else { - obj.build_deps = []; + obj.build_deps = message.buildDeps; } - obj.cosmos_sdk_version = message.cosmosSdkVersion; + obj.cosmos_sdk_version = message.cosmosSdkVersion === "" ? undefined : message.cosmosSdkVersion; return obj; }, fromProtoMsg(message: VersionInfoProtoMsg, useInterfaces: boolean = true): VersionInfo { @@ -1831,9 +1831,9 @@ export const Module = { }, toAmino(message: Module, useInterfaces: boolean = true): ModuleAmino { const obj: any = {}; - obj.path = message.path; - obj.version = message.version; - obj.sum = message.sum; + obj.path = message.path === "" ? undefined : message.path; + obj.version = message.version === "" ? undefined : message.version; + obj.sum = message.sum === "" ? undefined : message.sum; return obj; }, fromProtoMsg(message: ModuleProtoMsg, useInterfaces: boolean = true): Module { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts index c254097085..fa08cef7d8 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -181,8 +181,8 @@ export const Coin = { }, toAmino(message: Coin, useInterfaces: boolean = true): CoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromProtoMsg(message: CoinProtoMsg, useInterfaces: boolean = true): Coin { @@ -278,8 +278,8 @@ export const DecCoin = { }, toAmino(message: DecCoin, useInterfaces: boolean = true): DecCoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromProtoMsg(message: DecCoinProtoMsg, useInterfaces: boolean = true): DecCoin { @@ -360,7 +360,7 @@ export const IntProto = { }, toAmino(message: IntProto, useInterfaces: boolean = true): IntProtoAmino { const obj: any = {}; - obj.int = omitDefault(message.int); + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromProtoMsg(message: IntProtoProtoMsg, useInterfaces: boolean = true): IntProto { @@ -441,7 +441,7 @@ export const DecProto = { }, toAmino(message: DecProto, useInterfaces: boolean = true): DecProtoAmino { const obj: any = {}; - obj.dec = omitDefault(message.dec); + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromProtoMsg(message: DecProtoProtoMsg, useInterfaces: boolean = true): DecProto { diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts index f30600f69f..4503ee8378 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -146,7 +146,7 @@ export const Capability = { }, toAmino(message: Capability, useInterfaces: boolean = true): CapabilityAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; return obj; }, fromProtoMsg(message: CapabilityProtoMsg, useInterfaces: boolean = true): Capability { @@ -242,8 +242,8 @@ export const Owner = { }, toAmino(message: Owner, useInterfaces: boolean = true): OwnerAmino { const obj: any = {}; - obj.module = omitDefault(message.module); - obj.name = omitDefault(message.name); + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: OwnerProtoMsg, useInterfaces: boolean = true): Owner { @@ -333,7 +333,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e, useInterfaces) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts index 5d7faf69b6..a9a58d47da 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts @@ -247,7 +247,7 @@ export const GenesisState = { if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e, useInterfaces) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts index e99a1ab044..e86471031c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -128,9 +128,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant, useInterfaces: boolean = true): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.invariant_module_name = omitDefault(message.invariantModuleName); - obj.invariant_route = omitDefault(message.invariantRoute); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.invariant_module_name = message.invariantModuleName === "" ? undefined : message.invariantModuleName; + obj.invariant_route = message.invariantRoute === "" ? undefined : message.invariantRoute; return obj; }, fromProtoMsg(message: MsgVerifyInvariantProtoMsg, useInterfaces: boolean = true): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts index 686705b048..a92491c4d0 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -170,11 +170,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params, useInterfaces: boolean = true): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = omitDefault(message.purpose); - obj.coin_type = omitDefault(message.coinType); - obj.account = omitDefault(message.account); - obj.change = omitDefault(message.change); - obj.address_index = omitDefault(message.addressIndex); + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; return obj; }, fromProtoMsg(message: BIP44ParamsProtoMsg, useInterfaces: boolean = true): BIP44Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts index ec1361f76a..7753d92e12 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/keyring/v1/record.ts @@ -260,7 +260,7 @@ export const Record = { }, toAmino(message: Record, useInterfaces: boolean = true): RecordAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey, useInterfaces) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local, useInterfaces) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger, useInterfaces) : undefined; @@ -364,7 +364,7 @@ export const Record_Local = { toAmino(message: Record_Local, useInterfaces: boolean = true): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey, useInterfaces) : undefined; - obj.priv_key_type = message.privKeyType; + obj.priv_key_type = message.privKeyType === "" ? undefined : message.privKeyType; return obj; }, fromProtoMsg(message: Record_LocalProtoMsg, useInterfaces: boolean = true): Record_Local { diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts index 292e3acdec..8e699350c7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -119,11 +119,11 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey, useInterfaces: boolean = true): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = omitDefault(message.threshold); + obj.threshold = message.threshold === 0 ? undefined : message.threshold; if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.public_keys = []; + obj.public_keys = message.publicKeys; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts index 4105c7f302..b13eee3990 100644 --- a/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv3/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -137,7 +137,7 @@ export const MultiSignature = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -234,7 +234,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray, useInterfaces: boolean = true): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts index cd3f4719e0..59d175d4ab 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType, Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -488,10 +488,10 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.community_tax = padDecimal(message.communityTax); - obj.base_proposer_reward = padDecimal(message.baseProposerReward); - obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); - obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); + obj.community_tax = padDecimal(message.communityTax) === "" ? undefined : padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward) === "" ? undefined : padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward) === "" ? undefined : padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -596,9 +596,9 @@ export const ValidatorHistoricalRewards = { if (message.cumulativeRewardRatio) { obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.cumulative_reward_ratio = []; + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; } - obj.reference_count = omitDefault(message.referenceCount); + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; return obj; }, fromProtoMsg(message: ValidatorHistoricalRewardsProtoMsg, useInterfaces: boolean = true): ValidatorHistoricalRewards { @@ -705,9 +705,9 @@ export const ValidatorCurrentRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorCurrentRewardsProtoMsg, useInterfaces: boolean = true): ValidatorCurrentRewards { @@ -797,7 +797,7 @@ export const ValidatorAccumulatedCommission = { if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.commission = []; + obj.commission = message.commission; } return obj; }, @@ -888,7 +888,7 @@ export const ValidatorOutstandingRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -987,8 +987,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent, useInterfaces: boolean = true): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = omitDefault(message.validatorPeriod); - obj.fraction = padDecimal(message.fraction); + obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.fraction = padDecimal(message.fraction) === "" ? undefined : padDecimal(message.fraction); return obj; }, fromProtoMsg(message: ValidatorSlashEventProtoMsg, useInterfaces: boolean = true): ValidatorSlashEvent { @@ -1078,7 +1078,7 @@ export const ValidatorSlashEvents = { if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e, useInterfaces) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, @@ -1169,7 +1169,7 @@ export const FeePool = { if (message.communityPool) { obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.community_pool = []; + obj.community_pool = message.communityPool; } return obj; }, @@ -1302,13 +1302,13 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal, useInterfaces: boolean = true): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1424,9 +1424,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo, useInterfaces: boolean = true): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = omitDefault(message.previousPeriod); - obj.stake = padDecimal(message.stake); - obj.height = message.height; + obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.stake = padDecimal(message.stake) === "" ? undefined : padDecimal(message.stake); + obj.height = message.height ? message.height.toString() : "0"; return obj; }, fromProtoMsg(message: DelegatorStartingInfoProtoMsg, useInterfaces: boolean = true): DelegatorStartingInfo { @@ -1528,11 +1528,11 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward, useInterfaces: boolean = true): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.reward = []; + obj.reward = message.reward; } return obj; }, @@ -1674,11 +1674,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit, useInterfaces: boolean = true): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); - obj.amount = omitDefault(message.amount); - obj.deposit = omitDefault(message.deposit); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; return obj; }, fromProtoMsg(message: CommunityPoolSpendProposalWithDepositProtoMsg, useInterfaces: boolean = true): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts index b7df22e639..b66606be98 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts @@ -357,8 +357,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo, useInterfaces: boolean = true): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.withdraw_address = message.withdrawAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromProtoMsg(message: DelegatorWithdrawInfoProtoMsg, useInterfaces: boolean = true): DelegatorWithdrawInfo { @@ -460,11 +460,11 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord, useInterfaces: boolean = true): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } return obj; }, @@ -563,7 +563,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord, useInterfaces: boolean = true): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated, useInterfaces) : undefined; return obj; }, @@ -679,7 +679,7 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord, useInterfaces: boolean = true): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.period = message.period ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards, useInterfaces) : undefined; return obj; @@ -779,7 +779,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord, useInterfaces: boolean = true): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards, useInterfaces) : undefined; return obj; }, @@ -893,8 +893,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord, useInterfaces: boolean = true): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo, useInterfaces) : undefined; return obj; }, @@ -1027,7 +1027,7 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord, useInterfaces: boolean = true): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.height = message.height ? message.height.toString() : undefined; obj.period = message.period ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent, useInterfaces) : undefined; @@ -1297,38 +1297,38 @@ export const GenesisState = { if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.delegator_withdraw_infos = []; + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; } - obj.previous_proposer = message.previousProposer; + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } if (message.validatorAccumulatedCommissions) { obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.validator_accumulated_commissions = []; + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; } if (message.validatorHistoricalRewards) { obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.validator_historical_rewards = []; + obj.validator_historical_rewards = message.validatorHistoricalRewards; } if (message.validatorCurrentRewards) { obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.validator_current_rewards = []; + obj.validator_current_rewards = message.validatorCurrentRewards; } if (message.delegatorStartingInfos) { obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.delegator_starting_infos = []; + obj.delegator_starting_infos = message.delegatorStartingInfos; } if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts index e8e1f2bbe7..e8e7d82a62 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts @@ -695,7 +695,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest, useInterfaces: boolean = true): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromProtoMsg(message: QueryValidatorOutstandingRewardsRequestProtoMsg, useInterfaces: boolean = true): QueryValidatorOutstandingRewardsRequest { @@ -859,7 +859,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest, useInterfaces: boolean = true): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromProtoMsg(message: QueryValidatorCommissionRequestProtoMsg, useInterfaces: boolean = true): QueryValidatorCommissionRequest { @@ -1074,7 +1074,7 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest, useInterfaces: boolean = true): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; @@ -1184,7 +1184,7 @@ export const QueryValidatorSlashesResponse = { if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e, useInterfaces) : undefined); } else { - obj.slashes = []; + obj.slashes = message.slashes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1282,8 +1282,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest, useInterfaces: boolean = true): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromProtoMsg(message: QueryDelegationRewardsRequestProtoMsg, useInterfaces: boolean = true): QueryDelegationRewardsRequest { @@ -1373,7 +1373,7 @@ export const QueryDelegationRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1455,7 +1455,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest, useInterfaces: boolean = true): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromProtoMsg(message: QueryDelegationTotalRewardsRequestProtoMsg, useInterfaces: boolean = true): QueryDelegationTotalRewardsRequest { @@ -1566,12 +1566,12 @@ export const QueryDelegationTotalRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e, useInterfaces) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } if (message.total) { obj.total = message.total.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -1653,7 +1653,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest, useInterfaces: boolean = true): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromProtoMsg(message: QueryDelegatorValidatorsRequestProtoMsg, useInterfaces: boolean = true): QueryDelegatorValidatorsRequest { @@ -1743,7 +1743,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e); } else { - obj.validators = []; + obj.validators = message.validators; } return obj; }, @@ -1825,7 +1825,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest, useInterfaces: boolean = true): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromProtoMsg(message: QueryDelegatorWithdrawAddressRequestProtoMsg, useInterfaces: boolean = true): QueryDelegatorWithdrawAddressRequest { @@ -1906,7 +1906,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse, useInterfaces: boolean = true): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = message.withdrawAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromProtoMsg(message: QueryDelegatorWithdrawAddressResponseProtoMsg, useInterfaces: boolean = true): QueryDelegatorWithdrawAddressResponse { @@ -2059,7 +2059,7 @@ export const QueryCommunityPoolResponse = { if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.pool = []; + obj.pool = message.pool; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts index 8af3b2acf2..63db9b0507 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -243,8 +243,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress, useInterfaces: boolean = true): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromProtoMsg(message: MsgSetWithdrawAddressProtoMsg, useInterfaces: boolean = true): MsgSetWithdrawAddress { @@ -403,8 +403,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward, useInterfaces: boolean = true): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromProtoMsg(message: MsgWithdrawDelegatorRewardProtoMsg, useInterfaces: boolean = true): MsgWithdrawDelegatorReward { @@ -494,7 +494,7 @@ export const MsgWithdrawDelegatorRewardResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -576,7 +576,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission, useInterfaces: boolean = true): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromProtoMsg(message: MsgWithdrawValidatorCommissionProtoMsg, useInterfaces: boolean = true): MsgWithdrawValidatorCommission { @@ -666,7 +666,7 @@ export const MsgWithdrawValidatorCommissionResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -772,9 +772,9 @@ export const MsgFundCommunityPool = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.depositor = omitDefault(message.depositor); + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromProtoMsg(message: MsgFundCommunityPoolProtoMsg, useInterfaces: boolean = true): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts index f600f5e8f6..58eba949db 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts @@ -153,7 +153,7 @@ export const Equivocation = { obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, fromProtoMsg(message: EquivocationProtoMsg, useInterfaces: boolean = true): Equivocation { diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts index 501d56d933..dab9c20494 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/genesis.ts @@ -94,7 +94,7 @@ export const GenesisState = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts index b451389527..76357948f7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/query.ts @@ -436,7 +436,7 @@ export const QueryAllEvidenceResponse = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts index f8d32b099b..5a33e4fdbb 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/tx.ts @@ -133,7 +133,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence, useInterfaces: boolean = true): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = message.submitter; + obj.submitter = message.submitter === "" ? undefined : message.submitter; obj.evidence = message.evidence ? Evidence_ToAmino((message.evidence as Any), useInterfaces) : undefined; return obj; }, @@ -239,7 +239,7 @@ export const Evidence_InterfaceDecoder = (input: BinaryReader | Uint8Array): Any return data; } }; -export const Evidence_FromAmino = (content: AnyAmino) => { +export const Evidence_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const Evidence_ToAmino = (content: Any, useInterfaces: boolean = true) => { diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts index c55d95600a..948a24ec73 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/feegrant.ts @@ -265,7 +265,7 @@ export const BasicAllowance = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -430,12 +430,12 @@ export const PeriodicAllowance = { if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.period_spend_limit = []; + obj.period_spend_limit = message.periodSpendLimit; } if (message.periodCanSpend) { obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.period_can_spend = []; + obj.period_can_spend = message.periodCanSpend; } obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; return obj; @@ -546,7 +546,7 @@ export const AllowedMsgAllowance = { if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { - obj.allowed_messages = []; + obj.allowed_messages = message.allowedMessages; } return obj; }, @@ -660,8 +660,8 @@ export const Grant = { }, toAmino(message: Grant, useInterfaces: boolean = true): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any), useInterfaces) : undefined; return obj; }, @@ -692,7 +692,7 @@ export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const FeeAllowanceI_FromAmino = (content: AnyAmino) => { +export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BasicAllowance": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts index eb02b219e7..d19f80811b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e, useInterfaces) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts index feac871994..0000a499af 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/query.ts @@ -212,8 +212,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest, useInterfaces: boolean = true): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromProtoMsg(message: QueryAllowanceRequestProtoMsg, useInterfaces: boolean = true): QueryAllowanceRequest { @@ -394,7 +394,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest, useInterfaces: boolean = true): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = message.grantee; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -502,7 +502,7 @@ export const QueryAllowancesResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e, useInterfaces) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -602,7 +602,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest, useInterfaces: boolean = true): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = message.granter; + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -710,7 +710,7 @@ export const QueryAllowancesByGranterResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e, useInterfaces) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts index c388e245a7..96ca706231 100644 --- a/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/feegrant/v1beta1/tx.ts @@ -183,8 +183,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance, useInterfaces: boolean = true): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? FeeAllowanceI_ToAmino((message.allowance as Any), useInterfaces) : undefined; return obj; }, @@ -344,8 +344,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance, useInterfaces: boolean = true): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromProtoMsg(message: MsgRevokeAllowanceProtoMsg, useInterfaces: boolean = true): MsgRevokeAllowance { @@ -438,7 +438,7 @@ export const FeeAllowanceI_InterfaceDecoder = (input: BinaryReader | Uint8Array) return data; } }; -export const FeeAllowanceI_FromAmino = (content: AnyAmino) => { +export const FeeAllowanceI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/BasicAllowance": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts index fc4a5b7c97..e1c7cdfccd 100644 --- a/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts @@ -93,7 +93,7 @@ export const GenesisState = { if (message.genTxs) { obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); } else { - obj.gen_txs = []; + obj.gen_txs = message.genTxs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts index aec4703adc..636fde61cc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -231,21 +231,21 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e, useInterfaces) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams, useInterfaces) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts index a9db726544..38713b3bdc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts @@ -463,7 +463,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -472,8 +472,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption, useInterfaces: boolean = true): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromProtoMsg(message: WeightedVoteOptionProtoMsg, useInterfaces: boolean = true): WeightedVoteOption { @@ -593,11 +593,11 @@ export const Deposit = { toAmino(message: Deposit, useInterfaces: boolean = true): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -805,7 +805,7 @@ export const Proposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -834,20 +834,20 @@ export const Proposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult, useInterfaces) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: ProposalProtoMsg, useInterfaces: boolean = true): Proposal { @@ -973,10 +973,10 @@ export const TallyResult = { }, toAmino(message: TallyResult, useInterfaces: boolean = true): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromProtoMsg(message: TallyResultProtoMsg, useInterfaces: boolean = true): TallyResult { @@ -1111,13 +1111,13 @@ export const Vote = { toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: VoteProtoMsg, useInterfaces: boolean = true): Vote { @@ -1224,7 +1224,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod, useInterfaces) : undefined; return obj; @@ -1420,9 +1420,9 @@ export const TallyParams = { }, toAmino(message: TallyParams, useInterfaces: boolean = true): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; return obj; }, fromProtoMsg(message: TallyParamsProtoMsg, useInterfaces: boolean = true): TallyParams { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts index 1030d754fc..b3a3df254b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts @@ -623,7 +623,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -638,9 +638,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest, useInterfaces: boolean = true): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -748,7 +748,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -849,7 +849,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest, useInterfaces: boolean = true): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromProtoMsg(message: QueryVoteRequestProtoMsg, useInterfaces: boolean = true): QueryVoteRequest { @@ -1140,7 +1140,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1223,7 +1223,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest, useInterfaces: boolean = true): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromProtoMsg(message: QueryParamsRequestProtoMsg, useInterfaces: boolean = true): QueryParamsRequest { @@ -1441,7 +1441,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest, useInterfaces: boolean = true): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromProtoMsg(message: QueryDepositRequestProtoMsg, useInterfaces: boolean = true): QueryDepositRequest { @@ -1732,7 +1732,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e, useInterfaces) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts index ad7f23e63a..5af89ca633 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts @@ -337,15 +337,15 @@ export const MsgSubmitProposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? ProposalContentI_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: MsgSubmitProposalProtoMsg, useInterfaces: boolean = true): MsgSubmitProposal { @@ -527,7 +527,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent, useInterfaces: boolean = true): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any), useInterfaces) : undefined; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromProtoMsg(message: MsgExecLegacyContentProtoMsg, useInterfaces: boolean = true): MsgExecLegacyContent { @@ -709,7 +709,7 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -718,10 +718,10 @@ export const MsgVote = { }, toAmino(message: MsgVote, useInterfaces: boolean = true): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: MsgVoteProtoMsg, useInterfaces: boolean = true): MsgVote { @@ -918,14 +918,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted, useInterfaces: boolean = true): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: MsgVoteWeightedProtoMsg, useInterfaces: boolean = true): MsgVoteWeighted { @@ -1107,12 +1107,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit, useInterfaces: boolean = true): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1220,7 +1220,7 @@ export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Arr return data; } }; -export const ProposalContentI_FromAmino = (content: AnyAmino) => { +export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/v1/TextProposal": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts index e79416fde3..558b1ace66 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositAmino, DepositSDKType, Vote, VoteAmino, VoteSDKType, Proposal, ProposalAmino, ProposalSDKType, DepositParams, DepositParamsAmino, DepositParamsSDKType, VotingParams, VotingParamsAmino, VotingParamsSDKType, TallyParams, TallyParamsAmino, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -231,21 +231,21 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e, useInterfaces) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams, useInterfaces) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts index 2525cbc87c..2b7638dee1 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts @@ -9,7 +9,7 @@ import { SetSuperfluidAssetsProposal, SetSuperfluidAssetsProposalProtoMsg, SetSu import { UpdateFeeTokenProposal, UpdateFeeTokenProposalProtoMsg, UpdateFeeTokenProposalSDKType } from "../../../osmosis/txfees/v1beta1/gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -522,7 +522,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -531,8 +531,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption, useInterfaces: boolean = true): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromProtoMsg(message: WeightedVoteOptionProtoMsg, useInterfaces: boolean = true): WeightedVoteOption { @@ -629,8 +629,8 @@ export const TextProposal = { }, toAmino(message: TextProposal, useInterfaces: boolean = true): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: TextProposalProtoMsg, useInterfaces: boolean = true): TextProposal { @@ -750,11 +750,11 @@ export const Deposit = { toAmino(message: Deposit, useInterfaces: boolean = true): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -946,7 +946,7 @@ export const Proposal = { message.content = ProposalContentI_FromAmino(object.content); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -970,14 +970,14 @@ export const Proposal = { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any), useInterfaces) : undefined; - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult, useInterfaces) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; @@ -1106,10 +1106,10 @@ export const TallyResult = { }, toAmino(message: TallyResult, useInterfaces: boolean = true): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; return obj; }, fromProtoMsg(message: TallyResultProtoMsg, useInterfaces: boolean = true): TallyResult { @@ -1236,20 +1236,20 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; return message; }, toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1357,7 +1357,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod, useInterfaces) : undefined; return obj; @@ -1599,7 +1599,7 @@ export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Arr return data; } }; -export const ProposalContentI_FromAmino = (content: AnyAmino) => { +export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/TextProposal": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts index 73b95a0be2..8c5bdf686e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts @@ -623,7 +623,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -638,9 +638,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest, useInterfaces: boolean = true): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -748,7 +748,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -849,7 +849,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest, useInterfaces: boolean = true): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromProtoMsg(message: QueryVoteRequestProtoMsg, useInterfaces: boolean = true): QueryVoteRequest { @@ -1140,7 +1140,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1223,7 +1223,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest, useInterfaces: boolean = true): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromProtoMsg(message: QueryParamsRequestProtoMsg, useInterfaces: boolean = true): QueryParamsRequest { @@ -1441,7 +1441,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest, useInterfaces: boolean = true): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromProtoMsg(message: QueryDepositRequestProtoMsg, useInterfaces: boolean = true): QueryDepositRequest { @@ -1732,7 +1732,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e, useInterfaces) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts index 312b7a232e..d118b2a7f2 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts @@ -286,9 +286,9 @@ export const MsgSubmitProposal = { if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromProtoMsg(message: MsgSubmitProposalProtoMsg, useInterfaces: boolean = true): MsgSubmitProposal { @@ -371,7 +371,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse, useInterfaces: boolean = true): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; return obj; }, fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg, useInterfaces: boolean = true): MsgSubmitProposalResponse { @@ -478,15 +478,15 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } return message; }, toAmino(message: MsgVote, useInterfaces: boolean = true): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; return obj; }, fromProtoMsg(message: MsgVoteProtoMsg, useInterfaces: boolean = true): MsgVote { @@ -668,12 +668,12 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted, useInterfaces: boolean = true): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -856,12 +856,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit, useInterfaces: boolean = true): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -969,7 +969,7 @@ export const ProposalContentI_InterfaceDecoder = (input: BinaryReader | Uint8Arr return data; } }; -export const ProposalContentI_FromAmino = (content: AnyAmino) => { +export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/TextProposal": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts index 18476ea1e3..1995e8bba9 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts @@ -405,7 +405,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy, useInterfaces: boolean = true): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: EventCreateGroupPolicyProtoMsg, useInterfaces: boolean = true): EventCreateGroupPolicy { @@ -486,7 +486,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy, useInterfaces: boolean = true): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: EventUpdateGroupPolicyProtoMsg, useInterfaces: boolean = true): EventUpdateGroupPolicy { @@ -827,14 +827,14 @@ export const EventExec = { message.proposalId = BigInt(object.proposal_id); } if (object.result !== undefined && object.result !== null) { - message.result = proposalExecutorResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: EventExec, useInterfaces: boolean = true): EventExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = proposalExecutorResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromProtoMsg(message: EventExecProtoMsg, useInterfaces: boolean = true): EventExec { @@ -933,7 +933,7 @@ export const EventLeaveGroup = { toAmino(message: EventLeaveGroup, useInterfaces: boolean = true): EventLeaveGroupAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: EventLeaveGroupProtoMsg, useInterfaces: boolean = true): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts index edc88f6f26..94226a9855 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoAmino, GroupInfoSDKType, GroupMember, GroupMemberAmino, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoAmino, GroupPolicyInfoSDKType, Proposal, ProposalAmino, ProposalSDKType, Vote, VoteAmino, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -279,33 +279,33 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.group_seq = omitDefault(message.groupSeq); + obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } if (message.groupMembers) { obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e, useInterfaces) : undefined); } else { - obj.group_members = []; + obj.group_members = message.groupMembers; } - obj.group_policy_seq = omitDefault(message.groupPolicySeq); + obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } - obj.proposal_seq = omitDefault(message.proposalSeq); + obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts index 2586cc80b7..95d4b88745 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts @@ -787,7 +787,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest, useInterfaces: boolean = true): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryGroupPolicyInfoRequestProtoMsg, useInterfaces: boolean = true): QueryGroupPolicyInfoRequest { @@ -1078,7 +1078,7 @@ export const QueryGroupMembersResponse = { if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toAmino(e, useInterfaces) : undefined); } else { - obj.members = []; + obj.members = message.members; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1178,7 +1178,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest, useInterfaces: boolean = true): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1286,7 +1286,7 @@ export const QueryGroupsByAdminResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1496,7 +1496,7 @@ export const QueryGroupPoliciesByGroupResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1596,7 +1596,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest, useInterfaces: boolean = true): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1704,7 +1704,7 @@ export const QueryGroupPoliciesByAdminResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1970,7 +1970,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest, useInterfaces: boolean = true): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2078,7 +2078,7 @@ export const QueryProposalsByGroupPolicyResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2179,7 +2179,7 @@ export const QueryVoteByProposalVoterRequest = { toAmino(message: QueryVoteByProposalVoterRequest, useInterfaces: boolean = true): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromProtoMsg(message: QueryVoteByProposalVoterRequestProtoMsg, useInterfaces: boolean = true): QueryVoteByProposalVoterRequest { @@ -2470,7 +2470,7 @@ export const QueryVotesByProposalResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2570,7 +2570,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest, useInterfaces: boolean = true): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2678,7 +2678,7 @@ export const QueryVotesByVoterResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2778,7 +2778,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest, useInterfaces: boolean = true): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2886,7 +2886,7 @@ export const QueryGroupsByMemberResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts index 003fef1596..97f7ae6f85 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts @@ -776,13 +776,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup, useInterfaces: boolean = true): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e, useInterfaces) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: MsgCreateGroupProtoMsg, useInterfaces: boolean = true): MsgCreateGroup { @@ -984,12 +984,12 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers, useInterfaces: boolean = true): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e, useInterfaces) : undefined); } else { - obj.member_updates = []; + obj.member_updates = message.memberUpdates; } return obj; }, @@ -1166,9 +1166,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin, useInterfaces: boolean = true): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromProtoMsg(message: MsgUpdateGroupAdminProtoMsg, useInterfaces: boolean = true): MsgUpdateGroupAdmin { @@ -1344,9 +1344,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata, useInterfaces: boolean = true): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: MsgUpdateGroupMetadataProtoMsg, useInterfaces: boolean = true): MsgUpdateGroupMetadata { @@ -1539,9 +1539,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy, useInterfaces: boolean = true): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; return obj; }, @@ -1623,7 +1623,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse, useInterfaces: boolean = true): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: MsgCreateGroupPolicyResponseProtoMsg, useInterfaces: boolean = true): MsgCreateGroupPolicyResponse { @@ -1734,9 +1734,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin, useInterfaces: boolean = true): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromProtoMsg(message: MsgUpdateGroupPolicyAdminProtoMsg, useInterfaces: boolean = true): MsgUpdateGroupPolicyAdmin { @@ -1900,15 +1900,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy, useInterfaces: boolean = true): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e, useInterfaces) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; return obj; }, @@ -2008,7 +2008,7 @@ export const MsgCreateGroupWithPolicyResponse = { toAmino(message: MsgCreateGroupWithPolicyResponse, useInterfaces: boolean = true): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, fromProtoMsg(message: MsgCreateGroupWithPolicyResponseProtoMsg, useInterfaces: boolean = true): MsgCreateGroupWithPolicyResponse { @@ -2184,8 +2184,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy, useInterfaces: boolean = true): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; return obj; }, @@ -2360,9 +2360,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata, useInterfaces: boolean = true): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromProtoMsg(message: MsgUpdateGroupPolicyMetadataProtoMsg, useInterfaces: boolean = true): MsgUpdateGroupPolicyMetadata { @@ -2572,25 +2572,25 @@ export const MsgSubmitProposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgSubmitProposal, useInterfaces: boolean = true): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.exec = execToJSON(message.exec); + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromProtoMsg(message: MsgSubmitProposalProtoMsg, useInterfaces: boolean = true): MsgSubmitProposal { @@ -2772,7 +2772,7 @@ export const MsgWithdrawProposal = { toAmino(message: MsgWithdrawProposal, useInterfaces: boolean = true): MsgWithdrawProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: MsgWithdrawProposalProtoMsg, useInterfaces: boolean = true): MsgWithdrawProposal { @@ -2966,23 +2966,23 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgVote, useInterfaces: boolean = true): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; - obj.exec = execToJSON(message.exec); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromProtoMsg(message: MsgVoteProtoMsg, useInterfaces: boolean = true): MsgVote { @@ -3144,7 +3144,7 @@ export const MsgExec = { toAmino(message: MsgExec, useInterfaces: boolean = true): MsgExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgExecProtoMsg, useInterfaces: boolean = true): MsgExec { @@ -3305,7 +3305,7 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup, useInterfaces: boolean = true): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, @@ -3397,7 +3397,7 @@ export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const DecisionPolicy_FromAmino = (content: AnyAmino) => { +export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ThresholdDecisionPolicy": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts index 75c6122cd5..f43140dbcb 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts @@ -827,9 +827,9 @@ export const Member = { }, toAmino(message: Member, useInterfaces: boolean = true): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; return obj; }, @@ -920,7 +920,7 @@ export const Members = { if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e, useInterfaces) : undefined); } else { - obj.members = []; + obj.members = message.members; } return obj; }, @@ -1020,7 +1020,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy, useInterfaces: boolean = true): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === "" ? undefined : message.threshold; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows, useInterfaces) : undefined; return obj; }, @@ -1120,7 +1120,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy, useInterfaces: boolean = true): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = message.percentage === "" ? undefined : message.percentage; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows, useInterfaces) : undefined; return obj; }, @@ -1383,10 +1383,10 @@ export const GroupInfo = { toAmino(message: GroupInfo, useInterfaces: boolean = true): GroupInfoAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1665,10 +1665,10 @@ export const GroupPolicyInfo = { }, toAmino(message: GroupPolicyInfo, useInterfaces: boolean = true): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; @@ -1933,10 +1933,10 @@ export const Proposal = { message.groupPolicyVersion = BigInt(object.group_policy_version); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.result !== undefined && object.result !== null) { - message.result = proposalResultFromJSON(object.result); + message.result = object.result; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -1945,7 +1945,7 @@ export const Proposal = { message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); } if (object.executor_result !== undefined && object.executor_result !== null) { - message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; return message; @@ -1953,25 +1953,25 @@ export const Proposal = { toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = proposalStatusToJSON(message.status); - obj.result = proposalResultToJSON(message.result); + obj.status = message.status === 0 ? undefined : message.status; + obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult, useInterfaces) : undefined; obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; - obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -2098,10 +2098,10 @@ export const TallyResult = { }, toAmino(message: TallyResult, useInterfaces: boolean = true): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromProtoMsg(message: TallyResultProtoMsg, useInterfaces: boolean = true): TallyResult { @@ -2232,7 +2232,7 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -2245,9 +2245,9 @@ export const Vote = { toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; return obj; }, @@ -2276,7 +2276,7 @@ export const DecisionPolicy_InterfaceDecoder = (input: BinaryReader | Uint8Array return data; } }; -export const DecisionPolicy_FromAmino = (content: AnyAmino) => { +export const DecisionPolicy_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/ThresholdDecisionPolicy": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts index 32b6bc8c08..be3d074421 100644 --- a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -148,8 +148,8 @@ export const Minter = { }, toAmino(message: Minter, useInterfaces: boolean = true): MinterAmino { const obj: any = {}; - obj.inflation = padDecimal(message.inflation); - obj.annual_provisions = padDecimal(message.annualProvisions); + obj.inflation = padDecimal(message.inflation) === "" ? undefined : padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions) === "" ? undefined : padDecimal(message.annualProvisions); return obj; }, fromProtoMsg(message: MinterProtoMsg, useInterfaces: boolean = true): Minter { @@ -307,12 +307,12 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.inflation_rate_change = padDecimal(message.inflationRateChange); - obj.inflation_max = padDecimal(message.inflationMax); - obj.inflation_min = padDecimal(message.inflationMin); - obj.goal_bonded = padDecimal(message.goalBonded); - obj.blocks_per_year = omitDefault(message.blocksPerYear); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = padDecimal(message.inflationRateChange) === "" ? undefined : padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax) === "" ? undefined : padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin) === "" ? undefined : padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded) === "" ? undefined : padDecimal(message.goalBonded); + obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts index c281ffba21..72fd70641f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -180,10 +180,10 @@ export const EventSend = { }, toAmino(message: EventSend, useInterfaces: boolean = true): EventSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromProtoMsg(message: EventSendProtoMsg, useInterfaces: boolean = true): EventSend { @@ -294,9 +294,9 @@ export const EventMint = { }, toAmino(message: EventMint, useInterfaces: boolean = true): EventMintAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: EventMintProtoMsg, useInterfaces: boolean = true): EventMint { @@ -407,9 +407,9 @@ export const EventBurn = { }, toAmino(message: EventBurn, useInterfaces: boolean = true): EventBurnAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: EventBurnProtoMsg, useInterfaces: boolean = true): EventBurn { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts index 41f931c5c0..c7fe51c911 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassAmino, ClassSDKType, NFT, NFTAmino, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -141,12 +141,12 @@ export const GenesisState = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e, useInterfaces) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } if (message.entries) { obj.entries = message.entries.map(e => e ? Entry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -249,11 +249,11 @@ export const Entry = { }, toAmino(message: Entry, useInterfaces: boolean = true): EntryAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e, useInterfaces) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts index f6389bd11b..6160bc8dee 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/nft.ts @@ -245,12 +245,12 @@ export const Class = { }, toAmino(message: Class, useInterfaces: boolean = true): ClassAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.symbol = message.symbol; - obj.description = message.description; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.id = message.id === "" ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.description = message.description === "" ? undefined : message.description; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data, useInterfaces) : undefined; return obj; }, @@ -394,10 +394,10 @@ export const NFT = { }, toAmino(message: NFT, useInterfaces: boolean = true): NFTAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; - obj.uri = message.uri; - obj.uri_hash = message.uriHash; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts index c2c175b504..7d2c22f556 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts @@ -330,8 +330,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest, useInterfaces: boolean = true): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: QueryBalanceRequestProtoMsg, useInterfaces: boolean = true): QueryBalanceRequest { @@ -510,8 +510,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest, useInterfaces: boolean = true): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromProtoMsg(message: QueryOwnerRequestProtoMsg, useInterfaces: boolean = true): QueryOwnerRequest { @@ -592,7 +592,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse, useInterfaces: boolean = true): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: QueryOwnerResponseProtoMsg, useInterfaces: boolean = true): QueryOwnerResponse { @@ -673,7 +673,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest, useInterfaces: boolean = true): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromProtoMsg(message: QuerySupplyRequestProtoMsg, useInterfaces: boolean = true): QuerySupplyRequest { @@ -869,8 +869,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest, useInterfaces: boolean = true): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.owner = message.owner; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -978,7 +978,7 @@ export const QueryNFTsResponse = { if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e, useInterfaces) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1076,8 +1076,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest, useInterfaces: boolean = true): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = message.classId; - obj.id = message.id; + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromProtoMsg(message: QueryNFTRequestProtoMsg, useInterfaces: boolean = true): QueryNFTRequest { @@ -1241,7 +1241,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest, useInterfaces: boolean = true): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = message.classId; + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromProtoMsg(message: QueryClassRequestProtoMsg, useInterfaces: boolean = true): QueryClassRequest { @@ -1514,7 +1514,7 @@ export const QueryClassesResponse = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e, useInterfaces) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts index 592a356e39..5fb62cd8db 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -154,10 +154,10 @@ export const MsgSend = { }, toAmino(message: MsgSend, useInterfaces: boolean = true): MsgSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromProtoMsg(message: MsgSendProtoMsg, useInterfaces: boolean = true): MsgSend { diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts index 3fd380b2c5..f5434b229c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -319,9 +319,9 @@ export const TableDescriptor = { if (message.index) { obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.index = []; + obj.index = message.index; } - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromProtoMsg(message: TableDescriptorProtoMsg, useInterfaces: boolean = true): TableDescriptor { @@ -417,8 +417,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor, useInterfaces: boolean = true): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.auto_increment = omitDefault(message.autoIncrement); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.auto_increment = message.autoIncrement === false ? undefined : message.autoIncrement; return obj; }, fromProtoMsg(message: PrimaryKeyDescriptorProtoMsg, useInterfaces: boolean = true): PrimaryKeyDescriptor { @@ -529,9 +529,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor, useInterfaces: boolean = true): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.id = omitDefault(message.id); - obj.unique = omitDefault(message.unique); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.id = message.id === 0 ? undefined : message.id; + obj.unique = message.unique === false ? undefined : message.unique; return obj; }, fromProtoMsg(message: SecondaryIndexDescriptorProtoMsg, useInterfaces: boolean = true): SecondaryIndexDescriptor { @@ -612,7 +612,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor, useInterfaces: boolean = true): SingletonDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromProtoMsg(message: SingletonDescriptorProtoMsg, useInterfaces: boolean = true): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts index fa262a36c3..877f5b0612 100644 --- a/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv3/cosmos/orm/v1alpha1/schema.ts @@ -252,7 +252,7 @@ export const ModuleSchemaDescriptor = { if (message.schemaFile) { obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.schema_file = []; + obj.schema_file = message.schemaFile; } obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; @@ -359,15 +359,15 @@ export const ModuleSchemaDescriptor_FileEntry = { message.protoFileName = object.proto_file_name; } if (object.storage_type !== undefined && object.storage_type !== null) { - message.storageType = storageTypeFromJSON(object.storage_type); + message.storageType = object.storage_type; } return message; }, toAmino(message: ModuleSchemaDescriptor_FileEntry, useInterfaces: boolean = true): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = storageTypeToJSON(message.storageType); + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; return obj; }, fromProtoMsg(message: ModuleSchemaDescriptor_FileEntryProtoMsg, useInterfaces: boolean = true): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts index c51e8ba731..fadffcea16 100644 --- a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -155,12 +155,12 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal, useInterfaces: boolean = true): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e, useInterfaces) : undefined); } else { - obj.changes = []; + obj.changes = message.changes; } return obj; }, @@ -272,9 +272,9 @@ export const ParamChange = { }, toAmino(message: ParamChange, useInterfaces: boolean = true): ParamChangeAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: ParamChangeProtoMsg, useInterfaces: boolean = true): ParamChange { diff --git a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts index 07ad0e2740..98b30b1646 100644 --- a/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeAmino, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -195,8 +195,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest, useInterfaces: boolean = true): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; return obj; }, fromProtoMsg(message: QueryParamsRequestProtoMsg, useInterfaces: boolean = true): QueryParamsRequest { @@ -432,7 +432,7 @@ export const QuerySubspacesResponse = { if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e, useInterfaces) : undefined); } else { - obj.subspaces = []; + obj.subspaces = message.subspaces; } return obj; }, @@ -535,11 +535,11 @@ export const Subspace = { }, toAmino(message: Subspace, useInterfaces: boolean = true): SubspaceAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); + obj.subspace = message.subspace === "" ? undefined : message.subspace; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts index c65a4e0418..e50c6442be 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts @@ -233,12 +233,12 @@ export const GenesisState = { if (message.signingInfos) { obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.signing_infos = []; + obj.signing_infos = message.signingInfos; } if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e, useInterfaces) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -337,7 +337,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo, useInterfaces: boolean = true): SigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo, useInterfaces) : undefined; return obj; }, @@ -440,11 +440,11 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks, useInterfaces: boolean = true): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e, useInterfaces) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -544,7 +544,7 @@ export const MissedBlock = { toAmino(message: MissedBlock, useInterfaces: boolean = true): MissedBlockAmino { const obj: any = {}; obj.index = message.index ? message.index.toString() : undefined; - obj.missed = message.missed; + obj.missed = message.missed === false ? undefined : message.missed; return obj; }, fromProtoMsg(message: MissedBlockProtoMsg, useInterfaces: boolean = true): MissedBlock { diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts index f27336035a..5ddb52900d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsAmino, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoAmino, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -349,7 +349,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest, useInterfaces: boolean = true): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = omitDefault(message.consAddress); + obj.cons_address = message.consAddress === "" ? undefined : message.consAddress; return obj; }, fromProtoMsg(message: QuerySigningInfoRequestProtoMsg, useInterfaces: boolean = true): QuerySigningInfoRequest { @@ -622,7 +622,7 @@ export const QuerySigningInfosResponse = { if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.info = []; + obj.info = message.info; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts index a0dbf9e1f1..74b7183121 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts @@ -247,11 +247,11 @@ export const ValidatorSigningInfo = { }, toAmino(message: ValidatorSigningInfo, useInterfaces: boolean = true): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; - obj.tombstoned = message.tombstoned; + obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts index f804643aeb..a8855b6ecc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts @@ -92,7 +92,7 @@ export const MsgUnjail = { }, toAmino(message: MsgUnjail, useInterfaces: boolean = true): MsgUnjailAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr ?? ""; return obj; }, fromProtoMsg(message: MsgUnjailProtoMsg, useInterfaces: boolean = true): MsgUnjail { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts index f817769c89..addf9f32e0 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/authz.ts @@ -241,7 +241,7 @@ export const StakeAuthorization = { message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); } if (object.authorization_type !== undefined && object.authorization_type !== null) { - message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + message.authorizationType = object.authorization_type; } return message; }, @@ -250,7 +250,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens, useInterfaces) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList, useInterfaces) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList, useInterfaces) : undefined; - obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; return obj; }, fromProtoMsg(message: StakeAuthorizationProtoMsg, useInterfaces: boolean = true): StakeAuthorization { @@ -340,7 +340,7 @@ export const StakeAuthorization_Validators = { if (message.address) { obj.address = message.address.map(e => e); } else { - obj.address = []; + obj.address = message.address; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts index 07e6bc68ee..774add332b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsAmino, ParamsSDKType, Validator, ValidatorAmino, ValidatorSDKType, Delegation, DelegationAmino, DelegationSDKType, UnbondingDelegation, UnbondingDelegationAmino, UnbondingDelegationSDKType, Redelegation, RedelegationAmino, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -295,29 +295,29 @@ export const GenesisState = { if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e, useInterfaces) : undefined); } else { - obj.last_validator_powers = []; + obj.last_validator_powers = message.lastValidatorPowers; } if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } if (message.delegations) { obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e, useInterfaces) : undefined); } else { - obj.delegations = []; + obj.delegations = message.delegations; } if (message.unbondingDelegations) { obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e, useInterfaces) : undefined); } else { - obj.unbonding_delegations = []; + obj.unbonding_delegations = message.unbondingDelegations; } if (message.redelegations) { obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e, useInterfaces) : undefined); } else { - obj.redelegations = []; + obj.redelegations = message.redelegations; } - obj.exported = omitDefault(message.exported); + obj.exported = message.exported === false ? undefined : message.exported; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { @@ -415,8 +415,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower, useInterfaces: boolean = true): LastValidatorPowerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.power = omitDefault(message.power); + obj.address = message.address === "" ? undefined : message.address; + obj.power = message.power ? message.power.toString() : undefined; return obj; }, fromProtoMsg(message: LastValidatorPowerProtoMsg, useInterfaces: boolean = true): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts index e37b57fdb7..b738a7e046 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts @@ -822,7 +822,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest, useInterfaces: boolean = true): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = message.status; + obj.status = message.status === "" ? undefined : message.status; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -930,7 +930,7 @@ export const QueryValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1013,7 +1013,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest, useInterfaces: boolean = true): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromProtoMsg(message: QueryValidatorRequestProtoMsg, useInterfaces: boolean = true): QueryValidatorRequest { @@ -1194,7 +1194,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest, useInterfaces: boolean = true): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1302,7 +1302,7 @@ export const QueryValidatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1402,7 +1402,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest, useInterfaces: boolean = true): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1510,7 +1510,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e, useInterfaces) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1608,8 +1608,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest, useInterfaces: boolean = true): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromProtoMsg(message: QueryDelegationRequestProtoMsg, useInterfaces: boolean = true): QueryDelegationRequest { @@ -1788,8 +1788,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest, useInterfaces: boolean = true): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromProtoMsg(message: QueryUnbondingDelegationRequestProtoMsg, useInterfaces: boolean = true): QueryUnbondingDelegationRequest { @@ -1970,7 +1970,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest, useInterfaces: boolean = true): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2078,7 +2078,7 @@ export const QueryDelegatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2178,7 +2178,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest, useInterfaces: boolean = true): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2286,7 +2286,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e, useInterfaces) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2416,9 +2416,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest, useInterfaces: boolean = true): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.src_validator_addr = message.srcValidatorAddr; - obj.dst_validator_addr = message.dstValidatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2526,7 +2526,7 @@ export const QueryRedelegationsResponse = { if (message.redelegationResponses) { obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.redelegation_responses = []; + obj.redelegation_responses = message.redelegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2626,7 +2626,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest, useInterfaces: boolean = true): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2734,7 +2734,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2832,8 +2832,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest, useInterfaces: boolean = true): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = message.delegatorAddr; - obj.validator_addr = message.validatorAddr; + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromProtoMsg(message: QueryDelegatorValidatorRequestProtoMsg, useInterfaces: boolean = true): QueryDelegatorValidatorRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts index 072dfc8634..52c5716868 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Duration, DurationAmino, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Pubkey } from "@cosmjs/amino"; @@ -842,7 +842,7 @@ export const HistoricalInfo = { if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.valset = []; + obj.valset = message.valset; } return obj; }, @@ -954,9 +954,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates, useInterfaces: boolean = true): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate) === "" ? undefined : padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate) === "" ? undefined : padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate) === "" ? undefined : padDecimal(message.maxChangeRate); return obj; }, fromProtoMsg(message: CommissionRatesProtoMsg, useInterfaces: boolean = true): CommissionRates { @@ -1196,11 +1196,11 @@ export const Description = { }, toAmino(message: Description, useInterfaces: boolean = true): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; return obj; }, fromProtoMsg(message: DescriptionProtoMsg, useInterfaces: boolean = true): Description { @@ -1412,7 +1412,7 @@ export const Validator = { message.jailed = object.jailed; } if (object.status !== undefined && object.status !== null) { - message.status = bondStatusFromJSON(object.status); + message.status = object.status; } if (object.tokens !== undefined && object.tokens !== null) { message.tokens = object.tokens; @@ -1439,17 +1439,17 @@ export const Validator = { }, toAmino(message: Validator, useInterfaces: boolean = true): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = bondStatusToJSON(message.status); - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = padDecimal(message.delegatorShares) === "" ? undefined : padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description, useInterfaces) : undefined; obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission, useInterfaces) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromProtoMsg(message: ValidatorProtoMsg, useInterfaces: boolean = true): Validator { @@ -1539,7 +1539,7 @@ export const ValAddresses = { if (message.addresses) { obj.addresses = message.addresses.map(e => e); } else { - obj.addresses = []; + obj.addresses = message.addresses; } return obj; }, @@ -1636,8 +1636,8 @@ export const DVPair = { }, toAmino(message: DVPair, useInterfaces: boolean = true): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromProtoMsg(message: DVPairProtoMsg, useInterfaces: boolean = true): DVPair { @@ -1727,7 +1727,7 @@ export const DVPairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e, useInterfaces) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, @@ -1839,9 +1839,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet, useInterfaces: boolean = true): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; return obj; }, fromProtoMsg(message: DVVTripletProtoMsg, useInterfaces: boolean = true): DVVTriplet { @@ -1931,7 +1931,7 @@ export const DVVTriplets = { if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e, useInterfaces) : undefined); } else { - obj.triplets = []; + obj.triplets = message.triplets; } return obj; }, @@ -2043,9 +2043,9 @@ export const Delegation = { }, toAmino(message: Delegation, useInterfaces: boolean = true): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromProtoMsg(message: DelegationProtoMsg, useInterfaces: boolean = true): Delegation { @@ -2162,12 +2162,12 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation, useInterfaces: boolean = true): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2298,8 +2298,8 @@ export const UnbondingDelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromProtoMsg(message: UnbondingDelegationEntryProtoMsg, useInterfaces: boolean = true): UnbondingDelegationEntry { @@ -2429,8 +2429,8 @@ export const RedelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = padDecimal(message.sharesDst) === "" ? undefined : padDecimal(message.sharesDst); return obj; }, fromProtoMsg(message: RedelegationEntryProtoMsg, useInterfaces: boolean = true): RedelegationEntry { @@ -2562,13 +2562,13 @@ export const Redelegation = { }, toAmino(message: Redelegation, useInterfaces: boolean = true): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2728,11 +2728,11 @@ export const Params = { toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime, useInterfaces) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = padDecimal(message.minCommissionRate) === "" ? undefined : padDecimal(message.minCommissionRate); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -2932,7 +2932,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse, useInterfaces: boolean = true): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry, useInterfaces) : undefined; - obj.balance = message.balance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromProtoMsg(message: RedelegationEntryResponseProtoMsg, useInterfaces: boolean = true): RedelegationEntryResponse { @@ -3040,7 +3040,7 @@ export const RedelegationResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -3137,8 +3137,8 @@ export const Pool = { }, toAmino(message: Pool, useInterfaces: boolean = true): PoolAmino { const obj: any = {}; - obj.not_bonded_tokens = message.notBondedTokens; - obj.bonded_tokens = message.bondedTokens; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; return obj; }, fromProtoMsg(message: PoolProtoMsg, useInterfaces: boolean = true): Pool { @@ -3162,7 +3162,7 @@ export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => { +export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { return encodePubkey(content); }; export const Cosmos_cryptoPubKey_ToAmino = (content: Any, useInterfaces: boolean = true): Pubkey | null => { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts index 306f718ee5..1447a35974 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; import { Pubkey } from "@cosmjs/amino"; @@ -405,9 +405,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description, useInterfaces) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission, useInterfaces) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value, useInterfaces) : undefined; return obj; @@ -601,9 +601,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator, useInterfaces: boolean = true): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description, useInterfaces) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = padDecimal(message.commissionRate) === "" ? undefined : padDecimal(message.commissionRate); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromProtoMsg(message: MsgEditValidatorProtoMsg, useInterfaces: boolean = true): MsgEditValidator { @@ -779,8 +779,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate, useInterfaces: boolean = true): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; return obj; }, @@ -972,9 +972,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate, useInterfaces: boolean = true): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; return obj; }, @@ -1169,8 +1169,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate, useInterfaces: boolean = true): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; return obj; }, @@ -1276,7 +1276,7 @@ export const Cosmos_cryptoPubKey_InterfaceDecoder = (input: BinaryReader | Uint8 return data; } }; -export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => { +export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { return encodePubkey(content); }; export const Cosmos_cryptoPubKey_ToAmino = (content: Any, useInterfaces: boolean = true): Pubkey | null => { diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts index 2797309fd1..e260c9bc0e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts @@ -298,7 +298,7 @@ export const SignatureDescriptors = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -606,7 +606,7 @@ export const SignatureDescriptor_Data_Single = { fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); @@ -615,7 +615,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single, useInterfaces: boolean = true): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -724,7 +724,7 @@ export const SignatureDescriptor_Data_Multi = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e, useInterfaces) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts index 019468a923..4b8d0e41cc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts @@ -542,7 +542,7 @@ export const GetTxsEventRequest = { message.pagination = PageRequest.fromAmino(object.pagination); } if (object.order_by !== undefined && object.order_by !== null) { - message.orderBy = orderByFromJSON(object.order_by); + message.orderBy = object.order_by; } return message; }, @@ -551,10 +551,10 @@ export const GetTxsEventRequest = { if (message.events) { obj.events = message.events.map(e => e); } else { - obj.events = []; + obj.events = message.events; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; - obj.order_by = orderByToJSON(message.orderBy); + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; return obj; }, fromProtoMsg(message: GetTxsEventRequestProtoMsg, useInterfaces: boolean = true): GetTxsEventRequest { @@ -682,12 +682,12 @@ export const GetTxsEventResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e, useInterfaces) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } if (message.txResponses) { obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.tx_responses = []; + obj.tx_responses = message.txResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -779,14 +779,14 @@ export const BroadcastTxRequest = { message.txBytes = bytesFromBase64(object.tx_bytes); } if (object.mode !== undefined && object.mode !== null) { - message.mode = broadcastModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: BroadcastTxRequest, useInterfaces: boolean = true): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; - obj.mode = broadcastModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromProtoMsg(message: BroadcastTxRequestProtoMsg, useInterfaces: boolean = true): BroadcastTxRequest { @@ -1150,7 +1150,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest, useInterfaces: boolean = true): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromProtoMsg(message: GetTxRequestProtoMsg, useInterfaces: boolean = true): GetTxRequest { @@ -1493,7 +1493,7 @@ export const GetBlockWithTxsResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e, useInterfaces) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; obj.block = message.block ? Block.toAmino(message.block, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts index 9ab9a8ab2a..d22f9ff8b9 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts @@ -816,7 +816,7 @@ export const Tx = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -939,7 +939,7 @@ export const TxRaw = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1070,7 +1070,7 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; return obj; }, @@ -1237,7 +1237,7 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip, useInterfaces) : undefined; @@ -1404,19 +1404,19 @@ export const TxBody = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.extension_options = []; + obj.extension_options = message.extensionOptions; } if (message.nonCriticalExtensionOptions) { obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.non_critical_extension_options = []; + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; } return obj; }, @@ -1541,7 +1541,7 @@ export const AuthInfo = { if (message.signerInfos) { obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.signer_infos = []; + obj.signer_infos = message.signerInfos; } obj.fee = message.fee ? Fee.toAmino(message.fee, useInterfaces) : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip, useInterfaces) : undefined; @@ -1839,13 +1839,13 @@ export const ModeInfo_Single = { fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { const message = createBaseModeInfo_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: ModeInfo_Single, useInterfaces: boolean = true): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromProtoMsg(message: ModeInfo_SingleProtoMsg, useInterfaces: boolean = true): ModeInfo_Single { @@ -1953,7 +1953,7 @@ export const ModeInfo_Multi = { if (message.modeInfos) { obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.mode_infos = []; + obj.mode_infos = message.modeInfos; } return obj; }, @@ -2091,11 +2091,11 @@ export const Fee = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; return obj; }, fromProtoMsg(message: FeeProtoMsg, useInterfaces: boolean = true): Fee { @@ -2200,9 +2200,9 @@ export const Tip = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.tipper = message.tipper; + obj.tipper = message.tipper === "" ? undefined : message.tipper; return obj; }, fromProtoMsg(message: TipProtoMsg, useInterfaces: boolean = true): Tip { @@ -2321,7 +2321,7 @@ export const AuxSignerData = { message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -2330,9 +2330,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData, useInterfaces: boolean = true): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc, useInterfaces) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts index 8ba41f2b8c..cd36610b63 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanAmino, PlanSDKType, ModuleVersion, ModuleVersionAmino, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -503,7 +503,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest, useInterfaces: boolean = true): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: QueryAppliedPlanRequestProtoMsg, useInterfaces: boolean = true): QueryAppliedPlanRequest { @@ -586,7 +586,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse, useInterfaces: boolean = true): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromProtoMsg(message: QueryAppliedPlanResponseProtoMsg, useInterfaces: boolean = true): QueryAppliedPlanResponse { @@ -669,7 +669,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest, useInterfaces: boolean = true): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = omitDefault(message.lastHeight); + obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; return obj; }, fromProtoMsg(message: QueryUpgradedConsensusStateRequestProtoMsg, useInterfaces: boolean = true): QueryUpgradedConsensusStateRequest { @@ -831,7 +831,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest, useInterfaces: boolean = true): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = omitDefault(message.moduleName); + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; return obj; }, fromProtoMsg(message: QueryModuleVersionsRequestProtoMsg, useInterfaces: boolean = true): QueryModuleVersionsRequest { @@ -921,7 +921,7 @@ export const QueryModuleVersionsResponse = { if (message.moduleVersions) { obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e, useInterfaces) : undefined); } else { - obj.module_versions = []; + obj.module_versions = message.moduleVersions; } return obj; }, @@ -1066,7 +1066,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse, useInterfaces: boolean = true): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryAuthorityResponseProtoMsg, useInterfaces: boolean = true): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts index 3cdb388c10..2783b1499d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/tx.ts @@ -193,7 +193,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade, useInterfaces: boolean = true): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; obj.plan = message.plan ? Plan.toAmino(message.plan, useInterfaces) : undefined; return obj; }, @@ -338,7 +338,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade, useInterfaces: boolean = true): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromProtoMsg(message: MsgCancelUpgradeProtoMsg, useInterfaces: boolean = true): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts index 00f469ec7a..e110093d28 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts @@ -332,10 +332,10 @@ export const Plan = { }, toAmino(message: Plan, useInterfaces: boolean = true): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState, useInterfaces) : undefined; return obj; }, @@ -449,8 +449,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal, useInterfaces: boolean = true): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan, useInterfaces) : undefined; return obj; }, @@ -547,8 +547,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal, useInterfaces: boolean = true): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: CancelSoftwareUpgradeProposalProtoMsg, useInterfaces: boolean = true): CancelSoftwareUpgradeProposal { @@ -646,7 +646,7 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion, useInterfaces: boolean = true): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.version = message.version ? message.version.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts index 468a501c0c..65f8b235e7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodAmino, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -277,15 +277,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount, useInterfaces: boolean = true): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.end_time = omitDefault(message.endTime); - obj.delayed = omitDefault(message.delayed); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, fromProtoMsg(message: MsgCreateVestingAccountProtoMsg, useInterfaces: boolean = true): MsgCreateVestingAccount { @@ -465,12 +465,12 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount, useInterfaces: boolean = true): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -668,13 +668,13 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount, useInterfaces: boolean = true): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); - obj.start_time = omitDefault(message.startTime); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts index e3cde84bc5..c16e754d1b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts @@ -331,17 +331,17 @@ export const BaseVestingAccount = { if (message.originalVesting) { obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.original_vesting = []; + obj.original_vesting = message.originalVesting; } if (message.delegatedFree) { obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.delegated_free = []; + obj.delegated_free = message.delegatedFree; } if (message.delegatedVesting) { obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.delegated_vesting = []; + obj.delegated_vesting = message.delegatedVesting; } obj.end_time = message.endTime ? message.endTime.toString() : undefined; return obj; @@ -635,7 +635,7 @@ export const Period = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -762,7 +762,7 @@ export const PeriodicVestingAccount = { if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts index 6064f0b18e..72836c13c8 100644 --- a/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv3/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, omitDefault } from "../helpers"; +import { isSet, DeepPartial } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -246,8 +246,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor, useInterfaces: boolean = true): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: InterfaceDescriptorProtoMsg, useInterfaces: boolean = true): InterfaceDescriptor { @@ -367,17 +367,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor, useInterfaces: boolean = true): ScalarDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts index 9a74323377..6f74449f5d 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts @@ -285,22 +285,22 @@ export const GenesisState = { if (message.codes) { obj.codes = message.codes.map(e => e ? Code.toAmino(e, useInterfaces) : undefined); } else { - obj.codes = []; + obj.codes = message.codes; } if (message.contracts) { obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e, useInterfaces) : undefined); } else { - obj.contracts = []; + obj.contracts = message.contracts; } if (message.sequences) { obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e, useInterfaces) : undefined); } else { - obj.sequences = []; + obj.sequences = message.sequences; } if (message.genMsgs) { obj.gen_msgs = message.genMsgs.map(e => e ? GenesisState_GenMsgs.toAmino(e, useInterfaces) : undefined); } else { - obj.gen_msgs = []; + obj.gen_msgs = message.genMsgs; } return obj; }, @@ -553,7 +553,7 @@ export const Code = { obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo, useInterfaces) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; - obj.pinned = message.pinned; + obj.pinned = message.pinned === false ? undefined : message.pinned; return obj; }, fromProtoMsg(message: CodeProtoMsg, useInterfaces: boolean = true): Code { @@ -672,12 +672,12 @@ export const Contract = { }, toAmino(message: Contract, useInterfaces: boolean = true): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo, useInterfaces) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e, useInterfaces) : undefined); } else { - obj.contract_state = []; + obj.contract_state = message.contractState; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts index 8e77be299d..2586adf403 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts @@ -182,7 +182,7 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend, useInterfaces: boolean = true): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -266,7 +266,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel, useInterfaces: boolean = true): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; return obj; }, fromProtoMsg(message: MsgIBCCloseChannelProtoMsg, useInterfaces: boolean = true): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts index e4d8091b0d..8885fc1a93 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigAmino, AccessConfigSDKType } from "./types"; import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -498,9 +498,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal, useInterfaces: boolean = true): StoreCodeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission, useInterfaces) : undefined; return obj; @@ -696,17 +696,17 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal, useInterfaces: boolean = true): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.admin = omitDefault(message.admin); - obj.code_id = omitDefault(message.codeId); - obj.label = omitDefault(message.label); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -850,10 +850,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal, useInterfaces: boolean = true): MigrateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); - obj.code_id = omitDefault(message.codeId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -980,9 +980,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal, useInterfaces: boolean = true): SudoContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1145,15 +1145,15 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal, useInterfaces: boolean = true): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1280,10 +1280,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal, useInterfaces: boolean = true): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.new_admin = omitDefault(message.newAdmin); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromProtoMsg(message: UpdateAdminProposalProtoMsg, useInterfaces: boolean = true): UpdateAdminProposal { @@ -1394,9 +1394,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal, useInterfaces: boolean = true): ClearAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromProtoMsg(message: ClearAdminProposalProtoMsg, useInterfaces: boolean = true): ClearAdminProposal { @@ -1522,12 +1522,12 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal, useInterfaces: boolean = true): PinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -1654,12 +1654,12 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal, useInterfaces: boolean = true): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts index c93d9fc1ae..97da755bd6 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts @@ -589,7 +589,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest, useInterfaces: boolean = true): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryContractInfoRequestProtoMsg, useInterfaces: boolean = true): QueryContractInfoRequest { @@ -687,7 +687,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse, useInterfaces: boolean = true): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo, useInterfaces) : undefined; return obj; }, @@ -786,7 +786,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest, useInterfaces: boolean = true): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -894,7 +894,7 @@ export const QueryContractHistoryResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1104,7 +1104,7 @@ export const QueryContractsByCodeResponse = { if (message.contracts) { obj.contracts = message.contracts.map(e => e); } else { - obj.contracts = []; + obj.contracts = message.contracts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1204,7 +1204,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest, useInterfaces: boolean = true): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1312,7 +1312,7 @@ export const QueryAllContractStateResponse = { if (message.models) { obj.models = message.models.map(e => e ? Model.toAmino(e, useInterfaces) : undefined); } else { - obj.models = []; + obj.models = message.models; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1410,7 +1410,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest, useInterfaces: boolean = true): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1588,7 +1588,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest, useInterfaces: boolean = true): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1866,8 +1866,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse, useInterfaces: boolean = true): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; return obj; }, @@ -1967,7 +1967,7 @@ export const QueryCodeResponse = { toAmino(message: QueryCodeResponse, useInterfaces: boolean = true): QueryCodeResponseAmino { const obj: any = {}; obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo, useInterfaces) : undefined; - obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; return obj; }, fromProtoMsg(message: QueryCodeResponseProtoMsg, useInterfaces: boolean = true): QueryCodeResponse { @@ -2157,7 +2157,7 @@ export const QueryCodesResponse = { if (message.codeInfos) { obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.code_infos = []; + obj.code_infos = message.codeInfos; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2358,7 +2358,7 @@ export const QueryPinnedCodesResponse = { if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts index 60d929de95..fe9adb204e 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts @@ -407,7 +407,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode, useInterfaces: boolean = true): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission, useInterfaces) : undefined; return obj; @@ -656,15 +656,15 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract, useInterfaces: boolean = true): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -761,7 +761,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse, useInterfaces: boolean = true): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -894,13 +894,13 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract, useInterfaces: boolean = true): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1110,8 +1110,8 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract, useInterfaces: boolean = true): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1305,9 +1305,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin, useInterfaces: boolean = true): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromProtoMsg(message: MsgUpdateAdminProtoMsg, useInterfaces: boolean = true): MsgUpdateAdmin { @@ -1466,8 +1466,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin, useInterfaces: boolean = true): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromProtoMsg(message: MsgClearAdminProtoMsg, useInterfaces: boolean = true): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts index 91df9451ef..895d6f8440 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts @@ -402,13 +402,13 @@ export const AccessTypeParam = { fromAmino(object: AccessTypeParamAmino): AccessTypeParam { const message = createBaseAccessTypeParam(); if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); + message.value = object.value; } return message; }, toAmino(message: AccessTypeParam, useInterfaces: boolean = true): AccessTypeParamAmino { const obj: any = {}; - obj.value = accessTypeToJSON(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: AccessTypeParamProtoMsg, useInterfaces: boolean = true): AccessTypeParam { @@ -495,7 +495,7 @@ export const AccessConfig = { fromAmino(object: AccessConfigAmino): AccessConfig { const message = createBaseAccessConfig(); if (object.permission !== undefined && object.permission !== null) { - message.permission = accessTypeFromJSON(object.permission); + message.permission = object.permission; } if (object.address !== undefined && object.address !== null) { message.address = object.address; @@ -504,8 +504,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig, useInterfaces: boolean = true): AccessConfigAmino { const obj: any = {}; - obj.permission = accessTypeToJSON(message.permission); - obj.address = message.address; + obj.permission = message.permission === 0 ? undefined : message.permission; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: AccessConfigProtoMsg, useInterfaces: boolean = true): AccessConfig { @@ -611,7 +611,7 @@ export const Params = { message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); } if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { - message.instantiateDefaultPermission = accessTypeFromJSON(object.instantiate_default_permission); + message.instantiateDefaultPermission = object.instantiate_default_permission; } if (object.max_wasm_code_size !== undefined && object.max_wasm_code_size !== null) { message.maxWasmCodeSize = BigInt(object.max_wasm_code_size); @@ -621,7 +621,7 @@ export const Params = { toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess, useInterfaces) : undefined; - obj.instantiate_default_permission = accessTypeToJSON(message.instantiateDefaultPermission); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; return obj; }, @@ -736,7 +736,7 @@ export const CodeInfo = { toAmino(message: CodeInfo, useInterfaces: boolean = true): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig, useInterfaces) : undefined; return obj; }, @@ -915,11 +915,11 @@ export const ContractInfo = { toAmino(message: ContractInfo, useInterfaces: boolean = true): ContractInfoAmino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created, useInterfaces) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; obj.extension = message.extension ? ContractInfoExtension_ToAmino((message.extension as Any), useInterfaces) : undefined; return obj; }, @@ -1035,7 +1035,7 @@ export const ContractCodeHistoryEntry = { fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); if (object.operation !== undefined && object.operation !== null) { - message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + message.operation = object.operation; } if (object.code_id !== undefined && object.code_id !== null) { message.codeId = BigInt(object.code_id); @@ -1050,7 +1050,7 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry, useInterfaces: boolean = true): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + obj.operation = message.operation === 0 ? undefined : message.operation; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated, useInterfaces) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; @@ -1275,7 +1275,7 @@ export const ContractInfoExtension_InterfaceDecoder = (input: BinaryReader | Uin return data; } }; -export const ContractInfoExtension_FromAmino = (content: AnyAmino) => { +export const ContractInfoExtension_FromAmino = (content: AnyAmino): Any => { return Any.fromAmino(content); }; export const ContractInfoExtension_ToAmino = (content: Any, useInterfaces: boolean = true) => { diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts index 70cb4a21e7..51311e85b0 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/claims.ts @@ -236,7 +236,7 @@ export const Claim = { fromAmino(object: ClaimAmino): Claim { const message = createBaseClaim(); if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } if (object.completed !== undefined && object.completed !== null) { message.completed = object.completed; @@ -248,9 +248,9 @@ export const Claim = { }, toAmino(message: Claim, useInterfaces: boolean = true): ClaimAmino { const obj: any = {}; - obj.action = actionToJSON(message.action); - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = message.action === 0 ? undefined : message.action; + obj.completed = message.completed === false ? undefined : message.completed; + obj.claimable_amount = message.claimableAmount === "" ? undefined : message.claimableAmount; return obj; }, fromProtoMsg(message: ClaimProtoMsg, useInterfaces: boolean = true): Claim { @@ -375,12 +375,12 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress, useInterfaces: boolean = true): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = message.address === "" ? undefined : message.address; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, @@ -491,11 +491,11 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord, useInterfaces: boolean = true): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts index bcd30f5a4b..80c50c4192 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/genesis.ts @@ -172,7 +172,7 @@ export const GenesisState = { if (message.claimsRecords) { obj.claims_records = message.claimsRecords.map(e => e ? ClaimsRecordAddress.toAmino(e, useInterfaces) : undefined); } else { - obj.claims_records = []; + obj.claims_records = message.claimsRecords; } return obj; }, @@ -359,20 +359,20 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = message.enableClaims === false ? undefined : message.enableClaims; obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay, useInterfaces) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay, useInterfaces) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = message.claimsDenom === "" ? undefined : message.claimsDenom; if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { - obj.authorized_channels = []; + obj.authorized_channels = message.authorizedChannels; } if (message.evmChannels) { obj.evm_channels = message.evmChannels.map(e => e); } else { - obj.evm_channels = []; + obj.evm_channels = message.evmChannels; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts index 7b8fa82c6d..cc7834a0bf 100644 --- a/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin" import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressAmino, ClaimsRecordAddressSDKType, Claim, ClaimAmino, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -332,7 +332,7 @@ export const QueryTotalUnclaimedResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -665,7 +665,7 @@ export const QueryClaimsRecordsResponse = { if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toAmino(e, useInterfaces) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -747,7 +747,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest, useInterfaces: boolean = true): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryClaimsRecordRequestProtoMsg, useInterfaces: boolean = true): QueryClaimsRecordRequest { @@ -848,11 +848,11 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse, useInterfaces: boolean = true): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e, useInterfaces) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts index ec576890fa..d2080b4fbf 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts @@ -210,12 +210,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo, useInterfaces: boolean = true): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -305,7 +305,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts index 869be48ce5..eac036dce0 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; @@ -230,7 +230,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -312,7 +312,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest, useInterfaces: boolean = true): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromProtoMsg(message: QueryCurrentEpochRequestProtoMsg, useInterfaces: boolean = true): QueryCurrentEpochRequest { @@ -394,7 +394,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse, useInterfaces: boolean = true): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: QueryCurrentEpochResponseProtoMsg, useInterfaces: boolean = true): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts index c0f1467441..ce2b560989 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/erc20.ts @@ -306,16 +306,16 @@ export const TokenPair = { message.enabled = object.enabled; } if (object.contract_owner !== undefined && object.contract_owner !== null) { - message.contractOwner = ownerFromJSON(object.contract_owner); + message.contractOwner = object.contract_owner; } return message; }, toAmino(message: TokenPair, useInterfaces: boolean = true): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = ownerToJSON(message.contractOwner); + obj.erc20_address = message.erc20Address === "" ? undefined : message.erc20Address; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.contract_owner = message.contractOwner === 0 ? undefined : message.contractOwner; return obj; }, fromProtoMsg(message: TokenPairProtoMsg, useInterfaces: boolean = true): TokenPair { @@ -427,8 +427,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal, useInterfaces: boolean = true): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata, useInterfaces) : undefined; return obj; }, @@ -539,9 +539,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal, useInterfaces: boolean = true): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.erc20address = message.erc20address === "" ? undefined : message.erc20address; return obj; }, fromProtoMsg(message: RegisterERC20ProposalProtoMsg, useInterfaces: boolean = true): RegisterERC20Proposal { @@ -651,9 +651,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal, useInterfaces: boolean = true): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromProtoMsg(message: ToggleTokenConversionProposalProtoMsg, useInterfaces: boolean = true): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts index 07d6d9296e..2b5787ad42 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -147,7 +147,7 @@ export const GenesisState = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e, useInterfaces) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } return obj; }, @@ -243,8 +243,8 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = omitDefault(message.enableErc20); - obj.enable_evm_hook = omitDefault(message.enableEvmHook); + obj.enable_erc20 = message.enableErc20 === false ? undefined : message.enableErc20; + obj.enable_evm_hook = message.enableEvmHook === false ? undefined : message.enableEvmHook; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts index 7bccb702e3..24fe73f144 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageRe import { TokenPair, TokenPairAmino, TokenPairSDKType } from "./erc20"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -317,7 +317,7 @@ export const QueryTokenPairsResponse = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e, useInterfaces) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -399,7 +399,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest, useInterfaces: boolean = true): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = omitDefault(message.token); + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromProtoMsg(message: QueryTokenPairRequestProtoMsg, useInterfaces: boolean = true): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts index 122d681602..60cc6cb5b3 100644 --- a/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/erc20/v1/tx.ts @@ -195,8 +195,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin, useInterfaces: boolean = true): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin, useInterfaces) : undefined; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromProtoMsg(message: MsgConvertCoinProtoMsg, useInterfaces: boolean = true): MsgConvertCoin { @@ -383,10 +383,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20, useInterfaces: boolean = true): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.amount = message.amount; - obj.receiver = message.receiver; - obj.sender = message.sender; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromProtoMsg(message: MsgConvertERC20ProtoMsg, useInterfaces: boolean = true): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts index b30ab890af..1348aa6ca4 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -138,9 +138,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo, useInterfaces: boolean = true): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromProtoMsg(message: DevFeeInfoProtoMsg, useInterfaces: boolean = true): DevFeeInfo { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts index f215b3df4d..42d6ce76ca 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoAmino, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -173,7 +173,7 @@ export const GenesisState = { if (message.devFeeInfos) { obj.dev_fee_infos = message.devFeeInfos.map(e => e ? DevFeeInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.dev_fee_infos = []; + obj.dev_fee_infos = message.devFeeInfos; } return obj; }, @@ -316,11 +316,11 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.enable_fees = omitDefault(message.enableFees); - obj.developer_shares = padDecimal(message.developerShares); - obj.validator_shares = padDecimal(message.validatorShares); - obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); - obj.min_gas_price = padDecimal(message.minGasPrice); + obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; + obj.developer_shares = padDecimal(message.developerShares) === "" ? undefined : padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares) === "" ? undefined : padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.min_gas_price = padDecimal(message.minGasPrice) === "" ? undefined : padDecimal(message.minGasPrice); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts index 060e5b3400..680631bea3 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/query.ts @@ -382,7 +382,7 @@ export const QueryDevFeeInfosResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -464,7 +464,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest, useInterfaces: boolean = true): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromProtoMsg(message: QueryDevFeeInfoRequestProtoMsg, useInterfaces: boolean = true): QueryDevFeeInfoRequest { @@ -787,7 +787,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest, useInterfaces: boolean = true): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = message.deployerAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -894,7 +894,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts index a4d193531c..8035387118 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -280,13 +280,13 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo, useInterfaces: boolean = true): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -444,8 +444,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo, useInterfaces: boolean = true): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; return obj; }, fromProtoMsg(message: MsgCancelDevFeeInfoProtoMsg, useInterfaces: boolean = true): MsgCancelDevFeeInfo { @@ -617,9 +617,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo, useInterfaces: boolean = true): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromProtoMsg(message: MsgUpdateDevFeeInfoProtoMsg, useInterfaces: boolean = true): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts index 9ccdd234b1..4a0c60dce5 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveAmino, IncentiveSDKType, GasMeter, GasMeterAmino, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -176,12 +176,12 @@ export const GenesisState = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e, useInterfaces) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e, useInterfaces) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } return obj; }, @@ -307,10 +307,10 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.enable_incentives = omitDefault(message.enableIncentives); - obj.allocation_limit = padDecimal(message.allocationLimit); - obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); - obj.reward_scaler = padDecimal(message.rewardScaler); + obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; + obj.allocation_limit = padDecimal(message.allocationLimit) === "" ? undefined : padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; + obj.reward_scaler = padDecimal(message.rewardScaler) === "" ? undefined : padDecimal(message.rewardScaler); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts index d754aa5874..300d94eb64 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts @@ -278,13 +278,13 @@ export const Incentive = { }, toAmino(message: Incentive, useInterfaces: boolean = true): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; return obj; @@ -398,8 +398,8 @@ export const GasMeter = { }, toAmino(message: GasMeter, useInterfaces: boolean = true): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; return obj; }, @@ -547,15 +547,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal, useInterfaces: boolean = true): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; return obj; }, fromProtoMsg(message: RegisterIncentiveProposalProtoMsg, useInterfaces: boolean = true): RegisterIncentiveProposal { @@ -665,9 +665,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal, useInterfaces: boolean = true): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromProtoMsg(message: CancelIncentiveProposalProtoMsg, useInterfaces: boolean = true): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts index beec6d0c36..9cab90bc14 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts @@ -539,7 +539,7 @@ export const QueryIncentivesResponse = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e, useInterfaces) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -621,7 +621,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest, useInterfaces: boolean = true): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromProtoMsg(message: QueryIncentiveRequestProtoMsg, useInterfaces: boolean = true): QueryIncentiveRequest { @@ -800,7 +800,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest, useInterfaces: boolean = true): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -907,7 +907,7 @@ export const QueryGasMetersResponse = { if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e, useInterfaces) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1004,8 +1004,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest, useInterfaces: boolean = true): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; return obj; }, fromProtoMsg(message: QueryGasMeterRequestProtoMsg, useInterfaces: boolean = true): QueryGasMeterRequest { @@ -1275,7 +1275,7 @@ export const QueryAllocationMetersResponse = { if (message.allocationMeters) { obj.allocation_meters = message.allocationMeters.map(e => e ? DecCoin.toAmino(e, useInterfaces) : undefined); } else { - obj.allocation_meters = []; + obj.allocation_meters = message.allocationMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1357,7 +1357,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest, useInterfaces: boolean = true): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryAllocationMeterRequestProtoMsg, useInterfaces: boolean = true): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts index 4a243416da..67d393cb0c 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts @@ -207,7 +207,7 @@ export const GenesisState = { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; obj.period = message.period ? message.period.toString() : undefined; - obj.epoch_identifier = message.epochIdentifier; + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; @@ -338,10 +338,10 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation, useInterfaces) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution, useInterfaces) : undefined; - obj.enable_inflation = message.enableInflation; + obj.enable_inflation = message.enableInflation === false ? undefined : message.enableInflation; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts index fe405f01d1..186a5cab35 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/inflation.ts @@ -222,9 +222,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution, useInterfaces: boolean = true): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = padDecimal(message.stakingRewards); - obj.usage_incentives = padDecimal(message.usageIncentives); - obj.community_pool = padDecimal(message.communityPool); + obj.staking_rewards = padDecimal(message.stakingRewards) === "" ? undefined : padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives) === "" ? undefined : padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromProtoMsg(message: InflationDistributionProtoMsg, useInterfaces: boolean = true): InflationDistribution { @@ -364,11 +364,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation, useInterfaces: boolean = true): ExponentialCalculationAmino { const obj: any = {}; - obj.a = padDecimal(message.a); - obj.r = padDecimal(message.r); - obj.c = padDecimal(message.c); - obj.bonding_target = padDecimal(message.bondingTarget); - obj.max_variance = padDecimal(message.maxVariance); + obj.a = padDecimal(message.a) === "" ? undefined : padDecimal(message.a); + obj.r = padDecimal(message.r) === "" ? undefined : padDecimal(message.r); + obj.c = padDecimal(message.c) === "" ? undefined : padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget) === "" ? undefined : padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance) === "" ? undefined : padDecimal(message.maxVariance); return obj; }, fromProtoMsg(message: ExponentialCalculationProtoMsg, useInterfaces: boolean = true): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts index 8ac57aee29..01c486d0c3 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinAmino, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -372,7 +372,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse, useInterfaces: boolean = true): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPeriodResponseProtoMsg, useInterfaces: boolean = true): QueryPeriodResponse { @@ -660,7 +660,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse, useInterfaces: boolean = true): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromProtoMsg(message: QuerySkippedEpochsResponseProtoMsg, useInterfaces: boolean = true): QuerySkippedEpochsResponse { @@ -946,7 +946,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse, useInterfaces: boolean = true): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = padDecimal(message.inflationRate); + obj.inflation_rate = padDecimal(message.inflationRate) === "" ? undefined : padDecimal(message.inflationRate); return obj; }, fromProtoMsg(message: QueryInflationRateResponseProtoMsg, useInterfaces: boolean = true): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts index aefa30977b..09ae6548c5 100644 --- a/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/recovery/v1/genesis.ts @@ -206,7 +206,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.enable_recovery = message.enableRecovery; + obj.enable_recovery = message.enableRecovery === false ? undefined : message.enableRecovery; obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts index dbebbc8601..ecbd0e52af 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -121,7 +121,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest, useInterfaces: boolean = true): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryBalancesRequestProtoMsg, useInterfaces: boolean = true): QueryBalancesRequest { @@ -252,17 +252,17 @@ export const QueryBalancesResponse = { if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.locked = []; + obj.locked = message.locked; } if (message.unvested) { obj.unvested = message.unvested.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.unvested = []; + obj.unvested = message.unvested; } if (message.vested) { obj.vested = message.vested.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.vested = []; + obj.vested = message.vested; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts index af67f19827..31ea450eaf 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/tx.ts @@ -289,20 +289,20 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount, useInterfaces: boolean = true): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } - obj.merge = message.merge; + obj.merge = message.merge === false ? undefined : message.merge; return obj; }, fromProtoMsg(message: MsgCreateClawbackVestingAccountProtoMsg, useInterfaces: boolean = true): MsgCreateClawbackVestingAccount { @@ -474,9 +474,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback, useInterfaces: boolean = true): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + obj.dest_address = message.destAddress === "" ? undefined : message.destAddress; return obj; }, fromProtoMsg(message: MsgClawbackProtoMsg, useInterfaces: boolean = true): MsgClawback { diff --git a/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts index 4ac79082f0..add58deed7 100644 --- a/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv3/evmos/vesting/v1/vesting.ts @@ -201,17 +201,17 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount, useInterfaces: boolean = true): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount, useInterfaces) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/auth.ts b/__fixtures__/v-next/outputv3/google/api/auth.ts index bc03ecdcfd..5b22ac6ef6 100644 --- a/__fixtures__/v-next/outputv3/google/api/auth.ts +++ b/__fixtures__/v-next/outputv3/google/api/auth.ts @@ -661,12 +661,12 @@ export const Authentication = { if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } if (message.providers) { obj.providers = message.providers.map(e => e ? AuthProvider.toAmino(e, useInterfaces) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, @@ -800,13 +800,13 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule, useInterfaces: boolean = true): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth, useInterfaces) : undefined; - obj.allow_without_credential = message.allowWithoutCredential; + obj.allow_without_credential = message.allowWithoutCredential === false ? undefined : message.allowWithoutCredential; if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e, useInterfaces) : undefined); } else { - obj.requirements = []; + obj.requirements = message.requirements; } return obj; }, @@ -917,9 +917,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation, useInterfaces: boolean = true): JwtLocationAmino { const obj: any = {}; - obj.header = message.header; - obj.query = message.query; - obj.value_prefix = message.valuePrefix; + obj.header = message.header === null ? undefined : message.header; + obj.query = message.query === null ? undefined : message.query; + obj.value_prefix = message.valuePrefix === "" ? undefined : message.valuePrefix; return obj; }, fromProtoMsg(message: JwtLocationProtoMsg, useInterfaces: boolean = true): JwtLocation { @@ -1080,15 +1080,15 @@ export const AuthProvider = { }, toAmino(message: AuthProvider, useInterfaces: boolean = true): AuthProviderAmino { const obj: any = {}; - obj.id = message.id; - obj.issuer = message.issuer; - obj.jwks_uri = message.jwksUri; - obj.audiences = message.audiences; - obj.authorization_url = message.authorizationUrl; + obj.id = message.id === "" ? undefined : message.id; + obj.issuer = message.issuer === "" ? undefined : message.issuer; + obj.jwks_uri = message.jwksUri === "" ? undefined : message.jwksUri; + obj.audiences = message.audiences === "" ? undefined : message.audiences; + obj.authorization_url = message.authorizationUrl === "" ? undefined : message.authorizationUrl; if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e, useInterfaces) : undefined); } else { - obj.jwt_locations = []; + obj.jwt_locations = message.jwtLocations; } return obj; }, @@ -1169,7 +1169,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements, useInterfaces: boolean = true): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = message.canonicalScopes; + obj.canonical_scopes = message.canonicalScopes === "" ? undefined : message.canonicalScopes; return obj; }, fromProtoMsg(message: OAuthRequirementsProtoMsg, useInterfaces: boolean = true): OAuthRequirements { @@ -1264,8 +1264,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement, useInterfaces: boolean = true): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = message.providerId; - obj.audiences = message.audiences; + obj.provider_id = message.providerId === "" ? undefined : message.providerId; + obj.audiences = message.audiences === "" ? undefined : message.audiences; return obj; }, fromProtoMsg(message: AuthRequirementProtoMsg, useInterfaces: boolean = true): AuthRequirement { diff --git a/__fixtures__/v-next/outputv3/google/api/backend.ts b/__fixtures__/v-next/outputv3/google/api/backend.ts index b7ae617ae2..dbaa220bfc 100644 --- a/__fixtures__/v-next/outputv3/google/api/backend.ts +++ b/__fixtures__/v-next/outputv3/google/api/backend.ts @@ -379,7 +379,7 @@ export const Backend = { if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -565,7 +565,7 @@ export const BackendRule = { message.operationDeadline = object.operation_deadline; } if (object.path_translation !== undefined && object.path_translation !== null) { - message.pathTranslation = backendRule_PathTranslationFromJSON(object.path_translation); + message.pathTranslation = object.path_translation; } if (object.jwt_audience !== undefined && object.jwt_audience !== null) { message.jwtAudience = object.jwt_audience; @@ -580,15 +580,15 @@ export const BackendRule = { }, toAmino(message: BackendRule, useInterfaces: boolean = true): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = backendRule_PathTranslationToJSON(message.pathTranslation); - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.address = message.address === "" ? undefined : message.address; + obj.deadline = message.deadline === 0 ? undefined : message.deadline; + obj.min_deadline = message.minDeadline === 0 ? undefined : message.minDeadline; + obj.operation_deadline = message.operationDeadline === 0 ? undefined : message.operationDeadline; + obj.path_translation = message.pathTranslation === 0 ? undefined : message.pathTranslation; + obj.jwt_audience = message.jwtAudience === null ? undefined : message.jwtAudience; + obj.disable_auth = message.disableAuth === null ? undefined : message.disableAuth; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromProtoMsg(message: BackendRuleProtoMsg, useInterfaces: boolean = true): BackendRule { diff --git a/__fixtures__/v-next/outputv3/google/api/billing.ts b/__fixtures__/v-next/outputv3/google/api/billing.ts index 08ced04f66..d4e06b5dcd 100644 --- a/__fixtures__/v-next/outputv3/google/api/billing.ts +++ b/__fixtures__/v-next/outputv3/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -245,7 +245,7 @@ export const Billing = { if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toAmino(e, useInterfaces) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -347,11 +347,11 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination, useInterfaces: boolean = true): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/config_change.ts b/__fixtures__/v-next/outputv3/google/api/config_change.ts index fe88433972..9e831148ca 100644 --- a/__fixtures__/v-next/outputv3/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv3/google/api/config_change.ts @@ -315,21 +315,21 @@ export const ConfigChange = { message.newValue = object.new_value; } if (object.change_type !== undefined && object.change_type !== null) { - message.changeType = changeTypeFromJSON(object.change_type); + message.changeType = object.change_type; } message.advices = object.advices?.map(e => Advice.fromAmino(e)) || []; return message; }, toAmino(message: ConfigChange, useInterfaces: boolean = true): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = changeTypeToJSON(message.changeType); + obj.element = message.element === "" ? undefined : message.element; + obj.old_value = message.oldValue === "" ? undefined : message.oldValue; + obj.new_value = message.newValue === "" ? undefined : message.newValue; + obj.change_type = message.changeType === 0 ? undefined : message.changeType; if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e, useInterfaces) : undefined); } else { - obj.advices = []; + obj.advices = message.advices; } return obj; }, @@ -410,7 +410,7 @@ export const Advice = { }, toAmino(message: Advice, useInterfaces: boolean = true): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: AdviceProtoMsg, useInterfaces: boolean = true): Advice { diff --git a/__fixtures__/v-next/outputv3/google/api/consumer.ts b/__fixtures__/v-next/outputv3/google/api/consumer.ts index b400bdb30c..cfc1021efb 100644 --- a/__fixtures__/v-next/outputv3/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv3/google/api/consumer.ts @@ -260,7 +260,7 @@ export const ProjectProperties = { if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toAmino(e, useInterfaces) : undefined); } else { - obj.properties = []; + obj.properties = message.properties; } return obj; }, @@ -362,7 +362,7 @@ export const Property = { message.name = object.name; } if (object.type !== undefined && object.type !== null) { - message.type = property_PropertyTypeFromJSON(object.type); + message.type = object.type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -371,9 +371,9 @@ export const Property = { }, toAmino(message: Property, useInterfaces: boolean = true): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = property_PropertyTypeToJSON(message.type); - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === 0 ? undefined : message.type; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: PropertyProtoMsg, useInterfaces: boolean = true): Property { diff --git a/__fixtures__/v-next/outputv3/google/api/context.ts b/__fixtures__/v-next/outputv3/google/api/context.ts index 8e4f4257c6..bd4807cf1f 100644 --- a/__fixtures__/v-next/outputv3/google/api/context.ts +++ b/__fixtures__/v-next/outputv3/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -278,7 +278,7 @@ export const Context = { if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -443,26 +443,26 @@ export const ContextRule = { }, toAmino(message: ContextRule, useInterfaces: boolean = true): ContextRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.requested) { obj.requested = message.requested.map(e => e); } else { - obj.requested = []; + obj.requested = message.requested; } if (message.provided) { obj.provided = message.provided.map(e => e); } else { - obj.provided = []; + obj.provided = message.provided; } if (message.allowedRequestExtensions) { obj.allowed_request_extensions = message.allowedRequestExtensions.map(e => e); } else { - obj.allowed_request_extensions = []; + obj.allowed_request_extensions = message.allowedRequestExtensions; } if (message.allowedResponseExtensions) { obj.allowed_response_extensions = message.allowedResponseExtensions.map(e => e); } else { - obj.allowed_response_extensions = []; + obj.allowed_response_extensions = message.allowedResponseExtensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/control.ts b/__fixtures__/v-next/outputv3/google/api/control.ts index cac3598dca..2a44051f5e 100644 --- a/__fixtures__/v-next/outputv3/google/api/control.ts +++ b/__fixtures__/v-next/outputv3/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -101,7 +101,7 @@ export const Control = { }, toAmino(message: Control, useInterfaces: boolean = true): ControlAmino { const obj: any = {}; - obj.environment = omitDefault(message.environment); + obj.environment = message.environment === "" ? undefined : message.environment; return obj; }, fromProtoMsg(message: ControlProtoMsg, useInterfaces: boolean = true): Control { diff --git a/__fixtures__/v-next/outputv3/google/api/distribution.ts b/__fixtures__/v-next/outputv3/google/api/distribution.ts index 8013f19639..a7ecad9db7 100644 --- a/__fixtures__/v-next/outputv3/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/distribution.ts @@ -701,19 +701,19 @@ export const Distribution = { toAmino(message: Distribution, useInterfaces: boolean = true): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range, useInterfaces) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions, useInterfaces) : undefined; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e, useInterfaces) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -809,8 +809,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range, useInterfaces: boolean = true): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = message.min === 0 ? undefined : message.min; + obj.max = message.max === 0 ? undefined : message.max; return obj; }, fromProtoMsg(message: Distribution_RangeProtoMsg, useInterfaces: boolean = true): Distribution_Range { @@ -1038,9 +1038,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear, useInterfaces: boolean = true): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromProtoMsg(message: Distribution_BucketOptions_LinearProtoMsg, useInterfaces: boolean = true): Distribution_BucketOptions_Linear { @@ -1150,9 +1150,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential, useInterfaces: boolean = true): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromProtoMsg(message: Distribution_BucketOptions_ExponentialProtoMsg, useInterfaces: boolean = true): Distribution_BucketOptions_Exponential { @@ -1250,7 +1250,7 @@ export const Distribution_BucketOptions_Explicit = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, @@ -1367,12 +1367,12 @@ export const Distribution_Exemplar = { }, toAmino(message: Distribution_Exemplar, useInterfaces: boolean = true): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.attachments = []; + obj.attachments = message.attachments; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/documentation.ts b/__fixtures__/v-next/outputv3/google/api/documentation.ts index d74db315c2..3961f73766 100644 --- a/__fixtures__/v-next/outputv3/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv3/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -542,20 +542,20 @@ export const Documentation = { }, toAmino(message: Documentation, useInterfaces: boolean = true): DocumentationAmino { const obj: any = {}; - obj.summary = omitDefault(message.summary); + obj.summary = message.summary === "" ? undefined : message.summary; if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e, useInterfaces) : undefined); } else { - obj.pages = []; + obj.pages = message.pages; } if (message.rules) { obj.rules = message.rules.map(e => e ? DocumentationRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.documentation_root_url = omitDefault(message.documentationRootUrl); - obj.service_root_url = omitDefault(message.serviceRootUrl); - obj.overview = omitDefault(message.overview); + obj.documentation_root_url = message.documentationRootUrl === "" ? undefined : message.documentationRootUrl; + obj.service_root_url = message.serviceRootUrl === "" ? undefined : message.serviceRootUrl; + obj.overview = message.overview === "" ? undefined : message.overview; return obj; }, fromProtoMsg(message: DocumentationProtoMsg, useInterfaces: boolean = true): Documentation { @@ -665,9 +665,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule, useInterfaces: boolean = true): DocumentationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.description = omitDefault(message.description); - obj.deprecation_description = omitDefault(message.deprecationDescription); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.description = message.description === "" ? undefined : message.description; + obj.deprecation_description = message.deprecationDescription === "" ? undefined : message.deprecationDescription; return obj; }, fromProtoMsg(message: DocumentationRuleProtoMsg, useInterfaces: boolean = true): DocumentationRule { @@ -783,12 +783,12 @@ export const Page = { }, toAmino(message: Page, useInterfaces: boolean = true): PageAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.content = message.content === "" ? undefined : message.content; if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e, useInterfaces) : undefined); } else { - obj.subpages = []; + obj.subpages = message.subpages; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/endpoint.ts b/__fixtures__/v-next/outputv3/google/api/endpoint.ts index 5c67b6467b..ba95778cea 100644 --- a/__fixtures__/v-next/outputv3/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv3/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -245,14 +245,14 @@ export const Endpoint = { }, toAmino(message: Endpoint, useInterfaces: boolean = true): EndpointAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } - obj.target = omitDefault(message.target); - obj.allow_cors = omitDefault(message.allowCors); + obj.target = message.target === "" ? undefined : message.target; + obj.allow_cors = message.allowCors === false ? undefined : message.allowCors; return obj; }, fromProtoMsg(message: EndpointProtoMsg, useInterfaces: boolean = true): Endpoint { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts index 1f29b2f79c..732e045696 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -434,10 +434,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest, useInterfaces: boolean = true): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromProtoMsg(message: ParseRequestProtoMsg, useInterfaces: boolean = true): ParseRequest { @@ -544,7 +544,7 @@ export const ParseResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e, useInterfaces) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -682,10 +682,10 @@ export const CheckRequest = { if (message.typeEnv) { obj.type_env = message.typeEnv.map(e => e ? Decl.toAmino(e, useInterfaces) : undefined); } else { - obj.type_env = []; + obj.type_env = message.typeEnv; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = message.container === "" ? undefined : message.container; + obj.no_std_env = message.noStdEnv === false ? undefined : message.noStdEnv; return obj; }, fromProtoMsg(message: CheckRequestProtoMsg, useInterfaces: boolean = true): CheckRequest { @@ -792,7 +792,7 @@ export const CheckResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e, useInterfaces) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -889,7 +889,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry, useInterfaces: boolean = true): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value, useInterfaces) : undefined; return obj; }, @@ -1059,7 +1059,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromProtoMsg(message: EvalRequestProtoMsg, useInterfaces: boolean = true): EvalRequest { @@ -1166,7 +1166,7 @@ export const EvalResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e, useInterfaces) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -1269,7 +1269,7 @@ export const IssueDetails = { fromAmino(object: IssueDetailsAmino): IssueDetails { const message = createBaseIssueDetails(); if (object.severity !== undefined && object.severity !== null) { - message.severity = issueDetails_SeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.position !== undefined && object.position !== null) { message.position = SourcePosition.fromAmino(object.position); @@ -1281,7 +1281,7 @@ export const IssueDetails = { }, toAmino(message: IssueDetails, useInterfaces: boolean = true): IssueDetailsAmino { const obj: any = {}; - obj.severity = issueDetails_SeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position, useInterfaces) : undefined; obj.id = message.id ? message.id.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts index 5cda207442..73d7e36ebd 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts @@ -1249,7 +1249,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo, useInterfaces) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr, useInterfaces) : undefined; return obj; }, @@ -1485,16 +1485,16 @@ export const Type = { message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1525,15 +1525,15 @@ export const Type = { toAmino(message: Type, useInterfaces: boolean = true): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn, useInterfaces) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType, useInterfaces) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType, useInterfaces) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function, useInterfaces) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type, useInterfaces) : undefined; obj.error = message.error ? Empty.toAmino(message.error, useInterfaces) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType, useInterfaces) : undefined; @@ -1825,7 +1825,7 @@ export const Type_FunctionType = { if (message.argTypes) { obj.arg_types = message.argTypes.map(e => e ? Type.toAmino(e, useInterfaces) : undefined); } else { - obj.arg_types = []; + obj.arg_types = message.argTypes; } return obj; }, @@ -1927,11 +1927,11 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType, useInterfaces: boolean = true): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e, useInterfaces) : undefined); } else { - obj.parameter_types = []; + obj.parameter_types = message.parameterTypes; } return obj; }, @@ -2046,7 +2046,7 @@ export const Decl = { }, toAmino(message: Decl, useInterfaces: boolean = true): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident, useInterfaces) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function, useInterfaces) : undefined; return obj; @@ -2164,7 +2164,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type, useInterfaces) : undefined; obj.value = message.value ? Constant.toAmino(message.value, useInterfaces) : undefined; - obj.doc = message.doc; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromProtoMsg(message: Decl_IdentDeclProtoMsg, useInterfaces: boolean = true): Decl_IdentDecl { @@ -2253,7 +2253,7 @@ export const Decl_FunctionDecl = { if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toAmino(e, useInterfaces) : undefined); } else { - obj.overloads = []; + obj.overloads = message.overloads; } return obj; }, @@ -2423,20 +2423,20 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload, useInterfaces: boolean = true): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e, useInterfaces) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType, useInterfaces) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromProtoMsg(message: Decl_FunctionDecl_OverloadProtoMsg, useInterfaces: boolean = true): Decl_FunctionDecl_Overload { @@ -2554,11 +2554,11 @@ export const Reference = { }, toAmino(message: Reference, useInterfaces: boolean = true): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { - obj.overload_id = []; + obj.overload_id = message.overloadId; } obj.value = message.value ? Constant.toAmino(message.value, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts index 30b348d40e..ba81b86348 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { Status, StatusAmino, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -337,12 +337,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e, useInterfaces) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e, useInterfaces) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -442,8 +442,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result, useInterfaces: boolean = true): EvalState_ResultAmino { const obj: any = {}; - obj.expr = omitDefault(message.expr); - obj.value = omitDefault(message.value); + obj.expr = message.expr ? message.expr.toString() : undefined; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: EvalState_ResultProtoMsg, useInterfaces: boolean = true): EvalState_Result { @@ -650,7 +650,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e, useInterfaces) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -749,7 +749,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e.toString()); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts index 75e47d81a8..df398e62c9 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueAmino, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -176,12 +176,12 @@ export const Explain = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e, useInterfaces) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.exprSteps) { obj.expr_steps = message.exprSteps.map(e => e ? Explain_ExprStep.toAmino(e, useInterfaces) : undefined); } else { - obj.expr_steps = []; + obj.expr_steps = message.exprSteps; } return obj; }, @@ -279,8 +279,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep, useInterfaces: boolean = true): Explain_ExprStepAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.value_index = omitDefault(message.valueIndex); + obj.id = message.id ? message.id.toString() : undefined; + obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, fromProtoMsg(message: Explain_ExprStepProtoMsg, useInterfaces: boolean = true): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts index a0f458377f..adf75c32ba 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts @@ -1213,7 +1213,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident, useInterfaces: boolean = true): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: Expr_IdentProtoMsg, useInterfaces: boolean = true): Expr_Ident { @@ -1326,8 +1326,8 @@ export const Expr_Select = { toAmino(message: Expr_Select, useInterfaces: boolean = true): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand, useInterfaces) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromProtoMsg(message: Expr_SelectProtoMsg, useInterfaces: boolean = true): Expr_Select { @@ -1446,11 +1446,11 @@ export const Expr_Call = { toAmino(message: Expr_Call, useInterfaces: boolean = true): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target, useInterfaces) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e, useInterfaces) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1540,7 +1540,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e, useInterfaces) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1642,11 +1642,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct, useInterfaces: boolean = true): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = message.messageName === "" ? undefined : message.messageName; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1779,7 +1779,7 @@ export const Expr_CreateStruct_Entry = { toAmino(message: Expr_CreateStruct_Entry, useInterfaces: boolean = true): Expr_CreateStruct_EntryAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey, useInterfaces) : undefined; obj.value = message.value ? Expr.toAmino(message.value, useInterfaces) : undefined; return obj; @@ -1961,9 +1961,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension, useInterfaces: boolean = true): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange, useInterfaces) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit, useInterfaces) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition, useInterfaces) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep, useInterfaces) : undefined; @@ -2147,7 +2147,7 @@ export const Constant = { fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -2177,12 +2177,12 @@ export const Constant = { }, toAmino(message: Constant, useInterfaces: boolean = true): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue, useInterfaces) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -2282,7 +2282,7 @@ export const SourceInfo_PositionsEntry = { toAmino(message: SourceInfo_PositionsEntry, useInterfaces: boolean = true): SourceInfo_PositionsEntryAmino { const obj: any = {}; obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: SourceInfo_PositionsEntryProtoMsg, useInterfaces: boolean = true): SourceInfo_PositionsEntry { @@ -2600,12 +2600,12 @@ export const SourceInfo = { }, toAmino(message: SourceInfo, useInterfaces: boolean = true): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2743,10 +2743,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition, useInterfaces: boolean = true): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromProtoMsg(message: SourcePositionProtoMsg, useInterfaces: boolean = true): SourcePosition { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts index 8b80552e57..67ad418c1f 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts @@ -429,7 +429,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -468,18 +468,18 @@ export const Value = { }, toAmino(message: Value, useInterfaces: boolean = true): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue, useInterfaces) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue, useInterfaces) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue, useInterfaces) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue, useInterfaces) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromProtoMsg(message: ValueProtoMsg, useInterfaces: boolean = true): Value { @@ -574,8 +574,8 @@ export const EnumValue = { }, toAmino(message: EnumValue, useInterfaces: boolean = true): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: EnumValueProtoMsg, useInterfaces: boolean = true): EnumValue { @@ -664,7 +664,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e, useInterfaces) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -754,7 +754,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts index 4120653e0e..ef678d8988 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/decl.ts @@ -268,9 +268,9 @@ export const Decl = { }, toAmino(message: Decl, useInterfaces: boolean = true): DeclAmino { const obj: any = {}; - obj.id = message.id; - obj.name = message.name; - obj.doc = message.doc; + obj.id = message.id === 0 ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.doc = message.doc === "" ? undefined : message.doc; obj.ident = message.ident ? IdentDecl.toAmino(message.ident, useInterfaces) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function, useInterfaces) : undefined; return obj; @@ -388,12 +388,12 @@ export const DeclType = { }, toAmino(message: DeclType, useInterfaces: boolean = true): DeclTypeAmino { const obj: any = {}; - obj.id = message.id; - obj.type = message.type; + obj.id = message.id === 0 ? undefined : message.id; + obj.type = message.type === "" ? undefined : message.type; if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e, useInterfaces) : undefined); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } return obj; }, @@ -615,10 +615,10 @@ export const FunctionDecl = { if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toAmino(e, useInterfaces) : undefined); } else { - obj.args = []; + obj.args = message.args; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType, useInterfaces) : undefined; - obj.receiver_function = message.receiverFunction; + obj.receiver_function = message.receiverFunction === false ? undefined : message.receiverFunction; return obj; }, fromProtoMsg(message: FunctionDeclProtoMsg, useInterfaces: boolean = true): FunctionDecl { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts index a342ad2b86..e5cb5edc37 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/eval.ts @@ -355,12 +355,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e, useInterfaces) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e, useInterfaces) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -459,7 +459,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result, useInterfaces: boolean = true): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr, useInterfaces) : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: EvalState_ResultProtoMsg, useInterfaces: boolean = true): EvalState_Result { @@ -666,7 +666,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e, useInterfaces) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -756,7 +756,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e, useInterfaces) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -837,7 +837,7 @@ export const IdRef = { }, toAmino(message: IdRef, useInterfaces: boolean = true): IdRefAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromProtoMsg(message: IdRefProtoMsg, useInterfaces: boolean = true): IdRef { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts index 18ac7fe192..b1193c7fbb 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts @@ -730,7 +730,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr, useInterfaces) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo, useInterfaces) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; return obj; }, fromProtoMsg(message: ParsedExprProtoMsg, useInterfaces: boolean = true): ParsedExpr { @@ -929,7 +929,7 @@ export const Expr = { }, toAmino(message: Expr, useInterfaces: boolean = true): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr, useInterfaces) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr, useInterfaces) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr, useInterfaces) : undefined; @@ -1016,7 +1016,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident, useInterfaces: boolean = true): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: Expr_IdentProtoMsg, useInterfaces: boolean = true): Expr_Ident { @@ -1129,8 +1129,8 @@ export const Expr_Select = { toAmino(message: Expr_Select, useInterfaces: boolean = true): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand, useInterfaces) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromProtoMsg(message: Expr_SelectProtoMsg, useInterfaces: boolean = true): Expr_Select { @@ -1249,11 +1249,11 @@ export const Expr_Call = { toAmino(message: Expr_Call, useInterfaces: boolean = true): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target, useInterfaces) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e, useInterfaces) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1343,7 +1343,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e, useInterfaces) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1445,11 +1445,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct, useInterfaces: boolean = true): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1579,8 +1579,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry, useInterfaces: boolean = true): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = message.id === 0 ? undefined : message.id; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey, useInterfaces) : undefined; obj.value = message.value ? Expr.toAmino(message.value, useInterfaces) : undefined; return obj; @@ -1762,9 +1762,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension, useInterfaces: boolean = true): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange, useInterfaces) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit, useInterfaces) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition, useInterfaces) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep, useInterfaces) : undefined; @@ -1922,7 +1922,7 @@ export const Literal = { fromAmino(object: LiteralAmino): Literal { const message = createBaseLiteral(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1946,12 +1946,12 @@ export const Literal = { }, toAmino(message: Literal, useInterfaces: boolean = true): LiteralAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts index 60892cb335..99b33fa7c8 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -204,8 +204,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry, useInterfaces: boolean = true): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === 0 ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: SourceInfo_PositionsEntryProtoMsg, useInterfaces: boolean = true): SourceInfo_PositionsEntry { @@ -362,11 +362,11 @@ export const SourceInfo = { }, toAmino(message: SourceInfo, useInterfaces: boolean = true): SourceInfoAmino { const obj: any = {}; - obj.location = omitDefault(message.location); + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -498,10 +498,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition, useInterfaces: boolean = true): SourcePositionAmino { const obj: any = {}; - obj.location = omitDefault(message.location); - obj.offset = omitDefault(message.offset); - obj.line = omitDefault(message.line); - obj.column = omitDefault(message.column); + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromProtoMsg(message: SourcePositionProtoMsg, useInterfaces: boolean = true): SourcePosition { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts index f23ed56278..4c2224d297 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts @@ -429,7 +429,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -468,18 +468,18 @@ export const Value = { }, toAmino(message: Value, useInterfaces: boolean = true): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue, useInterfaces) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue, useInterfaces) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue, useInterfaces) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue, useInterfaces) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromProtoMsg(message: ValueProtoMsg, useInterfaces: boolean = true): Value { @@ -574,8 +574,8 @@ export const EnumValue = { }, toAmino(message: EnumValue, useInterfaces: boolean = true): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: EnumValueProtoMsg, useInterfaces: boolean = true): EnumValue { @@ -664,7 +664,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e, useInterfaces) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -754,7 +754,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/http.ts b/__fixtures__/v-next/outputv3/google/api/http.ts index fd02f08a8b..faa0ec2226 100644 --- a/__fixtures__/v-next/outputv3/google/api/http.ts +++ b/__fixtures__/v-next/outputv3/google/api/http.ts @@ -1102,9 +1102,9 @@ export const Http = { if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion; + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; return obj; }, fromProtoMsg(message: HttpProtoMsg, useInterfaces: boolean = true): Http { @@ -1327,19 +1327,19 @@ export const HttpRule = { }, toAmino(message: HttpRule, useInterfaces: boolean = true): HttpRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.get = message.get; - obj.put = message.put; - obj.post = message.post; - obj.delete = message.delete; - obj.patch = message.patch; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom, useInterfaces) : undefined; - obj.body = message.body; - obj.response_body = message.responseBody; + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e, useInterfaces) : undefined); } else { - obj.additional_bindings = []; + obj.additional_bindings = message.additionalBindings; } return obj; }, @@ -1435,8 +1435,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern, useInterfaces: boolean = true): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = message.kind; - obj.path = message.path; + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; return obj; }, fromProtoMsg(message: CustomHttpPatternProtoMsg, useInterfaces: boolean = true): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputv3/google/api/httpbody.ts b/__fixtures__/v-next/outputv3/google/api/httpbody.ts index 41c66f7fb2..61a9cf0e87 100644 --- a/__fixtures__/v-next/outputv3/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv3/google/api/httpbody.ts @@ -268,12 +268,12 @@ export const HttpBody = { }, toAmino(message: HttpBody, useInterfaces: boolean = true): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = message.contentType === "" ? undefined : message.contentType; obj.data = message.data ? base64FromBytes(message.data) : undefined; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/label.ts b/__fixtures__/v-next/outputv3/google/api/label.ts index d5223eeb8d..8630a45a51 100644 --- a/__fixtures__/v-next/outputv3/google/api/label.ts +++ b/__fixtures__/v-next/outputv3/google/api/label.ts @@ -156,7 +156,7 @@ export const LabelDescriptor = { message.key = object.key; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = labelDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -165,9 +165,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor, useInterfaces: boolean = true): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = labelDescriptor_ValueTypeToJSON(message.valueType); - obj.description = message.description; + obj.key = message.key === "" ? undefined : message.key; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: LabelDescriptorProtoMsg, useInterfaces: boolean = true): LabelDescriptor { diff --git a/__fixtures__/v-next/outputv3/google/api/log.ts b/__fixtures__/v-next/outputv3/google/api/log.ts index f3f8772f77..aa0a419c18 100644 --- a/__fixtures__/v-next/outputv3/google/api/log.ts +++ b/__fixtures__/v-next/outputv3/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorAmino, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -207,14 +207,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor, useInterfaces: boolean = true): LogDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.description = omitDefault(message.description); - obj.display_name = omitDefault(message.displayName); + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromProtoMsg(message: LogDescriptorProtoMsg, useInterfaces: boolean = true): LogDescriptor { diff --git a/__fixtures__/v-next/outputv3/google/api/logging.ts b/__fixtures__/v-next/outputv3/google/api/logging.ts index a38613139e..1ddbf69c2a 100644 --- a/__fixtures__/v-next/outputv3/google/api/logging.ts +++ b/__fixtures__/v-next/outputv3/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -276,12 +276,12 @@ export const Logging = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e, useInterfaces) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e, useInterfaces) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -383,11 +383,11 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination, useInterfaces: boolean = true): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.logs) { obj.logs = message.logs.map(e => e); } else { - obj.logs = []; + obj.logs = message.logs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/metric.ts b/__fixtures__/v-next/outputv3/google/api/metric.ts index dda719a8bf..676275e2fb 100644 --- a/__fixtures__/v-next/outputv3/google/api/metric.ts +++ b/__fixtures__/v-next/outputv3/google/api/metric.ts @@ -809,10 +809,10 @@ export const MetricDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.metric_kind !== undefined && object.metric_kind !== null) { - message.metricKind = metricDescriptor_MetricKindFromJSON(object.metric_kind); + message.metricKind = object.metric_kind; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = metricDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.unit !== undefined && object.unit !== null) { message.unit = object.unit; @@ -827,31 +827,31 @@ export const MetricDescriptor = { message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromAmino(object.metadata); } if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } message.monitoredResourceTypes = object.monitored_resource_types?.map(e => e) || []; return message; }, toAmino(message: MetricDescriptor, useInterfaces: boolean = true): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.metric_kind = metricDescriptor_MetricKindToJSON(message.metricKind); - obj.value_type = metricDescriptor_ValueTypeToJSON(message.valueType); - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = message.metricKind === 0 ? undefined : message.metricKind; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata, useInterfaces) : undefined; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { - obj.monitored_resource_types = []; + obj.monitored_resource_types = message.monitoredResourceTypes; } return obj; }, @@ -954,7 +954,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromAmino(object: MetricDescriptor_MetricDescriptorMetadataAmino): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } if (object.sample_period !== undefined && object.sample_period !== null) { message.samplePeriod = Duration.fromAmino(object.sample_period); @@ -966,7 +966,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata, useInterfaces: boolean = true): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod, useInterfaces) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay, useInterfaces) : undefined; return obj; @@ -1062,8 +1062,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry, useInterfaces: boolean = true): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: Metric_LabelsEntryProtoMsg, useInterfaces: boolean = true): Metric_LabelsEntry { @@ -1190,7 +1190,7 @@ export const Metric = { }, toAmino(message: Metric, useInterfaces: boolean = true): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts index 64d0ddb823..f7ef74d55d 100644 --- a/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv3/google/api/monitored_resource.ts @@ -451,22 +451,22 @@ export const MonitoredResourceDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } return message; }, toAmino(message: MonitoredResourceDescriptor, useInterfaces: boolean = true): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.display_name = message.displayName === "" ? undefined : message.displayName; + obj.description = message.description === "" ? undefined : message.description; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; return obj; }, fromProtoMsg(message: MonitoredResourceDescriptorProtoMsg, useInterfaces: boolean = true): MonitoredResourceDescriptor { @@ -560,8 +560,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry, useInterfaces: boolean = true): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: MonitoredResource_LabelsEntryProtoMsg, useInterfaces: boolean = true): MonitoredResource_LabelsEntry { @@ -688,7 +688,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource, useInterfaces: boolean = true): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -788,8 +788,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry, useInterfaces: boolean = true): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: MonitoredResourceMetadata_UserLabelsEntryProtoMsg, useInterfaces: boolean = true): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputv3/google/api/monitoring.ts b/__fixtures__/v-next/outputv3/google/api/monitoring.ts index 520790cff1..8a8f707f40 100644 --- a/__fixtures__/v-next/outputv3/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv3/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -349,12 +349,12 @@ export const Monitoring = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e, useInterfaces) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e, useInterfaces) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -456,11 +456,11 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination, useInterfaces: boolean = true): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/quota.ts b/__fixtures__/v-next/outputv3/google/api/quota.ts index 9a85c0cdf8..70c6ee22ae 100644 --- a/__fixtures__/v-next/outputv3/google/api/quota.ts +++ b/__fixtures__/v-next/outputv3/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; +import { DeepPartial, isSet, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -583,12 +583,12 @@ export const Quota = { if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toAmino(e, useInterfaces) : undefined); } else { - obj.limits = []; + obj.limits = message.limits; } if (message.metricRules) { obj.metric_rules = message.metricRules.map(e => e ? MetricRule.toAmino(e, useInterfaces) : undefined); } else { - obj.metric_rules = []; + obj.metric_rules = message.metricRules; } return obj; }, @@ -685,8 +685,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry, useInterfaces: boolean = true): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: MetricRule_MetricCostsEntryProtoMsg, useInterfaces: boolean = true): MetricRule_MetricCostsEntry { @@ -813,7 +813,7 @@ export const MetricRule = { }, toAmino(message: MetricRule, useInterfaces: boolean = true): MetricRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -915,8 +915,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry, useInterfaces: boolean = true): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: QuotaLimit_ValuesEntryProtoMsg, useInterfaces: boolean = true): QuotaLimit_ValuesEntry { @@ -1169,21 +1169,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit, useInterfaces: boolean = true): QuotaLimitAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); - obj.default_limit = omitDefault(message.defaultLimit); - obj.max_limit = omitDefault(message.maxLimit); - obj.free_tier = omitDefault(message.freeTier); - obj.duration = omitDefault(message.duration); - obj.metric = omitDefault(message.metric); - obj.unit = omitDefault(message.unit); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.duration = message.duration === "" ? undefined : message.duration; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = omitDefault(message.displayName); + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromProtoMsg(message: QuotaLimitProtoMsg, useInterfaces: boolean = true): QuotaLimit { diff --git a/__fixtures__/v-next/outputv3/google/api/resource.ts b/__fixtures__/v-next/outputv3/google/api/resource.ts index 38c643b23c..dbe2216b22 100644 --- a/__fixtures__/v-next/outputv3/google/api/resource.ts +++ b/__fixtures__/v-next/outputv3/google/api/resource.ts @@ -683,7 +683,7 @@ export const ResourceDescriptor = { message.nameField = object.name_field; } if (object.history !== undefined && object.history !== null) { - message.history = resourceDescriptor_HistoryFromJSON(object.history); + message.history = object.history; } if (object.plural !== undefined && object.plural !== null) { message.plural = object.plural; @@ -691,25 +691,25 @@ export const ResourceDescriptor = { if (object.singular !== undefined && object.singular !== null) { message.singular = object.singular; } - message.style = object.style?.map(e => resourceDescriptor_StyleFromJSON(e)) || []; + message.style = object.style?.map(e => e) || []; return message; }, toAmino(message: ResourceDescriptor, useInterfaces: boolean = true): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { - obj.pattern = []; + obj.pattern = message.pattern; } - obj.name_field = message.nameField; - obj.history = resourceDescriptor_HistoryToJSON(message.history); - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = message.nameField === "" ? undefined : message.nameField; + obj.history = message.history === 0 ? undefined : message.history; + obj.plural = message.plural === "" ? undefined : message.plural; + obj.singular = message.singular === "" ? undefined : message.singular; if (message.style) { - obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); + obj.style = message.style.map(e => e); } else { - obj.style = []; + obj.style = message.style; } return obj; }, @@ -805,8 +805,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference, useInterfaces: boolean = true): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = message.type === "" ? undefined : message.type; + obj.child_type = message.childType === "" ? undefined : message.childType; return obj; }, fromProtoMsg(message: ResourceReferenceProtoMsg, useInterfaces: boolean = true): ResourceReference { diff --git a/__fixtures__/v-next/outputv3/google/api/routing.ts b/__fixtures__/v-next/outputv3/google/api/routing.ts index 392632b625..b181e47d78 100644 --- a/__fixtures__/v-next/outputv3/google/api/routing.ts +++ b/__fixtures__/v-next/outputv3/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -1319,7 +1319,7 @@ export const RoutingRule = { if (message.routingParameters) { obj.routing_parameters = message.routingParameters.map(e => e ? RoutingParameter.toAmino(e, useInterfaces) : undefined); } else { - obj.routing_parameters = []; + obj.routing_parameters = message.routingParameters; } return obj; }, @@ -1415,8 +1415,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter, useInterfaces: boolean = true): RoutingParameterAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.path_template = omitDefault(message.pathTemplate); + obj.field = message.field === "" ? undefined : message.field; + obj.path_template = message.pathTemplate === "" ? undefined : message.pathTemplate; return obj; }, fromProtoMsg(message: RoutingParameterProtoMsg, useInterfaces: boolean = true): RoutingParameter { diff --git a/__fixtures__/v-next/outputv3/google/api/service.ts b/__fixtures__/v-next/outputv3/google/api/service.ts index 9c55ce042c..29f8174d5f 100644 --- a/__fixtures__/v-next/outputv3/google/api/service.ts +++ b/__fixtures__/v-next/outputv3/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersAmino, SystemParametersSDKType } from import { SourceInfo, SourceInfoAmino, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueAmino, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -815,24 +815,24 @@ export const Service = { }, toAmino(message: Service, useInterfaces: boolean = true): ServiceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.title = omitDefault(message.title); - obj.producer_project_id = omitDefault(message.producerProjectId); - obj.id = omitDefault(message.id); + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.id = message.id === "" ? undefined : message.id; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e, useInterfaces) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } if (message.types) { obj.types = message.types.map(e => e ? Type.toAmino(e, useInterfaces) : undefined); } else { - obj.types = []; + obj.types = message.types; } if (message.enums) { obj.enums = message.enums.map(e => e ? Enum.toAmino(e, useInterfaces) : undefined); } else { - obj.enums = []; + obj.enums = message.enums; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation, useInterfaces) : undefined; obj.backend = message.backend ? Backend.toAmino(message.backend, useInterfaces) : undefined; @@ -844,23 +844,23 @@ export const Service = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e, useInterfaces) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } obj.control = message.control ? Control.toAmino(message.control, useInterfaces) : undefined; if (message.logs) { obj.logs = message.logs.map(e => e ? LogDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } if (message.metrics) { obj.metrics = message.metrics.map(e => e ? MetricDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.billing = message.billing ? Billing.toAmino(message.billing, useInterfaces) : undefined; obj.logging = message.logging ? Logging.toAmino(message.logging, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts index 4eafe83df1..f0aea707f9 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/check_error.ts @@ -351,7 +351,7 @@ export const CheckError = { fromAmino(object: CheckErrorAmino): CheckError { const message = createBaseCheckError(); if (object.code !== undefined && object.code !== null) { - message.code = checkError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -366,9 +366,9 @@ export const CheckError = { }, toAmino(message: CheckError, useInterfaces: boolean = true): CheckErrorAmino { const obj: any = {}; - obj.code = checkError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.detail = message.detail === "" ? undefined : message.detail; obj.status = message.status ? Status.toAmino(message.status, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts index dcdd786856..99f8409cb6 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -520,15 +520,15 @@ export const Distribution = { }, toAmino(message: Distribution, useInterfaces: boolean = true): DistributionAmino { const obj: any = {}; - obj.count = omitDefault(message.count); - obj.mean = omitDefault(message.mean); - obj.minimum = omitDefault(message.minimum); - obj.maximum = omitDefault(message.maximum); - obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); + obj.count = message.count ? message.count.toString() : undefined; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.minimum = message.minimum === 0 ? undefined : message.minimum; + obj.maximum = message.maximum === 0 ? undefined : message.maximum; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } obj.linear_buckets = message.linearBuckets ? Distribution_LinearBuckets.toAmino(message.linearBuckets, useInterfaces) : undefined; obj.exponential_buckets = message.exponentialBuckets ? Distribution_ExponentialBuckets.toAmino(message.exponentialBuckets, useInterfaces) : undefined; @@ -536,7 +536,7 @@ export const Distribution = { if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e, useInterfaces) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -647,9 +647,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets, useInterfaces: boolean = true): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.width = omitDefault(message.width); - obj.offset = omitDefault(message.offset); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromProtoMsg(message: Distribution_LinearBucketsProtoMsg, useInterfaces: boolean = true): Distribution_LinearBuckets { @@ -759,9 +759,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets, useInterfaces: boolean = true): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.growth_factor = omitDefault(message.growthFactor); - obj.scale = omitDefault(message.scale); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromProtoMsg(message: Distribution_ExponentialBucketsProtoMsg, useInterfaces: boolean = true): Distribution_ExponentialBuckets { @@ -859,7 +859,7 @@ export const Distribution_ExplicitBuckets = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts index 27566bd460..35a552c622 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts @@ -464,21 +464,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest, useInterfaces: boolean = true): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; + obj.status = message.status === 0 ? undefined : message.status; obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency, useInterfaces) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromProtoMsg(message: HttpRequestProtoMsg, useInterfaces: boolean = true): HttpRequest { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts index 609506d618..5e17b71fcb 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts @@ -370,8 +370,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry, useInterfaces: boolean = true): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: LogEntry_LabelsEntryProtoMsg, useInterfaces: boolean = true): LogEntry_LabelsEntry { @@ -620,7 +620,7 @@ export const LogEntry = { message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -658,12 +658,12 @@ export const LogEntry = { }, toAmino(message: LogEntry, useInterfaces: boolean = true): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest, useInterfaces) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -671,7 +671,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload, useInterfaces) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload, useInterfaces) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation, useInterfaces) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation, useInterfaces) : undefined; @@ -799,10 +799,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation, useInterfaces: boolean = true): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromProtoMsg(message: LogEntryOperationProtoMsg, useInterfaces: boolean = true): LogEntryOperation { @@ -914,9 +914,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation, useInterfaces: boolean = true): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromProtoMsg(message: LogEntrySourceLocationProtoMsg, useInterfaces: boolean = true): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts index 0733ed455e..4253831625 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts @@ -221,8 +221,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry, useInterfaces: boolean = true): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: MetricValue_LabelsEntryProtoMsg, useInterfaces: boolean = true): MetricValue_LabelsEntry { @@ -453,10 +453,10 @@ export const MetricValue = { } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.bool_value = message.boolValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue, useInterfaces) : undefined; return obj; }, @@ -558,11 +558,11 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet, useInterfaces: boolean = true): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e, useInterfaces) : undefined); } else { - obj.metric_values = []; + obj.metric_values = message.metricValues; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts index d01b330b59..0fff06050d 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/operation.ts @@ -324,8 +324,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry, useInterfaces: boolean = true): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: Operation_LabelsEntryProtoMsg, useInterfaces: boolean = true): Operation_LabelsEntry { @@ -583,16 +583,16 @@ export const Operation = { message.metricValueSets = object.metric_value_sets?.map(e => MetricValueSet.fromAmino(e)) || []; message.logEntries = object.log_entries?.map(e => LogEntry.fromAmino(e)) || []; if (object.importance !== undefined && object.importance !== null) { - message.importance = operation_ImportanceFromJSON(object.importance); + message.importance = object.importance; } message.extensions = object.extensions?.map(e => Any.fromAmino(e)) || []; return message; }, toAmino(message: Operation, useInterfaces: boolean = true): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.operation_name = message.operationName === "" ? undefined : message.operationName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.labels = {}; @@ -604,18 +604,18 @@ export const Operation = { if (message.metricValueSets) { obj.metric_value_sets = message.metricValueSets.map(e => e ? MetricValueSet.toAmino(e, useInterfaces) : undefined); } else { - obj.metric_value_sets = []; + obj.metric_value_sets = message.metricValueSets; } if (message.logEntries) { obj.log_entries = message.logEntries.map(e => e ? LogEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.log_entries = []; + obj.log_entries = message.logEntries; } - obj.importance = operation_ImportanceToJSON(message.importance); + obj.importance = message.importance === 0 ? undefined : message.importance; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts index ea2ec4d2e9..fed13c2893 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/quota_controller.ts @@ -572,9 +572,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest, useInterfaces: boolean = true): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation, useInterfaces) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromProtoMsg(message: AllocateQuotaRequestProtoMsg, useInterfaces: boolean = true): AllocateQuotaRequest { @@ -668,8 +668,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry, useInterfaces: boolean = true): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: QuotaOperation_LabelsEntryProtoMsg, useInterfaces: boolean = true): QuotaOperation_LabelsEntry { @@ -856,15 +856,15 @@ export const QuotaOperation = { }, {}); message.quotaMetrics = object.quota_metrics?.map(e => MetricValueSet.fromAmino(e)) || []; if (object.quota_mode !== undefined && object.quota_mode !== null) { - message.quotaMode = quotaOperation_QuotaModeFromJSON(object.quota_mode); + message.quotaMode = object.quota_mode; } return message; }, toAmino(message: QuotaOperation, useInterfaces: boolean = true): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.method_name = message.methodName === "" ? undefined : message.methodName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -874,9 +874,9 @@ export const QuotaOperation = { if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e, useInterfaces) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.quota_mode = quotaOperation_QuotaModeToJSON(message.quotaMode); + obj.quota_mode = message.quotaMode === 0 ? undefined : message.quotaMode; return obj; }, fromProtoMsg(message: QuotaOperationProtoMsg, useInterfaces: boolean = true): QuotaOperation { @@ -1013,18 +1013,18 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse, useInterfaces: boolean = true): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e, useInterfaces) : undefined); } else { - obj.allocate_errors = []; + obj.allocate_errors = message.allocateErrors; } if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e, useInterfaces) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromProtoMsg(message: AllocateQuotaResponseProtoMsg, useInterfaces: boolean = true): AllocateQuotaResponse { @@ -1136,7 +1136,7 @@ export const QuotaError = { fromAmino(object: QuotaErrorAmino): QuotaError { const message = createBaseQuotaError(); if (object.code !== undefined && object.code !== null) { - message.code = quotaError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -1151,9 +1151,9 @@ export const QuotaError = { }, toAmino(message: QuotaError, useInterfaces: boolean = true): QuotaErrorAmino { const obj: any = {}; - obj.code = quotaError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.description = message.description; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; obj.status = message.status ? Status.toAmino(message.status, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts index 6cd093685b..bfbe8b5297 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts @@ -542,9 +542,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest, useInterfaces: boolean = true): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.operation = message.operation ? Operation.toAmino(message.operation, useInterfaces) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromProtoMsg(message: CheckRequestProtoMsg, useInterfaces: boolean = true): CheckRequest { @@ -692,14 +692,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse, useInterfaces: boolean = true): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e, useInterfaces) : undefined); } else { - obj.check_errors = []; + obj.check_errors = message.checkErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo, useInterfaces) : undefined; return obj; }, @@ -806,7 +806,7 @@ export const CheckResponse_CheckInfo = { if (message.unusedArguments) { obj.unused_arguments = message.unusedArguments.map(e => e); } else { - obj.unused_arguments = []; + obj.unused_arguments = message.unusedArguments; } obj.consumer_info = message.consumerInfo ? CheckResponse_ConsumerInfo.toAmino(message.consumerInfo, useInterfaces) : undefined; return obj; @@ -913,7 +913,7 @@ export const CheckResponse_ConsumerInfo = { message.projectNumber = BigInt(object.project_number); } if (object.type !== undefined && object.type !== null) { - message.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + message.type = object.type; } if (object.consumer_number !== undefined && object.consumer_number !== null) { message.consumerNumber = BigInt(object.consumer_number); @@ -923,7 +923,7 @@ export const CheckResponse_ConsumerInfo = { toAmino(message: CheckResponse_ConsumerInfo, useInterfaces: boolean = true): CheckResponse_ConsumerInfoAmino { const obj: any = {}; obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; return obj; }, @@ -1040,13 +1040,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest, useInterfaces: boolean = true): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e, useInterfaces) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromProtoMsg(message: ReportRequestProtoMsg, useInterfaces: boolean = true): ReportRequest { @@ -1165,10 +1165,10 @@ export const ReportResponse = { if (message.reportErrors) { obj.report_errors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toAmino(e, useInterfaces) : undefined); } else { - obj.report_errors = []; + obj.report_errors = message.reportErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; return obj; }, fromProtoMsg(message: ReportResponseProtoMsg, useInterfaces: boolean = true): ReportResponse { @@ -1265,7 +1265,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError, useInterfaces: boolean = true): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; obj.status = message.status ? Status.toAmino(message.status, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts index 252690e647..c45936a5f8 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v2/service_controller.ts @@ -395,15 +395,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest, useInterfaces: boolean = true): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes, useInterfaces) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } - obj.flags = message.flags; + obj.flags = message.flags === "" ? undefined : message.flags; return obj; }, fromProtoMsg(message: CheckRequestProtoMsg, useInterfaces: boolean = true): CheckRequest { @@ -543,11 +543,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo, useInterfaces: boolean = true): ResourceInfoAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.permission = message.permission; - obj.container = message.container; - obj.location = message.location; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.permission = message.permission === "" ? undefined : message.permission; + obj.container = message.container === "" ? undefined : message.container; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromProtoMsg(message: ResourceInfoProtoMsg, useInterfaces: boolean = true): ResourceInfo { @@ -641,8 +641,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry, useInterfaces: boolean = true): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: CheckResponse_HeadersEntryProtoMsg, useInterfaces: boolean = true): CheckResponse_HeadersEntry { @@ -893,12 +893,12 @@ export const ReportRequest = { }, toAmino(message: ReportRequest, useInterfaces: boolean = true): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.service_config_id = message.serviceConfigId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e, useInterfaces) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts index 4596212060..cccc19fde9 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/resources.ts @@ -864,8 +864,8 @@ export const ManagedService = { }, toAmino(message: ManagedService, useInterfaces: boolean = true): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; return obj; }, fromProtoMsg(message: ManagedServiceProtoMsg, useInterfaces: boolean = true): ManagedService { @@ -1005,14 +1005,14 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } if (message.steps) { obj.steps = message.steps.map(e => e ? OperationMetadata_Step.toAmino(e, useInterfaces) : undefined); } else { - obj.steps = []; + obj.steps = message.steps; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = message.progressPercentage === 0 ? undefined : message.progressPercentage; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -1102,14 +1102,14 @@ export const OperationMetadata_Step = { message.description = object.description; } if (object.status !== undefined && object.status !== null) { - message.status = operationMetadata_StatusFromJSON(object.status); + message.status = object.status; } return message; }, toAmino(message: OperationMetadata_Step, useInterfaces: boolean = true): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = operationMetadata_StatusToJSON(message.status); + obj.description = message.description === "" ? undefined : message.description; + obj.status = message.status === 0 ? undefined : message.status; return obj; }, fromProtoMsg(message: OperationMetadata_StepProtoMsg, useInterfaces: boolean = true): OperationMetadata_Step { @@ -1210,7 +1210,7 @@ export const Diagnostic = { message.location = object.location; } if (object.kind !== undefined && object.kind !== null) { - message.kind = diagnostic_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.message !== undefined && object.message !== null) { message.message = object.message; @@ -1219,9 +1219,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic, useInterfaces: boolean = true): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = diagnostic_KindToJSON(message.kind); - obj.message = message.message; + obj.location = message.location === "" ? undefined : message.location; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromProtoMsg(message: DiagnosticProtoMsg, useInterfaces: boolean = true): Diagnostic { @@ -1322,11 +1322,11 @@ export const ConfigSource = { }, toAmino(message: ConfigSource, useInterfaces: boolean = true): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e, useInterfaces) : undefined); } else { - obj.files = []; + obj.files = message.files; } return obj; }, @@ -1431,15 +1431,15 @@ export const ConfigFile = { message.fileContents = bytesFromBase64(object.file_contents); } if (object.file_type !== undefined && object.file_type !== null) { - message.fileType = configFile_FileTypeFromJSON(object.file_type); + message.fileType = object.file_type; } return message; }, toAmino(message: ConfigFile, useInterfaces: boolean = true): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = message.filePath === "" ? undefined : message.filePath; obj.file_contents = message.fileContents ? base64FromBytes(message.fileContents) : undefined; - obj.file_type = configFile_FileTypeToJSON(message.fileType); + obj.file_type = message.fileType === 0 ? undefined : message.fileType; return obj; }, fromProtoMsg(message: ConfigFileProtoMsg, useInterfaces: boolean = true): ConfigFile { @@ -1519,7 +1519,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef, useInterfaces: boolean = true): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: ConfigRefProtoMsg, useInterfaces: boolean = true): ConfigRef { @@ -1608,7 +1608,7 @@ export const ChangeReport = { if (message.configChanges) { obj.config_changes = message.configChanges.map(e => e ? ConfigChange.toAmino(e, useInterfaces) : undefined); } else { - obj.config_changes = []; + obj.config_changes = message.configChanges; } return obj; }, @@ -1768,7 +1768,7 @@ export const Rollout = { message.createdBy = object.created_by; } if (object.status !== undefined && object.status !== null) { - message.status = rollout_RolloutStatusFromJSON(object.status); + message.status = object.status; } if (object.traffic_percent_strategy !== undefined && object.traffic_percent_strategy !== null) { message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy); @@ -1783,13 +1783,13 @@ export const Rollout = { }, toAmino(message: Rollout, useInterfaces: boolean = true): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; - obj.created_by = message.createdBy; - obj.status = rollout_RolloutStatusToJSON(message.status); + obj.created_by = message.createdBy === "" ? undefined : message.createdBy; + obj.status = message.status === 0 ? undefined : message.status; obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy, useInterfaces) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy, useInterfaces) : undefined; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromProtoMsg(message: RolloutProtoMsg, useInterfaces: boolean = true): Rollout { @@ -1883,8 +1883,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry, useInterfaces: boolean = true): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: Rollout_TrafficPercentStrategy_PercentagesEntryProtoMsg, useInterfaces: boolean = true): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts index 1378ca9e97..dd7be2f313 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicemanagement/v1/servicemanager.ts @@ -783,10 +783,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest, useInterfaces: boolean = true): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; return obj; }, fromProtoMsg(message: ListServicesRequestProtoMsg, useInterfaces: boolean = true): ListServicesRequest { @@ -890,9 +890,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toAmino(e, useInterfaces) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListServicesResponseProtoMsg, useInterfaces: boolean = true): ListServicesResponse { @@ -972,7 +972,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest, useInterfaces: boolean = true): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromProtoMsg(message: GetServiceRequestProtoMsg, useInterfaces: boolean = true): GetServiceRequest { @@ -1134,7 +1134,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest, useInterfaces: boolean = true): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromProtoMsg(message: DeleteServiceRequestProtoMsg, useInterfaces: boolean = true): DeleteServiceRequest { @@ -1214,7 +1214,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest, useInterfaces: boolean = true): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromProtoMsg(message: UndeleteServiceRequestProtoMsg, useInterfaces: boolean = true): UndeleteServiceRequest { @@ -1400,15 +1400,15 @@ export const GetServiceConfigRequest = { message.configId = object.config_id; } if (object.view !== undefined && object.view !== null) { - message.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetServiceConfigRequest, useInterfaces: boolean = true): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = getServiceConfigRequest_ConfigViewToJSON(message.view); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.config_id = message.configId === "" ? undefined : message.configId; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromProtoMsg(message: GetServiceConfigRequestProtoMsg, useInterfaces: boolean = true): GetServiceConfigRequest { @@ -1518,9 +1518,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest, useInterfaces: boolean = true): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromProtoMsg(message: ListServiceConfigsRequestProtoMsg, useInterfaces: boolean = true): ListServiceConfigsRequest { @@ -1624,9 +1624,9 @@ export const ListServiceConfigsResponse = { if (message.serviceConfigs) { obj.service_configs = message.serviceConfigs.map(e => e ? Service.toAmino(e, useInterfaces) : undefined); } else { - obj.service_configs = []; + obj.service_configs = message.serviceConfigs; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListServiceConfigsResponseProtoMsg, useInterfaces: boolean = true): ListServiceConfigsResponse { @@ -1723,7 +1723,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest, useInterfaces: boolean = true): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig, useInterfaces) : undefined; return obj; }, @@ -1836,9 +1836,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest, useInterfaces: boolean = true): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource, useInterfaces) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = message.validateOnly === false ? undefined : message.validateOnly; return obj; }, fromProtoMsg(message: SubmitConfigSourceRequestProtoMsg, useInterfaces: boolean = true): SubmitConfigSourceRequest { @@ -2017,7 +2017,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest, useInterfaces: boolean = true): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.rollout = message.rollout ? Rollout.toAmino(message.rollout, useInterfaces) : undefined; return obj; }, @@ -2143,10 +2143,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest, useInterfaces: boolean = true): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromProtoMsg(message: ListServiceRolloutsRequestProtoMsg, useInterfaces: boolean = true): ListServiceRolloutsRequest { @@ -2250,9 +2250,9 @@ export const ListServiceRolloutsResponse = { if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toAmino(e, useInterfaces) : undefined); } else { - obj.rollouts = []; + obj.rollouts = message.rollouts; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListServiceRolloutsResponseProtoMsg, useInterfaces: boolean = true): ListServiceRolloutsResponse { @@ -2347,8 +2347,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest, useInterfaces: boolean = true): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; return obj; }, fromProtoMsg(message: GetServiceRolloutRequestProtoMsg, useInterfaces: boolean = true): GetServiceRolloutRequest { @@ -2585,17 +2585,17 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse, useInterfaces: boolean = true): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.id = message.id === "" ? undefined : message.id; if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e, useInterfaces) : undefined); } else { - obj.change_reports = []; + obj.change_reports = message.changeReports; } if (message.diagnostics) { obj.diagnostics = message.diagnostics.map(e => e ? Diagnostic.toAmino(e, useInterfaces) : undefined); } else { - obj.diagnostics = []; + obj.diagnostics = message.diagnostics; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts index b33f56b323..98200f08c7 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/resources.ts @@ -353,16 +353,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service, useInterfaces: boolean = true): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config, useInterfaces) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromProtoMsg(message: ServiceProtoMsg, useInterfaces: boolean = true): Service { @@ -605,12 +605,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig, useInterfaces: boolean = true): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e, useInterfaces) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation, useInterfaces) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota, useInterfaces) : undefined; @@ -619,12 +619,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e, useInterfaces) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring, useInterfaces) : undefined; return obj; @@ -715,7 +715,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts index e4e95b78b2..2449c0565a 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1/serviceusage.ts @@ -587,7 +587,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest, useInterfaces: boolean = true): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: EnableServiceRequestProtoMsg, useInterfaces: boolean = true): EnableServiceRequest { @@ -773,15 +773,15 @@ export const DisableServiceRequest = { message.disableDependentServices = object.disable_dependent_services; } if (object.check_if_service_has_usage !== undefined && object.check_if_service_has_usage !== null) { - message.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage); + message.checkIfServiceHasUsage = object.check_if_service_has_usage; } return message; }, toAmino(message: DisableServiceRequest, useInterfaces: boolean = true): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = disableServiceRequest_CheckIfServiceHasUsageToJSON(message.checkIfServiceHasUsage); + obj.name = message.name === "" ? undefined : message.name; + obj.disable_dependent_services = message.disableDependentServices === false ? undefined : message.disableDependentServices; + obj.check_if_service_has_usage = message.checkIfServiceHasUsage === 0 ? undefined : message.checkIfServiceHasUsage; return obj; }, fromProtoMsg(message: DisableServiceRequestProtoMsg, useInterfaces: boolean = true): DisableServiceRequest { @@ -943,7 +943,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest, useInterfaces: boolean = true): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetServiceRequestProtoMsg, useInterfaces: boolean = true): GetServiceRequest { @@ -1068,10 +1068,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest, useInterfaces: boolean = true): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromProtoMsg(message: ListServicesRequestProtoMsg, useInterfaces: boolean = true): ListServicesRequest { @@ -1175,9 +1175,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e, useInterfaces) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListServicesResponseProtoMsg, useInterfaces: boolean = true): ListServicesResponse { @@ -1278,11 +1278,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest, useInterfaces: boolean = true): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1393,12 +1393,12 @@ export const BatchEnableServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e, useInterfaces) : undefined); } else { - obj.services = []; + obj.services = message.services; } if (message.failures) { obj.failures = message.failures.map(e => e ? BatchEnableServicesResponse_EnableFailure.toAmino(e, useInterfaces) : undefined); } else { - obj.failures = []; + obj.failures = message.failures; } return obj; }, @@ -1494,8 +1494,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure, useInterfaces: boolean = true): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = message.serviceId === "" ? undefined : message.serviceId; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; return obj; }, fromProtoMsg(message: BatchEnableServicesResponse_EnableFailureProtoMsg, useInterfaces: boolean = true): BatchEnableServicesResponse_EnableFailure { @@ -1596,11 +1596,11 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest, useInterfaces: boolean = true): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.names) { obj.names = message.names.map(e => e); } else { - obj.names = []; + obj.names = message.names; } return obj; }, @@ -1690,7 +1690,7 @@ export const BatchGetServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e, useInterfaces) : undefined); } else { - obj.services = []; + obj.services = message.services; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts index 0f8eb66740..2a8e2f8b2e 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts @@ -1127,16 +1127,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service, useInterfaces: boolean = true): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config, useInterfaces) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromProtoMsg(message: ServiceProtoMsg, useInterfaces: boolean = true): Service { @@ -1379,12 +1379,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig, useInterfaces: boolean = true): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e, useInterfaces) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation, useInterfaces) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota, useInterfaces) : undefined; @@ -1393,12 +1393,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e, useInterfaces) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring, useInterfaces) : undefined; return obj; @@ -1489,7 +1489,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1657,20 +1657,20 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric, useInterfaces: boolean = true): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.display_name = message.displayName === "" ? undefined : message.displayName; if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e, useInterfaces) : undefined); } else { - obj.consumer_quota_limits = []; + obj.consumer_quota_limits = message.consumerQuotaLimits; } if (message.descendantConsumerQuotaLimits) { obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e, useInterfaces) : undefined); } else { - obj.descendant_consumer_quota_limits = []; + obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits; } - obj.unit = message.unit; + obj.unit = message.unit === "" ? undefined : message.unit; return obj; }, fromProtoMsg(message: ConsumerQuotaMetricProtoMsg, useInterfaces: boolean = true): ConsumerQuotaMetric { @@ -1831,15 +1831,15 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit, useInterfaces: boolean = true): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.is_precise = message.isPrecise === false ? undefined : message.isPrecise; + obj.allows_admin_overrides = message.allowsAdminOverrides === false ? undefined : message.allowsAdminOverrides; if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e, useInterfaces) : undefined); } else { - obj.quota_buckets = []; + obj.quota_buckets = message.quotaBuckets; } return obj; }, @@ -1934,8 +1934,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry, useInterfaces: boolean = true): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: QuotaBucket_DimensionsEntryProtoMsg, useInterfaces: boolean = true): QuotaBucket_DimensionsEntry { @@ -2236,8 +2236,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry, useInterfaces: boolean = true): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: QuotaOverride_DimensionsEntryProtoMsg, useInterfaces: boolean = true): QuotaOverride_DimensionsEntry { @@ -2426,7 +2426,7 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride, useInterfaces: boolean = true): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2434,9 +2434,9 @@ export const QuotaOverride = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.admin_override_ancestor = message.adminOverrideAncestor === "" ? undefined : message.adminOverrideAncestor; return obj; }, fromProtoMsg(message: QuotaOverrideProtoMsg, useInterfaces: boolean = true): QuotaOverride { @@ -2525,7 +2525,7 @@ export const OverrideInlineSource = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2620,8 +2620,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry, useInterfaces: boolean = true): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AdminQuotaPolicy_DimensionsEntryProtoMsg, useInterfaces: boolean = true): AdminQuotaPolicy_DimensionsEntry { @@ -2810,7 +2810,7 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy, useInterfaces: boolean = true): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2818,9 +2818,9 @@ export const AdminQuotaPolicy = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromProtoMsg(message: AdminQuotaPolicyProtoMsg, useInterfaces: boolean = true): AdminQuotaPolicy { @@ -2915,8 +2915,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity, useInterfaces: boolean = true): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = message.email === "" ? undefined : message.email; + obj.unique_id = message.uniqueId === "" ? undefined : message.uniqueId; return obj; }, fromProtoMsg(message: ServiceIdentityProtoMsg, useInterfaces: boolean = true): ServiceIdentity { diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts index c292d0f9db..27ff3aabd2 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/serviceusage.ts @@ -1485,7 +1485,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest, useInterfaces: boolean = true): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: EnableServiceRequestProtoMsg, useInterfaces: boolean = true): EnableServiceRequest { @@ -1565,7 +1565,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest, useInterfaces: boolean = true): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: DisableServiceRequestProtoMsg, useInterfaces: boolean = true): DisableServiceRequest { @@ -1645,7 +1645,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest, useInterfaces: boolean = true): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetServiceRequestProtoMsg, useInterfaces: boolean = true): GetServiceRequest { @@ -1770,10 +1770,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest, useInterfaces: boolean = true): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromProtoMsg(message: ListServicesRequestProtoMsg, useInterfaces: boolean = true): ListServicesRequest { @@ -1877,9 +1877,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e, useInterfaces) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListServicesResponseProtoMsg, useInterfaces: boolean = true): ListServicesResponse { @@ -1980,11 +1980,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest, useInterfaces: boolean = true): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -2104,16 +2104,16 @@ export const ListConsumerQuotaMetricsRequest = { message.pageToken = object.page_token; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: ListConsumerQuotaMetricsRequest, useInterfaces: boolean = true): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = quotaViewToJSON(message.view); + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromProtoMsg(message: ListConsumerQuotaMetricsRequestProtoMsg, useInterfaces: boolean = true): ListConsumerQuotaMetricsRequest { @@ -2217,9 +2217,9 @@ export const ListConsumerQuotaMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toAmino(e, useInterfaces) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListConsumerQuotaMetricsResponseProtoMsg, useInterfaces: boolean = true): ListConsumerQuotaMetricsResponse { @@ -2308,14 +2308,14 @@ export const GetConsumerQuotaMetricRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaMetricRequest, useInterfaces: boolean = true): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromProtoMsg(message: GetConsumerQuotaMetricRequestProtoMsg, useInterfaces: boolean = true): GetConsumerQuotaMetricRequest { @@ -2404,14 +2404,14 @@ export const GetConsumerQuotaLimitRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaLimitRequest, useInterfaces: boolean = true): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromProtoMsg(message: GetConsumerQuotaLimitRequestProtoMsg, useInterfaces: boolean = true): GetConsumerQuotaLimitRequest { @@ -2548,18 +2548,18 @@ export const CreateAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateAdminOverrideRequest, useInterfaces: boolean = true): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override, useInterfaces) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2714,19 +2714,19 @@ export const UpdateAdminOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateAdminOverrideRequest, useInterfaces: boolean = true): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override, useInterfaces) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2847,17 +2847,17 @@ export const DeleteAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteAdminOverrideRequest, useInterfaces: boolean = true): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2968,9 +2968,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest, useInterfaces: boolean = true): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromProtoMsg(message: ListAdminOverridesRequestProtoMsg, useInterfaces: boolean = true): ListAdminOverridesRequest { @@ -3074,9 +3074,9 @@ export const ListAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListAdminOverridesResponseProtoMsg, useInterfaces: boolean = true): ListAdminOverridesResponse { @@ -3165,7 +3165,7 @@ export const BatchCreateAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3303,18 +3303,18 @@ export const ImportAdminOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportAdminOverridesRequest, useInterfaces: boolean = true): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource, useInterfaces) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3404,7 +3404,7 @@ export const ImportAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3604,18 +3604,18 @@ export const CreateConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateConsumerOverrideRequest, useInterfaces: boolean = true): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override, useInterfaces) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3770,19 +3770,19 @@ export const UpdateConsumerOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateConsumerOverrideRequest, useInterfaces: boolean = true): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override, useInterfaces) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3903,17 +3903,17 @@ export const DeleteConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteConsumerOverrideRequest, useInterfaces: boolean = true): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4024,9 +4024,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest, useInterfaces: boolean = true): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromProtoMsg(message: ListConsumerOverridesRequestProtoMsg, useInterfaces: boolean = true): ListConsumerOverridesRequest { @@ -4130,9 +4130,9 @@ export const ListConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListConsumerOverridesResponseProtoMsg, useInterfaces: boolean = true): ListConsumerOverridesResponse { @@ -4221,7 +4221,7 @@ export const BatchCreateConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4359,18 +4359,18 @@ export const ImportConsumerOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportConsumerOverridesRequest, useInterfaces: boolean = true): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource, useInterfaces) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4460,7 +4460,7 @@ export const ImportConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e, useInterfaces) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4612,7 +4612,7 @@ export const ImportAdminQuotaPoliciesResponse = { if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toAmino(e, useInterfaces) : undefined); } else { - obj.policies = []; + obj.policies = message.policies; } return obj; }, @@ -4941,7 +4941,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest, useInterfaces: boolean = true): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; return obj; }, fromProtoMsg(message: GenerateServiceIdentityRequestProtoMsg, useInterfaces: boolean = true): GenerateServiceIdentityRequest { @@ -5032,14 +5032,14 @@ export const GetServiceIdentityResponse = { message.identity = ServiceIdentity.fromAmino(object.identity); } if (object.state !== undefined && object.state !== null) { - message.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: GetServiceIdentityResponse, useInterfaces: boolean = true): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity, useInterfaces) : undefined; - obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromProtoMsg(message: GetServiceIdentityResponseProtoMsg, useInterfaces: boolean = true): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputv3/google/api/source_info.ts b/__fixtures__/v-next/outputv3/google/api/source_info.ts index fa30c178ca..e872a5b86f 100644 --- a/__fixtures__/v-next/outputv3/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv3/google/api/source_info.ts @@ -93,7 +93,7 @@ export const SourceInfo = { if (message.sourceFiles) { obj.source_files = message.sourceFiles.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.source_files = []; + obj.source_files = message.sourceFiles; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/system_parameter.ts b/__fixtures__/v-next/outputv3/google/api/system_parameter.ts index 4998f39174..32749fd22e 100644 --- a/__fixtures__/v-next/outputv3/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv3/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -279,7 +279,7 @@ export const SystemParameters = { if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -381,11 +381,11 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule, useInterfaces: boolean = true): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e, useInterfaces) : undefined); } else { - obj.parameters = []; + obj.parameters = message.parameters; } return obj; }, @@ -496,9 +496,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter, useInterfaces: boolean = true): SystemParameterAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.http_header = omitDefault(message.httpHeader); - obj.url_query_parameter = omitDefault(message.urlQueryParameter); + obj.name = message.name === "" ? undefined : message.name; + obj.http_header = message.httpHeader === "" ? undefined : message.httpHeader; + obj.url_query_parameter = message.urlQueryParameter === "" ? undefined : message.urlQueryParameter; return obj; }, fromProtoMsg(message: SystemParameterProtoMsg, useInterfaces: boolean = true): SystemParameter { diff --git a/__fixtures__/v-next/outputv3/google/api/usage.ts b/__fixtures__/v-next/outputv3/google/api/usage.ts index 1ab4304f0b..8f17414c69 100644 --- a/__fixtures__/v-next/outputv3/google/api/usage.ts +++ b/__fixtures__/v-next/outputv3/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -316,14 +316,14 @@ export const Usage = { if (message.requirements) { obj.requirements = message.requirements.map(e => e); } else { - obj.requirements = []; + obj.requirements = message.requirements; } if (message.rules) { obj.rules = message.rules.map(e => e ? UsageRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); + obj.producer_notification_channel = message.producerNotificationChannel === "" ? undefined : message.producerNotificationChannel; return obj; }, fromProtoMsg(message: UsageProtoMsg, useInterfaces: boolean = true): Usage { @@ -433,9 +433,9 @@ export const UsageRule = { }, toAmino(message: UsageRule, useInterfaces: boolean = true): UsageRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); - obj.skip_service_control = omitDefault(message.skipServiceControl); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.allow_unregistered_calls = message.allowUnregisteredCalls === false ? undefined : message.allowUnregisteredCalls; + obj.skip_service_control = message.skipServiceControl === false ? undefined : message.skipServiceControl; return obj; }, fromProtoMsg(message: UsageRuleProtoMsg, useInterfaces: boolean = true): UsageRule { diff --git a/__fixtures__/v-next/outputv3/google/api/visibility.ts b/__fixtures__/v-next/outputv3/google/api/visibility.ts index 89e6b40212..9ae81dae12 100644 --- a/__fixtures__/v-next/outputv3/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv3/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -241,7 +241,7 @@ export const Visibility = { if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toAmino(e, useInterfaces) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -337,8 +337,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule, useInterfaces: boolean = true): VisibilityRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.restriction = omitDefault(message.restriction); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.restriction = message.restriction === "" ? undefined : message.restriction; return obj; }, fromProtoMsg(message: VisibilityRuleProtoMsg, useInterfaces: boolean = true): VisibilityRule { diff --git a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts index 4fcfb571d7..c76d18b0d6 100644 --- a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts @@ -468,21 +468,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest, useInterfaces: boolean = true): HttpRequestAmino { const obj: any = {}; - obj.request_method = message.requestMethod; - obj.request_url = message.requestUrl; + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; - obj.status = message.status; + obj.status = message.status === 0 ? undefined : message.status; obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; - obj.user_agent = message.userAgent; - obj.remote_ip = message.remoteIp; - obj.server_ip = message.serverIp; - obj.referer = message.referer; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency, useInterfaces) : undefined; - obj.cache_lookup = message.cacheLookup; - obj.cache_hit = message.cacheHit; - obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer; + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; - obj.protocol = message.protocol; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromProtoMsg(message: HttpRequestProtoMsg, useInterfaces: boolean = true): HttpRequest { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts index a55566a425..bdc86da745 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts @@ -598,8 +598,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry, useInterfaces: boolean = true): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: LogEntry_LabelsEntryProtoMsg, useInterfaces: boolean = true): LogEntry_LabelsEntry { @@ -927,7 +927,7 @@ export const LogEntry = { message.receiveTimestamp = fromTimestamp(Timestamp.fromAmino(object.receive_timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.insert_id !== undefined && object.insert_id !== null) { message.insertId = object.insert_id; @@ -965,15 +965,15 @@ export const LogEntry = { }, toAmino(message: LogEntry, useInterfaces: boolean = true): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource, useInterfaces) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload, useInterfaces) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload, useInterfaces) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.receive_timestamp = message.receiveTimestamp ? Timestamp.toAmino(toTimestamp(message.receiveTimestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); - obj.insert_id = message.insertId; + obj.severity = message.severity === 0 ? undefined : message.severity; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest, useInterfaces) : undefined; obj.labels = {}; if (message.labels) { @@ -982,9 +982,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation, useInterfaces) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.span_id = message.spanId === "" ? undefined : message.spanId; + obj.trace_sampled = message.traceSampled === false ? undefined : message.traceSampled; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation, useInterfaces) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split, useInterfaces) : undefined; return obj; @@ -1111,10 +1111,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation, useInterfaces: boolean = true): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromProtoMsg(message: LogEntryOperationProtoMsg, useInterfaces: boolean = true): LogEntryOperation { @@ -1226,9 +1226,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation, useInterfaces: boolean = true): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromProtoMsg(message: LogEntrySourceLocationProtoMsg, useInterfaces: boolean = true): LogEntrySourceLocation { @@ -1338,9 +1338,9 @@ export const LogSplit = { }, toAmino(message: LogSplit, useInterfaces: boolean = true): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = message.uid === "" ? undefined : message.uid; + obj.index = message.index === 0 ? undefined : message.index; + obj.total_splits = message.totalSplits === 0 ? undefined : message.totalSplits; return obj; }, fromProtoMsg(message: LogSplitProtoMsg, useInterfaces: boolean = true): LogSplit { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts index c04cc26ec0..6a213a9b94 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging.ts @@ -955,7 +955,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest, useInterfaces: boolean = true): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; return obj; }, fromProtoMsg(message: DeleteLogRequestProtoMsg, useInterfaces: boolean = true): DeleteLogRequest { @@ -1049,8 +1049,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry, useInterfaces: boolean = true): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: WriteLogEntriesRequest_LabelsEntryProtoMsg, useInterfaces: boolean = true): WriteLogEntriesRequest_LabelsEntry { @@ -1245,7 +1245,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest, useInterfaces: boolean = true): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource, useInterfaces) : undefined; obj.labels = {}; if (message.labels) { @@ -1256,10 +1256,10 @@ export const WriteLogEntriesRequest = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = message.partialSuccess === false ? undefined : message.partialSuccess; + obj.dry_run = message.dryRun === false ? undefined : message.dryRun; return obj; }, fromProtoMsg(message: WriteLogEntriesRequestProtoMsg, useInterfaces: boolean = true): WriteLogEntriesRequest { @@ -1417,7 +1417,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry, useInterfaces: boolean = true): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === 0 ? undefined : message.key; obj.value = message.value ? Status.toAmino(message.value, useInterfaces) : undefined; return obj; }, @@ -1684,12 +1684,12 @@ export const ListLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.order_by = message.orderBy === "" ? undefined : message.orderBy; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromProtoMsg(message: ListLogEntriesRequestProtoMsg, useInterfaces: boolean = true): ListLogEntriesRequest { @@ -1793,9 +1793,9 @@ export const ListLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListLogEntriesResponseProtoMsg, useInterfaces: boolean = true): ListLogEntriesResponse { @@ -1890,8 +1890,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest, useInterfaces: boolean = true): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromProtoMsg(message: ListMonitoredResourceDescriptorsRequestProtoMsg, useInterfaces: boolean = true): ListMonitoredResourceDescriptorsRequest { @@ -1995,9 +1995,9 @@ export const ListMonitoredResourceDescriptorsResponse = { if (message.resourceDescriptors) { obj.resource_descriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toAmino(e, useInterfaces) : undefined); } else { - obj.resource_descriptors = []; + obj.resource_descriptors = message.resourceDescriptors; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListMonitoredResourceDescriptorsResponseProtoMsg, useInterfaces: boolean = true): ListMonitoredResourceDescriptorsResponse { @@ -2128,13 +2128,13 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest, useInterfaces: boolean = true): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -2239,9 +2239,9 @@ export const ListLogsResponse = { if (message.logNames) { obj.log_names = message.logNames.map(e => e); } else { - obj.log_names = []; + obj.log_names = message.logNames; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListLogsResponseProtoMsg, useInterfaces: boolean = true): ListLogsResponse { @@ -2362,9 +2362,9 @@ export const TailLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow, useInterfaces) : undefined; return obj; }, @@ -2475,12 +2475,12 @@ export const TailLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e, useInterfaces) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.suppressionInfo) { obj.suppression_info = message.suppressionInfo.map(e => e ? TailLogEntriesResponse_SuppressionInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.suppression_info = []; + obj.suppression_info = message.suppressionInfo; } return obj; }, @@ -2567,7 +2567,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { fromAmino(object: TailLogEntriesResponse_SuppressionInfoAmino): TailLogEntriesResponse_SuppressionInfo { const message = createBaseTailLogEntriesResponse_SuppressionInfo(); if (object.reason !== undefined && object.reason !== null) { - message.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + message.reason = object.reason; } if (object.suppressed_count !== undefined && object.suppressed_count !== null) { message.suppressedCount = object.suppressed_count; @@ -2576,8 +2576,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo, useInterfaces: boolean = true): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason); - obj.suppressed_count = message.suppressedCount; + obj.reason = message.reason === 0 ? undefined : message.reason; + obj.suppressed_count = message.suppressedCount === 0 ? undefined : message.suppressedCount; return obj; }, fromProtoMsg(message: TailLogEntriesResponse_SuppressionInfoProtoMsg, useInterfaces: boolean = true): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts index 5e57050ffa..1748f131eb 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts @@ -3059,7 +3059,7 @@ export const LogBucket = { message.locked = object.locked; } if (object.lifecycle_state !== undefined && object.lifecycle_state !== null) { - message.lifecycleState = lifecycleStateFromJSON(object.lifecycle_state); + message.lifecycleState = object.lifecycle_state; } message.restrictedFields = object.restricted_fields?.map(e => e) || []; if (object.cmek_settings !== undefined && object.cmek_settings !== null) { @@ -3069,17 +3069,17 @@ export const LogBucket = { }, toAmino(message: LogBucket, useInterfaces: boolean = true): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = lifecycleStateToJSON(message.lifecycleState); + obj.retention_days = message.retentionDays === 0 ? undefined : message.retentionDays; + obj.locked = message.locked === false ? undefined : message.locked; + obj.lifecycle_state = message.lifecycleState === 0 ? undefined : message.lifecycleState; if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { - obj.restricted_fields = []; + obj.restricted_fields = message.restrictedFields; } obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings, useInterfaces) : undefined; return obj; @@ -3221,11 +3221,11 @@ export const LogView = { }, toAmino(message: LogView, useInterfaces: boolean = true): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromProtoMsg(message: LogViewProtoMsg, useInterfaces: boolean = true): LogView { @@ -3457,7 +3457,7 @@ export const LogSink = { } message.exclusions = object.exclusions?.map(e => LogExclusion.fromAmino(e)) || []; if (object.output_version_format !== undefined && object.output_version_format !== null) { - message.outputVersionFormat = logSink_VersionFormatFromJSON(object.output_version_format); + message.outputVersionFormat = object.output_version_format; } if (object.writer_identity !== undefined && object.writer_identity !== null) { message.writerIdentity = object.writer_identity; @@ -3478,19 +3478,19 @@ export const LogSink = { }, toAmino(message: LogSink, useInterfaces: boolean = true): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.destination = message.destination === "" ? undefined : message.destination; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.description = message.description === "" ? undefined : message.description; + obj.disabled = message.disabled === false ? undefined : message.disabled; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e, useInterfaces) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.output_version_format = logSink_VersionFormatToJSON(message.outputVersionFormat); - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = message.outputVersionFormat === 0 ? undefined : message.outputVersionFormat; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; + obj.include_children = message.includeChildren === false ? undefined : message.includeChildren; obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions, useInterfaces) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; @@ -3588,8 +3588,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions, useInterfaces: boolean = true): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = message.usePartitionedTables === false ? undefined : message.usePartitionedTables; + obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning === false ? undefined : message.usesTimestampColumnPartitioning; return obj; }, fromProtoMsg(message: BigQueryOptionsProtoMsg, useInterfaces: boolean = true): BigQueryOptions { @@ -3699,9 +3699,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest, useInterfaces: boolean = true): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromProtoMsg(message: ListBucketsRequestProtoMsg, useInterfaces: boolean = true): ListBucketsRequest { @@ -3805,9 +3805,9 @@ export const ListBucketsResponse = { if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toAmino(e, useInterfaces) : undefined); } else { - obj.buckets = []; + obj.buckets = message.buckets; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListBucketsResponseProtoMsg, useInterfaces: boolean = true): ListBucketsResponse { @@ -3919,8 +3919,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest, useInterfaces: boolean = true): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.bucket_id = message.bucketId === "" ? undefined : message.bucketId; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket, useInterfaces) : undefined; return obj; }, @@ -4035,7 +4035,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest, useInterfaces: boolean = true): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket, useInterfaces) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; return obj; @@ -4117,7 +4117,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest, useInterfaces: boolean = true): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetBucketRequestProtoMsg, useInterfaces: boolean = true): GetBucketRequest { @@ -4197,7 +4197,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest, useInterfaces: boolean = true): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: DeleteBucketRequestProtoMsg, useInterfaces: boolean = true): DeleteBucketRequest { @@ -4277,7 +4277,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest, useInterfaces: boolean = true): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: UndeleteBucketRequestProtoMsg, useInterfaces: boolean = true): UndeleteBucketRequest { @@ -4387,9 +4387,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest, useInterfaces: boolean = true): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromProtoMsg(message: ListViewsRequestProtoMsg, useInterfaces: boolean = true): ListViewsRequest { @@ -4493,9 +4493,9 @@ export const ListViewsResponse = { if (message.views) { obj.views = message.views.map(e => e ? LogView.toAmino(e, useInterfaces) : undefined); } else { - obj.views = []; + obj.views = message.views; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListViewsResponseProtoMsg, useInterfaces: boolean = true): ListViewsResponse { @@ -4607,8 +4607,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest, useInterfaces: boolean = true): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.view_id = message.viewId === "" ? undefined : message.viewId; obj.view = message.view ? LogView.toAmino(message.view, useInterfaces) : undefined; return obj; }, @@ -4723,7 +4723,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest, useInterfaces: boolean = true): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.view = message.view ? LogView.toAmino(message.view, useInterfaces) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; return obj; @@ -4805,7 +4805,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest, useInterfaces: boolean = true): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetViewRequestProtoMsg, useInterfaces: boolean = true): GetViewRequest { @@ -4885,7 +4885,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest, useInterfaces: boolean = true): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: DeleteViewRequestProtoMsg, useInterfaces: boolean = true): DeleteViewRequest { @@ -4995,9 +4995,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest, useInterfaces: boolean = true): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromProtoMsg(message: ListSinksRequestProtoMsg, useInterfaces: boolean = true): ListSinksRequest { @@ -5101,9 +5101,9 @@ export const ListSinksResponse = { if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toAmino(e, useInterfaces) : undefined); } else { - obj.sinks = []; + obj.sinks = message.sinks; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListSinksResponseProtoMsg, useInterfaces: boolean = true): ListSinksResponse { @@ -5183,7 +5183,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest, useInterfaces: boolean = true): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromProtoMsg(message: GetSinkRequestProtoMsg, useInterfaces: boolean = true): GetSinkRequest { @@ -5295,9 +5295,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest, useInterfaces: boolean = true): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.sink = message.sink ? LogSink.toAmino(message.sink, useInterfaces) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; return obj; }, fromProtoMsg(message: CreateSinkRequestProtoMsg, useInterfaces: boolean = true): CreateSinkRequest { @@ -5426,9 +5426,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest, useInterfaces: boolean = true): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; obj.sink = message.sink ? LogSink.toAmino(message.sink, useInterfaces) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; return obj; }, @@ -5509,7 +5509,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest, useInterfaces: boolean = true): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromProtoMsg(message: DeleteSinkRequestProtoMsg, useInterfaces: boolean = true): DeleteSinkRequest { @@ -5664,10 +5664,10 @@ export const LogExclusion = { }, toAmino(message: LogExclusion, useInterfaces: boolean = true): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; return obj; @@ -5779,9 +5779,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest, useInterfaces: boolean = true): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromProtoMsg(message: ListExclusionsRequestProtoMsg, useInterfaces: boolean = true): ListExclusionsRequest { @@ -5885,9 +5885,9 @@ export const ListExclusionsResponse = { if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e, useInterfaces) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListExclusionsResponseProtoMsg, useInterfaces: boolean = true): ListExclusionsResponse { @@ -5967,7 +5967,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest, useInterfaces: boolean = true): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetExclusionRequestProtoMsg, useInterfaces: boolean = true): GetExclusionRequest { @@ -6064,7 +6064,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest, useInterfaces: boolean = true): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion, useInterfaces) : undefined; return obj; }, @@ -6179,7 +6179,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest, useInterfaces: boolean = true): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion, useInterfaces) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; return obj; @@ -6261,7 +6261,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest, useInterfaces: boolean = true): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: DeleteExclusionRequestProtoMsg, useInterfaces: boolean = true): DeleteExclusionRequest { @@ -6341,7 +6341,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest, useInterfaces: boolean = true): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetCmekSettingsRequestProtoMsg, useInterfaces: boolean = true): GetCmekSettingsRequest { @@ -6455,7 +6455,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest, useInterfaces: boolean = true): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings, useInterfaces) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; return obj; @@ -6567,9 +6567,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings, useInterfaces: boolean = true): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.service_account_id = message.serviceAccountId === "" ? undefined : message.serviceAccountId; return obj; }, fromProtoMsg(message: CmekSettingsProtoMsg, useInterfaces: boolean = true): CmekSettings { @@ -6649,7 +6649,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest, useInterfaces: boolean = true): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetSettingsRequestProtoMsg, useInterfaces: boolean = true): GetSettingsRequest { @@ -6763,7 +6763,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest, useInterfaces: boolean = true): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.settings = message.settings ? Settings.toAmino(message.settings, useInterfaces) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask, useInterfaces) : undefined; return obj; @@ -6905,11 +6905,11 @@ export const Settings = { }, toAmino(message: Settings, useInterfaces: boolean = true): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.kms_service_account_id = message.kmsServiceAccountId === "" ? undefined : message.kmsServiceAccountId; + obj.storage_location = message.storageLocation === "" ? undefined : message.storageLocation; + obj.disable_default_sink = message.disableDefaultSink === false ? undefined : message.disableDefaultSink; return obj; }, fromProtoMsg(message: SettingsProtoMsg, useInterfaces: boolean = true): Settings { @@ -7019,9 +7019,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest, useInterfaces: boolean = true): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.destination = message.destination === "" ? undefined : message.destination; return obj; }, fromProtoMsg(message: CopyLogEntriesRequestProtoMsg, useInterfaces: boolean = true): CopyLogEntriesRequest { @@ -7175,7 +7175,7 @@ export const CopyLogEntriesMetadata = { message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); } if (object.state !== undefined && object.state !== null) { - message.state = operationStateFromJSON(object.state); + message.state = object.state; } if (object.cancellation_requested !== undefined && object.cancellation_requested !== null) { message.cancellationRequested = object.cancellation_requested; @@ -7195,11 +7195,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.state = operationStateToJSON(message.state); - obj.cancellation_requested = message.cancellationRequested; + obj.state = message.state === 0 ? undefined : message.state; + obj.cancellation_requested = message.cancellationRequested === false ? undefined : message.cancellationRequested; obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request, useInterfaces) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = message.progress === 0 ? undefined : message.progress; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; return obj; }, fromProtoMsg(message: CopyLogEntriesMetadataProtoMsg, useInterfaces: boolean = true): CopyLogEntriesMetadata { diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts index 4103e440b1..fbee2165d2 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_metrics.ts @@ -651,8 +651,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry, useInterfaces: boolean = true): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: LogMetric_LabelExtractorsEntryProtoMsg, useInterfaces: boolean = true): LogMetric_LabelExtractorsEntry { @@ -912,18 +912,18 @@ export const LogMetric = { message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); } if (object.version !== undefined && object.version !== null) { - message.version = logMetric_ApiVersionFromJSON(object.version); + message.version = object.version; } return message; }, toAmino(message: LogMetric, useInterfaces: boolean = true): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor, useInterfaces) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = message.valueExtractor === "" ? undefined : message.valueExtractor; obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -933,7 +933,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions, useInterfaces) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.version = logMetric_ApiVersionToJSON(message.version); + obj.version = message.version === 0 ? undefined : message.version; return obj; }, fromProtoMsg(message: LogMetricProtoMsg, useInterfaces: boolean = true): LogMetric { @@ -1043,9 +1043,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest, useInterfaces: boolean = true): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromProtoMsg(message: ListLogMetricsRequestProtoMsg, useInterfaces: boolean = true): ListLogMetricsRequest { @@ -1149,9 +1149,9 @@ export const ListLogMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toAmino(e, useInterfaces) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListLogMetricsResponseProtoMsg, useInterfaces: boolean = true): ListLogMetricsResponse { @@ -1231,7 +1231,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest, useInterfaces: boolean = true): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromProtoMsg(message: GetLogMetricRequestProtoMsg, useInterfaces: boolean = true): GetLogMetricRequest { @@ -1328,7 +1328,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest, useInterfaces: boolean = true): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.metric = message.metric ? LogMetric.toAmino(message.metric, useInterfaces) : undefined; return obj; }, @@ -1426,7 +1426,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest, useInterfaces: boolean = true): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; obj.metric = message.metric ? LogMetric.toAmino(message.metric, useInterfaces) : undefined; return obj; }, @@ -1507,7 +1507,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest, useInterfaces: boolean = true): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromProtoMsg(message: DeleteLogMetricRequestProtoMsg, useInterfaces: boolean = true): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputv3/google/longrunning/operations.ts b/__fixtures__/v-next/outputv3/google/longrunning/operations.ts index 18b628dbbf..4868a343b4 100644 --- a/__fixtures__/v-next/outputv3/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv3/google/longrunning/operations.ts @@ -459,9 +459,9 @@ export const Operation = { }, toAmino(message: Operation, useInterfaces: boolean = true): OperationAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.metadata = message.metadata ? Any.toAmino(message.metadata, useInterfaces) : undefined; - obj.done = message.done; + obj.done = message.done === false ? undefined : message.done; obj.error = message.error ? Status.toAmino(message.error, useInterfaces) : undefined; obj.response = message.response ? Any.toAmino(message.response, useInterfaces) : undefined; return obj; @@ -543,7 +543,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest, useInterfaces: boolean = true): GetOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: GetOperationRequestProtoMsg, useInterfaces: boolean = true): GetOperationRequest { @@ -668,10 +668,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest, useInterfaces: boolean = true): ListOperationsRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromProtoMsg(message: ListOperationsRequestProtoMsg, useInterfaces: boolean = true): ListOperationsRequest { @@ -775,9 +775,9 @@ export const ListOperationsResponse = { if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e, useInterfaces) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromProtoMsg(message: ListOperationsResponseProtoMsg, useInterfaces: boolean = true): ListOperationsResponse { @@ -857,7 +857,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest, useInterfaces: boolean = true): CancelOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: CancelOperationRequestProtoMsg, useInterfaces: boolean = true): CancelOperationRequest { @@ -937,7 +937,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest, useInterfaces: boolean = true): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromProtoMsg(message: DeleteOperationRequestProtoMsg, useInterfaces: boolean = true): DeleteOperationRequest { @@ -1034,7 +1034,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest, useInterfaces: boolean = true): WaitOperationRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timeout = message.timeout ? Duration.toAmino(message.timeout, useInterfaces) : undefined; return obj; }, @@ -1130,8 +1130,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo, useInterfaces: boolean = true): OperationInfoAmino { const obj: any = {}; - obj.response_type = message.responseType; - obj.metadata_type = message.metadataType; + obj.response_type = message.responseType === "" ? undefined : message.responseType; + obj.metadata_type = message.metadataType === "" ? undefined : message.metadataType; return obj; }, fromProtoMsg(message: OperationInfoProtoMsg, useInterfaces: boolean = true): OperationInfo { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/any.ts b/__fixtures__/v-next/outputv3/google/protobuf/any.ts index e692b2e27d..048be20b65 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/any.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/__fixtures__/v-next/outputv3/google/protobuf/api.ts b/__fixtures__/v-next/outputv3/google/protobuf/api.ts index 77e4947412..50231ff1cd 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/api.ts @@ -615,31 +615,31 @@ export const Api = { } message.mixins = object.mixins?.map(e => Mixin.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Api, useInterfaces: boolean = true): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e, useInterfaces) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext, useInterfaces) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e, useInterfaces) : undefined); } else { - obj.mixins = []; + obj.mixins = message.mixins; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromProtoMsg(message: ApiProtoMsg, useInterfaces: boolean = true): Api { @@ -809,23 +809,23 @@ export const Method = { } message.options = object.options?.map(e => Option.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Method, useInterfaces: boolean = true): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = message.name === "" ? undefined : message.name; + obj.request_type_url = message.requestTypeUrl === "" ? undefined : message.requestTypeUrl; + obj.request_streaming = message.requestStreaming === false ? undefined : message.requestStreaming; + obj.response_type_url = message.responseTypeUrl === "" ? undefined : message.responseTypeUrl; + obj.response_streaming = message.responseStreaming === false ? undefined : message.responseStreaming; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromProtoMsg(message: MethodProtoMsg, useInterfaces: boolean = true): Method { @@ -920,8 +920,8 @@ export const Mixin = { }, toAmino(message: Mixin, useInterfaces: boolean = true): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = message.name === "" ? undefined : message.name; + obj.root = message.root === "" ? undefined : message.root; return obj; }, fromProtoMsg(message: MixinProtoMsg, useInterfaces: boolean = true): Mixin { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts index 40d5b02456..a339055628 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoAmino, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -382,10 +382,10 @@ export const Version = { }, toAmino(message: Version, useInterfaces: boolean = true): VersionAmino { const obj: any = {}; - obj.major = omitDefault(message.major); - obj.minor = omitDefault(message.minor); - obj.patch = omitDefault(message.patch); - obj.suffix = omitDefault(message.suffix); + obj.major = message.major === 0 ? undefined : message.major; + obj.minor = message.minor === 0 ? undefined : message.minor; + obj.patch = message.patch === 0 ? undefined : message.patch; + obj.suffix = message.suffix === "" ? undefined : message.suffix; return obj; }, fromProtoMsg(message: VersionProtoMsg, useInterfaces: boolean = true): Version { @@ -527,13 +527,13 @@ export const CodeGeneratorRequest = { if (message.fileToGenerate) { obj.file_to_generate = message.fileToGenerate.map(e => e); } else { - obj.file_to_generate = []; + obj.file_to_generate = message.fileToGenerate; } - obj.parameter = omitDefault(message.parameter); + obj.parameter = message.parameter === "" ? undefined : message.parameter; if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.proto_file = []; + obj.proto_file = message.protoFile; } obj.compiler_version = message.compilerVersion ? Version.toAmino(message.compilerVersion, useInterfaces) : undefined; return obj; @@ -636,11 +636,11 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse, useInterfaces: boolean = true): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = omitDefault(message.error); + obj.error = message.error === "" ? undefined : message.error; if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e, useInterfaces) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -751,9 +751,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File, useInterfaces: boolean = true): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.insertion_point = omitDefault(message.insertionPoint); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.insertion_point = message.insertionPoint === "" ? undefined : message.insertionPoint; + obj.content = message.content === "" ? undefined : message.content; return obj; }, fromProtoMsg(message: CodeGeneratorResponse_FileProtoMsg, useInterfaces: boolean = true): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts index d352ecfe58..cafe75088f 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts @@ -2162,7 +2162,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -2472,46 +2472,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto, useInterfaces: boolean = true): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options, useInterfaces) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo, useInterfaces) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromProtoMsg(message: FileDescriptorProtoProtoMsg, useInterfaces: boolean = true): FileDescriptorProto { @@ -2776,47 +2776,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto, useInterfaces: boolean = true): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e, useInterfaces) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options, useInterfaces) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e, useInterfaces) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2929,8 +2929,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange, useInterfaces: boolean = true): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options, useInterfaces) : undefined; return obj; }, @@ -3026,8 +3026,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange, useInterfaces: boolean = true): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromProtoMsg(message: DescriptorProto_ReservedRangeProtoMsg, useInterfaces: boolean = true): DescriptorProto_ReservedRange { @@ -3116,7 +3116,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -3307,10 +3307,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -3334,15 +3334,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto, useInterfaces: boolean = true): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options, useInterfaces) : undefined; return obj; }, @@ -3440,7 +3440,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto, useInterfaces: boolean = true): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options, useInterfaces) : undefined; return obj; }, @@ -3601,22 +3601,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto, useInterfaces: boolean = true): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options, useInterfaces) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e, useInterfaces) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3712,8 +3712,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange, useInterfaces: boolean = true): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromProtoMsg(message: EnumDescriptorProto_EnumReservedRangeProtoMsg, useInterfaces: boolean = true): EnumDescriptorProto_EnumReservedRange { @@ -3825,8 +3825,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto, useInterfaces: boolean = true): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options, useInterfaces) : undefined; return obj; }, @@ -3945,11 +3945,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto, useInterfaces: boolean = true): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e, useInterfaces) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options, useInterfaces) : undefined; return obj; @@ -4108,12 +4108,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto, useInterfaces: boolean = true): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options, useInterfaces) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromProtoMsg(message: MethodDescriptorProtoProtoMsg, useInterfaces: boolean = true): MethodDescriptorProto { @@ -4450,7 +4450,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -4499,30 +4499,30 @@ export const FileOptions = { }, toAmino(message: FileOptions, useInterfaces: boolean = true): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4669,14 +4669,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions, useInterfaces: boolean = true): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4831,13 +4831,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4853,16 +4853,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions, useInterfaces: boolean = true): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4952,7 +4952,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5069,12 +5069,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions, useInterfaces: boolean = true): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5176,11 +5176,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions, useInterfaces: boolean = true): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5282,11 +5282,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions, useInterfaces: boolean = true): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5396,19 +5396,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions, useInterfaces: boolean = true): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e, useInterfaces) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5592,14 +5592,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e, useInterfaces) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromProtoMsg(message: UninterpretedOptionProtoMsg, useInterfaces: boolean = true): UninterpretedOption { @@ -5694,8 +5694,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart, useInterfaces: boolean = true): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromProtoMsg(message: UninterpretedOption_NamePartProtoMsg, useInterfaces: boolean = true): UninterpretedOption_NamePart { @@ -5784,7 +5784,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e, useInterfaces) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -5964,19 +5964,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -6066,7 +6066,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e, useInterfaces) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -6210,11 +6210,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromProtoMsg(message: GeneratedCodeInfo_AnnotationProtoMsg, useInterfaces: boolean = true): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/duration.ts b/__fixtures__/v-next/outputv3/google/protobuf/duration.ts index a8af14f694..7bd918c249 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/duration.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented diff --git a/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts index 4d66f0589d..fa9a8072f2 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/field_mask.ts @@ -692,7 +692,7 @@ export const FieldMask = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts index 5a349fa556..f98fc8b4d3 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -98,7 +98,7 @@ export const SourceContext = { }, toAmino(message: SourceContext, useInterfaces: boolean = true): SourceContextAmino { const obj: any = {}; - obj.file_name = omitDefault(message.fileName); + obj.file_name = message.fileName === "" ? undefined : message.fileName; return obj; }, fromProtoMsg(message: SourceContextProtoMsg, useInterfaces: boolean = true): SourceContext { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/struct.ts b/__fixtures__/v-next/outputv3/google/protobuf/struct.ts index 7ea669ce66..d5335f5e5c 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/struct.ts @@ -275,7 +275,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry, useInterfaces: boolean = true): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? Value.toAmino(message.value, useInterfaces) : undefined; return obj; }, @@ -531,7 +531,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.number_value !== undefined && object.number_value !== null) { message.numberValue = object.number_value; @@ -552,10 +552,10 @@ export const Value = { }, toAmino(message: Value, useInterfaces: boolean = true): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.number_value = message.numberValue === null ? undefined : message.numberValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.struct_value = message.structValue ? Struct.toAmino(message.structValue, useInterfaces) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue, useInterfaces) : undefined; return obj; @@ -646,7 +646,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e, useInterfaces) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts index ae2177fc12..f3bff0ef8e 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, omitDefault, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local diff --git a/__fixtures__/v-next/outputv3/google/protobuf/type.ts b/__fixtures__/v-next/outputv3/google/protobuf/type.ts index d3fd86b499..29b8bed5da 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/type.ts @@ -630,30 +630,30 @@ export const Type = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Type, useInterfaces: boolean = true): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e, useInterfaces) : undefined); } else { - obj.fields = []; + obj.fields = message.fields; } if (message.oneofs) { obj.oneofs = message.oneofs.map(e => e); } else { - obj.oneofs = []; + obj.oneofs = message.oneofs; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext, useInterfaces) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromProtoMsg(message: TypeProtoMsg, useInterfaces: boolean = true): Type { @@ -843,10 +843,10 @@ export const Field = { fromAmino(object: FieldAmino): Field { const message = createBaseField(); if (object.kind !== undefined && object.kind !== null) { - message.kind = field_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.cardinality !== undefined && object.cardinality !== null) { - message.cardinality = field_CardinalityFromJSON(object.cardinality); + message.cardinality = object.cardinality; } if (object.number !== undefined && object.number !== null) { message.number = object.number; @@ -874,20 +874,20 @@ export const Field = { }, toAmino(message: Field, useInterfaces: boolean = true): FieldAmino { const obj: any = {}; - obj.kind = field_KindToJSON(message.kind); - obj.cardinality = field_CardinalityToJSON(message.cardinality); - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.cardinality = message.cardinality === 0 ? undefined : message.cardinality; + obj.number = message.number === 0 ? undefined : message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.packed = message.packed === false ? undefined : message.packed; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; return obj; }, fromProtoMsg(message: FieldProtoMsg, useInterfaces: boolean = true): Field { @@ -1035,25 +1035,25 @@ export const Enum = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Enum, useInterfaces: boolean = true): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e, useInterfaces) : undefined); } else { - obj.enumvalue = []; + obj.enumvalue = message.enumvalue; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext, useInterfaces) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromProtoMsg(message: EnumProtoMsg, useInterfaces: boolean = true): Enum { @@ -1169,12 +1169,12 @@ export const EnumValue = { }, toAmino(message: EnumValue, useInterfaces: boolean = true): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e, useInterfaces) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1272,7 +1272,7 @@ export const Option = { }, toAmino(message: Option, useInterfaces: boolean = true): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.value = message.value ? Any.toAmino(message.value, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts index ce1c11ac8f..03586a4e77 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -335,7 +335,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue, useInterfaces: boolean = true): DoubleValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: DoubleValueProtoMsg, useInterfaces: boolean = true): DoubleValue { @@ -415,7 +415,7 @@ export const FloatValue = { }, toAmino(message: FloatValue, useInterfaces: boolean = true): FloatValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: FloatValueProtoMsg, useInterfaces: boolean = true): FloatValue { @@ -497,7 +497,7 @@ export const Int64Value = { }, toAmino(message: Int64Value, useInterfaces: boolean = true): Int64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: Int64ValueProtoMsg, useInterfaces: boolean = true): Int64Value { @@ -579,7 +579,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value, useInterfaces: boolean = true): UInt64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: UInt64ValueProtoMsg, useInterfaces: boolean = true): UInt64Value { @@ -659,7 +659,7 @@ export const Int32Value = { }, toAmino(message: Int32Value, useInterfaces: boolean = true): Int32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: Int32ValueProtoMsg, useInterfaces: boolean = true): Int32Value { @@ -739,7 +739,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value, useInterfaces: boolean = true): UInt32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromProtoMsg(message: UInt32ValueProtoMsg, useInterfaces: boolean = true): UInt32Value { @@ -819,7 +819,7 @@ export const BoolValue = { }, toAmino(message: BoolValue, useInterfaces: boolean = true): BoolValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === false ? undefined : message.value; return obj; }, fromProtoMsg(message: BoolValueProtoMsg, useInterfaces: boolean = true): BoolValue { @@ -899,7 +899,7 @@ export const StringValue = { }, toAmino(message: StringValue, useInterfaces: boolean = true): StringValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: StringValueProtoMsg, useInterfaces: boolean = true): StringValue { diff --git a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts index 8fb69f4979..17b3d6e06d 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts @@ -1156,7 +1156,7 @@ export const AttributeContext = { if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, @@ -1251,8 +1251,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry, useInterfaces: boolean = true): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeContext_Peer_LabelsEntryProtoMsg, useInterfaces: boolean = true): AttributeContext_Peer_LabelsEntry { @@ -1426,7 +1426,7 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer, useInterfaces: boolean = true): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; + obj.ip = message.ip === "" ? undefined : message.ip; obj.port = message.port ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { @@ -1434,8 +1434,8 @@ export const AttributeContext_Peer = { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = message.principal === "" ? undefined : message.principal; + obj.region_code = message.regionCode === "" ? undefined : message.regionCode; return obj; }, fromProtoMsg(message: AttributeContext_PeerProtoMsg, useInterfaces: boolean = true): AttributeContext_Peer { @@ -1560,10 +1560,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api, useInterfaces: boolean = true): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = message.service === "" ? undefined : message.service; + obj.operation = message.operation === "" ? undefined : message.operation; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromProtoMsg(message: AttributeContext_ApiProtoMsg, useInterfaces: boolean = true): AttributeContext_Api { @@ -1717,18 +1717,18 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth, useInterfaces: boolean = true): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = message.principal === "" ? undefined : message.principal; if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { - obj.audiences = []; + obj.audiences = message.audiences; } - obj.presenter = message.presenter; + obj.presenter = message.presenter === "" ? undefined : message.presenter; obj.claims = message.claims ? Struct.toAmino(message.claims, useInterfaces) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); } else { - obj.access_levels = []; + obj.access_levels = message.accessLevels; } return obj; }, @@ -1823,8 +1823,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry, useInterfaces: boolean = true): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeContext_Request_HeadersEntryProtoMsg, useInterfaces: boolean = true): AttributeContext_Request_HeadersEntry { @@ -2105,22 +2105,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request, useInterfaces: boolean = true): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = message.id === "" ? undefined : message.id; + obj.method = message.method === "" ? undefined : message.method; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = message.path === "" ? undefined : message.path; + obj.host = message.host === "" ? undefined : message.host; + obj.scheme = message.scheme === "" ? undefined : message.scheme; + obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth, useInterfaces) : undefined; return obj; }, @@ -2215,8 +2215,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry, useInterfaces: boolean = true): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeContext_Response_HeadersEntryProtoMsg, useInterfaces: boolean = true): AttributeContext_Response_HeadersEntry { @@ -2497,8 +2497,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry, useInterfaces: boolean = true): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeContext_Resource_LabelsEntryProtoMsg, useInterfaces: boolean = true): AttributeContext_Resource_LabelsEntry { @@ -2586,8 +2586,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry, useInterfaces: boolean = true): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: AttributeContext_Resource_AnnotationsEntryProtoMsg, useInterfaces: boolean = true): AttributeContext_Resource_AnnotationsEntry { @@ -2902,28 +2902,28 @@ export const AttributeContext_Resource = { }, toAmino(message: AttributeContext_Resource, useInterfaces: boolean = true): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = message.service === "" ? undefined : message.service; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = message.uid === "" ? undefined : message.uid; obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; obj.delete_time = message.deleteTime ? Timestamp.toAmino(toTimestamp(message.deleteTime)) : undefined; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = message.etag === "" ? undefined : message.etag; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromProtoMsg(message: AttributeContext_ResourceProtoMsg, useInterfaces: boolean = true): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputv3/google/rpc/error_details.ts b/__fixtures__/v-next/outputv3/google/rpc/error_details.ts index 9f97c44776..df632dc1b7 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationAmino, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; +import { isSet, DeepPartial, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -888,9 +888,9 @@ export const DebugInfo = { if (message.stackEntries) { obj.stack_entries = message.stackEntries.map(e => e); } else { - obj.stack_entries = []; + obj.stack_entries = message.stackEntries; } - obj.detail = omitDefault(message.detail); + obj.detail = message.detail === "" ? undefined : message.detail; return obj; }, fromProtoMsg(message: DebugInfoProtoMsg, useInterfaces: boolean = true): DebugInfo { @@ -979,7 +979,7 @@ export const QuotaFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? QuotaFailure_Violation.toAmino(e, useInterfaces) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1075,8 +1075,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation, useInterfaces: boolean = true): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: QuotaFailure_ViolationProtoMsg, useInterfaces: boolean = true): QuotaFailure_Violation { @@ -1170,8 +1170,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry, useInterfaces: boolean = true): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: ErrorInfo_MetadataEntryProtoMsg, useInterfaces: boolean = true): ErrorInfo_MetadataEntry { @@ -1313,8 +1313,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo, useInterfaces: boolean = true): ErrorInfoAmino { const obj: any = {}; - obj.reason = omitDefault(message.reason); - obj.domain = omitDefault(message.domain); + obj.reason = message.reason === "" ? undefined : message.reason; + obj.domain = message.domain === "" ? undefined : message.domain; obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1409,7 +1409,7 @@ export const PreconditionFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e, useInterfaces) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1520,9 +1520,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation, useInterfaces: boolean = true): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = omitDefault(message.type); - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.type = message.type === "" ? undefined : message.type; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: PreconditionFailure_ViolationProtoMsg, useInterfaces: boolean = true): PreconditionFailure_Violation { @@ -1611,7 +1611,7 @@ export const BadRequest = { if (message.fieldViolations) { obj.field_violations = message.fieldViolations.map(e => e ? BadRequest_FieldViolation.toAmino(e, useInterfaces) : undefined); } else { - obj.field_violations = []; + obj.field_violations = message.fieldViolations; } return obj; }, @@ -1707,8 +1707,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation, useInterfaces: boolean = true): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.description = omitDefault(message.description); + obj.field = message.field === "" ? undefined : message.field; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: BadRequest_FieldViolationProtoMsg, useInterfaces: boolean = true): BadRequest_FieldViolation { @@ -1803,8 +1803,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo, useInterfaces: boolean = true): RequestInfoAmino { const obj: any = {}; - obj.request_id = omitDefault(message.requestId); - obj.serving_data = omitDefault(message.servingData); + obj.request_id = message.requestId === "" ? undefined : message.requestId; + obj.serving_data = message.servingData === "" ? undefined : message.servingData; return obj; }, fromProtoMsg(message: RequestInfoProtoMsg, useInterfaces: boolean = true): RequestInfo { @@ -1929,10 +1929,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo, useInterfaces: boolean = true): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = omitDefault(message.resourceType); - obj.resource_name = omitDefault(message.resourceName); - obj.owner = omitDefault(message.owner); - obj.description = omitDefault(message.description); + obj.resource_type = message.resourceType === "" ? undefined : message.resourceType; + obj.resource_name = message.resourceName === "" ? undefined : message.resourceName; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromProtoMsg(message: ResourceInfoProtoMsg, useInterfaces: boolean = true): ResourceInfo { @@ -2021,7 +2021,7 @@ export const Help = { if (message.links) { obj.links = message.links.map(e => e ? Help_Link.toAmino(e, useInterfaces) : undefined); } else { - obj.links = []; + obj.links = message.links; } return obj; }, @@ -2117,8 +2117,8 @@ export const Help_Link = { }, toAmino(message: Help_Link, useInterfaces: boolean = true): Help_LinkAmino { const obj: any = {}; - obj.description = omitDefault(message.description); - obj.url = omitDefault(message.url); + obj.description = message.description === "" ? undefined : message.description; + obj.url = message.url === "" ? undefined : message.url; return obj; }, fromProtoMsg(message: Help_LinkProtoMsg, useInterfaces: boolean = true): Help_Link { @@ -2213,8 +2213,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage, useInterfaces: boolean = true): LocalizedMessageAmino { const obj: any = {}; - obj.locale = omitDefault(message.locale); - obj.message = omitDefault(message.message); + obj.locale = message.locale === "" ? undefined : message.locale; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromProtoMsg(message: LocalizedMessageProtoMsg, useInterfaces: boolean = true): LocalizedMessage { diff --git a/__fixtures__/v-next/outputv3/google/rpc/status.ts b/__fixtures__/v-next/outputv3/google/rpc/status.ts index 9c4f802156..009a54655e 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -168,12 +168,12 @@ export const Status = { }, toAmino(message: Status, useInterfaces: boolean = true): StatusAmino { const obj: any = {}; - obj.code = omitDefault(message.code); - obj.message = omitDefault(message.message); + obj.code = message.code === 0 ? undefined : message.code; + obj.message = message.message === "" ? undefined : message.message; if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { - obj.details = []; + obj.details = message.details; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts index 04a7da3560..da8d3b71ed 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -127,11 +127,11 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); + obj.port_id = message.portId === "" ? undefined : message.portId; if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e, useInterfaces) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts index b44a0718b7..562d9eb164 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestAmino, PageRequestSDKType, PageResponse, PageResponseAmino, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceAmino, DenomTraceSDKType, Params, ParamsAmino, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -209,7 +209,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest, useInterfaces: boolean = true): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = omitDefault(message.hash); + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromProtoMsg(message: QueryDenomTraceRequestProtoMsg, useInterfaces: boolean = true): QueryDenomTraceRequest { @@ -482,7 +482,7 @@ export const QueryDenomTracesResponse = { if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e, useInterfaces) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts index 87a13d8074..6fac066c6f 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -169,8 +169,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace, useInterfaces: boolean = true): DenomTraceAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.base_denom = omitDefault(message.baseDenom); + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromProtoMsg(message: DenomTraceProtoMsg, useInterfaces: boolean = true): DenomTrace { @@ -266,8 +266,8 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.send_enabled = omitDefault(message.sendEnabled); - obj.receive_enabled = omitDefault(message.receiveEnabled); + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts index c1e26ab7a0..6862c4d626 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts @@ -246,11 +246,11 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer, useInterfaces: boolean = true): MsgTransferAmino { const obj: any = {}; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token, useInterfaces) : undefined; - obj.sender = message.sender; - obj.receiver = message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight, useInterfaces) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts index 240028a400..1a1131d33c 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -156,10 +156,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData, useInterfaces: boolean = true): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromProtoMsg(message: FungibleTokenPacketDataProtoMsg, useInterfaces: boolean = true): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts index 8d1ba38aff..d5a37ae762 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts @@ -523,10 +523,10 @@ export const Channel = { fromAmino(object: ChannelAmino): Channel { const message = createBaseChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -539,15 +539,15 @@ export const Channel = { }, toAmino(message: Channel, useInterfaces: boolean = true): ChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromProtoMsg(message: ChannelProtoMsg, useInterfaces: boolean = true): Channel { @@ -704,10 +704,10 @@ export const IdentifiedChannel = { fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { const message = createBaseIdentifiedChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -726,17 +726,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel, useInterfaces: boolean = true): IdentifiedChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromProtoMsg(message: IdentifiedChannelProtoMsg, useInterfaces: boolean = true): IdentifiedChannel { @@ -832,8 +832,8 @@ export const Counterparty = { }, toAmino(message: Counterparty, useInterfaces: boolean = true): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromProtoMsg(message: CounterpartyProtoMsg, useInterfaces: boolean = true): Counterparty { @@ -1026,10 +1026,10 @@ export const Packet = { toAmino(message: Packet, useInterfaces: boolean = true): PacketAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight, useInterfaces) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; @@ -1160,8 +1160,8 @@ export const PacketState = { }, toAmino(message: PacketState, useInterfaces: boolean = true): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1260,7 +1260,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement, useInterfaces: boolean = true): AcknowledgementAmino { const obj: any = {}; obj.result = message.result ? base64FromBytes(message.result) : undefined; - obj.error = message.error; + obj.error = message.error === null ? undefined : message.error; return obj; }, fromProtoMsg(message: AcknowledgementProtoMsg, useInterfaces: boolean = true): Acknowledgement { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts index 8fd3ca2dd7..cdd805ff9a 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelAmino, IdentifiedChannelSDKType, PacketState, PacketStateAmino, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -289,39 +289,39 @@ export const GenesisState = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e, useInterfaces) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e, useInterfaces) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e, useInterfaces) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } if (message.receipts) { obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e, useInterfaces) : undefined); } else { - obj.receipts = []; + obj.receipts = message.receipts; } if (message.sendSequences) { obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e, useInterfaces) : undefined); } else { - obj.send_sequences = []; + obj.send_sequences = message.sendSequences; } if (message.recvSequences) { obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e, useInterfaces) : undefined); } else { - obj.recv_sequences = []; + obj.recv_sequences = message.recvSequences; } if (message.ackSequences) { obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e, useInterfaces) : undefined); } else { - obj.ack_sequences = []; + obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = omitDefault(message.nextChannelSequence); + obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { @@ -434,9 +434,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence, useInterfaces: boolean = true): PacketSequenceAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.sequence = omitDefault(message.sequence); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: PacketSequenceProtoMsg, useInterfaces: boolean = true): PacketSequence { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts index 91adb7cb9f..663484d983 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts @@ -1003,8 +1003,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest, useInterfaces: boolean = true): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromProtoMsg(message: QueryChannelRequestProtoMsg, useInterfaces: boolean = true): QueryChannelRequest { @@ -1328,7 +1328,7 @@ export const QueryChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e, useInterfaces) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; @@ -1429,7 +1429,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest, useInterfaces: boolean = true): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = message.connection === "" ? undefined : message.connection; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1554,7 +1554,7 @@ export const QueryConnectionChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e, useInterfaces) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; @@ -1653,8 +1653,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest, useInterfaces: boolean = true): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromProtoMsg(message: QueryChannelClientStateRequestProtoMsg, useInterfaces: boolean = true): QueryChannelClientStateRequest { @@ -1901,8 +1901,8 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest, useInterfaces: boolean = true): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -2035,7 +2035,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse, useInterfaces: boolean = true): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState, useInterfaces) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; return obj; @@ -2150,8 +2150,8 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest, useInterfaces: boolean = true): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2380,8 +2380,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest, useInterfaces: boolean = true): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2506,7 +2506,7 @@ export const QueryPacketCommitmentsResponse = { if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e, useInterfaces) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; @@ -2622,8 +2622,8 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest, useInterfaces: boolean = true): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2737,7 +2737,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse, useInterfaces: boolean = true): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = message.received === false ? undefined : message.received; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; return obj; @@ -2852,8 +2852,8 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest, useInterfaces: boolean = true): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -3112,13 +3112,13 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest, useInterfaces: boolean = true): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3243,7 +3243,7 @@ export const QueryPacketAcknowledgementsResponse = { if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e, useInterfaces) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; @@ -3372,12 +3372,12 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest, useInterfaces: boolean = true): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3494,7 +3494,7 @@ export const QueryUnreceivedPacketsResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; return obj; @@ -3622,12 +3622,12 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest, useInterfaces: boolean = true): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { - obj.packet_ack_sequences = []; + obj.packet_ack_sequences = message.packetAckSequences; } return obj; }, @@ -3744,7 +3744,7 @@ export const QueryUnreceivedAcksResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; return obj; @@ -3842,8 +3842,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest, useInterfaces: boolean = true): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromProtoMsg(message: QueryNextSequenceReceiveRequestProtoMsg, useInterfaces: boolean = true): QueryNextSequenceReceiveRequest { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts index 0f15e822b2..2e15a482ef 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts @@ -560,9 +560,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit, useInterfaces: boolean = true): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel, useInterfaces) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgChannelOpenInitProtoMsg, useInterfaces: boolean = true): MsgChannelOpenInit { @@ -800,13 +800,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry, useInterfaces: boolean = true): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel, useInterfaces) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgChannelOpenTryProtoMsg, useInterfaces: boolean = true): MsgChannelOpenTry { @@ -1042,13 +1042,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck, useInterfaces: boolean = true): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgChannelOpenAckProtoMsg, useInterfaces: boolean = true): MsgChannelOpenAck { @@ -1254,11 +1254,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm, useInterfaces: boolean = true): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgChannelOpenConfirmProtoMsg, useInterfaces: boolean = true): MsgChannelOpenConfirm { @@ -1432,9 +1432,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit, useInterfaces: boolean = true): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgChannelCloseInitProtoMsg, useInterfaces: boolean = true): MsgChannelCloseInit { @@ -1640,11 +1640,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm, useInterfaces: boolean = true): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgChannelCloseConfirmProtoMsg, useInterfaces: boolean = true): MsgChannelCloseConfirm { @@ -1840,7 +1840,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet, useInterfaces) : undefined; obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgRecvPacketProtoMsg, useInterfaces: boolean = true): MsgRecvPacket { @@ -2054,7 +2054,7 @@ export const MsgTimeout = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgTimeoutProtoMsg, useInterfaces: boolean = true): MsgTimeout { @@ -2284,7 +2284,7 @@ export const MsgTimeoutOnClose = { obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgTimeoutOnCloseProtoMsg, useInterfaces: boolean = true): MsgTimeoutOnClose { @@ -2496,7 +2496,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgAcknowledgementProtoMsg, useInterfaces: boolean = true): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts index 0459278266..1b3c0da7d7 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts @@ -363,7 +363,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState, useInterfaces: boolean = true): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState, useInterfaces) : undefined; return obj; }, @@ -567,11 +567,11 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates, useInterfaces: boolean = true): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e, useInterfaces) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } return obj; }, @@ -699,10 +699,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal, useInterfaces: boolean = true): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.subject_client_id = message.subjectClientId; - obj.substitute_client_id = message.substituteClientId; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; return obj; }, fromProtoMsg(message: ClientUpdateProposalProtoMsg, useInterfaces: boolean = true): ClientUpdateProposal { @@ -833,8 +833,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal, useInterfaces: boolean = true): UpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan, useInterfaces) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState, useInterfaces) : undefined; return obj; @@ -1023,7 +1023,7 @@ export const Params = { if (message.allowedClients) { obj.allowed_clients = message.allowedClients.map(e => e); } else { - obj.allowed_clients = []; + obj.allowed_clients = message.allowedClients; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts index 65be1b2bd2..227a95adae 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts @@ -268,20 +268,20 @@ export const GenesisState = { if (message.clients) { obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e, useInterfaces) : undefined); } else { - obj.clients = []; + obj.clients = message.clients; } if (message.clientsConsensus) { obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e, useInterfaces) : undefined); } else { - obj.clients_consensus = []; + obj.clients_consensus = message.clientsConsensus; } if (message.clientsMetadata) { obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e, useInterfaces) : undefined); } else { - obj.clients_metadata = []; + obj.clients_metadata = message.clientsMetadata; } obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; - obj.create_localhost = message.createLocalhost; + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; return obj; }, @@ -481,11 +481,11 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata, useInterfaces: boolean = true): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e, useInterfaces) : undefined); } else { - obj.client_metadata = []; + obj.client_metadata = message.clientMetadata; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts index bce9ddb1c5..c78c9ced57 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts @@ -537,7 +537,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest, useInterfaces: boolean = true): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromProtoMsg(message: QueryClientStateRequestProtoMsg, useInterfaces: boolean = true): QueryClientStateRequest { @@ -844,7 +844,7 @@ export const QueryClientStatesResponse = { if (message.clientStates) { obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e, useInterfaces) : undefined); } else { - obj.client_states = []; + obj.client_states = message.clientStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -976,10 +976,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest, useInterfaces: boolean = true): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; - obj.latest_height = message.latestHeight; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, fromProtoMsg(message: QueryConsensusStateRequestProtoMsg, useInterfaces: boolean = true): QueryConsensusStateRequest { @@ -1194,7 +1194,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest, useInterfaces: boolean = true): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1302,7 +1302,7 @@ export const QueryConsensusStatesResponse = { if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e, useInterfaces) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1385,7 +1385,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest, useInterfaces: boolean = true): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromProtoMsg(message: QueryClientStatusRequestProtoMsg, useInterfaces: boolean = true): QueryClientStatusRequest { @@ -1466,7 +1466,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse, useInterfaces: boolean = true): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = message.status; + obj.status = message.status === "" ? undefined : message.status; return obj; }, fromProtoMsg(message: QueryClientStatusResponseProtoMsg, useInterfaces: boolean = true): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts index 2dd4cb5fed..7c5f84c443 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/tx.ts @@ -318,7 +318,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState, useInterfaces) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState, useInterfaces) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgCreateClientProtoMsg, useInterfaces: boolean = true): MsgCreateClient { @@ -494,9 +494,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient, useInterfaces: boolean = true): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header = message.header ? Any.toAmino(message.header, useInterfaces) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgUpdateClientProtoMsg, useInterfaces: boolean = true): MsgUpdateClient { @@ -719,12 +719,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient, useInterfaces: boolean = true): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState, useInterfaces) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState, useInterfaces) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgUpgradeClientProtoMsg, useInterfaces: boolean = true): MsgUpgradeClient { @@ -900,9 +900,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour, useInterfaces: boolean = true): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour, useInterfaces) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgSubmitMisbehaviourProtoMsg, useInterfaces: boolean = true): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts index efb4c63102..607fa9075e 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/commitment/v1/commitment.ts @@ -353,7 +353,7 @@ export const MerklePath = { if (message.keyPath) { obj.key_path = message.keyPath.map(e => e); } else { - obj.key_path = []; + obj.key_path = message.keyPath; } return obj; }, @@ -444,7 +444,7 @@ export const MerkleProof = { if (message.proofs) { obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e, useInterfaces) : undefined); } else { - obj.proofs = []; + obj.proofs = message.proofs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts index 1111f19891..09c44a352e 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts @@ -444,7 +444,7 @@ export const ConnectionEnd = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -456,13 +456,13 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd, useInterfaces: boolean = true): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e, useInterfaces) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -618,7 +618,7 @@ export const IdentifiedConnection = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -630,14 +630,14 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection, useInterfaces: boolean = true): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e, useInterfaces) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -752,8 +752,8 @@ export const Counterparty = { }, toAmino(message: Counterparty, useInterfaces: boolean = true): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix, useInterfaces) : undefined; return obj; }, @@ -844,7 +844,7 @@ export const ClientPaths = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -947,11 +947,11 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths, useInterfaces: boolean = true): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -1054,11 +1054,11 @@ export const Version = { }, toAmino(message: Version, useInterfaces: boolean = true): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; if (message.features) { obj.features = message.features.map(e => e); } else { - obj.features = []; + obj.features = message.features; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts index 9c50e8075c..42933c4bd7 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts @@ -158,12 +158,12 @@ export const GenesisState = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e, useInterfaces) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } if (message.clientConnectionPaths) { obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e, useInterfaces) : undefined); } else { - obj.client_connection_paths = []; + obj.client_connection_paths = message.clientConnectionPaths; } obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts index 8f6613ed30..bdf94d46a5 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts @@ -402,7 +402,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest, useInterfaces: boolean = true): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromProtoMsg(message: QueryConnectionRequestProtoMsg, useInterfaces: boolean = true): QueryConnectionRequest { @@ -726,7 +726,7 @@ export const QueryConnectionsResponse = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e, useInterfaces) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; @@ -810,7 +810,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest, useInterfaces: boolean = true): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromProtoMsg(message: QueryClientConnectionsRequestProtoMsg, useInterfaces: boolean = true): QueryClientConnectionsRequest { @@ -932,7 +932,7 @@ export const QueryClientConnectionsResponse = { if (message.connectionPaths) { obj.connection_paths = message.connectionPaths.map(e => e); } else { - obj.connection_paths = []; + obj.connection_paths = message.connectionPaths; } obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; @@ -1016,7 +1016,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest, useInterfaces: boolean = true): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromProtoMsg(message: QueryConnectionClientStateRequestProtoMsg, useInterfaces: boolean = true): QueryConnectionClientStateRequest { @@ -1248,7 +1248,7 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest, useInterfaces: boolean = true): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1381,7 +1381,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse, useInterfaces: boolean = true): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState, useInterfaces) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts index f9a19fd99d..b2c79a67e9 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts @@ -408,11 +408,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit, useInterfaces: boolean = true): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; obj.version = message.version ? Version.toAmino(message.version, useInterfaces) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgConnectionOpenInitProtoMsg, useInterfaces: boolean = true): MsgConnectionOpenInit { @@ -737,22 +737,22 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry, useInterfaces: boolean = true): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState, useInterfaces) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e, useInterfaces) : undefined); } else { - obj.counterparty_versions = []; + obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgConnectionOpenTryProtoMsg, useInterfaces: boolean = true): MsgConnectionOpenTry { @@ -1039,8 +1039,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck, useInterfaces: boolean = true): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version, useInterfaces) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState, useInterfaces) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; @@ -1048,7 +1048,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgConnectionOpenAckProtoMsg, useInterfaces: boolean = true): MsgConnectionOpenAck { @@ -1239,10 +1239,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm, useInterfaces: boolean = true): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromProtoMsg(message: MsgConnectionOpenConfirmProtoMsg, useInterfaces: boolean = true): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts index 6dd96b225a..740be18fbb 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/port/v1/query.ts @@ -178,7 +178,7 @@ export const QueryAppVersionRequest = { message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -190,11 +190,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest, useInterfaces: boolean = true): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromProtoMsg(message: QueryAppVersionRequestProtoMsg, useInterfaces: boolean = true): QueryAppVersionRequest { @@ -290,8 +290,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse, useInterfaces: boolean = true): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromProtoMsg(message: QueryAppVersionResponseProtoMsg, useInterfaces: boolean = true): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts index 1120b8c804..5b235aec28 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/localhost/v1/localhost.ts @@ -116,7 +116,7 @@ export const ClientState = { }, toAmino(message: ClientState, useInterfaces: boolean = true): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? Height.toAmino(message.height, useInterfaces) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts index fbb7bd6b65..cb984740f7 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts @@ -702,7 +702,7 @@ export const ClientState = { obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState, useInterfaces) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromProtoMsg(message: ClientStateProtoMsg, useInterfaces: boolean = true): ClientState { @@ -818,7 +818,7 @@ export const ConsensusState = { toAmino(message: ConsensusState, useInterfaces: boolean = true): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -970,7 +970,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey, useInterfaces) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromProtoMsg(message: HeaderProtoMsg, useInterfaces: boolean = true): Header { @@ -1102,7 +1102,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour, useInterfaces: boolean = true): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne, useInterfaces) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo, useInterfaces) : undefined; @@ -1221,7 +1221,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1234,7 +1234,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData, useInterfaces: boolean = true): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1471,7 +1471,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1482,8 +1482,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1583,7 +1583,7 @@ export const HeaderData = { toAmino(message: HeaderData, useInterfaces: boolean = true): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey, useInterfaces) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromProtoMsg(message: HeaderDataProtoMsg, useInterfaces: boolean = true): HeaderData { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts index 57b9f5bf77..8c542aea8d 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts @@ -698,9 +698,9 @@ export const ClientState = { toAmino(message: ClientState, useInterfaces: boolean = true): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState, useInterfaces) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromProtoMsg(message: ClientStateProtoMsg, useInterfaces: boolean = true): ClientState { @@ -816,7 +816,7 @@ export const ConsensusState = { toAmino(message: ConsensusState, useInterfaces: boolean = true): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -968,7 +968,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey, useInterfaces) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromProtoMsg(message: HeaderProtoMsg, useInterfaces: boolean = true): Header { @@ -1100,7 +1100,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour, useInterfaces: boolean = true): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne, useInterfaces) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo, useInterfaces) : undefined; @@ -1219,7 +1219,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1232,7 +1232,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData, useInterfaces: boolean = true): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1469,7 +1469,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1480,8 +1480,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1581,7 +1581,7 @@ export const HeaderData = { toAmino(message: HeaderData, useInterfaces: boolean = true): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey, useInterfaces) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromProtoMsg(message: HeaderDataProtoMsg, useInterfaces: boolean = true): HeaderData { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts index 67e81e1d44..adcc0cffc4 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts @@ -509,7 +509,7 @@ export const ClientState = { }, toAmino(message: ClientState, useInterfaces: boolean = true): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel, useInterfaces) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod, useInterfaces) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod, useInterfaces) : undefined; @@ -519,15 +519,15 @@ export const ClientState = { if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e, useInterfaces) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromProtoMsg(message: ClientStateProtoMsg, useInterfaces: boolean = true): ClientState { @@ -757,7 +757,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour, useInterfaces: boolean = true): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header_1 = message.header1 ? Header.toAmino(message.header1, useInterfaces) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts index cd6de23ab8..a66a9d7fe8 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -196,16 +196,16 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord, useInterfaces: boolean = true): ClaimRecordAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.initial_claimable_amount = []; + obj.initial_claimable_amount = message.initialClaimableAmount; } if (message.actionCompleted) { obj.action_completed = message.actionCompleted.map(e => e); } else { - obj.action_completed = []; + obj.action_completed = message.actionCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts index 93fd764abd..b1514a49f7 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/genesis.ts @@ -142,7 +142,7 @@ export const GenesisState = { if (message.claimRecords) { obj.claim_records = message.claimRecords.map(e => e ? ClaimRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.claim_records = []; + obj.claim_records = message.claimRecords; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts index 97809ce2b0..ab7ece9347 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/params.ts @@ -147,7 +147,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay, useInterfaces) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay, useInterfaces) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = message.claimDenom === "" ? undefined : message.claimDenom; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts index a90c964ba2..ecad52bf64 100644 --- a/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/claim/v1beta1/query.ts @@ -278,7 +278,7 @@ export const QueryModuleAccountBalanceResponse = { if (message.moduleAccountBalance) { obj.moduleAccountBalance = message.moduleAccountBalance.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.moduleAccountBalance = []; + obj.moduleAccountBalance = message.moduleAccountBalance; } return obj; }, @@ -506,7 +506,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest, useInterfaces: boolean = true): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryClaimRecordRequestProtoMsg, useInterfaces: boolean = true): QueryClaimRecordRequest { @@ -679,14 +679,14 @@ export const QueryClaimableForActionRequest = { message.address = object.address; } if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } return message; }, toAmino(message: QueryClaimableForActionRequest, useInterfaces: boolean = true): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = actionToJSON(message.action); + obj.address = message.address === "" ? undefined : message.address; + obj.action = message.action === 0 ? undefined : message.action; return obj; }, fromProtoMsg(message: QueryClaimableForActionRequestProtoMsg, useInterfaces: boolean = true): QueryClaimableForActionRequest { @@ -776,7 +776,7 @@ export const QueryClaimableForActionResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -858,7 +858,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest, useInterfaces: boolean = true): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: QueryTotalClaimableRequestProtoMsg, useInterfaces: boolean = true): QueryTotalClaimableRequest { @@ -948,7 +948,7 @@ export const QueryTotalClaimableResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts index f41bbb00f3..de7807d12e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts @@ -313,12 +313,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo, useInterfaces: boolean = true): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -409,7 +409,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts index 924a20c9cd..d8d91fc5d0 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoAmino, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { @@ -185,7 +185,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, @@ -267,7 +267,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest, useInterfaces: boolean = true): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromProtoMsg(message: QueryCurrentEpochRequestProtoMsg, useInterfaces: boolean = true): QueryCurrentEpochRequest { @@ -350,7 +350,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse, useInterfaces: boolean = true): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: QueryCurrentEpochResponseProtoMsg, useInterfaces: boolean = true): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts index 456e447138..b18f2161fb 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../../google/ import { Duration, DurationAmino, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -381,12 +381,12 @@ export const SmoothWeightChangeParams = { if (message.initialPoolWeights) { obj.initial_pool_weights = message.initialPoolWeights.map(e => e ? PoolAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.initial_pool_weights = []; + obj.initial_pool_weights = message.initialPoolWeights; } if (message.targetPoolWeights) { obj.target_pool_weights = message.targetPoolWeights.map(e => e ? PoolAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.target_pool_weights = []; + obj.target_pool_weights = message.targetPoolWeights; } return obj; }, @@ -500,8 +500,8 @@ export const PoolParams = { }, toAmino(message: PoolParams, useInterfaces: boolean = true): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams, useInterfaces) : undefined; return obj; }, @@ -601,7 +601,7 @@ export const PoolAsset = { toAmino(message: PoolAsset, useInterfaces: boolean = true): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token, useInterfaces) : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromProtoMsg(message: PoolAssetProtoMsg, useInterfaces: boolean = true): PoolAsset { @@ -785,17 +785,17 @@ export const Pool = { }, toAmino(message: Pool, useInterfaces: boolean = true): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams, useInterfaces) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares, useInterfaces) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; return obj; }, fromProtoMsg(message: PoolProtoMsg, useInterfaces: boolean = true): Pool { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts index 91da230b1d..086891399f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -161,14 +161,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool, useInterfaces: boolean = true): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams, useInterfaces) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; return obj; }, fromProtoMsg(message: MsgCreateBalancerPoolProtoMsg, useInterfaces: boolean = true): MsgCreateBalancerPool { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index d05930eb79..0a8a08cd02 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinAmino, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -184,8 +184,8 @@ export const PoolParams = { }, toAmino(message: PoolParams, useInterfaces: boolean = true): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); return obj; }, fromProtoMsg(message: PoolParamsProtoMsg, useInterfaces: boolean = true): PoolParams { @@ -399,22 +399,22 @@ export const Pool = { }, toAmino(message: Pool, useInterfaces: boolean = true): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams, useInterfaces) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares, useInterfaces) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.pool_liquidity = []; + obj.pool_liquidity = message.poolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.scaling_factor_controller = message.scalingFactorController; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromProtoMsg(message: PoolProtoMsg, useInterfaces: boolean = true): Pool { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts index e4dabc081e..14f36b41c8 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts @@ -251,20 +251,20 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool, useInterfaces: boolean = true): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams, useInterfaces) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.initial_pool_liquidity = []; + obj.initial_pool_liquidity = message.initialPoolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.future_pool_governor = message.futurePoolGovernor; - obj.scaling_factor_controller = message.scalingFactorController; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromProtoMsg(message: MsgCreateStableswapPoolProtoMsg, useInterfaces: boolean = true): MsgCreateStableswapPool { @@ -475,12 +475,12 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors, useInterfaces: boolean = true): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts index d6b02e2c3d..01bbc60e4f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts @@ -126,7 +126,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -251,7 +251,7 @@ export const GenesisState = { if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; @@ -282,7 +282,7 @@ export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 return data; } }; -export const PoolI_FromAmino = (content: AnyAmino) => { +export const PoolI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "osmosis/gamm/pool": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts index 51f36a034c..7164fe7074 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts @@ -867,7 +867,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1179,7 +1179,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse, useInterfaces: boolean = true): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = message.poolType; + obj.pool_type = message.poolType === "" ? undefined : message.poolType; return obj; }, fromProtoMsg(message: QueryPoolTypeResponseProtoMsg, useInterfaces: boolean = true): QueryPoolTypeResponse { @@ -1287,7 +1287,7 @@ export const QueryCalcJoinPoolSharesRequest = { if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -1390,11 +1390,11 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse, useInterfaces: boolean = true): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1494,7 +1494,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest, useInterfaces: boolean = true): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromProtoMsg(message: QueryCalcExitPoolCoinsFromSharesRequestProtoMsg, useInterfaces: boolean = true): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1584,7 +1584,7 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1924,7 +1924,7 @@ export const QueryTotalPoolLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -2199,7 +2199,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -2305,9 +2305,9 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } - obj.shares_out = message.sharesOut; + obj.shares_out = message.sharesOut === "" ? undefined : message.sharesOut; return obj; }, fromProtoMsg(message: QueryCalcJoinPoolNoSwapSharesResponseProtoMsg, useInterfaces: boolean = true): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2421,8 +2421,8 @@ export const QuerySpotPriceRequest = { toAmino(message: QuerySpotPriceRequest, useInterfaces: boolean = true): QuerySpotPriceRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset_denom = message.baseAssetDenom; - obj.quote_asset_denom = message.quoteAssetDenom; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromProtoMsg(message: QuerySpotPriceRequestProtoMsg, useInterfaces: boolean = true): QuerySpotPriceRequest { @@ -2544,9 +2544,9 @@ export const QueryPoolsWithFilterRequest = { if (message.minLiquidity) { obj.min_liquidity = message.minLiquidity.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.min_liquidity = []; + obj.min_liquidity = message.minLiquidity; } - obj.pool_type = message.poolType; + obj.pool_type = message.poolType === "" ? undefined : message.poolType; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2654,7 +2654,7 @@ export const QueryPoolsWithFilterResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any), useInterfaces) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -2737,7 +2737,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse, useInterfaces: boolean = true): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = message.spotPrice; + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromProtoMsg(message: QuerySpotPriceResponseProtoMsg, useInterfaces: boolean = true): QuerySpotPriceResponse { @@ -2871,13 +2871,13 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest, useInterfaces: boolean = true): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in = message.tokenIn; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e, useInterfaces) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -2959,7 +2959,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse, useInterfaces: boolean = true): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromProtoMsg(message: QuerySwapExactAmountInResponseProtoMsg, useInterfaces: boolean = true): QuerySwapExactAmountInResponse { @@ -3093,14 +3093,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest, useInterfaces: boolean = true): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e, useInterfaces) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = message.tokenOut; + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromProtoMsg(message: QuerySwapExactAmountOutRequestProtoMsg, useInterfaces: boolean = true): QuerySwapExactAmountOutRequest { @@ -3181,7 +3181,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse, useInterfaces: boolean = true): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromProtoMsg(message: QuerySwapExactAmountOutResponseProtoMsg, useInterfaces: boolean = true): QuerySwapExactAmountOutResponse { @@ -3334,7 +3334,7 @@ export const QueryTotalLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -3363,7 +3363,7 @@ export const PoolI_InterfaceDecoder = (input: BinaryReader | Uint8Array): Pool1 return data; } }; -export const PoolI_FromAmino = (content: AnyAmino) => { +export const PoolI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "osmosis/gamm/pool": return Any.fromPartial({ diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts index 10fcd0f940..fe79173d33 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts @@ -483,13 +483,13 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool, useInterfaces: boolean = true): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -592,11 +592,11 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse, useInterfaces: boolean = true): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.token_in = []; + obj.token_in = message.tokenIn; } return obj; }, @@ -731,13 +731,13 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool, useInterfaces: boolean = true): MsgExitPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.token_out_mins = []; + obj.token_out_mins = message.tokenOutMins; } return obj; }, @@ -828,7 +828,7 @@ export const MsgExitPoolResponse = { if (message.tokenOut) { obj.token_out = message.tokenOut.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.token_out = []; + obj.token_out = message.tokenOut; } return obj; }, @@ -928,7 +928,7 @@ export const SwapAmountInRoute = { toAmino(message: SwapAmountInRoute, useInterfaces: boolean = true): SwapAmountInRouteAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromProtoMsg(message: SwapAmountInRouteProtoMsg, useInterfaces: boolean = true): SwapAmountInRoute { @@ -1062,14 +1062,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn, useInterfaces: boolean = true): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e, useInterfaces) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn, useInterfaces) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromProtoMsg(message: MsgSwapExactAmountInProtoMsg, useInterfaces: boolean = true): MsgSwapExactAmountIn { @@ -1150,7 +1150,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse, useInterfaces: boolean = true): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromProtoMsg(message: MsgSwapExactAmountInResponseProtoMsg, useInterfaces: boolean = true): MsgSwapExactAmountInResponse { @@ -1249,7 +1249,7 @@ export const SwapAmountOutRoute = { toAmino(message: SwapAmountOutRoute, useInterfaces: boolean = true): SwapAmountOutRouteAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromProtoMsg(message: SwapAmountOutRouteProtoMsg, useInterfaces: boolean = true): SwapAmountOutRoute { @@ -1383,13 +1383,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut, useInterfaces: boolean = true): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e, useInterfaces) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut, useInterfaces) : undefined; return obj; }, @@ -1471,7 +1471,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse, useInterfaces: boolean = true): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromProtoMsg(message: MsgSwapExactAmountOutResponseProtoMsg, useInterfaces: boolean = true): MsgSwapExactAmountOutResponse { @@ -1601,10 +1601,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn, useInterfaces: boolean = true): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn, useInterfaces) : undefined; - obj.share_out_min_amount = message.shareOutMinAmount; + obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; }, fromProtoMsg(message: MsgJoinSwapExternAmountInProtoMsg, useInterfaces: boolean = true): MsgJoinSwapExternAmountIn { @@ -1685,7 +1685,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse, useInterfaces: boolean = true): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; return obj; }, fromProtoMsg(message: MsgJoinSwapExternAmountInResponseProtoMsg, useInterfaces: boolean = true): MsgJoinSwapExternAmountInResponse { @@ -1828,11 +1828,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut, useInterfaces: boolean = true): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_in_denom = message.tokenInDenom; - obj.share_out_amount = message.shareOutAmount; - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; return obj; }, fromProtoMsg(message: MsgJoinSwapShareAmountOutProtoMsg, useInterfaces: boolean = true): MsgJoinSwapShareAmountOut { @@ -1913,7 +1913,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse, useInterfaces: boolean = true): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = message.tokenInAmount; + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromProtoMsg(message: MsgJoinSwapShareAmountOutResponseProtoMsg, useInterfaces: boolean = true): MsgJoinSwapShareAmountOutResponse { @@ -2056,11 +2056,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn, useInterfaces: boolean = true): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.token_out_denom = message.tokenOutDenom; - obj.share_in_amount = message.shareInAmount; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromProtoMsg(message: MsgExitSwapShareAmountInProtoMsg, useInterfaces: boolean = true): MsgExitSwapShareAmountIn { @@ -2141,7 +2141,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse, useInterfaces: boolean = true): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = message.tokenOutAmount; + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromProtoMsg(message: MsgExitSwapShareAmountInResponseProtoMsg, useInterfaces: boolean = true): MsgExitSwapShareAmountInResponse { @@ -2271,10 +2271,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut, useInterfaces: boolean = true): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut, useInterfaces) : undefined; - obj.share_in_max_amount = message.shareInMaxAmount; + obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; }, fromProtoMsg(message: MsgExitSwapExternAmountOutProtoMsg, useInterfaces: boolean = true): MsgExitSwapExternAmountOut { @@ -2355,7 +2355,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse, useInterfaces: boolean = true): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = message.shareInAmount; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromProtoMsg(message: MsgExitSwapExternAmountOutResponseProtoMsg, useInterfaces: boolean = true): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts index 5fa8a38ce8..7391902893 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -156,9 +156,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest, useInterfaces: boolean = true): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromProtoMsg(message: QuerySpotPriceRequestProtoMsg, useInterfaces: boolean = true): QuerySpotPriceRequest { @@ -239,7 +239,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse, useInterfaces: boolean = true): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromProtoMsg(message: QuerySpotPriceResponseProtoMsg, useInterfaces: boolean = true): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts index a0c79fcf81..4acec0de5f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -82,7 +82,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts index 356e18648c..8a30e03951 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts @@ -312,12 +312,12 @@ export const Gauge = { toAmino(message: Gauge, useInterfaces: boolean = true): GaugeAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo, useInterfaces) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -325,7 +325,7 @@ export const Gauge = { if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.distributed_coins = []; + obj.distributed_coins = message.distributedCoins; } return obj; }, @@ -416,7 +416,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e, useInterfaces) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts index e93167b041..813466c136 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { Gauge, GaugeAmino, GaugeSDKType } from "./gauge"; import { Duration, DurationAmino, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -188,14 +188,14 @@ export const GenesisState = { if (message.gauges) { obj.gauges = message.gauges.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.gauges = []; + obj.gauges = message.gauges; } if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e, useInterfaces) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = omitDefault(message.lastGaugeId); + obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts index a62e108237..fb01fa70b8 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -90,7 +90,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); + obj.distr_epoch_identifier = message.distrEpochIdentifier === "" ? undefined : message.distrEpochIdentifier; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts index f122816b98..39b3492315 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts @@ -453,7 +453,7 @@ export const ModuleToDistributeCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -810,7 +810,7 @@ export const GaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1002,7 +1002,7 @@ export const ActiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1102,7 +1102,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest, useInterfaces: boolean = true): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1210,7 +1210,7 @@ export const ActiveGaugesPerDenomResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1402,7 +1402,7 @@ export const UpcomingGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1502,7 +1502,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest, useInterfaces: boolean = true): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1610,7 +1610,7 @@ export const UpcomingGaugesPerDenomResponse = { if (message.upcomingGauges) { obj.upcoming_gauges = message.upcomingGauges.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.upcoming_gauges = []; + obj.upcoming_gauges = message.upcomingGauges; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1740,11 +1740,11 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest, useInterfaces: boolean = true): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { - obj.lock_ids = []; + obj.lock_ids = message.lockIds; } obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; return obj; @@ -1836,7 +1836,7 @@ export const RewardsEstResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1990,7 +1990,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e, useInterfaces) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts index 84375627f4..58a0edb367 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts @@ -263,13 +263,13 @@ export const MsgCreateGauge = { }, toAmino(message: MsgCreateGauge, useInterfaces: boolean = true): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; + obj.owner = message.owner === "" ? undefined : message.owner; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo, useInterfaces) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -454,12 +454,12 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge, useInterfaces: boolean = true): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts index de4c410a29..2b66b17078 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockAmino, PeriodLockSDKType, SyntheticLock, SyntheticLockAmino, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -133,16 +133,16 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = omitDefault(message.lastLockId); + obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e, useInterfaces) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts index 183a9b1be5..727a34ee68 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts @@ -393,13 +393,13 @@ export const PeriodLock = { toAmino(message: PeriodLock, useInterfaces: boolean = true): PeriodLockAmino { const obj: any = {}; obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -513,7 +513,7 @@ export const QueryCondition = { fromAmino(object: QueryConditionAmino): QueryCondition { const message = createBaseQueryCondition(); if (object.lock_query_type !== undefined && object.lock_query_type !== null) { - message.lockQueryType = lockQueryTypeFromJSON(object.lock_query_type); + message.lockQueryType = object.lock_query_type; } if (object.denom !== undefined && object.denom !== null) { message.denom = object.denom; @@ -528,8 +528,8 @@ export const QueryCondition = { }, toAmino(message: QueryCondition, useInterfaces: boolean = true): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = lockQueryTypeToJSON(message.lockQueryType); - obj.denom = message.denom; + obj.lock_query_type = message.lockQueryType === 0 ? undefined : message.lockQueryType; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; @@ -662,7 +662,7 @@ export const SyntheticLock = { toAmino(message: SyntheticLock, useInterfaces: boolean = true): SyntheticLockAmino { const obj: any = {}; obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts index a1d1704f98..2178c9bf65 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/params.ts @@ -88,7 +88,7 @@ export const Params = { if (message.forceUnlockAllowedAddresses) { obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses.map(e => e); } else { - obj.force_unlock_allowed_addresses = []; + obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts index e6604853f2..cb360554b2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts @@ -600,7 +600,7 @@ export const ModuleBalanceResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -754,7 +754,7 @@ export const ModuleLockedAmountResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -836,7 +836,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest, useInterfaces: boolean = true): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: AccountUnlockableCoinsRequestProtoMsg, useInterfaces: boolean = true): AccountUnlockableCoinsRequest { @@ -926,7 +926,7 @@ export const AccountUnlockableCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1008,7 +1008,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest, useInterfaces: boolean = true): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: AccountUnlockingCoinsRequestProtoMsg, useInterfaces: boolean = true): AccountUnlockingCoinsRequest { @@ -1098,7 +1098,7 @@ export const AccountUnlockingCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1180,7 +1180,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest, useInterfaces: boolean = true): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: AccountLockedCoinsRequestProtoMsg, useInterfaces: boolean = true): AccountLockedCoinsRequest { @@ -1270,7 +1270,7 @@ export const AccountLockedCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1367,7 +1367,7 @@ export const AccountLockedPastTimeRequest = { }, toAmino(message: AccountLockedPastTimeRequest, useInterfaces: boolean = true): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1458,7 +1458,7 @@ export const AccountLockedPastTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1555,7 +1555,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest, useInterfaces: boolean = true): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1646,7 +1646,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1743,7 +1743,7 @@ export const AccountUnlockedBeforeTimeRequest = { }, toAmino(message: AccountUnlockedBeforeTimeRequest, useInterfaces: boolean = true): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1834,7 +1834,7 @@ export const AccountUnlockedBeforeTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1946,9 +1946,9 @@ export const AccountLockedPastTimeDenomRequest = { }, toAmino(message: AccountLockedPastTimeDenomRequest, useInterfaces: boolean = true): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: AccountLockedPastTimeDenomRequestProtoMsg, useInterfaces: boolean = true): AccountLockedPastTimeDenomRequest { @@ -2038,7 +2038,7 @@ export const AccountLockedPastTimeDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2137,7 +2137,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest, useInterfaces: boolean = true): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; }, @@ -2219,7 +2219,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse, useInterfaces: boolean = true): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromProtoMsg(message: LockedDenomResponseProtoMsg, useInterfaces: boolean = true): LockedDenomResponse { @@ -2558,7 +2558,7 @@ export const SyntheticLockupsByLockupIDResponse = { if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e, useInterfaces) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2657,7 +2657,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest, useInterfaces: boolean = true): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; }, @@ -2748,7 +2748,7 @@ export const AccountLockedLongerDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2847,7 +2847,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest, useInterfaces: boolean = true): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; }, @@ -2938,7 +2938,7 @@ export const AccountLockedDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3037,7 +3037,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest, useInterfaces: boolean = true): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; }, @@ -3128,7 +3128,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3242,9 +3242,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest, useInterfaces: boolean = true): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: AccountLockedLongerDurationDenomRequestProtoMsg, useInterfaces: boolean = true): AccountLockedLongerDurationDenomRequest { @@ -3334,7 +3334,7 @@ export const AccountLockedLongerDurationDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts index 48826748ad..5182d2383c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts @@ -297,12 +297,12 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens, useInterfaces: boolean = true): MsgLockTokensAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -467,7 +467,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll, useInterfaces: boolean = true): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromProtoMsg(message: MsgBeginUnlockingAllProtoMsg, useInterfaces: boolean = true): MsgBeginUnlockingAll { @@ -557,7 +557,7 @@ export const MsgBeginUnlockingAllResponse = { if (message.unlocks) { obj.unlocks = message.unlocks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { - obj.unlocks = []; + obj.unlocks = message.unlocks; } return obj; }, @@ -677,12 +677,12 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking, useInterfaces: boolean = true): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -764,7 +764,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse, useInterfaces: boolean = true): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromProtoMsg(message: MsgBeginUnlockingResponseProtoMsg, useInterfaces: boolean = true): MsgBeginUnlockingResponse { @@ -879,7 +879,7 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup, useInterfaces: boolean = true): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; @@ -962,7 +962,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse, useInterfaces: boolean = true): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromProtoMsg(message: MsgExtendLockupResponseProtoMsg, useInterfaces: boolean = true): MsgExtendLockupResponse { @@ -1081,12 +1081,12 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock, useInterfaces: boolean = true): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1168,7 +1168,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse, useInterfaces: boolean = true): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = message.success; + obj.success = message.success === false ? undefined : message.success; return obj; }, fromProtoMsg(message: MsgForceUnlockResponseProtoMsg, useInterfaces: boolean = true): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts index 6bcf3465e0..dbc13116bd 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -274,7 +274,7 @@ export const Minter = { }, toAmino(message: Minter, useInterfaces: boolean = true): MinterAmino { const obj: any = {}; - obj.epoch_provisions = message.epochProvisions; + obj.epoch_provisions = padDecimal(message.epochProvisions) === "" ? undefined : padDecimal(message.epochProvisions); return obj; }, fromProtoMsg(message: MinterProtoMsg, useInterfaces: boolean = true): Minter { @@ -370,8 +370,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress, useInterfaces: boolean = true): WeightedAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromProtoMsg(message: WeightedAddressProtoMsg, useInterfaces: boolean = true): WeightedAddress { @@ -497,10 +497,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions, useInterfaces: boolean = true): DistributionProportionsAmino { const obj: any = {}; - obj.staking = message.staking; - obj.pool_incentives = message.poolIncentives; - obj.developer_rewards = message.developerRewards; - obj.community_pool = message.communityPool; + obj.staking = padDecimal(message.staking) === "" ? undefined : padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives) === "" ? undefined : padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards) === "" ? undefined : padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromProtoMsg(message: DistributionProportionsProtoMsg, useInterfaces: boolean = true): DistributionProportions { @@ -698,16 +698,16 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.mint_denom = message.mintDenom; - obj.genesis_epoch_provisions = message.genesisEpochProvisions; - obj.epoch_identifier = message.epochIdentifier; + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions) === "" ? undefined : padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; - obj.reduction_factor = message.reductionFactor; + obj.reduction_factor = padDecimal(message.reductionFactor) === "" ? undefined : padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions, useInterfaces) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e, useInterfaces) : undefined); } else { - obj.weighted_developer_rewards_receivers = []; + obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts index f7cbb7fa3c..7058db6b5d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/genesis.ts @@ -156,7 +156,7 @@ export const GenesisState = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e, useInterfaces) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.distr_info = message.distrInfo ? DistrInfo.toAmino(message.distrInfo, useInterfaces) : undefined; obj.pool_to_gauges = message.poolToGauges ? PoolToGauges.toAmino(message.poolToGauges, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts index 3491bf93f0..3391d193bf 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordAmino, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -200,12 +200,12 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal, useInterfaces: boolean = true): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -324,12 +324,12 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal, useInterfaces: boolean = true): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts index c1a7940904..7fdac51fe2 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts @@ -169,7 +169,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.minted_denom = message.mintedDenom; + obj.minted_denom = message.mintedDenom === "" ? undefined : message.mintedDenom; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -259,7 +259,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e, useInterfaces) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -362,11 +362,11 @@ export const DistrInfo = { }, toAmino(message: DistrInfo, useInterfaces: boolean = true): DistrInfoAmino { const obj: any = {}; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -466,7 +466,7 @@ export const DistrRecord = { toAmino(message: DistrRecord, useInterfaces: boolean = true): DistrRecordAmino { const obj: any = {}; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromProtoMsg(message: DistrRecordProtoMsg, useInterfaces: boolean = true): DistrRecord { @@ -675,7 +675,7 @@ export const PoolToGauges = { if (message.poolToGauge) { obj.pool_to_gauge = message.poolToGauge.map(e => e ? PoolToGauge.toAmino(e, useInterfaces) : undefined); } else { - obj.pool_to_gauge = []; + obj.pool_to_gauge = message.poolToGauge; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts index bc15be3a22..5e55559f42 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts @@ -325,7 +325,7 @@ export const QueryGaugeIdsResponse = { if (message.gaugeIdsWithDuration) { obj.gauge_ids_with_duration = message.gaugeIdsWithDuration.map(e => e ? QueryGaugeIdsResponse_GaugeIdWithDuration.toAmino(e, useInterfaces) : undefined); } else { - obj.gauge_ids_with_duration = []; + obj.gauge_ids_with_duration = message.gaugeIdsWithDuration; } return obj; }, @@ -443,7 +443,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { const obj: any = {}; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; - obj.gauge_incentive_percentage = message.gaugeIncentivePercentage; + obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; }, fromProtoMsg(message: QueryGaugeIdsResponse_GaugeIdWithDurationProtoMsg, useInterfaces: boolean = true): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -888,7 +888,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e, useInterfaces) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -1161,7 +1161,7 @@ export const QueryIncentivizedPoolsResponse = { if (message.incentivizedPools) { obj.incentivized_pools = message.incentivizedPools.map(e => e ? IncentivizedPool.toAmino(e, useInterfaces) : undefined); } else { - obj.incentivized_pools = []; + obj.incentivized_pools = message.incentivizedPools; } return obj; }, @@ -1315,7 +1315,7 @@ export const QueryExternalIncentiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e, useInterfaces) : undefined); } else { - obj.data = []; + obj.data = message.data; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts index 587dfe694a..d0c935e56e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv3/osmosis/sumtree/v1beta1/tree.ts @@ -117,7 +117,7 @@ export const Node = { if (message.children) { obj.children = message.children.map(e => e ? Child.toAmino(e, useInterfaces) : undefined); } else { - obj.children = []; + obj.children = message.children; } return obj; }, @@ -215,7 +215,7 @@ export const Child = { toAmino(message: Child, useInterfaces: boolean = true): ChildAmino { const obj: any = {}; obj.index = message.index ? base64FromBytes(message.index) : undefined; - obj.accumulation = message.accumulation; + obj.accumulation = message.accumulation === "" ? undefined : message.accumulation; return obj; }, fromProtoMsg(message: ChildProtoMsg, useInterfaces: boolean = true): Child { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts index e85405b4d8..6e680ceb8c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/genesis.ts @@ -210,22 +210,22 @@ export const GenesisState = { if (message.superfluidAssets) { obj.superfluid_assets = message.superfluidAssets.map(e => e ? SuperfluidAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.superfluid_assets = []; + obj.superfluid_assets = message.superfluidAssets; } if (message.osmoEquivalentMultipliers) { obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers.map(e => e ? OsmoEquivalentMultiplierRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.osmo_equivalent_multipliers = []; + obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers; } if (message.intermediaryAccounts) { obj.intermediary_accounts = message.intermediaryAccounts.map(e => e ? SuperfluidIntermediaryAccount.toAmino(e, useInterfaces) : undefined); } else { - obj.intermediary_accounts = []; + obj.intermediary_accounts = message.intermediaryAccounts; } if (message.intemediaryAccountConnections) { obj.intemediary_account_connections = message.intemediaryAccountConnections.map(e => e ? LockIdIntermediaryAccountConnection.toAmino(e, useInterfaces) : undefined); } else { - obj.intemediary_account_connections = []; + obj.intemediary_account_connections = message.intemediaryAccountConnections; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts index a30022ba22..8ed855ab64 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/params.ts @@ -95,7 +95,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor) === "" ? undefined : padDecimal(message.minimumRiskFactor); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts index 98c2480451..daee91dd69 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts @@ -666,7 +666,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest, useInterfaces: boolean = true): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: AssetTypeRequestProtoMsg, useInterfaces: boolean = true): AssetTypeRequest { @@ -741,13 +741,13 @@ export const AssetTypeResponse = { fromAmino(object: AssetTypeResponseAmino): AssetTypeResponse { const message = createBaseAssetTypeResponse(); if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: AssetTypeResponse, useInterfaces: boolean = true): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromProtoMsg(message: AssetTypeResponseProtoMsg, useInterfaces: boolean = true): AssetTypeResponse { @@ -900,7 +900,7 @@ export const AllAssetsResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -982,7 +982,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest, useInterfaces: boolean = true): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: AssetMultiplierRequestProtoMsg, useInterfaces: boolean = true): AssetMultiplierRequest { @@ -1193,10 +1193,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo, useInterfaces: boolean = true): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromProtoMsg(message: SuperfluidIntermediaryAccountInfoProtoMsg, useInterfaces: boolean = true): SuperfluidIntermediaryAccountInfo { @@ -1386,7 +1386,7 @@ export const AllIntermediaryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? SuperfluidIntermediaryAccountInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination, useInterfaces) : undefined; return obj; @@ -1635,7 +1635,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest, useInterfaces: boolean = true): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryTotalDelegationByValidatorForDenomRequestProtoMsg, useInterfaces: boolean = true): QueryTotalDelegationByValidatorForDenomRequest { @@ -1725,7 +1725,7 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? Delegations.toAmino(e, useInterfaces) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1837,9 +1837,9 @@ export const Delegations = { }, toAmino(message: Delegations, useInterfaces: boolean = true): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; + obj.amount_sfsd = message.amountSfsd === "" ? undefined : message.amountSfsd; + obj.osmo_equivalent = message.osmoEquivalent === "" ? undefined : message.osmoEquivalent; return obj; }, fromProtoMsg(message: DelegationsProtoMsg, useInterfaces: boolean = true): Delegations { @@ -1983,7 +1983,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse, useInterfaces: boolean = true): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = message.totalDelegations === "" ? undefined : message.totalDelegations; return obj; }, fromProtoMsg(message: TotalSuperfluidDelegationsResponseProtoMsg, useInterfaces: boolean = true): TotalSuperfluidDelegationsResponse { @@ -2094,9 +2094,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest, useInterfaces: boolean = true): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: SuperfluidDelegationAmountRequestProtoMsg, useInterfaces: boolean = true): SuperfluidDelegationAmountRequest { @@ -2186,7 +2186,7 @@ export const SuperfluidDelegationAmountResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -2268,7 +2268,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest, useInterfaces: boolean = true): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromProtoMsg(message: SuperfluidDelegationsByDelegatorRequestProtoMsg, useInterfaces: boolean = true): SuperfluidDelegationsByDelegatorRequest { @@ -2396,12 +2396,12 @@ export const SuperfluidDelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount, useInterfaces) : undefined; return obj; @@ -2499,8 +2499,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest, useInterfaces: boolean = true): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: SuperfluidUndelegationsByDelegatorRequestProtoMsg, useInterfaces: boolean = true): SuperfluidUndelegationsByDelegatorRequest { @@ -2632,17 +2632,17 @@ export const SuperfluidUndelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalUndelegatedCoins) { obj.total_undelegated_coins = message.totalUndelegatedCoins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total_undelegated_coins = []; + obj.total_undelegated_coins = message.totalUndelegatedCoins; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e, useInterfaces) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2739,8 +2739,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest, useInterfaces: boolean = true): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: SuperfluidDelegationsByValidatorDenomRequestProtoMsg, useInterfaces: boolean = true): SuperfluidDelegationsByValidatorDenomRequest { @@ -2830,7 +2830,7 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } return obj; }, @@ -2927,8 +2927,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest, useInterfaces: boolean = true): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestProtoMsg, useInterfaces: boolean = true): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3018,7 +3018,7 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } return obj; }, @@ -3100,7 +3100,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest, useInterfaces: boolean = true): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromProtoMsg(message: QueryTotalDelegationByDelegatorRequestProtoMsg, useInterfaces: boolean = true): QueryTotalDelegationByDelegatorRequest { @@ -3249,17 +3249,17 @@ export const QueryTotalDelegationByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.delegationResponse) { obj.delegation_response = message.delegationResponse.map(e => e ? DelegationResponse.toAmino(e, useInterfaces) : undefined); } else { - obj.delegation_response = []; + obj.delegation_response = message.delegationResponse; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount, useInterfaces) : undefined; return obj; @@ -3423,7 +3423,7 @@ export const QueryUnpoolWhitelistResponse = { if (message.poolIds) { obj.pool_ids = message.poolIds.map(e => e.toString()); } else { - obj.pool_ids = []; + obj.pool_ids = message.poolIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts index b077cd7e49..71acec66b3 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -304,14 +304,14 @@ export const SuperfluidAsset = { message.denom = object.denom; } if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: SuperfluidAsset, useInterfaces: boolean = true): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromProtoMsg(message: SuperfluidAssetProtoMsg, useInterfaces: boolean = true): SuperfluidAsset { @@ -424,8 +424,8 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount, useInterfaces: boolean = true): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, @@ -540,8 +540,8 @@ export const OsmoEquivalentMultiplierRecord = { toAmino(message: OsmoEquivalentMultiplierRecord, useInterfaces: boolean = true): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.multiplier = padDecimal(message.multiplier) === "" ? undefined : padDecimal(message.multiplier); return obj; }, fromProtoMsg(message: OsmoEquivalentMultiplierRecordProtoMsg, useInterfaces: boolean = true): OsmoEquivalentMultiplierRecord { @@ -671,8 +671,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord, useInterfaces: boolean = true): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount, useInterfaces) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount, useInterfaces) : undefined; return obj; @@ -773,7 +773,7 @@ export const LockIdIntermediaryAccountConnection = { toAmino(message: LockIdIntermediaryAccountConnection, useInterfaces: boolean = true): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, fromProtoMsg(message: LockIdIntermediaryAccountConnectionProtoMsg, useInterfaces: boolean = true): LockIdIntermediaryAccountConnection { @@ -872,7 +872,7 @@ export const UnpoolWhitelistedPools = { if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts index 2f6544fb0a..3ff85bf453 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinAmino, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -277,9 +277,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate, useInterfaces: boolean = true): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); - obj.val_addr = omitDefault(message.valAddr); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromProtoMsg(message: MsgSuperfluidDelegateProtoMsg, useInterfaces: boolean = true): MsgSuperfluidDelegate { @@ -440,8 +440,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate, useInterfaces: boolean = true): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgSuperfluidUndelegateProtoMsg, useInterfaces: boolean = true): MsgSuperfluidUndelegate { @@ -602,8 +602,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock, useInterfaces: boolean = true): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgSuperfluidUnbondLockProtoMsg, useInterfaces: boolean = true): MsgSuperfluidUnbondLock { @@ -783,13 +783,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate, useInterfaces: boolean = true): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } - obj.val_addr = omitDefault(message.valAddr); + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromProtoMsg(message: MsgLockAndSuperfluidDelegateProtoMsg, useInterfaces: boolean = true): MsgLockAndSuperfluidDelegate { @@ -872,7 +872,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse, useInterfaces: boolean = true): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromProtoMsg(message: MsgLockAndSuperfluidDelegateResponseProtoMsg, useInterfaces: boolean = true): MsgLockAndSuperfluidDelegateResponse { @@ -970,8 +970,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool, useInterfaces: boolean = true): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgUnPoolWhitelistedPoolProtoMsg, useInterfaces: boolean = true): MsgUnPoolWhitelistedPool { @@ -1070,7 +1070,7 @@ export const MsgUnPoolWhitelistedPoolResponse = { if (message.exitedLockIds) { obj.exited_lock_ids = message.exitedLockIds.map(e => e.toString()); } else { - obj.exited_lock_ids = []; + obj.exited_lock_ids = message.exitedLockIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts index 1792873422..5b8d9f82a4 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetAmino, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -206,12 +206,12 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal, useInterfaces: boolean = true): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e, useInterfaces) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -330,12 +330,12 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal, useInterfaces: boolean = true): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { - obj.superfluid_asset_denoms = []; + obj.superfluid_asset_denoms = message.superfluidAssetDenoms; } return obj; }, @@ -478,14 +478,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal, useInterfaces: boolean = true): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } - obj.is_overwrite = omitDefault(message.isOverwrite); + obj.is_overwrite = message.isOverwrite === false ? undefined : message.isOverwrite; return obj; }, fromProtoMsg(message: UpdateUnpoolWhiteListProposalProtoMsg, useInterfaces: boolean = true): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index fa8610c980..c6e7ee0108 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -96,7 +96,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata, useInterfaces: boolean = true): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromProtoMsg(message: DenomAuthorityMetadataProtoMsg, useInterfaces: boolean = true): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts index a59085624d..8811eb4f33 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/genesis.ts @@ -147,7 +147,7 @@ export const GenesisState = { if (message.factoryDenoms) { obj.factory_denoms = message.factoryDenoms.map(e => e ? GenesisDenom.toAmino(e, useInterfaces) : undefined); } else { - obj.factory_denoms = []; + obj.factory_denoms = message.factoryDenoms; } return obj; }, @@ -246,7 +246,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom, useInterfaces: boolean = true): GenesisDenomAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts index 569765874a..9bcde4ddda 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/params.ts @@ -92,7 +92,7 @@ export const Params = { if (message.denomCreationFee) { obj.denom_creation_fee = message.denomCreationFee.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { - obj.denom_creation_fee = []; + obj.denom_creation_fee = message.denomCreationFee; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts index 6867cb9026..3db557bda0 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsAmino, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataAmino, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -342,7 +342,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest, useInterfaces: boolean = true): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryDenomAuthorityMetadataRequestProtoMsg, useInterfaces: boolean = true): QueryDenomAuthorityMetadataRequest { @@ -506,7 +506,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest, useInterfaces: boolean = true): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = omitDefault(message.creator); + obj.creator = message.creator === "" ? undefined : message.creator; return obj; }, fromProtoMsg(message: QueryDenomsFromCreatorRequestProtoMsg, useInterfaces: boolean = true): QueryDenomsFromCreatorRequest { @@ -596,7 +596,7 @@ export const QueryDenomsFromCreatorResponse = { if (message.denoms) { obj.denoms = message.denoms.map(e => e); } else { - obj.denoms = []; + obj.denoms = message.denoms; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts index 8fc925902a..f5395a8c35 100644 --- a/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/tokenfactory/v1beta1/tx.ts @@ -326,8 +326,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom, useInterfaces: boolean = true): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = message.sender; - obj.subdenom = message.subdenom; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.subdenom = message.subdenom === "" ? undefined : message.subdenom; return obj; }, fromProtoMsg(message: MsgCreateDenomProtoMsg, useInterfaces: boolean = true): MsgCreateDenom { @@ -408,7 +408,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse, useInterfaces: boolean = true): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = message.newTokenDenom; + obj.new_token_denom = message.newTokenDenom === "" ? undefined : message.newTokenDenom; return obj; }, fromProtoMsg(message: MsgCreateDenomResponseProtoMsg, useInterfaces: boolean = true): MsgCreateDenomResponse { @@ -506,7 +506,7 @@ export const MsgMint = { }, toAmino(message: MsgMint, useInterfaces: boolean = true): MsgMintAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; return obj; }, @@ -668,7 +668,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn, useInterfaces: boolean = true): MsgBurnAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : undefined; return obj; }, @@ -843,9 +843,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin, useInterfaces: boolean = true): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.denom = message.denom; - obj.new_admin = message.newAdmin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromProtoMsg(message: MsgChangeAdminProtoMsg, useInterfaces: boolean = true): MsgChangeAdmin { @@ -1006,7 +1006,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata, useInterfaces: boolean = true): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts index 99a5804f42..1294ac332a 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/genesis.ts @@ -127,7 +127,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = message.pruneEpochIdentifier; + obj.prune_epoch_identifier = message.pruneEpochIdentifier === "" ? undefined : message.pruneEpochIdentifier; obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod, useInterfaces) : undefined; return obj; }, @@ -235,7 +235,7 @@ export const GenesisState = { if (message.twaps) { obj.twaps = message.twaps.map(e => e ? TwapRecord.toAmino(e, useInterfaces) : undefined); } else { - obj.twaps = []; + obj.twaps = message.twaps; } obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts index 5e3fcc87d8..092ff2b676 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsAmino, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -225,8 +225,8 @@ export const ArithmeticTwapRequest = { toAmino(message: ArithmeticTwapRequest, useInterfaces: boolean = true): ArithmeticTwapRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; return obj; @@ -309,7 +309,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse, useInterfaces: boolean = true): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromProtoMsg(message: ArithmeticTwapResponseProtoMsg, useInterfaces: boolean = true): ArithmeticTwapResponse { @@ -438,8 +438,8 @@ export const ArithmeticTwapToNowRequest = { toAmino(message: ArithmeticTwapToNowRequest, useInterfaces: boolean = true): ArithmeticTwapToNowRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -521,7 +521,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse, useInterfaces: boolean = true): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromProtoMsg(message: ArithmeticTwapToNowResponseProtoMsg, useInterfaces: boolean = true): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts index 5310bb9b1f..2c2c08e654 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampAmino, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -307,14 +307,14 @@ export const TwapRecord = { toAmino(message: TwapRecord, useInterfaces: boolean = true): TwapRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; + obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; + obj.height = message.height ? message.height.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice) === "" ? undefined : padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice) === "" ? undefined : padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts index 17857dc43a..f6d37675d9 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -117,8 +117,8 @@ export const FeeToken = { }, toAmino(message: FeeToken, useInterfaces: boolean = true): FeeTokenAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.poolID = omitDefault(message.poolID); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromProtoMsg(message: FeeTokenProtoMsg, useInterfaces: boolean = true): FeeToken { diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts index 563ea0e4d9..1f47c1e86b 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -107,11 +107,11 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.basedenom = omitDefault(message.basedenom); + obj.basedenom = message.basedenom === "" ? undefined : message.basedenom; if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e, useInterfaces) : undefined); } else { - obj.feetokens = []; + obj.feetokens = message.feetokens; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts index 24b2fd127a..0cbb20c791 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/gov.ts @@ -142,8 +142,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal, useInterfaces: boolean = true): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts index 4f40499bc4..c89300259e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenAmino, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -259,7 +259,7 @@ export const QueryFeeTokensResponse = { if (message.feeTokens) { obj.fee_tokens = message.feeTokens.map(e => e ? FeeToken.toAmino(e, useInterfaces) : undefined); } else { - obj.fee_tokens = []; + obj.fee_tokens = message.feeTokens; } return obj; }, @@ -341,7 +341,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest, useInterfaces: boolean = true): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryDenomSpotPriceRequestProtoMsg, useInterfaces: boolean = true): QueryDenomSpotPriceRequest { @@ -439,8 +439,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse, useInterfaces: boolean = true): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); - obj.spot_price = padDecimal(message.spotPrice); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.spot_price = padDecimal(message.spotPrice) === "" ? undefined : padDecimal(message.spotPrice); return obj; }, fromProtoMsg(message: QueryDenomSpotPriceResponseProtoMsg, useInterfaces: boolean = true): QueryDenomSpotPriceResponse { @@ -521,7 +521,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest, useInterfaces: boolean = true): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromProtoMsg(message: QueryDenomPoolIdRequestProtoMsg, useInterfaces: boolean = true): QueryDenomPoolIdRequest { @@ -604,7 +604,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse, useInterfaces: boolean = true): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromProtoMsg(message: QueryDenomPoolIdResponseProtoMsg, useInterfaces: boolean = true): QueryDenomPoolIdResponse { @@ -748,7 +748,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse, useInterfaces: boolean = true): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = omitDefault(message.baseDenom); + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromProtoMsg(message: QueryBaseDenomResponseProtoMsg, useInterfaces: boolean = true): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts index 1770f0824d..a002a8427d 100644 --- a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts @@ -1608,7 +1608,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho, useInterfaces: boolean = true): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromProtoMsg(message: RequestEchoProtoMsg, useInterfaces: boolean = true): RequestEcho { @@ -1784,7 +1784,7 @@ export const RequestInfo = { }, toAmino(message: RequestInfo, useInterfaces: boolean = true): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; return obj; @@ -1881,8 +1881,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption, useInterfaces: boolean = true): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromProtoMsg(message: RequestSetOptionProtoMsg, useInterfaces: boolean = true): RequestSetOption { @@ -2048,12 +2048,12 @@ export const RequestInitChain = { toAmino(message: RequestInitChain, useInterfaces: boolean = true): RequestInitChainAmino { const obj: any = {}; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams, useInterfaces) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; @@ -2184,9 +2184,9 @@ export const RequestQuery = { toAmino(message: RequestQuery, useInterfaces: boolean = true): RequestQueryAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.path = message.path; + obj.path = message.path === "" ? undefined : message.path; obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.prove = message.prove === false ? undefined : message.prove; return obj; }, fromProtoMsg(message: RequestQueryProtoMsg, useInterfaces: boolean = true): RequestQuery { @@ -2327,7 +2327,7 @@ export const RequestBeginBlock = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e, useInterfaces) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } return obj; }, @@ -2417,14 +2417,14 @@ export const RequestCheckTx = { message.tx = bytesFromBase64(object.tx); } if (object.type !== undefined && object.type !== null) { - message.type = checkTxTypeFromJSON(object.type); + message.type = object.type; } return message; }, toAmino(message: RequestCheckTx, useInterfaces: boolean = true): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.type = checkTxTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromProtoMsg(message: RequestCheckTxProtoMsg, useInterfaces: boolean = true): RequestCheckTx { @@ -2921,8 +2921,8 @@ export const RequestLoadSnapshotChunk = { toAmino(message: RequestLoadSnapshotChunk, useInterfaces: boolean = true): RequestLoadSnapshotChunkAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; }, fromProtoMsg(message: RequestLoadSnapshotChunkProtoMsg, useInterfaces: boolean = true): RequestLoadSnapshotChunk { @@ -3032,9 +3032,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk, useInterfaces: boolean = true): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromProtoMsg(message: RequestApplySnapshotChunkProtoMsg, useInterfaces: boolean = true): RequestApplySnapshotChunk { @@ -3466,7 +3466,7 @@ export const ResponseException = { }, toAmino(message: ResponseException, useInterfaces: boolean = true): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; return obj; }, fromProtoMsg(message: ResponseExceptionProtoMsg, useInterfaces: boolean = true): ResponseException { @@ -3546,7 +3546,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho, useInterfaces: boolean = true): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromProtoMsg(message: ResponseEchoProtoMsg, useInterfaces: boolean = true): ResponseEcho { @@ -3752,8 +3752,8 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo, useInterfaces: boolean = true): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; @@ -3866,9 +3866,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption, useInterfaces: boolean = true): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; return obj; }, fromProtoMsg(message: ResponseSetOptionProtoMsg, useInterfaces: boolean = true): ResponseSetOption { @@ -3990,7 +3990,7 @@ export const ResponseInitChain = { if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; @@ -4198,15 +4198,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery, useInterfaces: boolean = true): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.index = message.index ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps, useInterfaces) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromProtoMsg(message: ResponseQueryProtoMsg, useInterfaces: boolean = true): ResponseQuery { @@ -4295,7 +4295,7 @@ export const ResponseBeginBlock = { if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4491,18 +4491,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx, useInterfaces: boolean = true): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromProtoMsg(message: ResponseCheckTxProtoMsg, useInterfaces: boolean = true): ResponseCheckTx { @@ -4697,18 +4697,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx, useInterfaces: boolean = true): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromProtoMsg(message: ResponseDeliverTxProtoMsg, useInterfaces: boolean = true): ResponseDeliverTx { @@ -4835,13 +4835,13 @@ export const ResponseEndBlock = { if (message.validatorUpdates) { obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e, useInterfaces) : undefined); } else { - obj.validator_updates = []; + obj.validator_updates = message.validatorUpdates; } obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates, useInterfaces) : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -5029,7 +5029,7 @@ export const ResponseListSnapshots = { if (message.snapshots) { obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e, useInterfaces) : undefined); } else { - obj.snapshots = []; + obj.snapshots = message.snapshots; } return obj; }, @@ -5104,13 +5104,13 @@ export const ResponseOfferSnapshot = { fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: ResponseOfferSnapshot, useInterfaces: boolean = true): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = responseOfferSnapshot_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromProtoMsg(message: ResponseOfferSnapshotProtoMsg, useInterfaces: boolean = true): ResponseOfferSnapshot { @@ -5313,7 +5313,7 @@ export const ResponseApplySnapshotChunk = { fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); if (object.result !== undefined && object.result !== null) { - message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + message.result = object.result; } message.refetchChunks = object.refetch_chunks?.map(e => e) || []; message.rejectSenders = object.reject_senders?.map(e => e) || []; @@ -5321,16 +5321,16 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk, useInterfaces: boolean = true): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { - obj.refetch_chunks = []; + obj.refetch_chunks = message.refetchChunks; } if (message.rejectSenders) { obj.reject_senders = message.rejectSenders.map(e => e); } else { - obj.reject_senders = []; + obj.reject_senders = message.rejectSenders; } return obj; }, @@ -5668,11 +5668,11 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo, useInterfaces: boolean = true): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, @@ -5774,11 +5774,11 @@ export const Event = { }, toAmino(message: Event, useInterfaces: boolean = true): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e, useInterfaces) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -5891,7 +5891,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.index = message.index; + obj.index = message.index === false ? undefined : message.index; return obj; }, fromProtoMsg(message: EventAttributeProtoMsg, useInterfaces: boolean = true): EventAttribute { @@ -6021,7 +6021,7 @@ export const TxResult = { toAmino(message: TxResult, useInterfaces: boolean = true): TxResultAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result, useInterfaces) : undefined; return obj; @@ -6319,7 +6319,7 @@ export const VoteInfo = { toAmino(message: VoteInfo, useInterfaces: boolean = true): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator, useInterfaces) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; return obj; }, fromProtoMsg(message: VoteInfoProtoMsg, useInterfaces: boolean = true): VoteInfo { @@ -6447,7 +6447,7 @@ export const Evidence = { fromAmino(object: EvidenceAmino): Evidence { const message = createBaseEvidence(); if (object.type !== undefined && object.type !== null) { - message.type = evidenceTypeFromJSON(object.type); + message.type = object.type; } if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); @@ -6465,7 +6465,7 @@ export const Evidence = { }, toAmino(message: Evidence, useInterfaces: boolean = true): EvidenceAmino { const obj: any = {}; - obj.type = evidenceTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator, useInterfaces) : undefined; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; @@ -6612,8 +6612,8 @@ export const Snapshot = { toAmino(message: Snapshot, useInterfaces: boolean = true): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts index b82ee9e401..22eccd7223 100644 --- a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts @@ -237,7 +237,7 @@ export const Proof = { if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); } else { - obj.aunts = []; + obj.aunts = message.aunts; } return obj; }, @@ -446,9 +446,9 @@ export const DominoOp = { }, toAmino(message: DominoOp, useInterfaces: boolean = true): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; return obj; }, fromProtoMsg(message: DominoOpProtoMsg, useInterfaces: boolean = true): DominoOp { @@ -558,7 +558,7 @@ export const ProofOp = { }, toAmino(message: ProofOp, useInterfaces: boolean = true): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -649,7 +649,7 @@ export const ProofOps = { if (message.ops) { obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e, useInterfaces) : undefined); } else { - obj.ops = []; + obj.ops = message.ops; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts index f2c14b0a90..17192591eb 100644 --- a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -113,11 +113,11 @@ export const BitArray = { }, toAmino(message: BitArray, useInterfaces: boolean = true): BitArrayAmino { const obj: any = {}; - obj.bits = omitDefault(message.bits); + obj.bits = message.bits ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { - obj.elems = []; + obj.elems = message.elems; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts index 61d34f88cf..71cd9db44b 100644 --- a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts @@ -404,12 +404,12 @@ export const NodeInfo = { toAmino(message: NodeInfo, useInterfaces: boolean = true): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion, useInterfaces) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = message.nodeId === "" ? undefined : message.nodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; - obj.moniker = message.moniker; + obj.moniker = message.moniker === "" ? undefined : message.moniker; obj.other = message.other ? NodeInfoOther.toAmino(message.other, useInterfaces) : undefined; return obj; }, @@ -505,8 +505,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther, useInterfaces: boolean = true): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; return obj; }, fromProtoMsg(message: NodeInfoOtherProtoMsg, useInterfaces: boolean = true): NodeInfoOther { @@ -622,11 +622,11 @@ export const PeerInfo = { }, toAmino(message: PeerInfo, useInterfaces: boolean = true): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e, useInterfaces) : undefined); } else { - obj.address_info = []; + obj.address_info = message.addressInfo; } obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; return obj; @@ -753,10 +753,10 @@ export const PeerAddressInfo = { }, toAmino(message: PeerAddressInfo, useInterfaces: boolean = true): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; - obj.dial_failures = message.dialFailures; + obj.dial_failures = message.dialFailures === 0 ? undefined : message.dialFailures; return obj; }, fromProtoMsg(message: PeerAddressInfoProtoMsg, useInterfaces: boolean = true): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts index 174d4cb0f4..488a6d8467 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts @@ -482,7 +482,7 @@ export const LightClientAttackEvidence = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -574,7 +574,7 @@ export const EvidenceList = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e, useInterfaces) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/tendermint/types/params.ts b/__fixtures__/v-next/outputv3/tendermint/types/params.ts index 1905a54a07..60242b9da7 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/params.ts @@ -661,7 +661,7 @@ export const ValidatorParams = { if (message.pubKeyTypes) { obj.pub_key_types = message.pubKeyTypes.map(e => e); } else { - obj.pub_key_types = []; + obj.pub_key_types = message.pubKeyTypes; } return obj; }, diff --git a/__fixtures__/v-next/outputv3/tendermint/types/types.ts b/__fixtures__/v-next/outputv3/tendermint/types/types.ts index 01fa0345d7..75d0d8b86d 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/types.ts @@ -537,7 +537,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader, useInterfaces: boolean = true): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = message.total === 0 ? undefined : message.total; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, @@ -650,7 +650,7 @@ export const Part = { }, toAmino(message: Part, useInterfaces: boolean = true): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; obj.proof = message.proof ? Proof.toAmino(message.proof, useInterfaces) : undefined; return obj; @@ -1032,7 +1032,7 @@ export const Header = { toAmino(message: Header, useInterfaces: boolean = true): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version, useInterfaces) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId, useInterfaces) : undefined; @@ -1133,7 +1133,7 @@ export const Data = { if (message.txs) { obj.txs = message.txs.map(e => base64FromBytes(e)); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, @@ -1296,7 +1296,7 @@ export const Vote = { fromAmino(object: VoteAmino): Vote { const message = createBaseVote(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1323,13 +1323,13 @@ export const Vote = { }, toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; - obj.validator_index = message.validatorIndex; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -1466,12 +1466,12 @@ export const Commit = { toAmino(message: Commit, useInterfaces: boolean = true): CommitAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e, useInterfaces) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1582,7 +1582,7 @@ export const CommitSig = { fromAmino(object: CommitSigAmino): CommitSig { const message = createBaseCommitSig(); if (object.block_id_flag !== undefined && object.block_id_flag !== null) { - message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + message.blockIdFlag = object.block_id_flag; } if (object.validator_address !== undefined && object.validator_address !== null) { message.validatorAddress = bytesFromBase64(object.validator_address); @@ -1597,7 +1597,7 @@ export const CommitSig = { }, toAmino(message: CommitSig, useInterfaces: boolean = true): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; @@ -1750,7 +1750,7 @@ export const Proposal = { fromAmino(object: ProposalAmino): Proposal { const message = createBaseProposal(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1774,10 +1774,10 @@ export const Proposal = { }, toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; diff --git a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts index ae4c9d2751..d6f7616c24 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts @@ -166,7 +166,7 @@ export const ValidatorSet = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer, useInterfaces) : undefined; obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; diff --git a/__fixtures__/v-next/outputv3/tendermint/version/types.ts b/__fixtures__/v-next/outputv3/tendermint/version/types.ts index 6dfec6cb87..e15da31139 100644 --- a/__fixtures__/v-next/outputv3/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -144,8 +144,8 @@ export const App = { }, toAmino(message: App, useInterfaces: boolean = true): AppAmino { const obj: any = {}; - obj.protocol = omitDefault(message.protocol); - obj.software = omitDefault(message.software); + obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.software = message.software === "" ? undefined : message.software; return obj; }, fromProtoMsg(message: AppProtoMsg, useInterfaces: boolean = true): App { @@ -244,8 +244,8 @@ export const Consensus = { }, toAmino(message: Consensus, useInterfaces: boolean = true): ConsensusAmino { const obj: any = {}; - obj.block = omitDefault(message.block); - obj.app = omitDefault(message.app); + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; return obj; }, fromProtoMsg(message: ConsensusProtoMsg, useInterfaces: boolean = true): Consensus { diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts index 533d7261bf..1672cbeb5a 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts @@ -47,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.ts index 1c1512c55d..a78962bcef 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.ts @@ -215,12 +215,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -353,12 +353,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -588,12 +588,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -726,12 +726,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -938,12 +938,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts index e6f7269391..b2d09362e5 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts @@ -47,7 +47,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.ts index a1c4702b94..e37bc5f8cd 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.ts @@ -215,12 +215,12 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -353,12 +353,12 @@ export const AuditedAttributes = { }, toAmino(message: AuditedAttributes): AuditedAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -462,7 +462,7 @@ export const AttributesResponse = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -588,12 +588,12 @@ export const AttributesFilters = { if (message.auditors) { obj.auditors = message.auditors.map(e => e); } else { - obj.auditors = []; + obj.auditors = message.auditors; } if (message.owners) { obj.owners = message.owners.map(e => e); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, @@ -726,12 +726,12 @@ export const MsgSignProviderAttributes = { }, toAmino(message: MsgSignProviderAttributes): MsgSignProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -938,12 +938,12 @@ export const MsgDeleteProviderAttributes = { }, toAmino(message: MsgDeleteProviderAttributes): MsgDeleteProviderAttributesAmino { const obj: any = {}; - obj.owner = message.owner; - obj.auditor = message.auditor; + obj.owner = message.owner ?? ""; + obj.auditor = message.auditor ?? ""; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/genesis.ts index bac1aa7625..f377052406 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? AuditedAttributes.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts index 9303cc6e0f..128754e4c6 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./audit"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.audit.v1beta2"; /** QueryProvidersResponse is response type for the Query/Providers RPC method */ export interface QueryProvidersResponse { @@ -181,7 +181,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -293,8 +293,8 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); - obj.owner = omitDefault(message.owner); + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { @@ -502,7 +502,7 @@ export const QueryProviderAttributesRequest = { }, toAmino(message: QueryProviderAttributesRequest): QueryProviderAttributesRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -613,8 +613,8 @@ export const QueryProviderAuditorRequest = { }, toAmino(message: QueryProviderAuditorRequest): QueryProviderAuditorRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); - obj.owner = omitDefault(message.owner); + obj.auditor = message.auditor === "" ? undefined : message.auditor; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderAuditorRequestAminoMsg): QueryProviderAuditorRequest { @@ -726,7 +726,7 @@ export const QueryAuditorAttributesRequest = { }, toAmino(message: QueryAuditorAttributesRequest): QueryAuditorAttributesRequestAmino { const obj: any = {}; - obj.auditor = omitDefault(message.auditor); + obj.auditor = message.auditor === "" ? undefined : message.auditor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts index 59d5963d64..447d3f8556 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta1"; /** Attribute represents key value pair */ export interface Attribute { @@ -142,8 +142,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -268,12 +268,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -392,11 +392,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts index 424d9bb086..76b6f51da2 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/endpoint.ts @@ -110,13 +110,13 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } return message; }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); + obj.kind = message.kind === 0 ? undefined : message.kind; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts index 555673d4b9..2e5716a6cb 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts @@ -167,7 +167,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -286,11 +286,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -409,11 +409,11 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -574,7 +574,7 @@ export const ResourceUnits = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts index 60a6dd3bf1..193b3ae103 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.base.v1beta2"; /** Attribute represents key value pair */ export interface Attribute { @@ -142,8 +142,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -268,12 +268,12 @@ export const SignedBy = { if (message.allOf) { obj.all_of = message.allOf.map(e => e); } else { - obj.all_of = []; + obj.all_of = message.allOf; } if (message.anyOf) { obj.any_of = message.anyOf.map(e => e); } else { - obj.any_of = []; + obj.any_of = message.anyOf; } return obj; }, @@ -392,11 +392,11 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : undefined; + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts index a34dca88e4..0df46f4e5b 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/endpoint.ts @@ -132,7 +132,7 @@ export const Endpoint = { fromAmino(object: EndpointAmino): Endpoint { const message = createBaseEndpoint(); if (object.kind !== undefined && object.kind !== null) { - message.kind = endpoint_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.sequence_number !== undefined && object.sequence_number !== null) { message.sequenceNumber = object.sequence_number; @@ -141,8 +141,8 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.kind = endpoint_KindToJSON(message.kind); - obj.sequence_number = message.sequenceNumber; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.sequence_number = message.sequenceNumber ?? 0; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts index 09bed02fe5..19df53bad2 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts @@ -144,7 +144,7 @@ export const CPU = { if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -263,11 +263,11 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -402,12 +402,12 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.name = message.name; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : undefined; + obj.name = message.name ?? ""; + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/resourceunits.ts index e36ed32bd8..0eaa02e508 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/resourceunits.ts @@ -165,12 +165,12 @@ export const ResourceUnits = { if (message.storage) { obj.storage = message.storage.map(e => e ? Storage.toAmino(e) : undefined); } else { - obj.storage = []; + obj.storage = message.storage; } if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts index 3d90abcb1e..97a159b755 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: { + id: id == null ? id : { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts index e721efb876..bfb3981741 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts @@ -217,8 +217,8 @@ export const CertificateID = { }, toAmino(message: CertificateID): CertificateIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateIDAminoMsg): CertificateID { @@ -332,7 +332,7 @@ export const Certificate = { fromAmino(object: CertificateAmino): Certificate { const message = createBaseCertificate(); if (object.state !== undefined && object.state !== null) { - message.state = certificate_StateFromJSON(object.state); + message.state = object.state; } if (object.cert !== undefined && object.cert !== null) { message.cert = bytesFromBase64(object.cert); @@ -344,9 +344,9 @@ export const Certificate = { }, toAmino(message: Certificate): CertificateAmino { const obj: any = {}; - obj.state = certificate_StateToJSON(message.state); - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.state = message.state ?? 0; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: CertificateAminoMsg): Certificate { @@ -472,9 +472,9 @@ export const CertificateFilter = { }, toAmino(message: CertificateFilter): CertificateFilterAmino { const obj: any = {}; - obj.owner = message.owner; - obj.serial = message.serial; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.serial = message.serial ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: CertificateFilterAminoMsg): CertificateFilter { @@ -600,9 +600,9 @@ export const MsgCreateCertificate = { }, toAmino(message: MsgCreateCertificate): MsgCreateCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.cert = message.cert ? base64FromBytes(message.cert) : undefined; - obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : undefined; + obj.owner = message.owner ?? ""; + obj.cert = message.cert ? base64FromBytes(message.cert) : ""; + obj.pubkey = message.pubkey ? base64FromBytes(message.pubkey) : ""; return obj; }, fromAminoMsg(object: MsgCreateCertificateAminoMsg): MsgCreateCertificate { @@ -772,7 +772,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : undefined; + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts index 32eb7b74a9..3cb6a37102 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts @@ -115,8 +115,8 @@ export const GenesisCertificate = { }, toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; - obj.owner = message.owner; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; + obj.owner = message.owner ?? ""; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { @@ -219,7 +219,7 @@ export const GenesisState = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? GenesisCertificate.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts index 675f8ba362..c3cd752c70 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts @@ -132,8 +132,8 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : undefined; - obj.serial = message.serial; + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.serial = message.serial ?? ""; return obj; }, fromAminoMsg(object: CertificateResponseAminoMsg): CertificateResponse { @@ -369,7 +369,7 @@ export const QueryCertificatesResponse = { if (message.certificates) { obj.certificates = message.certificates.map(e => e ? CertificateResponse.toAmino(e) : undefined); } else { - obj.certificates = []; + obj.certificates = message.certificates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts index d33d12c97e..136c503512 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts index 323dbb174d..199a950791 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts @@ -313,14 +313,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -508,8 +508,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -717,13 +717,13 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -893,7 +893,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1079,8 +1079,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -1214,7 +1214,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -1226,9 +1226,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -1357,9 +1357,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts index c56045ac36..21ac8f466c 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts @@ -125,11 +125,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -251,9 +251,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts index 8d69cf43ba..18926deffa 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts @@ -2,7 +2,7 @@ import { PlacementRequirements, PlacementRequirementsSDKType } from "../../base/ import { ResourceUnits, ResourceUnitsSDKType } from "../../base/v1beta1/resource"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, Exact, omitDefault } from "../../../helpers"; +import { isSet, Exact } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta1"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -256,7 +256,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -426,7 +426,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -596,7 +596,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -798,9 +798,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { @@ -934,12 +934,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, @@ -1076,7 +1076,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -1088,10 +1088,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1221,9 +1221,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? Coin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts index 6d736b7daf..54dd585a27 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts index e052dbe06b..ac09f8200c 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts @@ -297,7 +297,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -531,11 +531,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts index 480cd225a2..0174ebbd77 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : undefined; + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts index 5361066f2e..ede028f38f 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts @@ -177,8 +177,8 @@ export const DeploymentID = { }, toAmino(message: DeploymentID): DeploymentIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; return obj; }, fromAminoMsg(object: DeploymentIDAminoMsg): DeploymentID { @@ -312,7 +312,7 @@ export const Deployment = { message.deploymentId = DeploymentID.fromAmino(object.deployment_id); } if (object.state !== undefined && object.state !== null) { - message.state = deployment_StateFromJSON(object.state); + message.state = object.state; } if (object.version !== undefined && object.version !== null) { message.version = bytesFromBase64(object.version); @@ -324,9 +324,9 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : undefined; - obj.state = deployment_StateToJSON(message.state); - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.state = message.state ?? 0; + obj.version = message.version ? base64FromBytes(message.version) : ""; obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, @@ -455,9 +455,9 @@ export const DeploymentFilters = { }, toAmino(message: DeploymentFilters): DeploymentFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq ? message.dseq.toString() : undefined; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: DeploymentFiltersAminoMsg): DeploymentFilters { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts index ebde71e394..6f620bcc9e 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts @@ -243,15 +243,15 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } - obj.version = message.version ? base64FromBytes(message.version) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; - obj.depositor = message.depositor; + obj.version = message.version ? base64FromBytes(message.version) : ""; + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -455,9 +455,9 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; - obj.depositor = message.depositor; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.depositor = message.depositor ?? ""; return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -643,8 +643,8 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; - obj.version = message.version ? base64FromBytes(message.version) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, fromAminoMsg(object: MsgUpdateDeploymentAminoMsg): MsgUpdateDeployment { @@ -814,7 +814,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : undefined; + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts index 21be410cc5..7853419e04 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts @@ -125,11 +125,11 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } return obj; }, @@ -251,9 +251,9 @@ export const GenesisState = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? GenesisDeployment.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts index 34c06758fa..3d95c54aa7 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts @@ -1,7 +1,7 @@ import { GroupID, GroupIDSDKType } from "./groupid"; import { GroupSpec, GroupSpecSDKType } from "./groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.deployment.v1beta2"; /** State is an enum which refers to state of group */ export enum Group_State { @@ -187,7 +187,7 @@ export const Group = { message.groupId = GroupID.fromAmino(object.group_id); } if (object.state !== undefined && object.state !== null) { - message.state = group_StateFromJSON(object.state); + message.state = object.state; } if (object.group_spec !== undefined && object.group_spec !== null) { message.groupSpec = GroupSpec.fromAmino(object.group_spec); @@ -199,10 +199,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : undefined; - obj.state = group_StateToJSON(message.state); - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.state = message.state ?? 0; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts index 093869faa1..56c8fe5f40 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupid.ts @@ -120,9 +120,9 @@ export const GroupID = { }, toAmino(message: GroupID): GroupIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; return obj; }, fromAminoMsg(object: GroupIDAminoMsg): GroupID { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts index 7678473a12..1df98da044 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts @@ -133,7 +133,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -303,7 +303,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -473,7 +473,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : undefined; + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts index a01a9cf5c4..88ade8bf5a 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts @@ -128,12 +128,12 @@ export const GroupSpec = { }, toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; - obj.name = message.name; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : undefined; + obj.name = message.name ?? ""; + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts index 272b065f4a..65b3ab2e8d 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : undefined; + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts index fa4b778be8..1e1a51a14f 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts @@ -297,7 +297,7 @@ export const QueryDeploymentsResponse = { if (message.deployments) { obj.deployments = message.deployments.map(e => e ? QueryDeploymentResponse.toAmino(e) : undefined); } else { - obj.deployments = []; + obj.deployments = message.deployments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -531,11 +531,11 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : undefined; + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.escrow_account = message.escrowAccount ? Account.toAmino(message.escrowAccount) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts index e56479dc78..3ad5531a6f 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts @@ -124,9 +124,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : undefined; - obj.count = message.count; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.count = message.count ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index 0e6cf7a88d..d50522d305 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -230,66 +230,66 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - groups: groups.map(el0 => ({ + groups: groups.map?.(el0 => ({ name: el0.name, - requirements: { - signedBy: { + requirements: el0.requirements == null ? el0.requirements : { + signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map(el2 => ({ + attributes: el0.requirements.attributes.map?.(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map(el1 => ({ - resources: { - cpu: { - units: { + resources: el0.resources.map?.(el1 => ({ + resources: el1.resources == null ? el1.resources : { + cpu: el1.resources.cpu == null ? el1.resources.cpu : { + units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map(el4 => ({ + attributes: el1.resources.cpu.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - memory: { - quantity: { + memory: el1.resources.memory == null ? el1.resources.memory : { + quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map(el4 => ({ + attributes: el1.resources.memory.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map(el3 => ({ + storage: el1.resources.storage.map?.(el3 => ({ name: el3.name, - quantity: { + quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map(el4 => ({ + attributes: el3.attributes.map?.(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map(el3 => ({ - kind: endpoint_KindFromJSON(el3.kind), + endpoints: el1.resources.endpoints.map?.(el3 => ({ + kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: { + price: el1.price == null ? el1.price : { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount }, @@ -322,11 +322,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount }, @@ -353,9 +353,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, version }; @@ -377,9 +377,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq) + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) } }; } @@ -401,9 +401,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; @@ -426,9 +426,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; @@ -451,9 +451,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: { + id: id == null ? id : { owner: id.owner, - dseq: BigInt(id.dseq), + dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/genesis.ts index 27ded574e3..12210d6d28 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/genesis.ts @@ -116,12 +116,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts index 92436c5ff7..e6672a7903 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, Payment, PaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta1"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -208,10 +208,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -333,7 +333,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -511,11 +511,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -637,7 +637,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? Payment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts index cf881667f8..a6a3f865f3 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts @@ -249,8 +249,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -417,7 +417,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = Coin.fromAmino(object.balance); @@ -432,12 +432,12 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -620,7 +620,7 @@ export const Payment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = payment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = Coin.fromAmino(object.rate); @@ -635,13 +635,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = payment_StateToJSON(message.state); - obj.rate = message.rate ? Coin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/genesis.ts index 868fa25cc5..04bb97ec14 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/genesis.ts @@ -116,12 +116,12 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts index a2e66937de..f70db8abc6 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Account, AccountSDKType, FractionalPayment, FractionalPaymentSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.escrow.v1beta2"; /** QueryAccountRequest is request type for the Query/Account RPC method */ export interface QueryAccountsRequest { @@ -208,10 +208,10 @@ export const QueryAccountsRequest = { }, toAmino(message: QueryAccountsRequest): QueryAccountsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -333,7 +333,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Account.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -511,11 +511,11 @@ export const QueryPaymentsRequest = { }, toAmino(message: QueryPaymentsRequest): QueryPaymentsRequestAmino { const obj: any = {}; - obj.scope = omitDefault(message.scope); - obj.xid = omitDefault(message.xid); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); - obj.state = omitDefault(message.state); + obj.scope = message.scope === "" ? undefined : message.scope; + obj.xid = message.xid === "" ? undefined : message.xid; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.state = message.state === "" ? undefined : message.state; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -637,7 +637,7 @@ export const QueryPaymentsResponse = { if (message.payments) { obj.payments = message.payments.map(e => e ? FractionalPayment.toAmino(e) : undefined); } else { - obj.payments = []; + obj.payments = message.payments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts index 08ed84a19f..a007accce1 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts @@ -262,8 +262,8 @@ export const AccountID = { }, toAmino(message: AccountID): AccountIDAmino { const obj: any = {}; - obj.scope = message.scope; - obj.xid = message.xid; + obj.scope = message.scope ?? ""; + obj.xid = message.xid ?? ""; return obj; }, fromAminoMsg(object: AccountIDAminoMsg): AccountID { @@ -458,7 +458,7 @@ export const Account = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = account_StateFromJSON(object.state); + message.state = object.state; } if (object.balance !== undefined && object.balance !== null) { message.balance = DecCoin.fromAmino(object.balance); @@ -479,14 +479,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : undefined; - obj.owner = message.owner; - obj.state = account_StateToJSON(message.state); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : undefined; - obj.settled_at = message.settledAt; - obj.depositor = message.depositor; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : undefined; + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; + obj.depositor = message.depositor ?? ""; + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -669,7 +669,7 @@ export const FractionalPayment = { message.owner = object.owner; } if (object.state !== undefined && object.state !== null) { - message.state = fractionalPayment_StateFromJSON(object.state); + message.state = object.state; } if (object.rate !== undefined && object.rate !== null) { message.rate = DecCoin.fromAmino(object.rate); @@ -684,13 +684,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : undefined; - obj.payment_id = message.paymentId; - obj.owner = message.owner; - obj.state = fractionalPayment_StateToJSON(message.state); - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : undefined; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : undefined; - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : undefined; + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.payment_id = message.paymentId ?? ""; + obj.owner = message.owner ?? ""; + obj.state = message.state ?? 0; + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts index 29b268e4f4..c1830d787a 100644 --- a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts @@ -85,7 +85,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts index ba7e8e0fe0..0bdc3e86c1 100644 --- a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/params.ts @@ -128,9 +128,9 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor); - obj.initial_inflation = padDecimal(message.initialInflation); - obj.variance = padDecimal(message.variance); + obj.inflation_decay_factor = padDecimal(message.inflationDecayFactor) ?? ""; + obj.initial_inflation = padDecimal(message.initialInflation) ?? ""; + obj.variance = padDecimal(message.variance) ?? ""; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts index e20368bef0..4d7f7d6e7c 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts @@ -1,7 +1,7 @@ import { OrderID, OrderIDSDKType } from "./order"; import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of bid */ export enum Bid_State { @@ -293,10 +293,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : undefined; - obj.provider = message.provider; - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : undefined; + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.provider = message.provider ?? ""; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -466,7 +466,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -700,11 +700,11 @@ export const BidID = { }, toAmino(message: BidID): BidIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: BidIDAminoMsg): BidID { @@ -840,7 +840,7 @@ export const Bid = { message.bidId = BidID.fromAmino(object.bid_id); } if (object.state !== undefined && object.state !== null) { - message.state = bid_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -852,10 +852,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; - obj.state = bid_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { @@ -1031,12 +1031,12 @@ export const BidFilters = { }, toAmino(message: BidFilters): BidFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: BidFiltersAminoMsg): BidFilters { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts index 5279f1243f..83cac6aee6 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts @@ -138,14 +138,14 @@ export const GenesisState = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } if (message.leases) { obj.leases = message.leases.map(e => e ? Lease.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : undefined; + obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts index 5a004cbf3b..da39230d92 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BidID, BidIDSDKType } from "./bid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of lease */ export enum Lease_State { @@ -308,11 +308,11 @@ export const LeaseID = { }, toAmino(message: LeaseID): LeaseIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; return obj; }, fromAminoMsg(object: LeaseIDAminoMsg): LeaseID { @@ -463,7 +463,7 @@ export const Lease = { message.leaseId = LeaseID.fromAmino(object.lease_id); } if (object.state !== undefined && object.state !== null) { - message.state = lease_StateFromJSON(object.state); + message.state = object.state; } if (object.price !== undefined && object.price !== null) { message.price = DecCoin.fromAmino(object.price); @@ -478,11 +478,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; - obj.state = lease_StateToJSON(message.state); - obj.price = message.price ? DecCoin.toAmino(message.price) : undefined; - obj.created_at = omitDefault(message.createdAt); - obj.closed_on = omitDefault(message.closedOn); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.state = message.state ?? 0; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -658,12 +658,12 @@ export const LeaseFilters = { }, toAmino(message: LeaseFilters): LeaseFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.provider = message.provider; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.provider = message.provider ?? ""; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: LeaseFiltersAminoMsg): LeaseFilters { @@ -759,7 +759,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -929,7 +929,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : undefined; + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1099,7 +1099,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : undefined; + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts index fcf7af16e8..9e91c39142 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts @@ -1,6 +1,6 @@ import { GroupSpec, GroupSpecSDKType } from "../../deployment/v1beta2/groupspec"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.market.v1beta2"; /** State is an enum which refers to state of order */ export enum Order_State { @@ -225,10 +225,10 @@ export const OrderID = { }, toAmino(message: OrderID): OrderIDAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; return obj; }, fromAminoMsg(object: OrderIDAminoMsg): OrderID { @@ -364,7 +364,7 @@ export const Order = { message.orderId = OrderID.fromAmino(object.order_id); } if (object.state !== undefined && object.state !== null) { - message.state = order_StateFromJSON(object.state); + message.state = object.state; } if (object.spec !== undefined && object.spec !== null) { message.spec = GroupSpec.fromAmino(object.spec); @@ -376,10 +376,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : undefined; - obj.state = order_StateToJSON(message.state); - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : undefined; - obj.created_at = omitDefault(message.createdAt); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.state = message.state ?? 0; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); + obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { @@ -539,11 +539,11 @@ export const OrderFilters = { }, toAmino(message: OrderFilters): OrderFiltersAmino { const obj: any = {}; - obj.owner = message.owner; - obj.dseq = message.dseq; - obj.gseq = message.gseq; - obj.oseq = message.oseq; - obj.state = message.state; + obj.owner = message.owner ?? ""; + obj.dseq = message.dseq ? message.dseq.toString() : "0"; + obj.gseq = message.gseq ?? 0; + obj.oseq = message.oseq ?? 0; + obj.state = message.state ?? ""; return obj; }, fromAminoMsg(object: OrderFiltersAminoMsg): OrderFilters { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts index 99d881bfee..eaf1756342 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts @@ -103,8 +103,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : undefined; - obj.order_max_bids = message.orderMaxBids; + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.ts index 7d81ae5eb0..22ec60f703 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/query.ts @@ -377,7 +377,7 @@ export const QueryOrdersResponse = { if (message.orders) { obj.orders = message.orders.map(e => e ? Order.toAmino(e) : undefined); } else { - obj.orders = []; + obj.orders = message.orders; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -807,7 +807,7 @@ export const QueryBidsResponse = { if (message.bids) { obj.bids = message.bids.map(e => e ? QueryBidResponse.toAmino(e) : undefined); } else { - obj.bids = []; + obj.bids = message.bids; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1256,7 +1256,7 @@ export const QueryLeasesResponse = { if (message.leases) { obj.leases = message.leases.map(e => e ? QueryLeaseResponse.toAmino(e) : undefined); } else { - obj.leases = []; + obj.leases = message.leases; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts index e8401755fa..0fc7ee0a5d 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts @@ -107,18 +107,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: { + order: order == null ? order : { owner: order.owner, - dseq: BigInt(order.dseq), + dseq: order.dseq == null ? order.dseq : BigInt(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: { + price: price == null ? price : { denom: price.denom, amount: price.amount }, - deposit: { + deposit: deposit == null ? deposit : { denom: deposit.denom, amount: deposit.amount } @@ -144,9 +144,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -173,9 +173,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -202,9 +202,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: { + bidId: bid_id == null ? bid_id : { owner: bid_id.owner, - dseq: BigInt(bid_id.dseq), + dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -231,9 +231,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: { + leaseId: lease_id == null ? lease_id : { owner: lease_id.owner, - dseq: BigInt(lease_id.dseq), + dseq: lease_id.dseq == null ? lease_id.dseq : BigInt(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts index 831b4eea3c..3ee12d22c8 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts @@ -70,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -111,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts index 2f08ae04ab..86ade67186 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts @@ -191,8 +191,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -342,14 +342,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -573,14 +573,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -748,7 +748,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -972,14 +972,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/genesis.ts index e106ac8e50..62e3969d1f 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts index d90c974036..8a038a1507 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts @@ -70,11 +70,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } @@ -111,11 +111,11 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map(el0 => ({ + attributes: attributes.map?.(el0 => ({ key: el0.key, value: el0.value })), - info: { + info: info == null ? info : { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts index 509e5db2b8..c3ebfde66f 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts @@ -191,8 +191,8 @@ export const ProviderInfo = { }, toAmino(message: ProviderInfo): ProviderInfoAmino { const obj: any = {}; - obj.email = message.email; - obj.website = message.website; + obj.email = message.email ?? ""; + obj.website = message.website ?? ""; return obj; }, fromAminoMsg(object: ProviderInfoAminoMsg): ProviderInfo { @@ -342,14 +342,14 @@ export const MsgCreateProvider = { }, toAmino(message: MsgCreateProvider): MsgCreateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -573,14 +573,14 @@ export const MsgUpdateProvider = { }, toAmino(message: MsgUpdateProvider): MsgUpdateProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -748,7 +748,7 @@ export const MsgDeleteProvider = { }, toAmino(message: MsgDeleteProvider): MsgDeleteProviderAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner ?? ""; return obj; }, fromAminoMsg(object: MsgDeleteProviderAminoMsg): MsgDeleteProvider { @@ -972,14 +972,14 @@ export const Provider = { }, toAmino(message: Provider): ProviderAmino { const obj: any = {}; - obj.owner = message.owner; - obj.host_uri = message.hostUri; + obj.owner = message.owner ?? ""; + obj.host_uri = message.hostUri ?? ""; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : undefined; + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts index 2af9407a49..a53f2eb074 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { Provider, ProviderSDKType } from "./provider"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, Exact, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, Exact } from "../../../helpers"; export const protobufPackage = "akash.provider.v1beta2"; /** QueryProvidersRequest is request type for the Query/Providers RPC method */ export interface QueryProvidersRequest { @@ -245,7 +245,7 @@ export const QueryProvidersResponse = { if (message.providers) { obj.providers = message.providers.map(e => e ? Provider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -341,7 +341,7 @@ export const QueryProviderRequest = { }, toAmino(message: QueryProviderRequest): QueryProviderRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryProviderRequestAminoMsg): QueryProviderRequest { diff --git a/__fixtures__/v-next/outputv4/confio/proofs.ts b/__fixtures__/v-next/outputv4/confio/proofs.ts index 66a0a731b6..4536cfdf0c 100644 --- a/__fixtures__/v-next/outputv4/confio/proofs.ts +++ b/__fixtures__/v-next/outputv4/confio/proofs.ts @@ -657,7 +657,7 @@ export const ExistenceProof = { if (message.path) { obj.path = message.path.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.path = []; + obj.path = message.path; } return obj; }, @@ -1065,16 +1065,16 @@ export const LeafOp = { fromAmino(object: LeafOpAmino): LeafOp { const message = createBaseLeafOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prehash_key !== undefined && object.prehash_key !== null) { - message.prehashKey = hashOpFromJSON(object.prehash_key); + message.prehashKey = object.prehash_key; } if (object.prehash_value !== undefined && object.prehash_value !== null) { - message.prehashValue = hashOpFromJSON(object.prehash_value); + message.prehashValue = object.prehash_value; } if (object.length !== undefined && object.length !== null) { - message.length = lengthOpFromJSON(object.length); + message.length = object.length; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1083,10 +1083,10 @@ export const LeafOp = { }, toAmino(message: LeafOp): LeafOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); - obj.prehash_key = hashOpToJSON(message.prehashKey); - obj.prehash_value = hashOpToJSON(message.prehashValue); - obj.length = lengthOpToJSON(message.length); + obj.hash = message.hash === 0 ? undefined : message.hash; + obj.prehash_key = message.prehashKey === 0 ? undefined : message.prehashKey; + obj.prehash_value = message.prehashValue === 0 ? undefined : message.prehashValue; + obj.length = message.length === 0 ? undefined : message.length; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; }, @@ -1195,7 +1195,7 @@ export const InnerOp = { fromAmino(object: InnerOpAmino): InnerOp { const message = createBaseInnerOp(); if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } if (object.prefix !== undefined && object.prefix !== null) { message.prefix = bytesFromBase64(object.prefix); @@ -1207,7 +1207,7 @@ export const InnerOp = { }, toAmino(message: InnerOp): InnerOpAmino { const obj: any = {}; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; obj.suffix = message.suffix ? base64FromBytes(message.suffix) : undefined; return obj; @@ -1351,8 +1351,8 @@ export const ProofSpec = { const obj: any = {}; obj.leaf_spec = message.leafSpec ? LeafOp.toAmino(message.leafSpec) : undefined; obj.inner_spec = message.innerSpec ? InnerSpec.toAmino(message.innerSpec) : undefined; - obj.max_depth = message.maxDepth; - obj.min_depth = message.minDepth; + obj.max_depth = message.maxDepth === 0 ? undefined : message.maxDepth; + obj.min_depth = message.minDepth === 0 ? undefined : message.minDepth; return obj; }, fromAminoMsg(object: ProofSpecAminoMsg): ProofSpec { @@ -1529,7 +1529,7 @@ export const InnerSpec = { message.emptyChild = bytesFromBase64(object.empty_child); } if (object.hash !== undefined && object.hash !== null) { - message.hash = hashOpFromJSON(object.hash); + message.hash = object.hash; } return message; }, @@ -1538,13 +1538,13 @@ export const InnerSpec = { if (message.childOrder) { obj.child_order = message.childOrder.map(e => e); } else { - obj.child_order = []; + obj.child_order = message.childOrder; } - obj.child_size = message.childSize; - obj.min_prefix_length = message.minPrefixLength; - obj.max_prefix_length = message.maxPrefixLength; + obj.child_size = message.childSize === 0 ? undefined : message.childSize; + obj.min_prefix_length = message.minPrefixLength === 0 ? undefined : message.minPrefixLength; + obj.max_prefix_length = message.maxPrefixLength === 0 ? undefined : message.maxPrefixLength; obj.empty_child = message.emptyChild ? base64FromBytes(message.emptyChild) : undefined; - obj.hash = hashOpToJSON(message.hash); + obj.hash = message.hash === 0 ? undefined : message.hash; return obj; }, fromAminoMsg(object: InnerSpecAminoMsg): InnerSpec { @@ -1641,7 +1641,7 @@ export const BatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? BatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1870,12 +1870,12 @@ export const CompressedBatchProof = { if (message.entries) { obj.entries = message.entries.map(e => e ? CompressedBatchEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.lookupInners) { obj.lookup_inners = message.lookupInners.map(e => e ? InnerOp.toAmino(e) : undefined); } else { - obj.lookup_inners = []; + obj.lookup_inners = message.lookupInners; } return obj; }, @@ -2144,7 +2144,7 @@ export const CompressedExistenceProof = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts index 91b94354e3..4abd348190 100644 --- a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/config.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** * Config represents the configuration for a Cosmos SDK ABCI app. @@ -139,7 +139,7 @@ export const Config = { if (message.modules) { obj.modules = message.modules.map(e => e ? ModuleConfig.toAmino(e) : undefined); } else { - obj.modules = []; + obj.modules = message.modules; } return obj; }, @@ -252,7 +252,7 @@ export const ModuleConfig = { }, toAmino(message: ModuleConfig): ModuleConfigAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.config = message.config ? Any.toAmino(message.config) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts index 3e4b0c24cd..58090c2f19 100644 --- a/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts +++ b/__fixtures__/v-next/outputv4/cosmos/app/v1alpha1/module.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.app.v1alpha1"; /** ModuleDescriptor describes an app module. */ export interface ModuleDescriptor { @@ -226,16 +226,16 @@ export const ModuleDescriptor = { }, toAmino(message: ModuleDescriptor): ModuleDescriptorAmino { const obj: any = {}; - obj.go_import = omitDefault(message.goImport); + obj.go_import = message.goImport === "" ? undefined : message.goImport; if (message.usePackage) { obj.use_package = message.usePackage.map(e => e ? PackageReference.toAmino(e) : undefined); } else { - obj.use_package = []; + obj.use_package = message.usePackage; } if (message.canMigrateFrom) { obj.can_migrate_from = message.canMigrateFrom.map(e => e ? MigrateFromInfo.toAmino(e) : undefined); } else { - obj.can_migrate_from = []; + obj.can_migrate_from = message.canMigrateFrom; } return obj; }, @@ -346,8 +346,8 @@ export const PackageReference = { }, toAmino(message: PackageReference): PackageReferenceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.revision = omitDefault(message.revision); + obj.name = message.name === "" ? undefined : message.name; + obj.revision = message.revision === 0 ? undefined : message.revision; return obj; }, fromAminoMsg(object: PackageReferenceAminoMsg): PackageReference { @@ -441,7 +441,7 @@ export const MigrateFromInfo = { }, toAmino(message: MigrateFromInfo): MigrateFromInfoAmino { const obj: any = {}; - obj.module = omitDefault(message.module); + obj.module = message.module === "" ? undefined : message.module; return obj; }, fromAminoMsg(object: MigrateFromInfoAminoMsg): MigrateFromInfo { diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts index a3b51be38a..a2e543f322 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * BaseAccount defines a base account type. It contains all the necessary fields @@ -187,10 +187,10 @@ export const BaseAccount = { }, toAmino(message: BaseAccount): BaseAccountAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = omitDefault(message.accountNumber); - obj.sequence = omitDefault(message.sequence); + obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -325,11 +325,11 @@ export const ModuleAccount = { toAmino(message: ModuleAccount): ModuleAccountAmino { const obj: any = {}; obj.base_account = message.baseAccount ? BaseAccount.toAmino(message.baseAccount) : undefined; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.permissions) { obj.permissions = message.permissions.map(e => e); } else { - obj.permissions = []; + obj.permissions = message.permissions; } return obj; }, @@ -498,11 +498,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = omitDefault(message.maxMemoCharacters); - obj.tx_sig_limit = omitDefault(message.txSigLimit); - obj.tx_size_cost_per_byte = omitDefault(message.txSizeCostPerByte); - obj.sig_verify_cost_ed25519 = omitDefault(message.sigVerifyCostEd25519); - obj.sig_verify_cost_secp256k1 = omitDefault(message.sigVerifyCostSecp256k1); + obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/genesis.ts index 17b02061a7..0df5f48e20 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/genesis.ts @@ -116,7 +116,7 @@ export const GenesisState = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts index 6fd869a48f..043f287cf7 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Params, ParamsSDKType } from "./auth"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.auth.v1beta1"; /** * QueryAccountsRequest is the request type for the Query/Accounts RPC method. @@ -376,7 +376,7 @@ export const QueryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -472,7 +472,7 @@ export const QueryAccountRequest = { }, toAmino(message: QueryAccountRequest): QueryAccountRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAccountRequestAminoMsg): QueryAccountRequest { @@ -915,7 +915,7 @@ export const QueryModuleAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } return obj; }, @@ -1084,7 +1084,7 @@ export const Bech32PrefixResponse = { }, toAmino(message: Bech32PrefixResponse): Bech32PrefixResponseAmino { const obj: any = {}; - obj.bech32_prefix = omitDefault(message.bech32Prefix); + obj.bech32_prefix = message.bech32Prefix === "" ? undefined : message.bech32Prefix; return obj; }, fromAminoMsg(object: Bech32PrefixResponseAminoMsg): Bech32PrefixResponse { @@ -1272,7 +1272,7 @@ export const AddressBytesToStringResponse = { }, toAmino(message: AddressBytesToStringResponse): AddressBytesToStringResponseAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressBytesToStringResponseAminoMsg): AddressBytesToStringResponse { @@ -1366,7 +1366,7 @@ export const AddressStringToBytesRequest = { }, toAmino(message: AddressStringToBytesRequest): AddressStringToBytesRequestAmino { const obj: any = {}; - obj.address_string = omitDefault(message.addressString); + obj.address_string = message.addressString === "" ? undefined : message.addressString; return obj; }, fromAminoMsg(object: AddressStringToBytesRequestAminoMsg): AddressStringToBytesRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts index 1b7078d9c8..6a77a18d87 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/authz.ts @@ -153,7 +153,7 @@ export const GenericAuthorization = { }, toAmino(message: GenericAuthorization): GenericAuthorizationAmino { const obj: any = {}; - obj.msg = message.msg; + obj.msg = message.msg === "" ? undefined : message.msg; return obj; }, fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { @@ -410,8 +410,8 @@ export const GrantAuthorization = { }, toAmino(message: GrantAuthorization): GrantAuthorizationAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.authorization = message.authorization ? Any.toAmino(message.authorization) : undefined; obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -516,7 +516,7 @@ export const GrantQueueItem = { if (message.msgTypeUrls) { obj.msg_type_urls = message.msgTypeUrls.map(e => e); } else { - obj.msg_type_urls = []; + obj.msg_type_urls = message.msgTypeUrls; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/genesis.ts index e77fd05933..b54632ef7d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.authorization) { obj.authorization = message.authorization.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.authorization = []; + obj.authorization = message.authorization; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts index 3403ae4551..a270d32b76 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType, GrantAuthorization, GrantAuthorizationSDKType } from "./authz"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** QueryGrantsRequest is the request type for the Query/Grants RPC method. */ export interface QueryGrantsRequest { @@ -220,9 +220,9 @@ export const QueryGrantsRequest = { }, toAmino(message: QueryGrantsRequest): QueryGrantsRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -344,7 +344,7 @@ export const QueryGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -458,7 +458,7 @@ export const QueryGranterGrantsRequest = { }, toAmino(message: QueryGranterGrantsRequest): QueryGranterGrantsRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -580,7 +580,7 @@ export const QueryGranterGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -694,7 +694,7 @@ export const QueryGranteeGrantsRequest = { }, toAmino(message: QueryGranteeGrantsRequest): QueryGranteeGrantsRequestAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -816,7 +816,7 @@ export const QueryGranteeGrantsResponse = { if (message.grants) { obj.grants = message.grants.map(e => e ? GrantAuthorization.toAmino(e) : undefined); } else { - obj.grants = []; + obj.grants = message.grants; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts index b035d8f4ff..9653f58093 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts @@ -1,6 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; export interface MsgGrantAminoType extends AminoMsg { type: "cosmos-sdk/MsgGrant"; @@ -43,11 +44,11 @@ export const AminoConverter = { grant }: MsgGrant): MsgGrantAminoType["value"] => { return { - granter, - grantee, + granter: omitDefault(granter), + grantee: omitDefault(grantee), grant: { authorization: { - type_url: grant.authorization.typeUrl, + type_url: omitDefault(grant.authorization.typeUrl), value: grant.authorization.value }, expiration: grant.expiration @@ -62,8 +63,8 @@ export const AminoConverter = { return { granter, grantee, - grant: { - authorization: { + grant: grant == null ? grant : { + authorization: grant.authorization == null ? grant.authorization : { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, @@ -79,9 +80,9 @@ export const AminoConverter = { msgs }: MsgExec): MsgExecAminoType["value"] => { return { - grantee, + grantee: omitDefault(grantee), msgs: msgs.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })) }; @@ -92,7 +93,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map(el0 => ({ + msgs: msgs.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })) @@ -107,9 +108,9 @@ export const AminoConverter = { msgTypeUrl }: MsgRevoke): MsgRevokeAminoType["value"] => { return { - granter, - grantee, - msg_type_url: msgTypeUrl + granter: omitDefault(granter), + grantee: omitDefault(grantee), + msg_type_url: omitDefault(msgTypeUrl) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts index 2634faa23a..563831e79c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Grant, GrantSDKType } from "./authz"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.authz.v1beta1"; /** * MsgGrant is a request type for Grant method. It declares authorization to the grantee @@ -205,8 +205,8 @@ export const MsgGrant = { }, toAmino(message: MsgGrant): MsgGrantAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; return obj; }, @@ -310,7 +310,7 @@ export const MsgExecResponse = { if (message.results) { obj.results = message.results.map(e => base64FromBytes(e)); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -427,11 +427,11 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -632,9 +632,9 @@ export const MsgRevoke = { }, toAmino(message: MsgRevoke): MsgRevokeAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/authz.ts index 1c0c2865db..e8630c19dc 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/authz.ts @@ -102,7 +102,7 @@ export const SendAuthorization = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts index cd8abb8237..f20a349c30 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/bank.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** Params defines the parameters for the bank module. */ export interface Params { @@ -271,9 +271,9 @@ export const Params = { if (message.sendEnabled) { obj.send_enabled = message.sendEnabled.map(e => e ? SendEnabled.toAmino(e) : undefined); } else { - obj.send_enabled = []; + obj.send_enabled = message.sendEnabled; } - obj.default_send_enabled = omitDefault(message.defaultSendEnabled); + obj.default_send_enabled = message.defaultSendEnabled === false ? undefined : message.defaultSendEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -383,8 +383,8 @@ export const SendEnabled = { }, toAmino(message: SendEnabled): SendEnabledAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.enabled = omitDefault(message.enabled); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; return obj; }, fromAminoMsg(object: SendEnabledAminoMsg): SendEnabled { @@ -500,11 +500,11 @@ export const Input = { }, toAmino(message: Input): InputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -621,11 +621,11 @@ export const Output = { }, toAmino(message: Output): OutputAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -729,7 +729,7 @@ export const Supply = { if (message.total) { obj.total = message.total.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -862,12 +862,12 @@ export const DenomUnit = { }, toAmino(message: DenomUnit): DenomUnitAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.exponent = omitDefault(message.exponent); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.exponent = message.exponent === 0 ? undefined : message.exponent; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } return obj; }, @@ -1080,18 +1080,18 @@ export const Metadata = { }, toAmino(message: Metadata): MetadataAmino { const obj: any = {}; - obj.description = omitDefault(message.description); + obj.description = message.description === "" ? undefined : message.description; if (message.denomUnits) { obj.denom_units = message.denomUnits.map(e => e ? DenomUnit.toAmino(e) : undefined); } else { - obj.denom_units = []; + obj.denom_units = message.denomUnits; } - obj.base = omitDefault(message.base); - obj.display = omitDefault(message.display); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.base = message.base === "" ? undefined : message.base; + obj.display = message.display === "" ? undefined : message.display; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; return obj; }, fromAminoMsg(object: MetadataAminoMsg): Metadata { diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts index f15748d44b..cf1165ab68 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** GenesisState defines the bank module's genesis state. */ export interface GenesisState { @@ -191,17 +191,17 @@ export const GenesisState = { if (message.balances) { obj.balances = message.balances.map(e => e ? Balance.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } if (message.denomMetadata) { obj.denom_metadata = message.denomMetadata.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.denom_metadata = []; + obj.denom_metadata = message.denomMetadata; } return obj; }, @@ -318,11 +318,11 @@ export const Balance = { }, toAmino(message: Balance): BalanceAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts index 723d19f08b..e81e9b0747 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Params, ParamsSDKType, Metadata, MetadataSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method. */ export interface QueryBalanceRequest { @@ -425,8 +425,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.denom = omitDefault(message.denom); + obj.address = message.address === "" ? undefined : message.address; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -634,7 +634,7 @@ export const QueryAllBalancesRequest = { }, toAmino(message: QueryAllBalancesRequest): QueryAllBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -756,7 +756,7 @@ export const QueryAllBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -870,7 +870,7 @@ export const QuerySpendableBalancesRequest = { }, toAmino(message: QuerySpendableBalancesRequest): QuerySpendableBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -992,7 +992,7 @@ export const QuerySpendableBalancesResponse = { if (message.balances) { obj.balances = message.balances.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.balances = []; + obj.balances = message.balances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1211,7 +1211,7 @@ export const QueryTotalSupplyResponse = { if (message.supply) { obj.supply = message.supply.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.supply = []; + obj.supply = message.supply; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1307,7 +1307,7 @@ export const QuerySupplyOfRequest = { }, toAmino(message: QuerySupplyOfRequest): QuerySupplyOfRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QuerySupplyOfRequestAminoMsg): QuerySupplyOfRequest { @@ -1790,7 +1790,7 @@ export const QueryDenomsMetadataResponse = { if (message.metadatas) { obj.metadatas = message.metadatas.map(e => e ? Metadata.toAmino(e) : undefined); } else { - obj.metadatas = []; + obj.metadatas = message.metadatas; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1886,7 +1886,7 @@ export const QueryDenomMetadataRequest = { }, toAmino(message: QueryDenomMetadataRequest): QueryDenomMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomMetadataRequestAminoMsg): QueryDenomMetadataRequest { @@ -2094,7 +2094,7 @@ export const QueryDenomOwnersRequest = { }, toAmino(message: QueryDenomOwnersRequest): QueryDenomOwnersRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2207,7 +2207,7 @@ export const DenomOwner = { }, toAmino(message: DenomOwner): DenomOwnerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.balance = message.balance ? Coin.toAmino(message.balance) : undefined; return obj; }, @@ -2329,7 +2329,7 @@ export const QueryDenomOwnersResponse = { if (message.denomOwners) { obj.denom_owners = message.denomOwners.map(e => e ? DenomOwner.toAmino(e) : undefined); } else { - obj.denom_owners = []; + obj.denom_owners = message.denomOwners; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts index 91e06445ec..a675254230 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -93,16 +93,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map(el0 => ({ + inputs: inputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map(el0 => ({ + outputs: outputs.map?.(el0 => ({ address: el0.address, - coins: el0.coins.map(el1 => ({ + coins: el0.coins.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts index 967b6af6c2..72455f3624 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Input, InputSDKType, Output, OutputSDKType } from "./bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.bank.v1beta1"; /** MsgSend represents a message to send coins from one account to another. */ export interface MsgSend { @@ -156,12 +156,12 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -361,12 +361,12 @@ export const MsgMultiSend = { if (message.inputs) { obj.inputs = message.inputs.map(e => e ? Input.toAmino(e) : undefined); } else { - obj.inputs = []; + obj.inputs = message.inputs; } if (message.outputs) { obj.outputs = message.outputs.map(e => e ? Output.toAmino(e) : undefined); } else { - obj.outputs = []; + obj.outputs = message.outputs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts index 34e78a549e..17bb26fd6f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts @@ -564,25 +564,25 @@ export const TxResponse = { toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.txhash = message.txhash; - obj.codespace = message.codespace; - obj.code = message.code; - obj.data = message.data; - obj.raw_log = message.rawLog; + obj.txhash = message.txhash === "" ? undefined : message.txhash; + obj.codespace = message.codespace === "" ? undefined : message.codespace; + obj.code = message.code === 0 ? undefined : message.code; + obj.data = message.data === "" ? undefined : message.data; + obj.raw_log = message.rawLog === "" ? undefined : message.rawLog; if (message.logs) { obj.logs = message.logs.map(e => e ? ABCIMessageLog.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; - obj.timestamp = message.timestamp; + obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -715,12 +715,12 @@ export const ABCIMessageLog = { }, toAmino(message: ABCIMessageLog): ABCIMessageLogAmino { const obj: any = {}; - obj.msg_index = message.msgIndex; - obj.log = message.log; + obj.msg_index = message.msgIndex ?? 0; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? StringEvent.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -837,11 +837,11 @@ export const StringEvent = { }, toAmino(message: StringEvent): StringEventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -952,8 +952,8 @@ export const Attribute = { }, toAmino(message: Attribute): AttributeAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeAminoMsg): Attribute { @@ -1223,16 +1223,16 @@ export const Result = { toAmino(message: Result): ResultAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; + obj.log = message.log === "" ? undefined : message.log; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1458,7 +1458,7 @@ export const MsgData = { }, toAmino(message: MsgData): MsgDataAmino { const obj: any = {}; - obj.msg_type = message.msgType; + obj.msg_type = message.msgType === "" ? undefined : message.msgType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1584,12 +1584,12 @@ export const TxMsgData = { if (message.data) { obj.data = message.data.map(e => e ? MsgData.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } if (message.msgResponses) { obj.msg_responses = message.msgResponses.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.msg_responses = []; + obj.msg_responses = message.msgResponses; } return obj; }, @@ -1788,7 +1788,7 @@ export const SearchTxsResult = { if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/kv/v1beta1/kv.ts b/__fixtures__/v-next/outputv4/cosmos/base/kv/v1beta1/kv.ts index 466ecd439a..e591fb3961 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/kv/v1beta1/kv.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/kv/v1beta1/kv.ts @@ -105,7 +105,7 @@ export const Pairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? Pair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts index 8aa1c12d87..7a03f47a54 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts @@ -241,8 +241,8 @@ export const PageRequest = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.offset = message.offset ? message.offset.toString() : undefined; obj.limit = message.limit ? message.limit.toString() : undefined; - obj.count_total = message.countTotal; - obj.reverse = message.reverse; + obj.count_total = message.countTotal === false ? undefined : message.countTotal; + obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; }, fromAminoMsg(object: PageRequestAminoMsg): PageRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts index 6f68a40711..baa1eb275a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v1beta1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v1beta1"; /** ListAllInterfacesRequest is the request type of the ListAllInterfaces RPC. */ export interface ListAllInterfacesRequest {} @@ -211,7 +211,7 @@ export const ListAllInterfacesResponse = { if (message.interfaceNames) { obj.interface_names = message.interfaceNames.map(e => e); } else { - obj.interface_names = []; + obj.interface_names = message.interfaceNames; } return obj; }, @@ -306,7 +306,7 @@ export const ListImplementationsRequest = { }, toAmino(message: ListImplementationsRequest): ListImplementationsRequestAmino { const obj: any = {}; - obj.interface_name = omitDefault(message.interfaceName); + obj.interface_name = message.interfaceName === "" ? undefined : message.interfaceName; return obj; }, fromAminoMsg(object: ListImplementationsRequestAminoMsg): ListImplementationsRequest { @@ -409,7 +409,7 @@ export const ListImplementationsResponse = { if (message.implementationMessageNames) { obj.implementation_message_names = message.implementationMessageNames.map(e => e); } else { - obj.implementation_message_names = []; + obj.implementation_message_names = message.implementationMessageNames; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts index 91cdb2a83a..997c34dde8 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/reflection/v2alpha1/reflection.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.reflection.v2alpha1"; /** AppDescriptor describes a cosmos-sdk based application */ export interface AppDescriptor { @@ -694,11 +694,11 @@ export const TxDescriptor = { }, toAmino(message: TxDescriptor): TxDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.msgs) { obj.msgs = message.msgs.map(e => e ? MsgDescriptor.toAmino(e) : undefined); } else { - obj.msgs = []; + obj.msgs = message.msgs; } return obj; }, @@ -802,7 +802,7 @@ export const AuthnDescriptor = { if (message.signModes) { obj.sign_modes = message.signModes.map(e => e ? SigningModeDescriptor.toAmino(e) : undefined); } else { - obj.sign_modes = []; + obj.sign_modes = message.signModes; } return obj; }, @@ -929,9 +929,9 @@ export const SigningModeDescriptor = { }, toAmino(message: SigningModeDescriptor): SigningModeDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.number = omitDefault(message.number); - obj.authn_info_provider_method_fullname = omitDefault(message.authnInfoProviderMethodFullname); + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.authn_info_provider_method_fullname = message.authnInfoProviderMethodFullname === "" ? undefined : message.authnInfoProviderMethodFullname; return obj; }, fromAminoMsg(object: SigningModeDescriptorAminoMsg): SigningModeDescriptor { @@ -1025,7 +1025,7 @@ export const ChainDescriptor = { }, toAmino(message: ChainDescriptor): ChainDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: ChainDescriptorAminoMsg): ChainDescriptor { @@ -1128,7 +1128,7 @@ export const CodecDescriptor = { if (message.interfaces) { obj.interfaces = message.interfaces.map(e => e ? InterfaceDescriptor.toAmino(e) : undefined); } else { - obj.interfaces = []; + obj.interfaces = message.interfaces; } return obj; }, @@ -1267,16 +1267,16 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.interfaceAcceptingMessages) { obj.interface_accepting_messages = message.interfaceAcceptingMessages.map(e => e ? InterfaceAcceptingMessageDescriptor.toAmino(e) : undefined); } else { - obj.interface_accepting_messages = []; + obj.interface_accepting_messages = message.interfaceAcceptingMessages; } if (message.interfaceImplementers) { obj.interface_implementers = message.interfaceImplementers.map(e => e ? InterfaceImplementerDescriptor.toAmino(e) : undefined); } else { - obj.interface_implementers = []; + obj.interface_implementers = message.interfaceImplementers; } return obj; }, @@ -1387,8 +1387,8 @@ export const InterfaceImplementerDescriptor = { }, toAmino(message: InterfaceImplementerDescriptor): InterfaceImplementerDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.type_url = omitDefault(message.typeUrl); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; return obj; }, fromAminoMsg(object: InterfaceImplementerDescriptorAminoMsg): InterfaceImplementerDescriptor { @@ -1504,11 +1504,11 @@ export const InterfaceAcceptingMessageDescriptor = { }, toAmino(message: InterfaceAcceptingMessageDescriptor): InterfaceAcceptingMessageDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); + obj.fullname = message.fullname === "" ? undefined : message.fullname; if (message.fieldDescriptorNames) { obj.field_descriptor_names = message.fieldDescriptorNames.map(e => e); } else { - obj.field_descriptor_names = []; + obj.field_descriptor_names = message.fieldDescriptorNames; } return obj; }, @@ -1603,7 +1603,7 @@ export const ConfigurationDescriptor = { }, toAmino(message: ConfigurationDescriptor): ConfigurationDescriptorAmino { const obj: any = {}; - obj.bech32_account_address_prefix = omitDefault(message.bech32AccountAddressPrefix); + obj.bech32_account_address_prefix = message.bech32AccountAddressPrefix === "" ? undefined : message.bech32AccountAddressPrefix; return obj; }, fromAminoMsg(object: ConfigurationDescriptorAminoMsg): ConfigurationDescriptor { @@ -1697,7 +1697,7 @@ export const MsgDescriptor = { }, toAmino(message: MsgDescriptor): MsgDescriptorAmino { const obj: any = {}; - obj.msg_type_url = omitDefault(message.msgTypeUrl); + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; return obj; }, fromAminoMsg(object: MsgDescriptorAminoMsg): MsgDescriptor { @@ -2820,7 +2820,7 @@ export const QueryServicesDescriptor = { if (message.queryServices) { obj.query_services = message.queryServices.map(e => e ? QueryServiceDescriptor.toAmino(e) : undefined); } else { - obj.query_services = []; + obj.query_services = message.queryServices; } return obj; }, @@ -2953,12 +2953,12 @@ export const QueryServiceDescriptor = { }, toAmino(message: QueryServiceDescriptor): QueryServiceDescriptorAmino { const obj: any = {}; - obj.fullname = omitDefault(message.fullname); - obj.is_module = omitDefault(message.isModule); + obj.fullname = message.fullname === "" ? undefined : message.fullname; + obj.is_module = message.isModule === false ? undefined : message.isModule; if (message.methods) { obj.methods = message.methods.map(e => e ? QueryMethodDescriptor.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } return obj; }, @@ -3069,8 +3069,8 @@ export const QueryMethodDescriptor = { }, toAmino(message: QueryMethodDescriptor): QueryMethodDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.full_query_path = omitDefault(message.fullQueryPath); + obj.name = message.name === "" ? undefined : message.name; + obj.full_query_path = message.fullQueryPath === "" ? undefined : message.fullQueryPath; return obj; }, fromAminoMsg(object: QueryMethodDescriptorAminoMsg): QueryMethodDescriptor { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts index fa28d3445a..6a2bfd1322 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -278,8 +278,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; @@ -384,7 +384,7 @@ export const Metadata = { if (message.chunkHashes) { obj.chunk_hashes = message.chunkHashes.map(e => base64FromBytes(e)); } else { - obj.chunk_hashes = []; + obj.chunk_hashes = message.chunkHashes; } return obj; }, @@ -670,7 +670,7 @@ export const SnapshotStoreItem = { }, toAmino(message: SnapshotStoreItem): SnapshotStoreItemAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: SnapshotStoreItemAminoMsg): SnapshotStoreItem { @@ -817,7 +817,7 @@ export const SnapshotIAVLItem = { obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.version = message.version ? message.version.toString() : undefined; - obj.height = message.height; + obj.height = message.height === 0 ? undefined : message.height; return obj; }, fromAminoMsg(object: SnapshotIAVLItemAminoMsg): SnapshotIAVLItem { @@ -927,8 +927,8 @@ export const SnapshotExtensionMeta = { }, toAmino(message: SnapshotExtensionMeta): SnapshotExtensionMetaAmino { const obj: any = {}; - obj.name = message.name; - obj.format = message.format; + obj.name = message.name === "" ? undefined : message.name; + obj.format = message.format === 0 ? undefined : message.format; return obj; }, fromAminoMsg(object: SnapshotExtensionMetaAminoMsg): SnapshotExtensionMeta { @@ -1236,7 +1236,7 @@ export const SnapshotSchema = { if (message.keys) { obj.keys = message.keys.map(e => base64FromBytes(e)); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts index deff71edfe..189b44abe3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts @@ -158,7 +158,7 @@ export const CommitInfo = { if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { - obj.store_infos = []; + obj.store_infos = message.storeInfos; } return obj; }, @@ -271,7 +271,7 @@ export const StoreInfo = { }, toAmino(message: StoreInfo): StoreInfoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.commit_id = message.commitId ? CommitID.toAmino(message.commitId) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts index b656b5422b..23924bf152 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/listening.ts @@ -150,8 +150,8 @@ export const StoreKVPair = { }, toAmino(message: StoreKVPair): StoreKVPairAmino { const obj: any = {}; - obj.store_key = message.storeKey; - obj.delete = message.delete; + obj.store_key = message.storeKey === "" ? undefined : message.storeKey; + obj.delete = message.delete === false ? undefined : message.delete; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts index 5b2bc062da..5ce8b2c682 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts @@ -4,7 +4,7 @@ import { BlockID, BlockIDSDKType } from "../../../../tendermint/types/types"; import { Block, BlockSDKType } from "../../../../tendermint/types/block"; import { NodeInfo, NodeInfoSDKType } from "../../../../tendermint/p2p/types"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.base.tendermint.v1beta1"; /** GetValidatorSetByHeightRequest is the request type for the Query/GetValidatorSetByHeight RPC method. */ export interface GetValidatorSetByHeightRequest { @@ -311,7 +311,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -448,11 +448,11 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = omitDefault(message.blockHeight); + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -686,11 +686,11 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = omitDefault(message.blockHeight); + obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -840,10 +840,10 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); - obj.proposer_priority = omitDefault(message.proposerPriority); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -939,7 +939,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { @@ -1411,7 +1411,7 @@ export const GetSyncingResponse = { }, toAmino(message: GetSyncingResponse): GetSyncingResponseAmino { const obj: any = {}; - obj.syncing = omitDefault(message.syncing); + obj.syncing = message.syncing === false ? undefined : message.syncing; return obj; }, fromAminoMsg(object: GetSyncingResponseAminoMsg): GetSyncingResponse { @@ -1812,18 +1812,18 @@ export const VersionInfo = { }, toAmino(message: VersionInfo): VersionInfoAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.app_name = omitDefault(message.appName); - obj.version = omitDefault(message.version); - obj.git_commit = omitDefault(message.gitCommit); - obj.build_tags = omitDefault(message.buildTags); - obj.go_version = omitDefault(message.goVersion); + obj.name = message.name === "" ? undefined : message.name; + obj.app_name = message.appName === "" ? undefined : message.appName; + obj.version = message.version === "" ? undefined : message.version; + obj.git_commit = message.gitCommit === "" ? undefined : message.gitCommit; + obj.build_tags = message.buildTags === "" ? undefined : message.buildTags; + obj.go_version = message.goVersion === "" ? undefined : message.goVersion; if (message.buildDeps) { obj.build_deps = message.buildDeps.map(e => e ? Module.toAmino(e) : undefined); } else { - obj.build_deps = []; + obj.build_deps = message.buildDeps; } - obj.cosmos_sdk_version = omitDefault(message.cosmosSdkVersion); + obj.cosmos_sdk_version = message.cosmosSdkVersion === "" ? undefined : message.cosmosSdkVersion; return obj; }, fromAminoMsg(object: VersionInfoAminoMsg): VersionInfo { @@ -1949,9 +1949,9 @@ export const Module = { }, toAmino(message: Module): ModuleAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.version = omitDefault(message.version); - obj.sum = omitDefault(message.sum); + obj.path = message.path === "" ? undefined : message.path; + obj.version = message.version === "" ? undefined : message.version; + obj.sum = message.sum === "" ? undefined : message.sum; return obj; }, fromAminoMsg(object: ModuleAminoMsg): Module { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts b/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts index 0d289cf4d2..4ff5ee250a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/v1beta1/coin.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.base.v1beta1"; /** * Coin defines a token with a denomination and an amount. @@ -158,8 +158,8 @@ export const Coin = { }, toAmino(message: Coin): CoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: CoinAminoMsg): Coin { @@ -269,8 +269,8 @@ export const DecCoin = { }, toAmino(message: DecCoin): DecCoinAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: DecCoinAminoMsg): DecCoin { @@ -364,7 +364,7 @@ export const IntProto = { }, toAmino(message: IntProto): IntProtoAmino { const obj: any = {}; - obj.int = omitDefault(message.int); + obj.int = message.int === "" ? undefined : message.int; return obj; }, fromAminoMsg(object: IntProtoAminoMsg): IntProto { @@ -458,7 +458,7 @@ export const DecProto = { }, toAmino(message: DecProto): DecProtoAmino { const obj: any = {}; - obj.dec = omitDefault(message.dec); + obj.dec = message.dec === "" ? undefined : message.dec; return obj; }, fromAminoMsg(object: DecProtoAminoMsg): DecProto { diff --git a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts index 39a9b11c87..560e36c210 100644 --- a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** * Capability defines an implementation of an object capability. The index @@ -128,7 +128,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { @@ -238,8 +238,8 @@ export const Owner = { }, toAmino(message: Owner): OwnerAmino { const obj: any = {}; - obj.module = omitDefault(message.module); - obj.name = omitDefault(message.name); + obj.module = message.module === "" ? undefined : message.module; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: OwnerAminoMsg): Owner { @@ -342,7 +342,7 @@ export const CapabilityOwners = { if (message.owners) { obj.owners = message.owners.map(e => e ? Owner.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts index fa7e2bb472..babd51f927 100644 --- a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { CapabilityOwners, CapabilityOwnersSDKType } from "./capability"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.capability.v1beta1"; /** GenesisOwners defines the capability owners with their corresponding index. */ export interface GenesisOwners { @@ -126,7 +126,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -245,11 +245,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = omitDefault(message.index); + obj.index = message.index ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { - obj.owners = []; + obj.owners = message.owners; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts index 4e1341a976..d7d8a0d9f6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crisis/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crisis.v1beta1"; /** MsgVerifyInvariant represents a message to verify a particular invariance. */ export interface MsgVerifyInvariant { @@ -126,9 +126,9 @@ export const MsgVerifyInvariant = { }, toAmino(message: MsgVerifyInvariant): MsgVerifyInvariantAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.invariant_module_name = omitDefault(message.invariantModuleName); - obj.invariant_route = omitDefault(message.invariantRoute); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.invariant_module_name = message.invariantModuleName === "" ? undefined : message.invariantModuleName; + obj.invariant_route = message.invariantRoute === "" ? undefined : message.invariantRoute; return obj; }, fromAminoMsg(object: MsgVerifyInvariantAminoMsg): MsgVerifyInvariant { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts index 332471c83d..e6b9131273 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/hd/v1/hd.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.hd.v1"; /** BIP44Params is used as path field in ledger item in Record. */ export interface BIP44Params { @@ -162,11 +162,11 @@ export const BIP44Params = { }, toAmino(message: BIP44Params): BIP44ParamsAmino { const obj: any = {}; - obj.purpose = omitDefault(message.purpose); - obj.coin_type = omitDefault(message.coinType); - obj.account = omitDefault(message.account); - obj.change = omitDefault(message.change); - obj.address_index = omitDefault(message.addressIndex); + obj.purpose = message.purpose === 0 ? undefined : message.purpose; + obj.coin_type = message.coinType === 0 ? undefined : message.coinType; + obj.account = message.account === 0 ? undefined : message.account; + obj.change = message.change === false ? undefined : message.change; + obj.address_index = message.addressIndex === 0 ? undefined : message.addressIndex; return obj; }, fromAminoMsg(object: BIP44ParamsAminoMsg): BIP44Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts index e36a5dc728..0afcc743c5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/keyring/v1/record.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { BIP44Params, BIP44ParamsSDKType } from "../../hd/v1/hd"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "cosmos.crypto.keyring.v1"; /** Record is used for representing a key in the keyring. */ export interface Record { @@ -238,7 +238,7 @@ export const Record = { }, toAmino(message: Record): RecordAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; obj.local = message.local ? Record_Local.toAmino(message.local) : undefined; obj.ledger = message.ledger ? Record_Ledger.toAmino(message.ledger) : undefined; @@ -356,7 +356,7 @@ export const Record_Local = { toAmino(message: Record_Local): Record_LocalAmino { const obj: any = {}; obj.priv_key = message.privKey ? Any.toAmino(message.privKey) : undefined; - obj.priv_key_type = omitDefault(message.privKeyType); + obj.priv_key_type = message.privKeyType === "" ? undefined : message.privKeyType; return obj; }, fromAminoMsg(object: Record_LocalAminoMsg): Record_Local { diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts index f33e1a884a..aabd5a7261 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/keys.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.crypto.multisig"; /** * LegacyAminoPubKey specifies a public key type @@ -115,11 +115,11 @@ export const LegacyAminoPubKey = { }, toAmino(message: LegacyAminoPubKey): LegacyAminoPubKeyAmino { const obj: any = {}; - obj.threshold = omitDefault(message.threshold); + obj.threshold = message.threshold === 0 ? undefined : message.threshold; if (message.publicKeys) { obj.public_keys = message.publicKeys.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.public_keys = []; + obj.public_keys = message.publicKeys; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts index f14d457ff2..2066e7f759 100644 --- a/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts +++ b/__fixtures__/v-next/outputv4/cosmos/crypto/multisig/v1beta1/multisig.ts @@ -123,7 +123,7 @@ export const MultiSignature = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -234,7 +234,7 @@ export const CompactBitArray = { }, toAmino(message: CompactBitArray): CompactBitArrayAmino { const obj: any = {}; - obj.extra_bits_stored = message.extraBitsStored; + obj.extra_bits_stored = message.extraBitsStored === 0 ? undefined : message.extraBitsStored; obj.elems = message.elems ? base64FromBytes(message.elems) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts index 5f0edf7c6a..0589e6403e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType, Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** Params defines the set of params for the distribution module. */ export interface Params { @@ -386,10 +386,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.community_tax = padDecimal(message.communityTax); - obj.base_proposer_reward = padDecimal(message.baseProposerReward); - obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward); - obj.withdraw_addr_enabled = omitDefault(message.withdrawAddrEnabled); + obj.community_tax = padDecimal(message.communityTax) === "" ? undefined : padDecimal(message.communityTax); + obj.base_proposer_reward = padDecimal(message.baseProposerReward) === "" ? undefined : padDecimal(message.baseProposerReward); + obj.bonus_proposer_reward = padDecimal(message.bonusProposerReward) === "" ? undefined : padDecimal(message.bonusProposerReward); + obj.withdraw_addr_enabled = message.withdrawAddrEnabled === false ? undefined : message.withdrawAddrEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -508,9 +508,9 @@ export const ValidatorHistoricalRewards = { if (message.cumulativeRewardRatio) { obj.cumulative_reward_ratio = message.cumulativeRewardRatio.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.cumulative_reward_ratio = []; + obj.cumulative_reward_ratio = message.cumulativeRewardRatio; } - obj.reference_count = omitDefault(message.referenceCount); + obj.reference_count = message.referenceCount === 0 ? undefined : message.referenceCount; return obj; }, fromAminoMsg(object: ValidatorHistoricalRewardsAminoMsg): ValidatorHistoricalRewards { @@ -631,9 +631,9 @@ export const ValidatorCurrentRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -736,7 +736,7 @@ export const ValidatorAccumulatedCommission = { if (message.commission) { obj.commission = message.commission.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.commission = []; + obj.commission = message.commission; } return obj; }, @@ -840,7 +840,7 @@ export const ValidatorOutstandingRewards = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -953,8 +953,8 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = omitDefault(message.validatorPeriod); - obj.fraction = padDecimal(message.fraction); + obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.fraction = padDecimal(message.fraction) === "" ? undefined : padDecimal(message.fraction); return obj; }, fromAminoMsg(object: ValidatorSlashEventAminoMsg): ValidatorSlashEvent { @@ -1057,7 +1057,7 @@ export const ValidatorSlashEvents = { if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, @@ -1161,7 +1161,7 @@ export const FeePool = { if (message.communityPool) { obj.community_pool = message.communityPool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.community_pool = []; + obj.community_pool = message.communityPool; } return obj; }, @@ -1310,13 +1310,13 @@ export const CommunityPoolSpendProposal = { }, toAmino(message: CommunityPoolSpendProposal): CommunityPoolSpendProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -1447,9 +1447,9 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = omitDefault(message.previousPeriod); - obj.stake = padDecimal(message.stake); - obj.height = message.height; + obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.stake = padDecimal(message.stake) === "" ? undefined : padDecimal(message.stake); + obj.height = message.height ? message.height.toString() : "0"; return obj; }, fromAminoMsg(object: DelegatorStartingInfoAminoMsg): DelegatorStartingInfo { @@ -1565,11 +1565,11 @@ export const DelegationDelegatorReward = { }, toAmino(message: DelegationDelegatorReward): DelegationDelegatorRewardAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.reward) { obj.reward = message.reward.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.reward = []; + obj.reward = message.reward; } return obj; }, @@ -1728,11 +1728,11 @@ export const CommunityPoolSpendProposalWithDeposit = { }, toAmino(message: CommunityPoolSpendProposalWithDeposit): CommunityPoolSpendProposalWithDepositAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.recipient = omitDefault(message.recipient); - obj.amount = omitDefault(message.amount); - obj.deposit = omitDefault(message.deposit); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.recipient = message.recipient === "" ? undefined : message.recipient; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.deposit = message.deposit === "" ? undefined : message.deposit; return obj; }, fromAminoMsg(object: CommunityPoolSpendProposalWithDepositAminoMsg): CommunityPoolSpendProposalWithDeposit { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts index 34afe2e698..770aac4ff1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorHistoricalRewards, ValidatorHistoricalRewardsSDKType, ValidatorCurrentRewards, ValidatorCurrentRewardsSDKType, DelegatorStartingInfo, DelegatorStartingInfoSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, Params, ParamsSDKType, FeePool, FeePoolSDKType } from "./distribution"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * DelegatorWithdrawInfo is the address for where distributions rewards are @@ -272,8 +272,8 @@ export const DelegatorWithdrawInfo = { }, toAmino(message: DelegatorWithdrawInfo): DelegatorWithdrawInfoAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DelegatorWithdrawInfoAminoMsg): DelegatorWithdrawInfo { @@ -389,11 +389,11 @@ export const ValidatorOutstandingRewardsRecord = { }, toAmino(message: ValidatorOutstandingRewardsRecord): ValidatorOutstandingRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } return obj; }, @@ -506,7 +506,7 @@ export const ValidatorAccumulatedCommissionRecord = { }, toAmino(message: ValidatorAccumulatedCommissionRecord): ValidatorAccumulatedCommissionRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.accumulated = message.accumulated ? ValidatorAccumulatedCommission.toAmino(message.accumulated) : undefined; return obj; }, @@ -637,8 +637,8 @@ export const ValidatorHistoricalRewardsRecord = { }, toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.period = omitDefault(message.period); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.period = message.period ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -751,7 +751,7 @@ export const ValidatorCurrentRewardsRecord = { }, toAmino(message: ValidatorCurrentRewardsRecord): ValidatorCurrentRewardsRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.rewards = message.rewards ? ValidatorCurrentRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -880,8 +880,8 @@ export const DelegatorStartingInfoRecord = { }, toAmino(message: DelegatorStartingInfoRecord): DelegatorStartingInfoRecordAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.starting_info = message.startingInfo ? DelegatorStartingInfo.toAmino(message.startingInfo) : undefined; return obj; }, @@ -1030,9 +1030,9 @@ export const ValidatorSlashEventRecord = { }, toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.height = omitDefault(message.height); - obj.period = omitDefault(message.period); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.height = message.height ? message.height.toString() : undefined; + obj.period = message.period ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, @@ -1322,38 +1322,38 @@ export const GenesisState = { if (message.delegatorWithdrawInfos) { obj.delegator_withdraw_infos = message.delegatorWithdrawInfos.map(e => e ? DelegatorWithdrawInfo.toAmino(e) : undefined); } else { - obj.delegator_withdraw_infos = []; + obj.delegator_withdraw_infos = message.delegatorWithdrawInfos; } - obj.previous_proposer = omitDefault(message.previousProposer); + obj.previous_proposer = message.previousProposer === "" ? undefined : message.previousProposer; if (message.outstandingRewards) { obj.outstanding_rewards = message.outstandingRewards.map(e => e ? ValidatorOutstandingRewardsRecord.toAmino(e) : undefined); } else { - obj.outstanding_rewards = []; + obj.outstanding_rewards = message.outstandingRewards; } if (message.validatorAccumulatedCommissions) { obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions.map(e => e ? ValidatorAccumulatedCommissionRecord.toAmino(e) : undefined); } else { - obj.validator_accumulated_commissions = []; + obj.validator_accumulated_commissions = message.validatorAccumulatedCommissions; } if (message.validatorHistoricalRewards) { obj.validator_historical_rewards = message.validatorHistoricalRewards.map(e => e ? ValidatorHistoricalRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_historical_rewards = []; + obj.validator_historical_rewards = message.validatorHistoricalRewards; } if (message.validatorCurrentRewards) { obj.validator_current_rewards = message.validatorCurrentRewards.map(e => e ? ValidatorCurrentRewardsRecord.toAmino(e) : undefined); } else { - obj.validator_current_rewards = []; + obj.validator_current_rewards = message.validatorCurrentRewards; } if (message.delegatorStartingInfos) { obj.delegator_starting_infos = message.delegatorStartingInfos.map(e => e ? DelegatorStartingInfoRecord.toAmino(e) : undefined); } else { - obj.delegator_starting_infos = []; + obj.delegator_starting_infos = message.delegatorStartingInfos; } if (message.validatorSlashEvents) { obj.validator_slash_events = message.validatorSlashEvents.map(e => e ? ValidatorSlashEventRecord.toAmino(e) : undefined); } else { - obj.validator_slash_events = []; + obj.validator_slash_events = message.validatorSlashEvents; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts index 22b281150a..09b6b4786c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Params, ParamsSDKType, ValidatorOutstandingRewards, ValidatorOutstandingRewardsSDKType, ValidatorAccumulatedCommission, ValidatorAccumulatedCommissionSDKType, ValidatorSlashEvent, ValidatorSlashEventSDKType, DelegationDelegatorReward, DelegationDelegatorRewardSDKType } from "./distribution"; import { DecCoin, DecCoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -580,7 +580,7 @@ export const QueryValidatorOutstandingRewardsRequest = { }, toAmino(message: QueryValidatorOutstandingRewardsRequest): QueryValidatorOutstandingRewardsRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorOutstandingRewardsRequestAminoMsg): QueryValidatorOutstandingRewardsRequest { @@ -770,7 +770,7 @@ export const QueryValidatorCommissionRequest = { }, toAmino(message: QueryValidatorCommissionRequest): QueryValidatorCommissionRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryValidatorCommissionRequestAminoMsg): QueryValidatorCommissionRequest { @@ -1014,9 +1014,9 @@ export const QueryValidatorSlashesRequest = { }, toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); - obj.starting_height = omitDefault(message.startingHeight); - obj.ending_height = omitDefault(message.endingHeight); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1138,7 +1138,7 @@ export const QueryValidatorSlashesResponse = { if (message.slashes) { obj.slashes = message.slashes.map(e => e ? ValidatorSlashEvent.toAmino(e) : undefined); } else { - obj.slashes = []; + obj.slashes = message.slashes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1250,8 +1250,8 @@ export const QueryDelegationRewardsRequest = { }, toAmino(message: QueryDelegationRewardsRequest): QueryDelegationRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationRewardsRequestAminoMsg): QueryDelegationRewardsRequest { @@ -1354,7 +1354,7 @@ export const QueryDelegationRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, @@ -1449,7 +1449,7 @@ export const QueryDelegationTotalRewardsRequest = { }, toAmino(message: QueryDelegationTotalRewardsRequest): QueryDelegationTotalRewardsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegationTotalRewardsRequestAminoMsg): QueryDelegationTotalRewardsRequest { @@ -1574,12 +1574,12 @@ export const QueryDelegationTotalRewardsResponse = { if (message.rewards) { obj.rewards = message.rewards.map(e => e ? DelegationDelegatorReward.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } if (message.total) { obj.total = message.total.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.total = []; + obj.total = message.total; } return obj; }, @@ -1674,7 +1674,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorsRequestAminoMsg): QueryDelegatorValidatorsRequest { @@ -1777,7 +1777,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e); } else { - obj.validators = []; + obj.validators = message.validators; } return obj; }, @@ -1872,7 +1872,7 @@ export const QueryDelegatorWithdrawAddressRequest = { }, toAmino(message: QueryDelegatorWithdrawAddressRequest): QueryDelegatorWithdrawAddressRequestAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressRequestAminoMsg): QueryDelegatorWithdrawAddressRequest { @@ -1966,7 +1966,7 @@ export const QueryDelegatorWithdrawAddressResponse = { }, toAmino(message: QueryDelegatorWithdrawAddressResponse): QueryDelegatorWithdrawAddressResponseAmino { const obj: any = {}; - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: QueryDelegatorWithdrawAddressResponseAminoMsg): QueryDelegatorWithdrawAddressResponse { @@ -2143,7 +2143,7 @@ export const QueryCommunityPoolResponse = { if (message.pool) { obj.pool = message.pool.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.pool = []; + obj.pool = message.pool; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts index 05a4e031f8..86be0e8941 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts @@ -111,7 +111,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts index f2cdccc1cc..4c4e7aab5e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.distribution.v1beta1"; /** * MsgSetWithdrawAddress sets the withdraw address for @@ -205,8 +205,8 @@ export const MsgSetWithdrawAddress = { }, toAmino(message: MsgSetWithdrawAddress): MsgSetWithdrawAddressAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgSetWithdrawAddressAminoMsg): MsgSetWithdrawAddress { @@ -390,8 +390,8 @@ export const MsgWithdrawDelegatorReward = { }, toAmino(message: MsgWithdrawDelegatorReward): MsgWithdrawDelegatorRewardAmino { const obj: any = {}; - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawDelegatorRewardAminoMsg): MsgWithdrawDelegatorReward { @@ -494,7 +494,7 @@ export const MsgWithdrawDelegatorRewardResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -589,7 +589,7 @@ export const MsgWithdrawValidatorCommission = { }, toAmino(message: MsgWithdrawValidatorCommission): MsgWithdrawValidatorCommissionAmino { const obj: any = {}; - obj.validator_address = omitDefault(message.validatorAddress); + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: MsgWithdrawValidatorCommissionAminoMsg): MsgWithdrawValidatorCommission { @@ -692,7 +692,7 @@ export const MsgWithdrawValidatorCommissionResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -812,9 +812,9 @@ export const MsgFundCommunityPool = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.depositor = omitDefault(message.depositor); + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: MsgFundCommunityPoolAminoMsg): MsgFundCommunityPool { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts index 52251debe1..177cc55a60 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts @@ -150,7 +150,7 @@ export const Equivocation = { obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.power = message.power ? message.power.toString() : undefined; - obj.consensus_address = message.consensusAddress; + obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, fromAminoMsg(object: EquivocationAminoMsg): Equivocation { diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/genesis.ts index 36f4ac6267..0f9af10194 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/genesis.ts @@ -93,7 +93,7 @@ export const GenesisState = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.ts index 10fdce2c79..ff8e98afc0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/query.ts @@ -452,7 +452,7 @@ export const QueryAllEvidenceResponse = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts index 4abb8bc814..6d45f73942 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts @@ -33,7 +33,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: { + evidence: evidence == null ? evidence : { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts index 8a96fe99ee..dad536bebf 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.evidence.v1beta1"; /** * MsgSubmitEvidence represents a message that supports submitting arbitrary @@ -122,7 +122,7 @@ export const MsgSubmitEvidence = { }, toAmino(message: MsgSubmitEvidence): MsgSubmitEvidenceAmino { const obj: any = {}; - obj.submitter = omitDefault(message.submitter); + obj.submitter = message.submitter === "" ? undefined : message.submitter; obj.evidence = message.evidence ? Any.toAmino(message.evidence) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts index 19615801a1..a6646039c5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/feegrant.ts @@ -201,7 +201,7 @@ export const BasicAllowance = { if (message.spendLimit) { obj.spend_limit = message.spendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.spend_limit = []; + obj.spend_limit = message.spendLimit; } obj.expiration = message.expiration ? Timestamp.toAmino(toTimestamp(message.expiration)) : undefined; return obj; @@ -382,12 +382,12 @@ export const PeriodicAllowance = { if (message.periodSpendLimit) { obj.period_spend_limit = message.periodSpendLimit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_spend_limit = []; + obj.period_spend_limit = message.periodSpendLimit; } if (message.periodCanSpend) { obj.period_can_spend = message.periodCanSpend.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.period_can_spend = []; + obj.period_can_spend = message.periodCanSpend; } obj.period_reset = message.periodReset ? Timestamp.toAmino(toTimestamp(message.periodReset)) : undefined; return obj; @@ -511,7 +511,7 @@ export const AllowedMsgAllowance = { if (message.allowedMessages) { obj.allowed_messages = message.allowedMessages.map(e => e); } else { - obj.allowed_messages = []; + obj.allowed_messages = message.allowedMessages; } return obj; }, @@ -640,8 +640,8 @@ export const Grant = { }, toAmino(message: Grant): GrantAmino { const obj: any = {}; - obj.granter = message.granter; - obj.grantee = message.grantee; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/genesis.ts index 824ca6b8c0..fcf07fd608 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts index ecff28630d..98978433d2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Grant, GrantSDKType } from "./feegrant"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */ export interface QueryAllowanceRequest { @@ -179,8 +179,8 @@ export const QueryAllowanceRequest = { }, toAmino(message: QueryAllowanceRequest): QueryAllowanceRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: QueryAllowanceRequestAminoMsg): QueryAllowanceRequest { @@ -388,7 +388,7 @@ export const QueryAllowancesRequest = { }, toAmino(message: QueryAllowancesRequest): QueryAllowancesRequestAmino { const obj: any = {}; - obj.grantee = omitDefault(message.grantee); + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -510,7 +510,7 @@ export const QueryAllowancesResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -624,7 +624,7 @@ export const QueryAllowancesByGranterRequest = { }, toAmino(message: QueryAllowancesByGranterRequest): QueryAllowancesByGranterRequestAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); + obj.granter = message.granter === "" ? undefined : message.granter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -746,7 +746,7 @@ export const QueryAllowancesByGranterResponse = { if (message.allowances) { obj.allowances = message.allowances.map(e => e ? Grant.toAmino(e) : undefined); } else { - obj.allowances = []; + obj.allowances = message.allowances; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts index 08792b032d..ae2e63181f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: { + allowance: allowance == null ? allowance : { typeUrl: allowance.type_url, value: allowance.value } diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts index eabe3a490d..0dcc83f50e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.feegrant.v1beta1"; /** * MsgGrantAllowance adds permission for Grantee to spend up to Allowance @@ -162,8 +162,8 @@ export const MsgGrantAllowance = { }, toAmino(message: MsgGrantAllowance): MsgGrantAllowanceAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; obj.allowance = message.allowance ? Any.toAmino(message.allowance) : undefined; return obj; }, @@ -348,8 +348,8 @@ export const MsgRevokeAllowance = { }, toAmino(message: MsgRevokeAllowance): MsgRevokeAllowanceAmino { const obj: any = {}; - obj.granter = omitDefault(message.granter); - obj.grantee = omitDefault(message.grantee); + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; return obj; }, fromAminoMsg(object: MsgRevokeAllowanceAminoMsg): MsgRevokeAllowance { diff --git a/__fixtures__/v-next/outputv4/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/genutil/v1beta1/genesis.ts index 338baea52b..5bedc0a94f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/genutil/v1beta1/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { if (message.genTxs) { obj.gen_txs = message.genTxs.map(e => base64FromBytes(e)); } else { - obj.gen_txs = []; + obj.gen_txs = message.genTxs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts index e9e9323788..ca340c46b4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -224,21 +224,21 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts index ec47d12fda..2d1a4fad72 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts @@ -385,7 +385,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -394,8 +394,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -530,11 +530,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -764,7 +764,7 @@ export const Proposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -793,20 +793,20 @@ export const Proposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: ProposalAminoMsg): Proposal { @@ -948,10 +948,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1102,13 +1102,13 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: VoteAminoMsg): Vote { @@ -1229,7 +1229,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -1453,9 +1453,9 @@ export const TallyParams = { }, toAmino(message: TallyParams): TallyParamsAmino { const obj: any = {}; - obj.quorum = message.quorum; - obj.threshold = message.threshold; - obj.veto_threshold = message.vetoThreshold; + obj.quorum = message.quorum === "" ? undefined : message.quorum; + obj.threshold = message.threshold === "" ? undefined : message.threshold; + obj.veto_threshold = message.vetoThreshold === "" ? undefined : message.vetoThreshold; return obj; }, fromAminoMsg(object: TallyParamsAminoMsg): TallyParams { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts index 62971f184a..d62ff97658 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts @@ -549,7 +549,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -564,9 +564,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -688,7 +688,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -803,7 +803,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1135,7 +1135,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1231,7 +1231,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1478,7 +1478,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1810,7 +1810,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index 3ee8d1dcaa..c8dd2d001c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -90,11 +90,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -122,7 +122,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, @@ -152,9 +152,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata }; } @@ -184,10 +184,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -216,9 +216,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts index 280aabcbf9..e373ff2c21 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts @@ -279,15 +279,15 @@ export const MsgSubmitProposal = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; - obj.metadata = message.metadata; + obj.proposer = message.proposer === "" ? undefined : message.proposer; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -496,7 +496,7 @@ export const MsgExecLegacyContent = { toAmino(message: MsgExecLegacyContent): MsgExecLegacyContentAmino { const obj: any = {}; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.authority = message.authority; + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgExecLegacyContentAminoMsg): MsgExecLegacyContent { @@ -705,7 +705,7 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -714,10 +714,10 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -941,14 +941,14 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgVoteWeightedAminoMsg): MsgVoteWeighted { @@ -1156,12 +1156,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts index ed72e3225d..86d0f07abe 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Deposit, DepositSDKType, Vote, VoteSDKType, Proposal, ProposalSDKType, DepositParams, DepositParamsSDKType, VotingParams, VotingParamsSDKType, TallyParams, TallyParamsSDKType } from "./gov"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** GenesisState defines the gov module's genesis state. */ export interface GenesisState { @@ -224,21 +224,21 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = omitDefault(message.startingProposalId); + obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.deposit_params = message.depositParams ? DepositParams.toAmino(message.depositParams) : undefined; obj.voting_params = message.votingParams ? VotingParams.toAmino(message.votingParams) : undefined; diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts index a7c45ac114..576665471a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts @@ -4,7 +4,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp" import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.gov.v1beta1"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -418,7 +418,7 @@ export const WeightedVoteOption = { fromAmino(object: WeightedVoteOptionAmino): WeightedVoteOption { const message = createBaseWeightedVoteOption(); if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.weight !== undefined && object.weight !== null) { message.weight = object.weight; @@ -427,8 +427,8 @@ export const WeightedVoteOption = { }, toAmino(message: WeightedVoteOption): WeightedVoteOptionAmino { const obj: any = {}; - obj.option = voteOptionToJSON(message.option); - obj.weight = message.weight; + obj.option = message.option === 0 ? undefined : message.option; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedVoteOptionAminoMsg): WeightedVoteOption { @@ -538,8 +538,8 @@ export const TextProposal = { }, toAmino(message: TextProposal): TextProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: TextProposalAminoMsg): TextProposal { @@ -674,11 +674,11 @@ export const Deposit = { toAmino(message: Deposit): DepositAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -891,7 +891,7 @@ export const Proposal = { message.content = Any.fromAmino(object.content); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -915,14 +915,14 @@ export const Proposal = { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; - obj.status = proposalStatusToJSON(message.status); + obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.deposit_end_time = message.depositEndTime ? Timestamp.toAmino(toTimestamp(message.depositEndTime)) : undefined; if (message.totalDeposit) { obj.total_deposit = message.totalDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_deposit = []; + obj.total_deposit = message.totalDeposit; } obj.voting_start_time = message.votingStartTime ? Timestamp.toAmino(toTimestamp(message.votingStartTime)) : undefined; obj.voting_end_time = message.votingEndTime ? Timestamp.toAmino(toTimestamp(message.votingEndTime)) : undefined; @@ -1067,10 +1067,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes = message.yes; - obj.abstain = message.abstain; - obj.no = message.no; - obj.no_with_veto = message.noWithVeto; + obj.yes = message.yes === "" ? undefined : message.yes; + obj.abstain = message.abstain === "" ? undefined : message.abstain; + obj.no = message.no === "" ? undefined : message.no; + obj.no_with_veto = message.noWithVeto === "" ? undefined : message.noWithVeto; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -1213,20 +1213,20 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } message.options = object.options?.map(e => WeightedVoteOption.fromAmino(e)) || []; return message; }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1348,7 +1348,7 @@ export const DepositParams = { if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts index 0994ffd094..9424d83417 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts @@ -549,7 +549,7 @@ export const QueryProposalsRequest = { fromAmino(object: QueryProposalsRequestAmino): QueryProposalsRequest { const message = createBaseQueryProposalsRequest(); if (object.proposal_status !== undefined && object.proposal_status !== null) { - message.proposalStatus = proposalStatusFromJSON(object.proposal_status); + message.proposalStatus = object.proposal_status; } if (object.voter !== undefined && object.voter !== null) { message.voter = object.voter; @@ -564,9 +564,9 @@ export const QueryProposalsRequest = { }, toAmino(message: QueryProposalsRequest): QueryProposalsRequestAmino { const obj: any = {}; - obj.proposal_status = proposalStatusToJSON(message.proposalStatus); - obj.voter = message.voter; - obj.depositor = message.depositor; + obj.proposal_status = message.proposalStatus === 0 ? undefined : message.proposalStatus; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.depositor = message.depositor === "" ? undefined : message.depositor; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -688,7 +688,7 @@ export const QueryProposalsResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -803,7 +803,7 @@ export const QueryVoteRequest = { toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteRequestAminoMsg): QueryVoteRequest { @@ -1135,7 +1135,7 @@ export const QueryVotesResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1231,7 +1231,7 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.params_type = message.paramsType; + obj.params_type = message.paramsType === "" ? undefined : message.paramsType; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -1478,7 +1478,7 @@ export const QueryDepositRequest = { toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, fromAminoMsg(object: QueryDepositRequestAminoMsg): QueryDepositRequest { @@ -1810,7 +1810,7 @@ export const QueryDepositsResponse = { if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { - obj.deposits = []; + obj.deposits = message.deposits; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index 8614717a58..db9b98121a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -74,11 +74,11 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -105,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option) + option: option == null ? option : voteOptionFromJSON(option) }; } }, @@ -133,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -164,9 +164,9 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts index 34cd0eb781..c51f6d9e71 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts @@ -239,9 +239,9 @@ export const MsgSubmitProposal = { if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = message.proposer; + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -337,7 +337,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -459,15 +459,15 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -675,12 +675,12 @@ export const MsgVoteWeighted = { }, toAmino(message: MsgVoteWeighted): MsgVoteWeightedAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -889,12 +889,12 @@ export const MsgDeposit = { }, toAmino(message: MsgDeposit): MsgDepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.depositor = message.depositor; + obj.proposal_id = message.proposalId ? message.proposalId.toString() : "0"; + obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts index 04fa045c5d..dcea2fb135 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts @@ -386,7 +386,7 @@ export const EventCreateGroupPolicy = { }, toAmino(message: EventCreateGroupPolicy): EventCreateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventCreateGroupPolicyAminoMsg): EventCreateGroupPolicy { @@ -480,7 +480,7 @@ export const EventUpdateGroupPolicy = { }, toAmino(message: EventUpdateGroupPolicy): EventUpdateGroupPolicyAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventUpdateGroupPolicyAminoMsg): EventUpdateGroupPolicy { @@ -874,14 +874,14 @@ export const EventExec = { message.proposalId = BigInt(object.proposal_id); } if (object.result !== undefined && object.result !== null) { - message.result = proposalExecutorResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.result = proposalExecutorResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: EventExecAminoMsg): EventExec { @@ -994,7 +994,7 @@ export const EventLeaveGroup = { toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: EventLeaveGroupAminoMsg): EventLeaveGroup { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts index 10dd91abf1..8f63f57201 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts @@ -1,6 +1,6 @@ import { GroupInfo, GroupInfoSDKType, GroupMember, GroupMemberSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** GenesisState defines the group module's genesis state. */ export interface GenesisState { @@ -262,33 +262,33 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = omitDefault(message.groupSeq); + obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } if (message.groupMembers) { obj.group_members = message.groupMembers.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.group_members = []; + obj.group_members = message.groupMembers; } - obj.group_policy_seq = omitDefault(message.groupPolicySeq); + obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } - obj.proposal_seq = omitDefault(message.proposalSeq); + obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts index c4a9a7c875..e28bd59ec0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { GroupInfo, GroupInfoSDKType, GroupPolicyInfo, GroupPolicyInfoSDKType, GroupMember, GroupMemberSDKType, Proposal, ProposalSDKType, Vote, VoteSDKType, TallyResult, TallyResultSDKType } from "./types"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.group.v1"; /** QueryGroupInfoRequest is the Query/GroupInfo request type. */ export interface QueryGroupInfoRequest { @@ -463,7 +463,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -653,7 +653,7 @@ export const QueryGroupPolicyInfoRequest = { }, toAmino(message: QueryGroupPolicyInfoRequest): QueryGroupPolicyInfoRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryGroupPolicyInfoRequestAminoMsg): QueryGroupPolicyInfoRequest { @@ -863,7 +863,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -985,7 +985,7 @@ export const QueryGroupMembersResponse = { if (message.members) { obj.members = message.members.map(e => e ? GroupMember.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1099,7 +1099,7 @@ export const QueryGroupsByAdminRequest = { }, toAmino(message: QueryGroupsByAdminRequest): QueryGroupsByAdminRequestAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1221,7 +1221,7 @@ export const QueryGroupsByAdminResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1337,7 +1337,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = omitDefault(message.groupId); + obj.group_id = message.groupId ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1459,7 +1459,7 @@ export const QueryGroupPoliciesByGroupResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1573,7 +1573,7 @@ export const QueryGroupPoliciesByAdminRequest = { }, toAmino(message: QueryGroupPoliciesByAdminRequest): QueryGroupPoliciesByAdminRequestAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1695,7 +1695,7 @@ export const QueryGroupPoliciesByAdminResponse = { if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { - obj.group_policies = []; + obj.group_policies = message.groupPolicies; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1793,7 +1793,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2001,7 +2001,7 @@ export const QueryProposalsByGroupPolicyRequest = { }, toAmino(message: QueryProposalsByGroupPolicyRequest): QueryProposalsByGroupPolicyRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2123,7 +2123,7 @@ export const QueryProposalsByGroupPolicyResponse = { if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { - obj.proposals = []; + obj.proposals = message.proposals; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2237,8 +2237,8 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); - obj.voter = omitDefault(message.voter); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, fromAminoMsg(object: QueryVoteByProposalVoterRequestAminoMsg): QueryVoteByProposalVoterRequest { @@ -2448,7 +2448,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2570,7 +2570,7 @@ export const QueryVotesByProposalResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2684,7 +2684,7 @@ export const QueryVotesByVoterRequest = { }, toAmino(message: QueryVotesByVoterRequest): QueryVotesByVoterRequestAmino { const obj: any = {}; - obj.voter = omitDefault(message.voter); + obj.voter = message.voter === "" ? undefined : message.voter; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2806,7 +2806,7 @@ export const QueryVotesByVoterResponse = { if (message.votes) { obj.votes = message.votes.map(e => e ? Vote.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2920,7 +2920,7 @@ export const QueryGroupsByMemberRequest = { }, toAmino(message: QueryGroupsByMemberRequest): QueryGroupsByMemberRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3042,7 +3042,7 @@ export const QueryGroupsByMemberResponse = { if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { - obj.groups = []; + obj.groups = message.groups; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3140,7 +3140,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = omitDefault(message.proposalId); + obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index e44a0f0c10..26b8514f79 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -1,6 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -155,14 +156,14 @@ export const AminoConverter = { metadata }: MsgCreateGroup): MsgCreateGroupAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - metadata + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -172,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -190,12 +191,12 @@ export const AminoConverter = { memberUpdates }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { - admin, - group_id: groupId.toString(), + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), member_updates: memberUpdates.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })) }; @@ -207,8 +208,8 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: BigInt(group_id), - memberUpdates: member_updates.map(el0 => ({ + groupId: group_id == null ? group_id : BigInt(group_id), + memberUpdates: member_updates.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -225,9 +226,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - new_admin: newAdmin + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -237,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), newAdmin: new_admin }; } @@ -250,9 +251,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -262,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), metadata }; } @@ -276,11 +277,11 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { - admin, - group_id: groupId.toString(), - metadata, + admin: omitDefault(admin), + group_id: omitDefault(groupId)?.toString?.(), + metadata: omitDefault(metadata), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -293,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: BigInt(group_id), + groupId: group_id == null ? group_id : BigInt(group_id), metadata, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -313,18 +314,18 @@ export const AminoConverter = { decisionPolicy }: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAminoType["value"] => { return { - admin, + admin: omitDefault(admin), members: members.map(el0 => ({ - address: el0.address, - weight: el0.weight, - metadata: el0.metadata, + address: omitDefault(el0.address), + weight: omitDefault(el0.weight), + metadata: omitDefault(el0.metadata), added_at: el0.addedAt })), - group_metadata: groupMetadata, - group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: groupPolicyAsAdmin, + group_metadata: omitDefault(groupMetadata), + group_policy_metadata: omitDefault(groupPolicyMetadata), + group_policy_as_admin: omitDefault(groupPolicyAsAdmin), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -339,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map(el0 => ({ + members: members.map?.(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -348,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -363,9 +364,9 @@ export const AminoConverter = { newAdmin }: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAminoType["value"] => { return { - admin, - address, - new_admin: newAdmin + admin: omitDefault(admin), + address: omitDefault(address), + new_admin: omitDefault(newAdmin) }; }, fromAmino: ({ @@ -388,10 +389,10 @@ export const AminoConverter = { decisionPolicy }: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAminoType["value"] => { return { - admin, - address, + admin: omitDefault(admin), + address: omitDefault(address), decision_policy: { - type_url: decisionPolicy.typeUrl, + type_url: omitDefault(decisionPolicy.typeUrl), value: decisionPolicy.value } }; @@ -404,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: { + decisionPolicy: decision_policy == null ? decision_policy : { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -419,9 +420,9 @@ export const AminoConverter = { metadata }: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAminoType["value"] => { return { - admin, - address, - metadata + admin: omitDefault(admin), + address: omitDefault(address), + metadata: omitDefault(metadata) }; }, fromAmino: ({ @@ -446,14 +447,14 @@ export const AminoConverter = { exec }: MsgSubmitProposal): MsgSubmitProposalAminoType["value"] => { return { - address, - proposers, - metadata, + address: omitDefault(address), + proposers: proposers, + metadata: omitDefault(metadata), messages: messages.map(el0 => ({ - type_url: el0.typeUrl, + type_url: omitDefault(el0.typeUrl), value: el0.value })), - exec + exec: exec }; }, fromAmino: ({ @@ -467,11 +468,11 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map(el0 => ({ + messages: messages.map?.(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -482,8 +483,8 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId.toString(), - address + proposal_id: omitDefault(proposalId)?.toString?.(), + address: omitDefault(address) }; }, fromAmino: ({ @@ -491,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), address }; } @@ -506,11 +507,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId.toString(), - voter, - option, - metadata, - exec + proposal_id: omitDefault(proposalId)?.toString?.(), + voter: omitDefault(voter), + option: option, + metadata: omitDefault(metadata), + exec: exec }; }, fromAmino: ({ @@ -521,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option), + option: option == null ? option : voteOptionFromJSON(option), metadata, - exec: execFromJSON(exec) + exec: exec == null ? exec : execFromJSON(exec) }; } }, @@ -536,8 +537,8 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId.toString(), - signer + proposal_id: omitDefault(proposalId)?.toString?.(), + signer: omitDefault(signer) }; }, fromAmino: ({ @@ -545,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), signer }; } @@ -557,8 +558,8 @@ export const AminoConverter = { groupId }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { - address, - group_id: groupId.toString() + address: omitDefault(address), + group_id: omitDefault(groupId)?.toString?.() }; }, fromAmino: ({ @@ -567,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: BigInt(group_id) + groupId: group_id == null ? group_id : BigInt(group_id) }; } } diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts index b89ad98892..9978c185d0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts @@ -581,13 +581,13 @@ export const MsgCreateGroup = { }, toAmino(message: MsgCreateGroup): MsgCreateGroupAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgCreateGroupAminoMsg): MsgCreateGroup { @@ -817,12 +817,12 @@ export const MsgUpdateGroupMembers = { }, toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.member_updates = []; + obj.member_updates = message.memberUpdates; } return obj; }, @@ -1025,9 +1025,9 @@ export const MsgUpdateGroupAdmin = { }, toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.new_admin = message.newAdmin; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupAdminAminoMsg): MsgUpdateGroupAdmin { @@ -1229,9 +1229,9 @@ export const MsgUpdateGroupMetadata = { }, toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupMetadataAminoMsg): MsgUpdateGroupMetadata { @@ -1451,9 +1451,9 @@ export const MsgCreateGroupPolicy = { }, toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1548,7 +1548,7 @@ export const MsgCreateGroupPolicyResponse = { }, toAmino(message: MsgCreateGroupPolicyResponse): MsgCreateGroupPolicyResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgCreateGroupPolicyResponseAminoMsg): MsgCreateGroupPolicyResponse { @@ -1674,9 +1674,9 @@ export const MsgUpdateGroupPolicyAdmin = { }, toAmino(message: MsgUpdateGroupPolicyAdmin): MsgUpdateGroupPolicyAdminAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.new_admin = message.newAdmin; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyAdminAminoMsg): MsgUpdateGroupPolicyAdmin { @@ -1858,15 +1858,15 @@ export const MsgCreateGroupWithPolicy = { }, toAmino(message: MsgCreateGroupWithPolicy): MsgCreateGroupWithPolicyAmino { const obj: any = {}; - obj.admin = message.admin; + obj.admin = message.admin === "" ? undefined : message.admin; if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } - obj.group_metadata = message.groupMetadata; - obj.group_policy_metadata = message.groupPolicyMetadata; - obj.group_policy_as_admin = message.groupPolicyAsAdmin; + obj.group_metadata = message.groupMetadata === "" ? undefined : message.groupMetadata; + obj.group_policy_metadata = message.groupPolicyMetadata === "" ? undefined : message.groupPolicyMetadata; + obj.group_policy_as_admin = message.groupPolicyAsAdmin === false ? undefined : message.groupPolicyAsAdmin; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -1980,7 +1980,7 @@ export const MsgCreateGroupWithPolicyResponse = { toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.group_policy_address = message.groupPolicyAddress; + obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, fromAminoMsg(object: MsgCreateGroupWithPolicyResponseAminoMsg): MsgCreateGroupWithPolicyResponse { @@ -2182,8 +2182,8 @@ export const MsgUpdateGroupPolicyDecisionPolicy = { }, toAmino(message: MsgUpdateGroupPolicyDecisionPolicy): MsgUpdateGroupPolicyDecisionPolicyAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; }, @@ -2384,9 +2384,9 @@ export const MsgUpdateGroupPolicyMetadata = { }, toAmino(message: MsgUpdateGroupPolicyMetadata): MsgUpdateGroupPolicyMetadataAmino { const obj: any = {}; - obj.admin = message.admin; - obj.address = message.address; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, fromAminoMsg(object: MsgUpdateGroupPolicyMetadataAminoMsg): MsgUpdateGroupPolicyMetadata { @@ -2624,25 +2624,25 @@ export const MsgSubmitProposal = { } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgSubmitProposal): MsgSubmitProposalAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } - obj.metadata = message.metadata; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.exec = execToJSON(message.exec); + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -2851,7 +2851,7 @@ export const MsgWithdrawProposal = { toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: MsgWithdrawProposalAminoMsg): MsgWithdrawProposal { @@ -3073,23 +3073,23 @@ export const MsgVote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; } if (object.exec !== undefined && object.exec !== null) { - message.exec = execFromJSON(object.exec); + message.exec = object.exec; } return message; }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; - obj.exec = execToJSON(message.exec); + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; + obj.exec = message.exec === 0 ? undefined : message.exec; return obj; }, fromAminoMsg(object: MsgVoteAminoMsg): MsgVote { @@ -3276,7 +3276,7 @@ export const MsgExec = { toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgExecAminoMsg): MsgExec { @@ -3462,7 +3462,7 @@ export const MsgLeaveGroup = { }, toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts index 6f9c46019a..0f7746a3b5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts @@ -643,9 +643,9 @@ export const Member = { }, toAmino(message: Member): MemberAmino { const obj: any = {}; - obj.address = message.address; - obj.weight = message.weight; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.weight = message.weight === "" ? undefined : message.weight; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.added_at = message.addedAt ? Timestamp.toAmino(toTimestamp(message.addedAt)) : undefined; return obj; }, @@ -749,7 +749,7 @@ export const Members = { if (message.members) { obj.members = message.members.map(e => e ? Member.toAmino(e) : undefined); } else { - obj.members = []; + obj.members = message.members; } return obj; }, @@ -862,7 +862,7 @@ export const ThresholdDecisionPolicy = { }, toAmino(message: ThresholdDecisionPolicy): ThresholdDecisionPolicyAmino { const obj: any = {}; - obj.threshold = message.threshold; + obj.threshold = message.threshold === "" ? undefined : message.threshold; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -975,7 +975,7 @@ export const PercentageDecisionPolicy = { }, toAmino(message: PercentageDecisionPolicy): PercentageDecisionPolicyAmino { const obj: any = {}; - obj.percentage = message.percentage; + obj.percentage = message.percentage === "" ? undefined : message.percentage; obj.windows = message.windows ? DecisionPolicyWindows.toAmino(message.windows) : undefined; return obj; }, @@ -1270,10 +1270,10 @@ export const GroupInfo = { toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; }, @@ -1585,10 +1585,10 @@ export const GroupPolicyInfo = { }, toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.group_id = message.groupId ? message.groupId.toString() : undefined; - obj.admin = message.admin; - obj.metadata = message.metadata; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.version = message.version ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; @@ -1878,10 +1878,10 @@ export const Proposal = { message.groupPolicyVersion = BigInt(object.group_policy_version); } if (object.status !== undefined && object.status !== null) { - message.status = proposalStatusFromJSON(object.status); + message.status = object.status; } if (object.result !== undefined && object.result !== null) { - message.result = proposalResultFromJSON(object.result); + message.result = object.result; } if (object.final_tally_result !== undefined && object.final_tally_result !== null) { message.finalTallyResult = TallyResult.fromAmino(object.final_tally_result); @@ -1890,7 +1890,7 @@ export const Proposal = { message.votingPeriodEnd = fromTimestamp(Timestamp.fromAmino(object.voting_period_end)); } if (object.executor_result !== undefined && object.executor_result !== null) { - message.executorResult = proposalExecutorResultFromJSON(object.executor_result); + message.executorResult = object.executor_result; } message.messages = object.messages?.map(e => Any.fromAmino(e)) || []; return message; @@ -1898,25 +1898,25 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.address = message.address; - obj.metadata = message.metadata; + obj.address = message.address === "" ? undefined : message.address; + obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { obj.proposers = message.proposers.map(e => e); } else { - obj.proposers = []; + obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; - obj.status = proposalStatusToJSON(message.status); - obj.result = proposalResultToJSON(message.result); + obj.status = message.status === 0 ? undefined : message.status; + obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; obj.voting_period_end = message.votingPeriodEnd ? Timestamp.toAmino(toTimestamp(message.votingPeriodEnd)) : undefined; - obj.executor_result = proposalExecutorResultToJSON(message.executorResult); + obj.executor_result = message.executorResult === 0 ? undefined : message.executorResult; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } return obj; }, @@ -2059,10 +2059,10 @@ export const TallyResult = { }, toAmino(message: TallyResult): TallyResultAmino { const obj: any = {}; - obj.yes_count = message.yesCount; - obj.abstain_count = message.abstainCount; - obj.no_count = message.noCount; - obj.no_with_veto_count = message.noWithVetoCount; + obj.yes_count = message.yesCount === "" ? undefined : message.yesCount; + obj.abstain_count = message.abstainCount === "" ? undefined : message.abstainCount; + obj.no_count = message.noCount === "" ? undefined : message.noCount; + obj.no_with_veto_count = message.noWithVetoCount === "" ? undefined : message.noWithVetoCount; return obj; }, fromAminoMsg(object: TallyResultAminoMsg): TallyResult { @@ -2210,7 +2210,7 @@ export const Vote = { message.voter = object.voter; } if (object.option !== undefined && object.option !== null) { - message.option = voteOptionFromJSON(object.option); + message.option = object.option; } if (object.metadata !== undefined && object.metadata !== null) { message.metadata = object.metadata; @@ -2223,9 +2223,9 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; - obj.voter = message.voter; - obj.option = voteOptionToJSON(message.option); - obj.metadata = message.metadata; + obj.voter = message.voter === "" ? undefined : message.voter; + obj.option = message.option === 0 ? undefined : message.option; + obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts index 9b25972335..964c7c4954 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "cosmos.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -131,8 +131,8 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.inflation = padDecimal(message.inflation); - obj.annual_provisions = padDecimal(message.annualProvisions); + obj.inflation = padDecimal(message.inflation) === "" ? undefined : padDecimal(message.inflation); + obj.annual_provisions = padDecimal(message.annualProvisions) === "" ? undefined : padDecimal(message.annualProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -308,12 +308,12 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.inflation_rate_change = padDecimal(message.inflationRateChange); - obj.inflation_max = padDecimal(message.inflationMax); - obj.inflation_min = padDecimal(message.inflationMin); - obj.goal_bonded = padDecimal(message.goalBonded); - obj.blocks_per_year = omitDefault(message.blocksPerYear); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.inflation_rate_change = padDecimal(message.inflationRateChange) === "" ? undefined : padDecimal(message.inflationRateChange); + obj.inflation_max = padDecimal(message.inflationMax) === "" ? undefined : padDecimal(message.inflationMax); + obj.inflation_min = padDecimal(message.inflationMin) === "" ? undefined : padDecimal(message.inflationMin); + obj.goal_bonded = padDecimal(message.goalBonded) === "" ? undefined : padDecimal(message.goalBonded); + obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts index 6f908107a2..87da093e56 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/event.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** EventSend is emitted on Msg/Send */ export interface EventSend { @@ -168,10 +168,10 @@ export const EventSend = { }, toAmino(message: EventSend): EventSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: EventSendAminoMsg): EventSend { @@ -297,9 +297,9 @@ export const EventMint = { }, toAmino(message: EventMint): EventMintAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventMintAminoMsg): EventMint { @@ -425,9 +425,9 @@ export const EventBurn = { }, toAmino(message: EventBurn): EventBurnAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: EventBurnAminoMsg): EventBurn { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts index 9b9c1d2965..b29ffad4c9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Class, ClassSDKType, NFT, NFTSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** GenesisState defines the nft module's genesis state. */ export interface GenesisState { @@ -133,12 +133,12 @@ export const GenesisState = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } if (message.entries) { obj.entries = message.entries.map(e => e ? Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -255,11 +255,11 @@ export const Entry = { }, toAmino(message: Entry): EntryAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts index f204ec1b61..5dd51cf4aa 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/nft.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** Class defines the class of the nft type. */ export interface Class { @@ -225,12 +225,12 @@ export const Class = { }, toAmino(message: Class): ClassAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.name = omitDefault(message.name); - obj.symbol = omitDefault(message.symbol); - obj.description = omitDefault(message.description); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.id = message.id === "" ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.symbol = message.symbol === "" ? undefined : message.symbol; + obj.description = message.description === "" ? undefined : message.description; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, @@ -391,10 +391,10 @@ export const NFT = { }, toAmino(message: NFT): NFTAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.uri = omitDefault(message.uri); - obj.uri_hash = omitDefault(message.uriHash); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.uri = message.uri === "" ? undefined : message.uri; + obj.uri_hash = message.uriHash === "" ? undefined : message.uriHash; obj.data = message.data ? Any.toAmino(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts index badd6c9221..31c7ee24a1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { NFT, NFTSDKType, Class, ClassSDKType } from "./nft"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** QueryBalanceRequest is the request type for the Query/Balance RPC method */ export interface QueryBalanceRequest { @@ -271,8 +271,8 @@ export const QueryBalanceRequest = { }, toAmino(message: QueryBalanceRequest): QueryBalanceRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryBalanceRequestAminoMsg): QueryBalanceRequest { @@ -368,7 +368,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = omitDefault(message.amount); + obj.amount = message.amount ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -478,8 +478,8 @@ export const QueryOwnerRequest = { }, toAmino(message: QueryOwnerRequest): QueryOwnerRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryOwnerRequestAminoMsg): QueryOwnerRequest { @@ -573,7 +573,7 @@ export const QueryOwnerResponse = { }, toAmino(message: QueryOwnerResponse): QueryOwnerResponseAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: QueryOwnerResponseAminoMsg): QueryOwnerResponse { @@ -667,7 +667,7 @@ export const QuerySupplyRequest = { }, toAmino(message: QuerySupplyRequest): QuerySupplyRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QuerySupplyRequestAminoMsg): QuerySupplyRequest { @@ -763,7 +763,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = omitDefault(message.amount); + obj.amount = message.amount ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { @@ -891,8 +891,8 @@ export const QueryNFTsRequest = { }, toAmino(message: QueryNFTsRequest): QueryNFTsRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.owner = omitDefault(message.owner); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.owner = message.owner === "" ? undefined : message.owner; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1014,7 +1014,7 @@ export const QueryNFTsResponse = { if (message.nfts) { obj.nfts = message.nfts.map(e => e ? NFT.toAmino(e) : undefined); } else { - obj.nfts = []; + obj.nfts = message.nfts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1126,8 +1126,8 @@ export const QueryNFTRequest = { }, toAmino(message: QueryNFTRequest): QueryNFTRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; return obj; }, fromAminoMsg(object: QueryNFTRequestAminoMsg): QueryNFTRequest { @@ -1317,7 +1317,7 @@ export const QueryClassRequest = { }, toAmino(message: QueryClassRequest): QueryClassRequestAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); + obj.class_id = message.classId === "" ? undefined : message.classId; return obj; }, fromAminoMsg(object: QueryClassRequestAminoMsg): QueryClassRequest { @@ -1630,7 +1630,7 @@ export const QueryClassesResponse = { if (message.classes) { obj.classes = message.classes.map(e => e ? Class.toAmino(e) : undefined); } else { - obj.classes = []; + obj.classes = message.classes; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts index 6e1e408af1..ab63449137 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.nft.v1beta1"; /** MsgSend represents a message to send a nft from one account to another account. */ export interface MsgSend { @@ -148,10 +148,10 @@ export const MsgSend = { }, toAmino(message: MsgSend): MsgSendAmino { const obj: any = {}; - obj.class_id = omitDefault(message.classId); - obj.id = omitDefault(message.id); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.class_id = message.classId === "" ? undefined : message.classId; + obj.id = message.id === "" ? undefined : message.id; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: MsgSendAminoMsg): MsgSend { diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts index 5d74483d28..eb484d838c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1/orm.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.orm.v1"; /** TableDescriptor describes an ORM table. */ export interface TableDescriptor { @@ -238,9 +238,9 @@ export const TableDescriptor = { if (message.index) { obj.index = message.index.map(e => e ? SecondaryIndexDescriptor.toAmino(e) : undefined); } else { - obj.index = []; + obj.index = message.index; } - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: TableDescriptorAminoMsg): TableDescriptor { @@ -350,8 +350,8 @@ export const PrimaryKeyDescriptor = { }, toAmino(message: PrimaryKeyDescriptor): PrimaryKeyDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.auto_increment = omitDefault(message.autoIncrement); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.auto_increment = message.autoIncrement === false ? undefined : message.autoIncrement; return obj; }, fromAminoMsg(object: PrimaryKeyDescriptorAminoMsg): PrimaryKeyDescriptor { @@ -477,9 +477,9 @@ export const SecondaryIndexDescriptor = { }, toAmino(message: SecondaryIndexDescriptor): SecondaryIndexDescriptorAmino { const obj: any = {}; - obj.fields = omitDefault(message.fields); - obj.id = omitDefault(message.id); - obj.unique = omitDefault(message.unique); + obj.fields = message.fields === "" ? undefined : message.fields; + obj.id = message.id === 0 ? undefined : message.id; + obj.unique = message.unique === false ? undefined : message.unique; return obj; }, fromAminoMsg(object: SecondaryIndexDescriptorAminoMsg): SecondaryIndexDescriptor { @@ -573,7 +573,7 @@ export const SingletonDescriptor = { }, toAmino(message: SingletonDescriptor): SingletonDescriptorAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: SingletonDescriptorAminoMsg): SingletonDescriptor { diff --git a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts index 64df2df94a..d84ff52617 100644 --- a/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts +++ b/__fixtures__/v-next/outputv4/cosmos/orm/v1alpha1/schema.ts @@ -227,7 +227,7 @@ export const ModuleSchemaDescriptor = { if (message.schemaFile) { obj.schema_file = message.schemaFile.map(e => e ? ModuleSchemaDescriptor_FileEntry.toAmino(e) : undefined); } else { - obj.schema_file = []; + obj.schema_file = message.schemaFile; } obj.prefix = message.prefix ? base64FromBytes(message.prefix) : undefined; return obj; @@ -349,15 +349,15 @@ export const ModuleSchemaDescriptor_FileEntry = { message.protoFileName = object.proto_file_name; } if (object.storage_type !== undefined && object.storage_type !== null) { - message.storageType = storageTypeFromJSON(object.storage_type); + message.storageType = object.storage_type; } return message; }, toAmino(message: ModuleSchemaDescriptor_FileEntry): ModuleSchemaDescriptor_FileEntryAmino { const obj: any = {}; - obj.id = message.id; - obj.proto_file_name = message.protoFileName; - obj.storage_type = storageTypeToJSON(message.storageType); + obj.id = message.id === 0 ? undefined : message.id; + obj.proto_file_name = message.protoFileName === "" ? undefined : message.protoFileName; + obj.storage_type = message.storageType === 0 ? undefined : message.storageType; return obj; }, fromAminoMsg(object: ModuleSchemaDescriptor_FileEntryAminoMsg): ModuleSchemaDescriptor_FileEntry { diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts index 592ca762c8..031eba73c0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** ParameterChangeProposal defines a proposal to change one or more parameters. */ export interface ParameterChangeProposal { @@ -146,12 +146,12 @@ export const ParameterChangeProposal = { }, toAmino(message: ParameterChangeProposal): ParameterChangeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.changes) { obj.changes = message.changes.map(e => e ? ParamChange.toAmino(e) : undefined); } else { - obj.changes = []; + obj.changes = message.changes; } return obj; }, @@ -278,9 +278,9 @@ export const ParamChange = { }, toAmino(message: ParamChange): ParamChangeAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ParamChangeAminoMsg): ParamChange { diff --git a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts index 358de22139..84d9c1302f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/params/v1beta1/query.ts @@ -1,6 +1,6 @@ import { ParamChange, ParamChangeSDKType } from "./params"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.params.v1beta1"; /** QueryParamsRequest is request type for the Query/Params RPC method. */ export interface QueryParamsRequest { @@ -168,8 +168,8 @@ export const QueryParamsRequest = { }, toAmino(message: QueryParamsRequest): QueryParamsRequestAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); - obj.key = omitDefault(message.key); + obj.subspace = message.subspace === "" ? undefined : message.subspace; + obj.key = message.key === "" ? undefined : message.key; return obj; }, fromAminoMsg(object: QueryParamsRequestAminoMsg): QueryParamsRequest { @@ -442,7 +442,7 @@ export const QuerySubspacesResponse = { if (message.subspaces) { obj.subspaces = message.subspaces.map(e => e ? Subspace.toAmino(e) : undefined); } else { - obj.subspaces = []; + obj.subspaces = message.subspaces; } return obj; }, @@ -559,11 +559,11 @@ export const Subspace = { }, toAmino(message: Subspace): SubspaceAmino { const obj: any = {}; - obj.subspace = omitDefault(message.subspace); + obj.subspace = message.subspace === "" ? undefined : message.subspace; if (message.keys) { obj.keys = message.keys.map(e => e); } else { - obj.keys = []; + obj.keys = message.keys; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts index 88cd643488..ade24fdab1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** GenesisState defines the slashing module's genesis state. */ export interface GenesisState { @@ -200,12 +200,12 @@ export const GenesisState = { if (message.signingInfos) { obj.signing_infos = message.signingInfos.map(e => e ? SigningInfo.toAmino(e) : undefined); } else { - obj.signing_infos = []; + obj.signing_infos = message.signingInfos; } if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? ValidatorMissedBlocks.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -318,7 +318,7 @@ export const SigningInfo = { }, toAmino(message: SigningInfo): SigningInfoAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; obj.validator_signing_info = message.validatorSigningInfo ? ValidatorSigningInfo.toAmino(message.validatorSigningInfo) : undefined; return obj; }, @@ -435,11 +435,11 @@ export const ValidatorMissedBlocks = { }, toAmino(message: ValidatorMissedBlocks): ValidatorMissedBlocksAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.missedBlocks) { obj.missed_blocks = message.missedBlocks.map(e => e ? MissedBlock.toAmino(e) : undefined); } else { - obj.missed_blocks = []; + obj.missed_blocks = message.missedBlocks; } return obj; }, @@ -552,8 +552,8 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = omitDefault(message.index); - obj.missed = omitDefault(message.missed); + obj.index = message.index ? message.index.toString() : undefined; + obj.missed = message.missed === false ? undefined : message.missed; return obj; }, fromAminoMsg(object: MissedBlockAminoMsg): MissedBlock { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts index ef0a62a758..45dac2b073 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Params, ParamsSDKType, ValidatorSigningInfo, ValidatorSigningInfoSDKType } from "./slashing"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "cosmos.slashing.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method */ export interface QueryParamsRequest {} @@ -339,7 +339,7 @@ export const QuerySigningInfoRequest = { }, toAmino(message: QuerySigningInfoRequest): QuerySigningInfoRequestAmino { const obj: any = {}; - obj.cons_address = omitDefault(message.consAddress); + obj.cons_address = message.consAddress === "" ? undefined : message.consAddress; return obj; }, fromAminoMsg(object: QuerySigningInfoRequestAminoMsg): QuerySigningInfoRequest { @@ -652,7 +652,7 @@ export const QuerySigningInfosResponse = { if (message.info) { obj.info = message.info.map(e => e ? ValidatorSigningInfo.toAmino(e) : undefined); } else { - obj.info = []; + obj.info = message.info; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts index cf19b468a1..a82bd224c5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts @@ -221,11 +221,11 @@ export const ValidatorSigningInfo = { }, toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; - obj.tombstoned = message.tombstoned; + obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts index 9a9294f90e..95d3b99a07 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/tx.ts @@ -90,7 +90,7 @@ export const MsgUnjail = { }, toAmino(message: MsgUnjail): MsgUnjailAmino { const obj: any = {}; - obj.validator_addr = message.validatorAddr; + obj.validator_addr = message.validatorAddr ?? ""; return obj; }, fromAminoMsg(object: MsgUnjailAminoMsg): MsgUnjail { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts index 7b88f8f2a9..c068fd6167 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/authz.ts @@ -219,7 +219,7 @@ export const StakeAuthorization = { message.denyList = StakeAuthorization_Validators.fromAmino(object.deny_list); } if (object.authorization_type !== undefined && object.authorization_type !== null) { - message.authorizationType = authorizationTypeFromJSON(object.authorization_type); + message.authorizationType = object.authorization_type; } return message; }, @@ -228,7 +228,7 @@ export const StakeAuthorization = { obj.max_tokens = message.maxTokens ? Coin.toAmino(message.maxTokens) : undefined; obj.allow_list = message.allowList ? StakeAuthorization_Validators.toAmino(message.allowList) : undefined; obj.deny_list = message.denyList ? StakeAuthorization_Validators.toAmino(message.denyList) : undefined; - obj.authorization_type = authorizationTypeToJSON(message.authorizationType); + obj.authorization_type = message.authorizationType === 0 ? undefined : message.authorizationType; return obj; }, fromAminoMsg(object: StakeAuthorizationAminoMsg): StakeAuthorization { @@ -331,7 +331,7 @@ export const StakeAuthorization_Validators = { if (message.address) { obj.address = message.address.map(e => e); } else { - obj.address = []; + obj.address = message.address; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts index 77bf4697e5..7f2b0792a3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Params, ParamsSDKType, Validator, ValidatorSDKType, Delegation, DelegationSDKType, UnbondingDelegation, UnbondingDelegationSDKType, Redelegation, RedelegationSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** GenesisState defines the staking module's genesis state. */ export interface GenesisState { @@ -275,29 +275,29 @@ export const GenesisState = { if (message.lastValidatorPowers) { obj.last_validator_powers = message.lastValidatorPowers.map(e => e ? LastValidatorPower.toAmino(e) : undefined); } else { - obj.last_validator_powers = []; + obj.last_validator_powers = message.lastValidatorPowers; } if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } if (message.delegations) { obj.delegations = message.delegations.map(e => e ? Delegation.toAmino(e) : undefined); } else { - obj.delegations = []; + obj.delegations = message.delegations; } if (message.unbondingDelegations) { obj.unbonding_delegations = message.unbondingDelegations.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_delegations = []; + obj.unbonding_delegations = message.unbondingDelegations; } if (message.redelegations) { obj.redelegations = message.redelegations.map(e => e ? Redelegation.toAmino(e) : undefined); } else { - obj.redelegations = []; + obj.redelegations = message.redelegations; } - obj.exported = omitDefault(message.exported); + obj.exported = message.exported === false ? undefined : message.exported; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -409,8 +409,8 @@ export const LastValidatorPower = { }, toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.power = omitDefault(message.power); + obj.address = message.address === "" ? undefined : message.address; + obj.power = message.power ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts index dfbc291aa3..cf5479ff8b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../base/query/v1beta1/pagination"; import { Validator, ValidatorSDKType, DelegationResponse, DelegationResponseSDKType, UnbondingDelegation, UnbondingDelegationSDKType, RedelegationResponse, RedelegationResponseSDKType, HistoricalInfo, HistoricalInfoSDKType, Pool, PoolSDKType, Params, ParamsSDKType } from "./staking"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.staking.v1beta1"; /** QueryValidatorsRequest is request type for Query/Validators RPC method. */ export interface QueryValidatorsRequest { @@ -605,7 +605,7 @@ export const QueryValidatorsRequest = { }, toAmino(message: QueryValidatorsRequest): QueryValidatorsRequestAmino { const obj: any = {}; - obj.status = omitDefault(message.status); + obj.status = message.status === "" ? undefined : message.status; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -727,7 +727,7 @@ export const QueryValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -823,7 +823,7 @@ export const QueryValidatorRequest = { }, toAmino(message: QueryValidatorRequest): QueryValidatorRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryValidatorRequestAminoMsg): QueryValidatorRequest { @@ -1031,7 +1031,7 @@ export const QueryValidatorDelegationsRequest = { }, toAmino(message: QueryValidatorDelegationsRequest): QueryValidatorDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1153,7 +1153,7 @@ export const QueryValidatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1267,7 +1267,7 @@ export const QueryValidatorUnbondingDelegationsRequest = { }, toAmino(message: QueryValidatorUnbondingDelegationsRequest): QueryValidatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.validator_addr = omitDefault(message.validatorAddr); + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1389,7 +1389,7 @@ export const QueryValidatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1501,8 +1501,8 @@ export const QueryDelegationRequest = { }, toAmino(message: QueryDelegationRequest): QueryDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegationRequestAminoMsg): QueryDelegationRequest { @@ -1708,8 +1708,8 @@ export const QueryUnbondingDelegationRequest = { }, toAmino(message: QueryUnbondingDelegationRequest): QueryUnbondingDelegationRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryUnbondingDelegationRequestAminoMsg): QueryUnbondingDelegationRequest { @@ -1917,7 +1917,7 @@ export const QueryDelegatorDelegationsRequest = { }, toAmino(message: QueryDelegatorDelegationsRequest): QueryDelegatorDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2039,7 +2039,7 @@ export const QueryDelegatorDelegationsResponse = { if (message.delegationResponses) { obj.delegation_responses = message.delegationResponses.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_responses = []; + obj.delegation_responses = message.delegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2153,7 +2153,7 @@ export const QueryDelegatorUnbondingDelegationsRequest = { }, toAmino(message: QueryDelegatorUnbondingDelegationsRequest): QueryDelegatorUnbondingDelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2275,7 +2275,7 @@ export const QueryDelegatorUnbondingDelegationsResponse = { if (message.unbondingResponses) { obj.unbonding_responses = message.unbondingResponses.map(e => e ? UnbondingDelegation.toAmino(e) : undefined); } else { - obj.unbonding_responses = []; + obj.unbonding_responses = message.unbondingResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2421,9 +2421,9 @@ export const QueryRedelegationsRequest = { }, toAmino(message: QueryRedelegationsRequest): QueryRedelegationsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.src_validator_addr = omitDefault(message.srcValidatorAddr); - obj.dst_validator_addr = omitDefault(message.dstValidatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.src_validator_addr = message.srcValidatorAddr === "" ? undefined : message.srcValidatorAddr; + obj.dst_validator_addr = message.dstValidatorAddr === "" ? undefined : message.dstValidatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2545,7 +2545,7 @@ export const QueryRedelegationsResponse = { if (message.redelegationResponses) { obj.redelegation_responses = message.redelegationResponses.map(e => e ? RedelegationResponse.toAmino(e) : undefined); } else { - obj.redelegation_responses = []; + obj.redelegation_responses = message.redelegationResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2659,7 +2659,7 @@ export const QueryDelegatorValidatorsRequest = { }, toAmino(message: QueryDelegatorValidatorsRequest): QueryDelegatorValidatorsRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2781,7 +2781,7 @@ export const QueryDelegatorValidatorsResponse = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2893,8 +2893,8 @@ export const QueryDelegatorValidatorRequest = { }, toAmino(message: QueryDelegatorValidatorRequest): QueryDelegatorValidatorRequestAmino { const obj: any = {}; - obj.delegator_addr = omitDefault(message.delegatorAddr); - obj.validator_addr = omitDefault(message.validatorAddr); + obj.delegator_addr = message.delegatorAddr === "" ? undefined : message.delegatorAddr; + obj.validator_addr = message.validatorAddr === "" ? undefined : message.validatorAddr; return obj; }, fromAminoMsg(object: QueryDelegatorValidatorRequestAminoMsg): QueryDelegatorValidatorRequest { @@ -3086,7 +3086,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts index 08190929e0..cacb6e18c3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts @@ -4,7 +4,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -624,7 +624,7 @@ export const HistoricalInfo = { if (message.valset) { obj.valset = message.valset.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.valset = []; + obj.valset = message.valset; } return obj; }, @@ -751,9 +751,9 @@ export const CommissionRates = { }, toAmino(message: CommissionRates): CommissionRatesAmino { const obj: any = {}; - obj.rate = message.rate; - obj.max_rate = message.maxRate; - obj.max_change_rate = message.maxChangeRate; + obj.rate = padDecimal(message.rate) === "" ? undefined : padDecimal(message.rate); + obj.max_rate = padDecimal(message.maxRate) === "" ? undefined : padDecimal(message.maxRate); + obj.max_change_rate = padDecimal(message.maxChangeRate) === "" ? undefined : padDecimal(message.maxChangeRate); return obj; }, fromAminoMsg(object: CommissionRatesAminoMsg): CommissionRates { @@ -1024,11 +1024,11 @@ export const Description = { }, toAmino(message: Description): DescriptionAmino { const obj: any = {}; - obj.moniker = message.moniker; - obj.identity = message.identity; - obj.website = message.website; - obj.security_contact = message.securityContact; - obj.details = message.details; + obj.moniker = message.moniker === "" ? undefined : message.moniker; + obj.identity = message.identity === "" ? undefined : message.identity; + obj.website = message.website === "" ? undefined : message.website; + obj.security_contact = message.securityContact === "" ? undefined : message.securityContact; + obj.details = message.details === "" ? undefined : message.details; return obj; }, fromAminoMsg(object: DescriptionAminoMsg): Description { @@ -1263,7 +1263,7 @@ export const Validator = { message.jailed = object.jailed; } if (object.status !== undefined && object.status !== null) { - message.status = bondStatusFromJSON(object.status); + message.status = object.status; } if (object.tokens !== undefined && object.tokens !== null) { message.tokens = object.tokens; @@ -1290,17 +1290,17 @@ export const Validator = { }, toAmino(message: Validator): ValidatorAmino { const obj: any = {}; - obj.operator_address = message.operatorAddress; + obj.operator_address = message.operatorAddress === "" ? undefined : message.operatorAddress; obj.consensus_pubkey = message.consensusPubkey ? decodePubkey(message.consensusPubkey) : undefined; - obj.jailed = message.jailed; - obj.status = bondStatusToJSON(message.status); - obj.tokens = message.tokens; - obj.delegator_shares = message.delegatorShares; + obj.jailed = message.jailed === false ? undefined : message.jailed; + obj.status = message.status === 0 ? undefined : message.status; + obj.tokens = message.tokens === "" ? undefined : message.tokens; + obj.delegator_shares = padDecimal(message.delegatorShares) === "" ? undefined : padDecimal(message.delegatorShares); obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1403,7 +1403,7 @@ export const ValAddresses = { if (message.addresses) { obj.addresses = message.addresses.map(e => e); } else { - obj.addresses = []; + obj.addresses = message.addresses; } return obj; }, @@ -1514,8 +1514,8 @@ export const DVPair = { }, toAmino(message: DVPair): DVPairAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; return obj; }, fromAminoMsg(object: DVPairAminoMsg): DVPair { @@ -1618,7 +1618,7 @@ export const DVPairs = { if (message.pairs) { obj.pairs = message.pairs.map(e => e ? DVPair.toAmino(e) : undefined); } else { - obj.pairs = []; + obj.pairs = message.pairs; } return obj; }, @@ -1745,9 +1745,9 @@ export const DVVTriplet = { }, toAmino(message: DVVTriplet): DVVTripletAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; return obj; }, fromAminoMsg(object: DVVTripletAminoMsg): DVVTriplet { @@ -1850,7 +1850,7 @@ export const DVVTriplets = { if (message.triplets) { obj.triplets = message.triplets.map(e => e ? DVVTriplet.toAmino(e) : undefined); } else { - obj.triplets = []; + obj.triplets = message.triplets; } return obj; }, @@ -1977,9 +1977,9 @@ export const Delegation = { }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -2111,12 +2111,12 @@ export const UnbondingDelegation = { }, toAmino(message: UnbondingDelegation): UnbondingDelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? UnbondingDelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2263,8 +2263,8 @@ export const UnbondingDelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.balance = message.balance; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: UnbondingDelegationEntryAminoMsg): UnbondingDelegationEntry { @@ -2410,8 +2410,8 @@ export const RedelegationEntry = { const obj: any = {}; obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; - obj.initial_balance = message.initialBalance; - obj.shares_dst = message.sharesDst; + obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; + obj.shares_dst = padDecimal(message.sharesDst) === "" ? undefined : padDecimal(message.sharesDst); return obj; }, fromAminoMsg(object: RedelegationEntryAminoMsg): RedelegationEntry { @@ -2559,13 +2559,13 @@ export const Redelegation = { }, toAmino(message: Redelegation): RedelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2743,11 +2743,11 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.unbonding_time = message.unbondingTime ? Duration.toAmino(message.unbondingTime) : undefined; - obj.max_validators = message.maxValidators; - obj.max_entries = message.maxEntries; - obj.historical_entries = message.historicalEntries; - obj.bond_denom = message.bondDenom; - obj.min_commission_rate = message.minCommissionRate; + obj.max_validators = message.maxValidators === 0 ? undefined : message.maxValidators; + obj.max_entries = message.maxEntries === 0 ? undefined : message.maxEntries; + obj.historical_entries = message.historicalEntries === 0 ? undefined : message.historicalEntries; + obj.bond_denom = message.bondDenom === "" ? undefined : message.bondDenom; + obj.min_commission_rate = padDecimal(message.minCommissionRate) === "" ? undefined : padDecimal(message.minCommissionRate); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -2975,7 +2975,7 @@ export const RedelegationEntryResponse = { toAmino(message: RedelegationEntryResponse): RedelegationEntryResponseAmino { const obj: any = {}; obj.redelegation_entry = message.redelegationEntry ? RedelegationEntry.toAmino(message.redelegationEntry) : undefined; - obj.balance = message.balance; + obj.balance = message.balance === "" ? undefined : message.balance; return obj; }, fromAminoMsg(object: RedelegationEntryResponseAminoMsg): RedelegationEntryResponse { @@ -3097,7 +3097,7 @@ export const RedelegationResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? RedelegationEntryResponse.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -3208,8 +3208,8 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.not_bonded_tokens = message.notBondedTokens; - obj.bonded_tokens = message.bondedTokens; + obj.not_bonded_tokens = message.notBondedTokens ?? ""; + obj.bonded_tokens = message.bondedTokens ?? ""; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts index 3f3fa4907d..7d5f289a9b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts @@ -125,14 +125,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: { + commission: commission == null ? commission : { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -141,7 +141,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: { + value: value == null ? value : { denom: value.denom, amount: value.amount } @@ -176,7 +176,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, @@ -213,7 +213,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -248,7 +248,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -279,7 +279,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts index ba705910f9..63fb425425 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.ts @@ -3,7 +3,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, toTimestamp, fromTimestamp } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal, toTimestamp, fromTimestamp } from "../../../helpers"; import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "cosmos.staking.v1beta1"; @@ -346,9 +346,9 @@ export const MsgCreateValidator = { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = message.minSelfDelegation; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -569,9 +569,9 @@ export const MsgEditValidator = { toAmino(message: MsgEditValidator): MsgEditValidatorAmino { const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.validator_address = message.validatorAddress; - obj.commission_rate = message.commissionRate; - obj.min_self_delegation = message.minSelfDelegation; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.commission_rate = padDecimal(message.commissionRate) === "" ? undefined : padDecimal(message.commissionRate); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; return obj; }, fromAminoMsg(object: MsgEditValidatorAminoMsg): MsgEditValidator { @@ -773,8 +773,8 @@ export const MsgDelegate = { }, toAmino(message: MsgDelegate): MsgDelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -993,9 +993,9 @@ export const MsgBeginRedelegate = { }, toAmino(message: MsgBeginRedelegate): MsgBeginRedelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_src_address = message.validatorSrcAddress; - obj.validator_dst_address = message.validatorDstAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_src_address = message.validatorSrcAddress === "" ? undefined : message.validatorSrcAddress; + obj.validator_dst_address = message.validatorDstAddress === "" ? undefined : message.validatorDstAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -1218,8 +1218,8 @@ export const MsgUndelegate = { }, toAmino(message: MsgUndelegate): MsgUndelegateAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts index 1ee7dd167d..f014120f56 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts @@ -258,7 +258,7 @@ export const SignatureDescriptors = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -609,7 +609,7 @@ export const SignatureDescriptor_Data_Single = { fromAmino(object: SignatureDescriptor_Data_SingleAmino): SignatureDescriptor_Data_Single { const message = createBaseSignatureDescriptor_Data_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.signature !== undefined && object.signature !== null) { message.signature = bytesFromBase64(object.signature); @@ -618,7 +618,7 @@ export const SignatureDescriptor_Data_Single = { }, toAmino(message: SignatureDescriptor_Data_Single): SignatureDescriptor_Data_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -741,7 +741,7 @@ export const SignatureDescriptor_Data_Multi = { if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor_Data.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts index 01b863d948..854df5e397 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts @@ -438,7 +438,7 @@ export const GetTxsEventRequest = { message.pagination = PageRequest.fromAmino(object.pagination); } if (object.order_by !== undefined && object.order_by !== null) { - message.orderBy = orderByFromJSON(object.order_by); + message.orderBy = object.order_by; } return message; }, @@ -447,10 +447,10 @@ export const GetTxsEventRequest = { if (message.events) { obj.events = message.events.map(e => e); } else { - obj.events = []; + obj.events = message.events; } obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.order_by = orderByToJSON(message.orderBy); + obj.order_by = message.orderBy === 0 ? undefined : message.orderBy; return obj; }, fromAminoMsg(object: GetTxsEventRequestAminoMsg): GetTxsEventRequest { @@ -593,12 +593,12 @@ export const GetTxsEventResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } if (message.txResponses) { obj.tx_responses = message.txResponses.map(e => e ? TxResponse.toAmino(e) : undefined); } else { - obj.tx_responses = []; + obj.tx_responses = message.txResponses; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -704,14 +704,14 @@ export const BroadcastTxRequest = { message.txBytes = bytesFromBase64(object.tx_bytes); } if (object.mode !== undefined && object.mode !== null) { - message.mode = broadcastModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: BroadcastTxRequest): BroadcastTxRequestAmino { const obj: any = {}; obj.tx_bytes = message.txBytes ? base64FromBytes(message.txBytes) : undefined; - obj.mode = broadcastModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: BroadcastTxRequestAminoMsg): BroadcastTxRequest { @@ -1129,7 +1129,7 @@ export const GetTxRequest = { }, toAmino(message: GetTxRequest): GetTxRequestAmino { const obj: any = {}; - obj.hash = message.hash; + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: GetTxRequestAminoMsg): GetTxRequest { @@ -1516,7 +1516,7 @@ export const GetBlockWithTxsResponse = { if (message.txs) { obj.txs = message.txs.map(e => e ? Tx.toAmino(e) : undefined); } else { - obj.txs = []; + obj.txs = message.txs; } obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.block = message.block ? Block.toAmino(message.block) : undefined; diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts index 6394fc4be1..b0bbbeddf4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts @@ -556,7 +556,7 @@ export const Tx = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -694,7 +694,7 @@ export const TxRaw = { if (message.signatures) { obj.signatures = message.signatures.map(e => base64FromBytes(e)); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -841,7 +841,7 @@ export const SignDoc = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; return obj; }, @@ -1026,7 +1026,7 @@ export const SignDocDirectAux = { const obj: any = {}; obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1210,19 +1210,19 @@ export const TxBody = { if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.messages = []; + obj.messages = message.messages; } - obj.memo = message.memo; + obj.memo = message.memo === "" ? undefined : message.memo; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extension_options = []; + obj.extension_options = message.extensionOptions; } if (message.nonCriticalExtensionOptions) { obj.non_critical_extension_options = message.nonCriticalExtensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.non_critical_extension_options = []; + obj.non_critical_extension_options = message.nonCriticalExtensionOptions; } return obj; }, @@ -1362,7 +1362,7 @@ export const AuthInfo = { if (message.signerInfos) { obj.signer_infos = message.signerInfos.map(e => e ? SignerInfo.toAmino(e) : undefined); } else { - obj.signer_infos = []; + obj.signer_infos = message.signerInfos; } obj.fee = message.fee ? Fee.toAmino(message.fee) : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; @@ -1702,13 +1702,13 @@ export const ModeInfo_Single = { fromAmino(object: ModeInfo_SingleAmino): ModeInfo_Single { const message = createBaseModeInfo_Single(); if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } return message; }, toAmino(message: ModeInfo_Single): ModeInfo_SingleAmino { const obj: any = {}; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; return obj; }, fromAminoMsg(object: ModeInfo_SingleAminoMsg): ModeInfo_Single { @@ -1830,7 +1830,7 @@ export const ModeInfo_Multi = { if (message.modeInfos) { obj.mode_infos = message.modeInfos.map(e => e ? ModeInfo.toAmino(e) : undefined); } else { - obj.mode_infos = []; + obj.mode_infos = message.modeInfos; } return obj; }, @@ -1984,11 +1984,11 @@ export const Fee = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; - obj.payer = message.payer; - obj.granter = message.granter; + obj.payer = message.payer === "" ? undefined : message.payer; + obj.granter = message.granter === "" ? undefined : message.granter; return obj; }, fromAminoMsg(object: FeeAminoMsg): Fee { @@ -2107,9 +2107,9 @@ export const Tip = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.tipper = message.tipper; + obj.tipper = message.tipper === "" ? undefined : message.tipper; return obj; }, fromAminoMsg(object: TipAminoMsg): Tip { @@ -2244,7 +2244,7 @@ export const AuxSignerData = { message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -2253,9 +2253,9 @@ export const AuxSignerData = { }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts index cb684dc42b..d4742ee7d4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType, ModuleVersion, ModuleVersionSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * QueryCurrentPlanRequest is the request type for the Query/CurrentPlan RPC @@ -443,7 +443,7 @@ export const QueryAppliedPlanRequest = { }, toAmino(message: QueryAppliedPlanRequest): QueryAppliedPlanRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: QueryAppliedPlanRequestAminoMsg): QueryAppliedPlanRequest { @@ -539,7 +539,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = omitDefault(message.height); + obj.height = message.height ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -635,7 +635,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = omitDefault(message.lastHeight); + obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { @@ -823,7 +823,7 @@ export const QueryModuleVersionsRequest = { }, toAmino(message: QueryModuleVersionsRequest): QueryModuleVersionsRequestAmino { const obj: any = {}; - obj.module_name = omitDefault(message.moduleName); + obj.module_name = message.moduleName === "" ? undefined : message.moduleName; return obj; }, fromAminoMsg(object: QueryModuleVersionsRequestAminoMsg): QueryModuleVersionsRequest { @@ -926,7 +926,7 @@ export const QueryModuleVersionsResponse = { if (message.moduleVersions) { obj.module_versions = message.moduleVersions.map(e => e ? ModuleVersion.toAmino(e) : undefined); } else { - obj.module_versions = []; + obj.module_versions = message.moduleVersions; } return obj; }, @@ -1095,7 +1095,7 @@ export const QueryAuthorityResponse = { }, toAmino(message: QueryAuthorityResponse): QueryAuthorityResponseAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryAuthorityResponseAminoMsg): QueryAuthorityResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts index 92673592c2..60ac05e8c1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,5 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -32,14 +33,14 @@ export const AminoConverter = { plan }: MsgSoftwareUpgrade): MsgSoftwareUpgradeAminoType["value"] => { return { - authority, + authority: omitDefault(authority), plan: { - name: plan.name, + name: omitDefault(plan.name), time: plan.time, - height: plan.height.toString(), - info: plan.info, + height: omitDefault(plan.height)?.toString?.(), + info: omitDefault(plan.info), upgraded_client_state: { - type_url: plan.upgradedClientState.typeUrl, + type_url: omitDefault(plan.upgradedClientState.typeUrl), value: plan.upgradedClientState.value } } @@ -51,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: { + plan: plan == null ? plan : { name: plan.name, time: plan.time, - height: BigInt(plan.height), + height: plan.height == null ? plan.height : BigInt(plan.height), info: plan.info, - upgradedClientState: { + upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } @@ -70,7 +71,7 @@ export const AminoConverter = { authority }: MsgCancelUpgrade): MsgCancelUpgradeAminoType["value"] => { return { - authority + authority: omitDefault(authority) }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts index 9277195dda..e1dd8a5a0a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.upgrade.v1beta1"; /** * MsgSoftwareUpgrade is the Msg/SoftwareUpgrade request type. @@ -166,7 +166,7 @@ export const MsgSoftwareUpgrade = { }, toAmino(message: MsgSoftwareUpgrade): MsgSoftwareUpgradeAmino { const obj: any = {}; - obj.authority = omitDefault(message.authority); + obj.authority = message.authority === "" ? undefined : message.authority; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -335,7 +335,7 @@ export const MsgCancelUpgrade = { }, toAmino(message: MsgCancelUpgrade): MsgCancelUpgradeAmino { const obj: any = {}; - obj.authority = omitDefault(message.authority); + obj.authority = message.authority === "" ? undefined : message.authority; return obj; }, fromAminoMsg(object: MsgCancelUpgradeAminoMsg): MsgCancelUpgrade { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts index 53a8f02865..f7c0520f77 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts @@ -269,10 +269,10 @@ export const Plan = { }, toAmino(message: Plan): PlanAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.info = message.info; + obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; }, @@ -401,8 +401,8 @@ export const SoftwareUpgradeProposal = { }, toAmino(message: SoftwareUpgradeProposal): SoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; return obj; }, @@ -513,8 +513,8 @@ export const CancelSoftwareUpgradeProposal = { }, toAmino(message: CancelSoftwareUpgradeProposal): CancelSoftwareUpgradeProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: CancelSoftwareUpgradeProposalAminoMsg): CancelSoftwareUpgradeProposal { @@ -626,7 +626,7 @@ export const ModuleVersion = { }, toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.version = message.version ? message.version.toString() : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index e840986a6c..93abf3fd7e 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -73,11 +73,11 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - endTime: BigInt(end_time), + endTime: end_time == null ? end_time : BigInt(end_time), delayed }; } @@ -106,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -143,10 +143,10 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: BigInt(start_time), - vestingPeriods: vesting_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + startTime: start_time == null ? start_time : BigInt(start_time), + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts index ff286fde77..23ff1b99de 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * MsgCreateVestingAccount defines a message that enables creating a vesting @@ -246,15 +246,15 @@ export const MsgCreateVestingAccount = { }, toAmino(message: MsgCreateVestingAccount): MsgCreateVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } - obj.end_time = omitDefault(message.endTime); - obj.delayed = omitDefault(message.delayed); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, fromAminoMsg(object: MsgCreateVestingAccountAminoMsg): MsgCreateVestingAccount { @@ -460,12 +460,12 @@ export const MsgCreatePermanentLockedAccount = { }, toAmino(message: MsgCreatePermanentLockedAccount): MsgCreatePermanentLockedAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -690,13 +690,13 @@ export const MsgCreatePeriodicVestingAccount = { }, toAmino(message: MsgCreatePeriodicVestingAccount): MsgCreatePeriodicVestingAccountAmino { const obj: any = {}; - obj.from_address = omitDefault(message.fromAddress); - obj.to_address = omitDefault(message.toAddress); - obj.start_time = omitDefault(message.startTime); + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts index 79cdab17e6..d46fa33da4 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts @@ -1,7 +1,7 @@ import { BaseAccount, BaseAccountSDKType } from "../../auth/v1beta1/auth"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "cosmos.vesting.v1beta1"; /** * BaseVestingAccount implements the VestingAccount interface. It contains all @@ -288,19 +288,19 @@ export const BaseVestingAccount = { if (message.originalVesting) { obj.original_vesting = message.originalVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.original_vesting = []; + obj.original_vesting = message.originalVesting; } if (message.delegatedFree) { obj.delegated_free = message.delegatedFree.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_free = []; + obj.delegated_free = message.delegatedFree; } if (message.delegatedVesting) { obj.delegated_vesting = message.delegatedVesting.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.delegated_vesting = []; + obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = omitDefault(message.endTime); + obj.end_time = message.endTime ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -415,7 +415,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = omitDefault(message.startTime); + obj.start_time = message.startTime ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -629,11 +629,11 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = omitDefault(message.length); + obj.length = message.length ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -771,11 +771,11 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = omitDefault(message.startTime); + obj.start_time = message.startTime ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts b/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts index c46b5d6a51..323c2ddf40 100644 --- a/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts +++ b/__fixtures__/v-next/outputv4/cosmos_proto/cosmos.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, omitDefault } from "../helpers"; +import { isSet, DeepPartial } from "../helpers"; export const protobufPackage = "cosmos_proto"; export enum ScalarType { SCALAR_TYPE_UNSPECIFIED = 0, @@ -202,8 +202,8 @@ export const InterfaceDescriptor = { }, toAmino(message: InterfaceDescriptor): InterfaceDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: InterfaceDescriptorAminoMsg): InterfaceDescriptor { @@ -333,17 +333,17 @@ export const ScalarDescriptor = { if (object.description !== undefined && object.description !== null) { message.description = object.description; } - message.fieldType = object.field_type?.map(e => scalarTypeFromJSON(e)) || []; + message.fieldType = object.field_type?.map(e => e) || []; return message; }, toAmino(message: ScalarDescriptor): ScalarDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; if (message.fieldType) { - obj.field_type = message.fieldType.map(e => scalarTypeToJSON(e)); + obj.field_type = message.fieldType.map(e => e); } else { - obj.field_type = []; + obj.field_type = message.fieldType; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts index 53c8bf0dde..a0cf4fa807 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts @@ -257,22 +257,22 @@ export const GenesisState = { if (message.codes) { obj.codes = message.codes.map(e => e ? Code.toAmino(e) : undefined); } else { - obj.codes = []; + obj.codes = message.codes; } if (message.contracts) { obj.contracts = message.contracts.map(e => e ? Contract.toAmino(e) : undefined); } else { - obj.contracts = []; + obj.contracts = message.contracts; } if (message.sequences) { obj.sequences = message.sequences.map(e => e ? Sequence.toAmino(e) : undefined); } else { - obj.sequences = []; + obj.sequences = message.sequences; } if (message.genMsgs) { obj.gen_msgs = message.genMsgs.map(e => e ? GenesisState_GenMsgs.toAmino(e) : undefined); } else { - obj.gen_msgs = []; + obj.gen_msgs = message.genMsgs; } return obj; }, @@ -556,7 +556,7 @@ export const Code = { obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; - obj.pinned = message.pinned; + obj.pinned = message.pinned === false ? undefined : message.pinned; return obj; }, fromAminoMsg(object: CodeAminoMsg): Code { @@ -690,12 +690,12 @@ export const Contract = { }, toAmino(message: Contract): ContractAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; if (message.contractState) { obj.contract_state = message.contractState.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.contract_state = []; + obj.contract_state = message.contractState; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts index 83feddf0a2..8e7cd6c134 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts @@ -165,7 +165,7 @@ export const MsgIBCSend = { }, toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -262,7 +262,7 @@ export const MsgIBCCloseChannel = { }, toAmino(message: MsgIBCCloseChannel): MsgIBCCloseChannelAmino { const obj: any = {}; - obj.channel = message.channel; + obj.channel = message.channel === "" ? undefined : message.channel; return obj; }, fromAminoMsg(object: MsgIBCCloseChannelAminoMsg): MsgIBCCloseChannel { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts index bb6c84bc08..5026591c1b 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts @@ -1,7 +1,7 @@ import { AccessConfig, AccessConfigSDKType } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../../helpers"; import { fromBase64, toBase64, toUtf8, fromUtf8 } from "@cosmjs/encoding"; export const protobufPackage = "cosmwasm.wasm.v1"; /** StoreCodeProposal gov proposal content type to submit WASM code to the system */ @@ -382,9 +382,9 @@ export const StoreCodeProposal = { }, toAmino(message: StoreCodeProposal): StoreCodeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -600,17 +600,17 @@ export const InstantiateContractProposal = { }, toAmino(message: InstantiateContractProposal): InstantiateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.admin = omitDefault(message.admin); - obj.code_id = omitDefault(message.codeId); - obj.label = omitDefault(message.label); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -771,10 +771,10 @@ export const MigrateContractProposal = { }, toAmino(message: MigrateContractProposal): MigrateContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); - obj.code_id = omitDefault(message.codeId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -917,9 +917,9 @@ export const SudoContractProposal = { }, toAmino(message: SudoContractProposal): SudoContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, @@ -1100,15 +1100,15 @@ export const ExecuteContractProposal = { }, toAmino(message: ExecuteContractProposal): ExecuteContractProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.run_as = omitDefault(message.runAs); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.run_as = message.runAs === "" ? undefined : message.runAs; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1251,10 +1251,10 @@ export const UpdateAdminProposal = { }, toAmino(message: UpdateAdminProposal): UpdateAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.new_admin = omitDefault(message.newAdmin); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: UpdateAdminProposalAminoMsg): UpdateAdminProposal { @@ -1380,9 +1380,9 @@ export const ClearAdminProposal = { }, toAmino(message: ClearAdminProposal): ClearAdminProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.contract = omitDefault(message.contract); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: ClearAdminProposalAminoMsg): ClearAdminProposal { @@ -1523,12 +1523,12 @@ export const PinCodesProposal = { }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -1670,12 +1670,12 @@ export const UnpinCodesProposal = { }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts index bb2d5d1cce..eb38798ea0 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts @@ -437,7 +437,7 @@ export const QueryContractInfoRequest = { }, toAmino(message: QueryContractInfoRequest): QueryContractInfoRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryContractInfoRequestAminoMsg): QueryContractInfoRequest { @@ -549,7 +549,7 @@ export const QueryContractInfoResponse = { }, toAmino(message: QueryContractInfoResponse): QueryContractInfoResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.contract_info = message.contractInfo ? ContractInfo.toAmino(message.contractInfo) : undefined; return obj; }, @@ -662,7 +662,7 @@ export const QueryContractHistoryRequest = { }, toAmino(message: QueryContractHistoryRequest): QueryContractHistoryRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -784,7 +784,7 @@ export const QueryContractHistoryResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? ContractCodeHistoryEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1022,7 +1022,7 @@ export const QueryContractsByCodeResponse = { if (message.contracts) { obj.contracts = message.contracts.map(e => e); } else { - obj.contracts = []; + obj.contracts = message.contracts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1136,7 +1136,7 @@ export const QueryAllContractStateRequest = { }, toAmino(message: QueryAllContractStateRequest): QueryAllContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1258,7 +1258,7 @@ export const QueryAllContractStateResponse = { if (message.models) { obj.models = message.models.map(e => e ? Model.toAmino(e) : undefined); } else { - obj.models = []; + obj.models = message.models; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1370,7 +1370,7 @@ export const QueryRawContractStateRequest = { }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1575,7 +1575,7 @@ export const QuerySmartContractStateRequest = { }, toAmino(message: QuerySmartContractStateRequest): QuerySmartContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? JSON.parse(fromUtf8(message.queryData)) : undefined; return obj; }, @@ -1894,8 +1894,8 @@ export const CodeInfoResponse = { }, toAmino(message: CodeInfoResponse): CodeInfoResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; + obj.code_id = message.codeId ? message.codeId.toString() : "0"; + obj.creator = message.creator === "" ? undefined : message.creator; obj.data_hash = message.dataHash ? base64FromBytes(message.dataHash) : undefined; return obj; }, @@ -2009,7 +2009,7 @@ export const QueryCodeResponse = { toAmino(message: QueryCodeResponse): QueryCodeResponseAmino { const obj: any = {}; obj.code_info = message.codeInfo ? CodeInfoResponse.toAmino(message.codeInfo) : undefined; - obj.data = message.data ? base64FromBytes(message.data) : undefined; + obj.data = message.data ? base64FromBytes(message.data) : ""; return obj; }, fromAminoMsg(object: QueryCodeResponseAminoMsg): QueryCodeResponse { @@ -2226,7 +2226,7 @@ export const QueryCodesResponse = { if (message.codeInfos) { obj.code_infos = message.codeInfos.map(e => e ? CodeInfoResponse.toAmino(e) : undefined); } else { - obj.code_infos = []; + obj.code_infos = message.codeInfos; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2454,7 +2454,7 @@ export const QueryPinnedCodesResponse = { if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index 476501027c..005a774ec6 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -89,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: fromBase64(wasm_byte_code), - instantiatePermission: { - permission: accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), + instantiatePermission: instantiate_permission == null ? instantiate_permission : { + permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -130,10 +130,10 @@ export const AminoConverter = { return { sender, admin, - codeId: BigInt(code_id), + codeId: code_id == null ? code_id : BigInt(code_id), label, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -167,8 +167,8 @@ export const AminoConverter = { return { sender, contract, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -199,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: BigInt(code_id), - msg: toUtf8(JSON.stringify(msg)) + codeId: code_id == null ? code_id : BigInt(code_id), + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) }; } }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts index b020cc0738..4659919c1e 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts @@ -316,7 +316,7 @@ export const MsgStoreCode = { }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -596,15 +596,15 @@ export const MsgInstantiateContract = { }, toAmino(message: MsgInstantiateContract): MsgInstantiateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.admin = message.admin; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.admin = message.admin === "" ? undefined : message.admin; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.label = message.label; + obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -715,7 +715,7 @@ export const MsgInstantiateContractResponse = { }, toAmino(message: MsgInstantiateContractResponse): MsgInstantiateContractResponseAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -864,13 +864,13 @@ export const MsgExecuteContract = { }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, @@ -1109,8 +1109,8 @@ export const MsgMigrateContract = { }, toAmino(message: MsgMigrateContract): MsgMigrateContractAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1332,9 +1332,9 @@ export const MsgUpdateAdmin = { }, toAmino(message: MsgUpdateAdmin): MsgUpdateAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.new_admin = message.newAdmin; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgUpdateAdminAminoMsg): MsgUpdateAdmin { @@ -1518,8 +1518,8 @@ export const MsgClearAdmin = { }, toAmino(message: MsgClearAdmin): MsgClearAdminAmino { const obj: any = {}; - obj.sender = message.sender; - obj.contract = message.contract; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: MsgClearAdminAminoMsg): MsgClearAdmin { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts index 49e230122c..8eef86ad3d 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts @@ -321,13 +321,13 @@ export const AccessTypeParam = { fromAmino(object: AccessTypeParamAmino): AccessTypeParam { const message = createBaseAccessTypeParam(); if (object.value !== undefined && object.value !== null) { - message.value = accessTypeFromJSON(object.value); + message.value = object.value; } return message; }, toAmino(message: AccessTypeParam): AccessTypeParamAmino { const obj: any = {}; - obj.value = accessTypeToJSON(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: AccessTypeParamAminoMsg): AccessTypeParam { @@ -428,7 +428,7 @@ export const AccessConfig = { fromAmino(object: AccessConfigAmino): AccessConfig { const message = createBaseAccessConfig(); if (object.permission !== undefined && object.permission !== null) { - message.permission = accessTypeFromJSON(object.permission); + message.permission = object.permission; } if (object.address !== undefined && object.address !== null) { message.address = object.address; @@ -437,8 +437,8 @@ export const AccessConfig = { }, toAmino(message: AccessConfig): AccessConfigAmino { const obj: any = {}; - obj.permission = accessTypeToJSON(message.permission); - obj.address = message.address; + obj.permission = message.permission === 0 ? undefined : message.permission; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { @@ -559,7 +559,7 @@ export const Params = { message.codeUploadAccess = AccessConfig.fromAmino(object.code_upload_access); } if (object.instantiate_default_permission !== undefined && object.instantiate_default_permission !== null) { - message.instantiateDefaultPermission = accessTypeFromJSON(object.instantiate_default_permission); + message.instantiateDefaultPermission = object.instantiate_default_permission; } if (object.max_wasm_code_size !== undefined && object.max_wasm_code_size !== null) { message.maxWasmCodeSize = BigInt(object.max_wasm_code_size); @@ -569,7 +569,7 @@ export const Params = { toAmino(message: Params): ParamsAmino { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; - obj.instantiate_default_permission = accessTypeToJSON(message.instantiateDefaultPermission); + obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; return obj; }, @@ -699,7 +699,7 @@ export const CodeInfo = { toAmino(message: CodeInfo): CodeInfoAmino { const obj: any = {}; obj.code_hash = message.codeHash ? base64FromBytes(message.codeHash) : undefined; - obj.creator = message.creator; + obj.creator = message.creator === "" ? undefined : message.creator; obj.instantiate_config = message.instantiateConfig ? AccessConfig.toAmino(message.instantiateConfig) : undefined; return obj; }, @@ -897,11 +897,11 @@ export const ContractInfo = { toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; obj.code_id = message.codeId ? message.codeId.toString() : undefined; - obj.creator = message.creator; - obj.admin = message.admin; - obj.label = message.label; + obj.creator = message.creator === "" ? undefined : message.creator; + obj.admin = message.admin === "" ? undefined : message.admin; + obj.label = message.label === "" ? undefined : message.label; obj.created = message.created ? AbsoluteTxPosition.toAmino(message.created) : undefined; - obj.ibc_port_id = message.ibcPortId; + obj.ibc_port_id = message.ibcPortId === "" ? undefined : message.ibcPortId; obj.extension = message.extension ? Any.toAmino(message.extension) : undefined; return obj; }, @@ -1033,7 +1033,7 @@ export const ContractCodeHistoryEntry = { fromAmino(object: ContractCodeHistoryEntryAmino): ContractCodeHistoryEntry { const message = createBaseContractCodeHistoryEntry(); if (object.operation !== undefined && object.operation !== null) { - message.operation = contractCodeHistoryOperationTypeFromJSON(object.operation); + message.operation = object.operation; } if (object.code_id !== undefined && object.code_id !== null) { message.codeId = BigInt(object.code_id); @@ -1048,7 +1048,7 @@ export const ContractCodeHistoryEntry = { }, toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; - obj.operation = contractCodeHistoryOperationTypeToJSON(message.operation); + obj.operation = message.operation === 0 ? undefined : message.operation; obj.code_id = message.codeId ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts index 4320f6636a..7e6c20d76b 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/claims.ts @@ -211,7 +211,7 @@ export const Claim = { fromAmino(object: ClaimAmino): Claim { const message = createBaseClaim(); if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } if (object.completed !== undefined && object.completed !== null) { message.completed = object.completed; @@ -223,9 +223,9 @@ export const Claim = { }, toAmino(message: Claim): ClaimAmino { const obj: any = {}; - obj.action = actionToJSON(message.action); - obj.completed = message.completed; - obj.claimable_amount = message.claimableAmount; + obj.action = message.action === 0 ? undefined : message.action; + obj.completed = message.completed === false ? undefined : message.completed; + obj.claimable_amount = message.claimableAmount === "" ? undefined : message.claimableAmount; return obj; }, fromAminoMsg(object: ClaimAminoMsg): Claim { @@ -360,12 +360,12 @@ export const ClaimsRecordAddress = { }, toAmino(message: ClaimsRecordAddress): ClaimsRecordAddressAmino { const obj: any = {}; - obj.address = message.address; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.address = message.address === "" ? undefined : message.address; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, @@ -485,11 +485,11 @@ export const ClaimsRecord = { }, toAmino(message: ClaimsRecord): ClaimsRecordAmino { const obj: any = {}; - obj.initial_claimable_amount = message.initialClaimableAmount; + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.actionsCompleted) { obj.actions_completed = message.actionsCompleted.map(e => e); } else { - obj.actions_completed = []; + obj.actions_completed = message.actionsCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts index 3e78603a28..f6ed9ff78d 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/genesis.ts @@ -151,7 +151,7 @@ export const GenesisState = { if (message.claimsRecords) { obj.claims_records = message.claimsRecords.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims_records = []; + obj.claims_records = message.claimsRecords; } return obj; }, @@ -352,20 +352,20 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_claims = message.enableClaims; + obj.enable_claims = message.enableClaims === false ? undefined : message.enableClaims; obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claims_denom = message.claimsDenom; + obj.claims_denom = message.claimsDenom === "" ? undefined : message.claimsDenom; if (message.authorizedChannels) { obj.authorized_channels = message.authorizedChannels.map(e => e); } else { - obj.authorized_channels = []; + obj.authorized_channels = message.authorizedChannels; } if (message.evmChannels) { obj.evm_channels = message.evmChannels.map(e => e); } else { - obj.evm_channels = []; + obj.evm_channels = message.evmChannels; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts index dda69c91ee..2018f52b10 100644 --- a/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/claims/v1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { ClaimsRecordAddress, ClaimsRecordAddressSDKType, Claim, ClaimSDKType } from "./claims"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "evmos.claims.v1"; /** * QueryTotalUnclaimedRequest is the request type for the Query/TotalUnclaimed @@ -287,7 +287,7 @@ export const QueryTotalUnclaimedResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -651,7 +651,7 @@ export const QueryClaimsRecordsResponse = { if (message.claims) { obj.claims = message.claims.map(e => e ? ClaimsRecordAddress.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -741,7 +741,7 @@ export const QueryClaimsRecordRequest = { }, toAmino(message: QueryClaimsRecordRequest): QueryClaimsRecordRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimsRecordRequestAminoMsg): QueryClaimsRecordRequest { @@ -851,11 +851,11 @@ export const QueryClaimsRecordResponse = { }, toAmino(message: QueryClaimsRecordResponse): QueryClaimsRecordResponseAmino { const obj: any = {}; - obj.initial_claimable_amount = omitDefault(message.initialClaimableAmount); + obj.initial_claimable_amount = message.initialClaimableAmount === "" ? undefined : message.initialClaimableAmount; if (message.claims) { obj.claims = message.claims.map(e => e ? Claim.toAmino(e) : undefined); } else { - obj.claims = []; + obj.claims = message.claims; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts index 20b8fc6d75..7ce1b4da96 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts @@ -208,12 +208,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -311,7 +311,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts index 3ea805e27d..96bb2a0e58 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../cosmos/base/query/v1beta1/pagination"; import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.epochs.v1"; export interface QueryEpochsInfoRequest { pagination?: PageRequest; @@ -231,7 +231,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -321,7 +321,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -411,7 +411,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts index e0c816c1fa..c0181a0f74 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/erc20.ts @@ -260,16 +260,16 @@ export const TokenPair = { message.enabled = object.enabled; } if (object.contract_owner !== undefined && object.contract_owner !== null) { - message.contractOwner = ownerFromJSON(object.contract_owner); + message.contractOwner = object.contract_owner; } return message; }, toAmino(message: TokenPair): TokenPairAmino { const obj: any = {}; - obj.erc20_address = message.erc20Address; - obj.denom = message.denom; - obj.enabled = message.enabled; - obj.contract_owner = ownerToJSON(message.contractOwner); + obj.erc20_address = message.erc20Address === "" ? undefined : message.erc20Address; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.enabled = message.enabled === false ? undefined : message.enabled; + obj.contract_owner = message.contractOwner === 0 ? undefined : message.contractOwner; return obj; }, fromAminoMsg(object: TokenPairAminoMsg): TokenPair { @@ -391,8 +391,8 @@ export const RegisterCoinProposal = { }, toAmino(message: RegisterCoinProposal): RegisterCoinProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, @@ -513,9 +513,9 @@ export const RegisterERC20Proposal = { }, toAmino(message: RegisterERC20Proposal): RegisterERC20ProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.erc20address = message.erc20address; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.erc20address = message.erc20address === "" ? undefined : message.erc20address; return obj; }, fromAminoMsg(object: RegisterERC20ProposalAminoMsg): RegisterERC20Proposal { @@ -635,9 +635,9 @@ export const ToggleTokenConversionProposal = { }, toAmino(message: ToggleTokenConversionProposal): ToggleTokenConversionProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.token = message.token; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: ToggleTokenConversionProposalAminoMsg): ToggleTokenConversionProposal { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts index c5e420b846..7965af5ad5 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/genesis.ts @@ -1,6 +1,6 @@ import { TokenPair, TokenPairSDKType } from "./erc20"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** GenesisState defines the module's genesis state. */ export interface GenesisState { @@ -135,7 +135,7 @@ export const GenesisState = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } return obj; }, @@ -240,8 +240,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_erc20 = omitDefault(message.enableErc20); - obj.enable_evm_hook = omitDefault(message.enableEvmHook); + obj.enable_erc20 = message.enableErc20 === false ? undefined : message.enableErc20; + obj.enable_evm_hook = message.enableEvmHook === false ? undefined : message.enableEvmHook; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts index adc6a5a2e3..5d582cb95b 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { TokenPair, TokenPairSDKType } from "./erc20"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** * QueryTokenPairsRequest is the request type for the Query/TokenPairs RPC @@ -290,7 +290,7 @@ export const QueryTokenPairsResponse = { if (message.tokenPairs) { obj.token_pairs = message.tokenPairs.map(e => e ? TokenPair.toAmino(e) : undefined); } else { - obj.token_pairs = []; + obj.token_pairs = message.tokenPairs; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -380,7 +380,7 @@ export const QueryTokenPairRequest = { }, toAmino(message: QueryTokenPairRequest): QueryTokenPairRequestAmino { const obj: any = {}; - obj.token = omitDefault(message.token); + obj.token = message.token === "" ? undefined : message.token; return obj; }, fromAminoMsg(object: QueryTokenPairRequestAminoMsg): QueryTokenPairRequest { diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts index cad7e1500f..514c9c6a37 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: { + coin: coin == null ? coin : { denom: coin.denom, amount: coin.amount }, diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts index b1821e26c4..486029ad07 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.erc20.v1"; /** MsgConvertCoin defines a Msg to convert a native Cosmos coin to a ERC20 token */ export interface MsgConvertCoin { @@ -172,8 +172,8 @@ export const MsgConvertCoin = { toAmino(message: MsgConvertCoin): MsgConvertCoinAmino { const obj: any = {}; obj.coin = message.coin ? Coin.toAmino(message.coin) : undefined; - obj.receiver = omitDefault(message.receiver); - obj.sender = omitDefault(message.sender); + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertCoinAminoMsg): MsgConvertCoin { @@ -377,10 +377,10 @@ export const MsgConvertERC20 = { }, toAmino(message: MsgConvertERC20): MsgConvertERC20Amino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.amount = omitDefault(message.amount); - obj.receiver = omitDefault(message.receiver); - obj.sender = omitDefault(message.sender); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.receiver = message.receiver === "" ? undefined : message.receiver; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: MsgConvertERC20AminoMsg): MsgConvertERC20 { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts index b6606b9e51..0d72231999 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/fees.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * DevFeeInfo defines an instance that organizes fee distribution conditions @@ -130,9 +130,9 @@ export const DevFeeInfo = { }, toAmino(message: DevFeeInfo): DevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: DevFeeInfoAminoMsg): DevFeeInfo { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts index 997b70f7cf..68c84403ed 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts @@ -1,6 +1,6 @@ import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.fees.v1"; /** GenesisState defines the module's genesis state. */ @@ -150,7 +150,7 @@ export const GenesisState = { if (message.devFeeInfos) { obj.dev_fee_infos = message.devFeeInfos.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.dev_fee_infos = []; + obj.dev_fee_infos = message.devFeeInfos; } return obj; }, @@ -305,11 +305,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_fees = omitDefault(message.enableFees); - obj.developer_shares = padDecimal(message.developerShares); - obj.validator_shares = padDecimal(message.validatorShares); - obj.addr_derivation_cost_create = omitDefault(message.addrDerivationCostCreate); - obj.min_gas_price = padDecimal(message.minGasPrice); + obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; + obj.developer_shares = padDecimal(message.developerShares) === "" ? undefined : padDecimal(message.developerShares); + obj.validator_shares = padDecimal(message.validatorShares) === "" ? undefined : padDecimal(message.validatorShares); + obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.min_gas_price = padDecimal(message.minGasPrice) === "" ? undefined : padDecimal(message.minGasPrice); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts index 3b5676da06..b455127f67 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { DevFeeInfo, DevFeeInfoSDKType } from "./fees"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** * QueryDevFeeInfosRequest is the request type for the Query/DevFeeInfos RPC @@ -336,7 +336,7 @@ export const QueryDevFeeInfosResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -426,7 +426,7 @@ export const QueryDevFeeInfoRequest = { }, toAmino(message: QueryDevFeeInfoRequest): QueryDevFeeInfoRequestAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: QueryDevFeeInfoRequestAminoMsg): QueryDevFeeInfoRequest { @@ -780,7 +780,7 @@ export const QueryDevFeeInfosPerDeployerRequest = { }, toAmino(message: QueryDevFeeInfosPerDeployerRequest): QueryDevFeeInfosPerDeployerRequestAmino { const obj: any = {}; - obj.deployer_address = omitDefault(message.deployerAddress); + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -896,7 +896,7 @@ export const QueryDevFeeInfosPerDeployerResponse = { if (message.fees) { obj.fees = message.fees.map(e => e ? DevFeeInfo.toAmino(e) : undefined); } else { - obj.fees = []; + obj.fees = message.fees; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts index a53f2bf860..18aaa3533b 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts @@ -51,7 +51,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map(el0 => BigInt(el0)) + nonces: nonces.map?.(el0 => BigInt(el0)) }; } }, diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts index 8d99ea81f8..437bb6b2fe 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.fees.v1"; /** MsgRegisterFeesContract defines a message that registers a DevFeeInfo */ export interface MsgRegisterDevFeeInfo { @@ -239,13 +239,13 @@ export const MsgRegisterDevFeeInfo = { }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -418,8 +418,8 @@ export const MsgCancelDevFeeInfo = { }, toAmino(message: MsgCancelDevFeeInfo): MsgCancelDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; return obj; }, fromAminoMsg(object: MsgCancelDevFeeInfoAminoMsg): MsgCancelDevFeeInfo { @@ -607,9 +607,9 @@ export const MsgUpdateDevFeeInfo = { }, toAmino(message: MsgUpdateDevFeeInfo): MsgUpdateDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); - obj.deployer_address = omitDefault(message.deployerAddress); - obj.withdraw_address = omitDefault(message.withdrawAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; return obj; }, fromAminoMsg(object: MsgUpdateDevFeeInfoAminoMsg): MsgUpdateDevFeeInfo { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts index 0eae0e7606..c25d70cd42 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/genesis.ts @@ -1,6 +1,6 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault, padDecimal } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.incentives.v1"; /** GenesisState defines the module's genesis state. */ @@ -163,12 +163,12 @@ export const GenesisState = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } return obj; }, @@ -305,10 +305,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_incentives = omitDefault(message.enableIncentives); - obj.allocation_limit = padDecimal(message.allocationLimit); - obj.incentives_epoch_identifier = omitDefault(message.incentivesEpochIdentifier); - obj.reward_scaler = padDecimal(message.rewardScaler); + obj.enable_incentives = message.enableIncentives === false ? undefined : message.enableIncentives; + obj.allocation_limit = padDecimal(message.allocationLimit) === "" ? undefined : padDecimal(message.allocationLimit); + obj.incentives_epoch_identifier = message.incentivesEpochIdentifier === "" ? undefined : message.incentivesEpochIdentifier; + obj.reward_scaler = padDecimal(message.rewardScaler) === "" ? undefined : padDecimal(message.rewardScaler); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts index c563bf6a30..397ec5baa2 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts @@ -238,13 +238,13 @@ export const Incentive = { }, toAmino(message: Incentive): IncentiveAmino { const obj: any = {}; - obj.contract = message.contract; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; return obj; @@ -368,8 +368,8 @@ export const GasMeter = { }, toAmino(message: GasMeter): GasMeterAmino { const obj: any = {}; - obj.contract = message.contract; - obj.participant = message.participant; + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; return obj; }, @@ -528,15 +528,15 @@ export const RegisterIncentiveProposal = { }, toAmino(message: RegisterIncentiveProposal): RegisterIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; if (message.allocations) { obj.allocations = message.allocations.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocations = []; + obj.allocations = message.allocations; } - obj.epochs = message.epochs; + obj.epochs = message.epochs === 0 ? undefined : message.epochs; return obj; }, fromAminoMsg(object: RegisterIncentiveProposalAminoMsg): RegisterIncentiveProposal { @@ -656,9 +656,9 @@ export const CancelIncentiveProposal = { }, toAmino(message: CancelIncentiveProposal): CancelIncentiveProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; - obj.contract = message.contract; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: CancelIncentiveProposalAminoMsg): CancelIncentiveProposal { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts index 1603dacf30..0e03fbe393 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts @@ -3,7 +3,7 @@ import { Incentive, IncentiveSDKType, GasMeter, GasMeterSDKType } from "./incent import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.incentives.v1"; /** * QueryIncentivesRequest is the request type for the Query/Incentives RPC @@ -446,7 +446,7 @@ export const QueryIncentivesResponse = { if (message.incentives) { obj.incentives = message.incentives.map(e => e ? Incentive.toAmino(e) : undefined); } else { - obj.incentives = []; + obj.incentives = message.incentives; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -536,7 +536,7 @@ export const QueryIncentiveRequest = { }, toAmino(message: QueryIncentiveRequest): QueryIncentiveRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); + obj.contract = message.contract === "" ? undefined : message.contract; return obj; }, fromAminoMsg(object: QueryIncentiveRequestAminoMsg): QueryIncentiveRequest { @@ -732,7 +732,7 @@ export const QueryGasMetersRequest = { }, toAmino(message: QueryGasMetersRequest): QueryGasMetersRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); + obj.contract = message.contract === "" ? undefined : message.contract; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -848,7 +848,7 @@ export const QueryGasMetersResponse = { if (message.gasMeters) { obj.gas_meters = message.gasMeters.map(e => e ? GasMeter.toAmino(e) : undefined); } else { - obj.gas_meters = []; + obj.gas_meters = message.gasMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -954,8 +954,8 @@ export const QueryGasMeterRequest = { }, toAmino(message: QueryGasMeterRequest): QueryGasMeterRequestAmino { const obj: any = {}; - obj.contract = omitDefault(message.contract); - obj.participant = omitDefault(message.participant); + obj.contract = message.contract === "" ? undefined : message.contract; + obj.participant = message.participant === "" ? undefined : message.participant; return obj; }, fromAminoMsg(object: QueryGasMeterRequestAminoMsg): QueryGasMeterRequest { @@ -1045,7 +1045,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = omitDefault(message.gasMeter); + obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { @@ -1250,7 +1250,7 @@ export const QueryAllocationMetersResponse = { if (message.allocationMeters) { obj.allocation_meters = message.allocationMeters.map(e => e ? DecCoin.toAmino(e) : undefined); } else { - obj.allocation_meters = []; + obj.allocation_meters = message.allocationMeters; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1340,7 +1340,7 @@ export const QueryAllocationMeterRequest = { }, toAmino(message: QueryAllocationMeterRequest): QueryAllocationMeterRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryAllocationMeterRequestAminoMsg): QueryAllocationMeterRequest { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts index 54e4c1e028..2390374c0a 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts @@ -1,6 +1,6 @@ import { ExponentialCalculation, ExponentialCalculationSDKType, InflationDistribution, InflationDistributionSDKType } from "./inflation"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.inflation.v1"; /** GenesisState defines the inflation module's genesis state. */ export interface GenesisState { @@ -191,10 +191,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = omitDefault(message.period); - obj.epoch_identifier = omitDefault(message.epochIdentifier); - obj.epochs_per_period = omitDefault(message.epochsPerPeriod); - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.period = message.period ? message.period.toString() : undefined; + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; + obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -334,10 +334,10 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.exponential_calculation = message.exponentialCalculation ? ExponentialCalculation.toAmino(message.exponentialCalculation) : undefined; obj.inflation_distribution = message.inflationDistribution ? InflationDistribution.toAmino(message.inflationDistribution) : undefined; - obj.enable_inflation = omitDefault(message.enableInflation); + obj.enable_inflation = message.enableInflation === false ? undefined : message.enableInflation; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts index a47a1726d3..6ef4300957 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/inflation.ts @@ -184,9 +184,9 @@ export const InflationDistribution = { }, toAmino(message: InflationDistribution): InflationDistributionAmino { const obj: any = {}; - obj.staking_rewards = padDecimal(message.stakingRewards); - obj.usage_incentives = padDecimal(message.usageIncentives); - obj.community_pool = padDecimal(message.communityPool); + obj.staking_rewards = padDecimal(message.stakingRewards) === "" ? undefined : padDecimal(message.stakingRewards); + obj.usage_incentives = padDecimal(message.usageIncentives) === "" ? undefined : padDecimal(message.usageIncentives); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: InflationDistributionAminoMsg): InflationDistribution { @@ -338,11 +338,11 @@ export const ExponentialCalculation = { }, toAmino(message: ExponentialCalculation): ExponentialCalculationAmino { const obj: any = {}; - obj.a = padDecimal(message.a); - obj.r = padDecimal(message.r); - obj.c = padDecimal(message.c); - obj.bonding_target = padDecimal(message.bondingTarget); - obj.max_variance = padDecimal(message.maxVariance); + obj.a = padDecimal(message.a) === "" ? undefined : padDecimal(message.a); + obj.r = padDecimal(message.r) === "" ? undefined : padDecimal(message.r); + obj.c = padDecimal(message.c) === "" ? undefined : padDecimal(message.c); + obj.bonding_target = padDecimal(message.bondingTarget) === "" ? undefined : padDecimal(message.bondingTarget); + obj.max_variance = padDecimal(message.maxVariance) === "" ? undefined : padDecimal(message.maxVariance); return obj; }, fromAminoMsg(object: ExponentialCalculationAminoMsg): ExponentialCalculation { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts index e0c6a93119..b67fb6b1ef 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts @@ -1,7 +1,7 @@ import { DecCoin, DecCoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "evmos.inflation.v1"; /** QueryPeriodRequest is the request type for the Query/Period RPC method. */ @@ -317,7 +317,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = omitDefault(message.period); + obj.period = message.period ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -633,7 +633,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = omitDefault(message.skippedEpochs); + obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { @@ -947,7 +947,7 @@ export const QueryInflationRateResponse = { }, toAmino(message: QueryInflationRateResponse): QueryInflationRateResponseAmino { const obj: any = {}; - obj.inflation_rate = padDecimal(message.inflationRate); + obj.inflation_rate = padDecimal(message.inflationRate) === "" ? undefined : padDecimal(message.inflationRate); return obj; }, fromAminoMsg(object: QueryInflationRateResponseAminoMsg): QueryInflationRateResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts index def1669df8..11b39553c0 100644 --- a/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/recovery/v1/genesis.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.recovery.v1"; /** GenesisState defines the recovery module's genesis state. */ export interface GenesisState { @@ -208,7 +208,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.enable_recovery = omitDefault(message.enableRecovery); + obj.enable_recovery = message.enableRecovery === false ? undefined : message.enableRecovery; obj.packet_timeout_duration = message.packetTimeoutDuration ? Duration.toAmino(message.packetTimeoutDuration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts index 586c1b335d..bfda615b80 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/query.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "evmos.vesting.v1"; /** QueryBalancesRequest is the request type for the Query/Balances RPC method. */ export interface QueryBalancesRequest { @@ -109,7 +109,7 @@ export const QueryBalancesRequest = { }, toAmino(message: QueryBalancesRequest): QueryBalancesRequestAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryBalancesRequestAminoMsg): QueryBalancesRequest { @@ -250,17 +250,17 @@ export const QueryBalancesResponse = { if (message.locked) { obj.locked = message.locked.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.locked = []; + obj.locked = message.locked; } if (message.unvested) { obj.unvested = message.unvested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.unvested = []; + obj.unvested = message.unvested; } if (message.vested) { obj.vested = message.vested.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.vested = []; + obj.vested = message.vested; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index 031641c46c..edb8ed1f1b 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -79,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + lockupPeriods: lockup_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map(el0 => ({ - length: BigInt(el0.length), - amount: el0.amount.map(el1 => ({ + vestingPeriods: vesting_periods.map?.(el0 => ({ + length: el0.length == null ? el0.length : BigInt(el0.length), + amount: el0.amount.map?.(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts index 1a301fc010..c6dc1c0a23 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.ts @@ -252,20 +252,20 @@ export const MsgCreateClawbackVestingAccount = { }, toAmino(message: MsgCreateClawbackVestingAccount): MsgCreateClawbackVestingAccountAmino { const obj: any = {}; - obj.from_address = message.fromAddress; - obj.to_address = message.toAddress; + obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; + obj.to_address = message.toAddress === "" ? undefined : message.toAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } - obj.merge = message.merge; + obj.merge = message.merge === false ? undefined : message.merge; return obj; }, fromAminoMsg(object: MsgCreateClawbackVestingAccountAminoMsg): MsgCreateClawbackVestingAccount { @@ -453,9 +453,9 @@ export const MsgClawback = { }, toAmino(message: MsgClawback): MsgClawbackAmino { const obj: any = {}; - obj.funder_address = message.funderAddress; - obj.account_address = message.accountAddress; - obj.dest_address = message.destAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; + obj.account_address = message.accountAddress === "" ? undefined : message.accountAddress; + obj.dest_address = message.destAddress === "" ? undefined : message.destAddress; return obj; }, fromAminoMsg(object: MsgClawbackAminoMsg): MsgClawback { diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts index ffb222d228..03523bb20e 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/vesting.ts @@ -189,17 +189,17 @@ export const ClawbackVestingAccount = { toAmino(message: ClawbackVestingAccount): ClawbackVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.funder_address = message.funderAddress; + obj.funder_address = message.funderAddress === "" ? undefined : message.funderAddress; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; if (message.lockupPeriods) { obj.lockup_periods = message.lockupPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.lockup_periods = []; + obj.lockup_periods = message.lockupPeriods; } if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { - obj.vesting_periods = []; + obj.vesting_periods = message.vestingPeriods; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/auth.ts b/__fixtures__/v-next/outputv4/google/api/auth.ts index e2f313e929..c4ac81b745 100644 --- a/__fixtures__/v-next/outputv4/google/api/auth.ts +++ b/__fixtures__/v-next/outputv4/google/api/auth.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Authentication` defines the authentication configuration for API methods @@ -442,12 +442,12 @@ export const Authentication = { if (message.rules) { obj.rules = message.rules.map(e => e ? AuthenticationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } if (message.providers) { obj.providers = message.providers.map(e => e ? AuthProvider.toAmino(e) : undefined); } else { - obj.providers = []; + obj.providers = message.providers; } return obj; }, @@ -592,13 +592,13 @@ export const AuthenticationRule = { }, toAmino(message: AuthenticationRule): AuthenticationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.oauth = message.oauth ? OAuthRequirements.toAmino(message.oauth) : undefined; - obj.allow_without_credential = omitDefault(message.allowWithoutCredential); + obj.allow_without_credential = message.allowWithoutCredential === false ? undefined : message.allowWithoutCredential; if (message.requirements) { obj.requirements = message.requirements.map(e => e ? AuthRequirement.toAmino(e) : undefined); } else { - obj.requirements = []; + obj.requirements = message.requirements; } return obj; }, @@ -719,9 +719,9 @@ export const JwtLocation = { }, toAmino(message: JwtLocation): JwtLocationAmino { const obj: any = {}; - obj.header = omitDefault(message.header); - obj.query = omitDefault(message.query); - obj.value_prefix = omitDefault(message.valuePrefix); + obj.header = message.header === null ? undefined : message.header; + obj.query = message.query === null ? undefined : message.query; + obj.value_prefix = message.valuePrefix === "" ? undefined : message.valuePrefix; return obj; }, fromAminoMsg(object: JwtLocationAminoMsg): JwtLocation { @@ -895,15 +895,15 @@ export const AuthProvider = { }, toAmino(message: AuthProvider): AuthProviderAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.issuer = omitDefault(message.issuer); - obj.jwks_uri = omitDefault(message.jwksUri); - obj.audiences = omitDefault(message.audiences); - obj.authorization_url = omitDefault(message.authorizationUrl); + obj.id = message.id === "" ? undefined : message.id; + obj.issuer = message.issuer === "" ? undefined : message.issuer; + obj.jwks_uri = message.jwksUri === "" ? undefined : message.jwksUri; + obj.audiences = message.audiences === "" ? undefined : message.audiences; + obj.authorization_url = message.authorizationUrl === "" ? undefined : message.authorizationUrl; if (message.jwtLocations) { obj.jwt_locations = message.jwtLocations.map(e => e ? JwtLocation.toAmino(e) : undefined); } else { - obj.jwt_locations = []; + obj.jwt_locations = message.jwtLocations; } return obj; }, @@ -992,7 +992,7 @@ export const OAuthRequirements = { }, toAmino(message: OAuthRequirements): OAuthRequirementsAmino { const obj: any = {}; - obj.canonical_scopes = omitDefault(message.canonicalScopes); + obj.canonical_scopes = message.canonicalScopes === "" ? undefined : message.canonicalScopes; return obj; }, fromAminoMsg(object: OAuthRequirementsAminoMsg): OAuthRequirements { @@ -1096,8 +1096,8 @@ export const AuthRequirement = { }, toAmino(message: AuthRequirement): AuthRequirementAmino { const obj: any = {}; - obj.provider_id = omitDefault(message.providerId); - obj.audiences = omitDefault(message.audiences); + obj.provider_id = message.providerId === "" ? undefined : message.providerId; + obj.audiences = message.audiences === "" ? undefined : message.audiences; return obj; }, fromAminoMsg(object: AuthRequirementAminoMsg): AuthRequirement { diff --git a/__fixtures__/v-next/outputv4/google/api/backend.ts b/__fixtures__/v-next/outputv4/google/api/backend.ts index 2c398a7e21..953d36987c 100644 --- a/__fixtures__/v-next/outputv4/google/api/backend.ts +++ b/__fixtures__/v-next/outputv4/google/api/backend.ts @@ -289,7 +289,7 @@ export const Backend = { if (message.rules) { obj.rules = message.rules.map(e => e ? BackendRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -491,7 +491,7 @@ export const BackendRule = { message.operationDeadline = object.operation_deadline; } if (object.path_translation !== undefined && object.path_translation !== null) { - message.pathTranslation = backendRule_PathTranslationFromJSON(object.path_translation); + message.pathTranslation = object.path_translation; } if (object.jwt_audience !== undefined && object.jwt_audience !== null) { message.jwtAudience = object.jwt_audience; @@ -506,15 +506,15 @@ export const BackendRule = { }, toAmino(message: BackendRule): BackendRuleAmino { const obj: any = {}; - obj.selector = message.selector; - obj.address = message.address; - obj.deadline = message.deadline; - obj.min_deadline = message.minDeadline; - obj.operation_deadline = message.operationDeadline; - obj.path_translation = backendRule_PathTranslationToJSON(message.pathTranslation); - obj.jwt_audience = message.jwtAudience; - obj.disable_auth = message.disableAuth; - obj.protocol = message.protocol; + obj.selector = message.selector === "" ? undefined : message.selector; + obj.address = message.address === "" ? undefined : message.address; + obj.deadline = message.deadline === 0 ? undefined : message.deadline; + obj.min_deadline = message.minDeadline === 0 ? undefined : message.minDeadline; + obj.operation_deadline = message.operationDeadline === 0 ? undefined : message.operationDeadline; + obj.path_translation = message.pathTranslation === 0 ? undefined : message.pathTranslation; + obj.jwt_audience = message.jwtAudience === null ? undefined : message.jwtAudience; + obj.disable_auth = message.disableAuth === null ? undefined : message.disableAuth; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: BackendRuleAminoMsg): BackendRule { diff --git a/__fixtures__/v-next/outputv4/google/api/billing.ts b/__fixtures__/v-next/outputv4/google/api/billing.ts index 931b7b60ae..cae2208762 100644 --- a/__fixtures__/v-next/outputv4/google/api/billing.ts +++ b/__fixtures__/v-next/outputv4/google/api/billing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Billing related configuration of the service. @@ -191,7 +191,7 @@ export const Billing = { if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Billing_BillingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -302,11 +302,11 @@ export const Billing_BillingDestination = { }, toAmino(message: Billing_BillingDestination): Billing_BillingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/config_change.ts b/__fixtures__/v-next/outputv4/google/api/config_change.ts index 644c92458c..3c4038a3da 100644 --- a/__fixtures__/v-next/outputv4/google/api/config_change.ts +++ b/__fixtures__/v-next/outputv4/google/api/config_change.ts @@ -273,21 +273,21 @@ export const ConfigChange = { message.newValue = object.new_value; } if (object.change_type !== undefined && object.change_type !== null) { - message.changeType = changeTypeFromJSON(object.change_type); + message.changeType = object.change_type; } message.advices = object.advices?.map(e => Advice.fromAmino(e)) || []; return message; }, toAmino(message: ConfigChange): ConfigChangeAmino { const obj: any = {}; - obj.element = message.element; - obj.old_value = message.oldValue; - obj.new_value = message.newValue; - obj.change_type = changeTypeToJSON(message.changeType); + obj.element = message.element === "" ? undefined : message.element; + obj.old_value = message.oldValue === "" ? undefined : message.oldValue; + obj.new_value = message.newValue === "" ? undefined : message.newValue; + obj.change_type = message.changeType === 0 ? undefined : message.changeType; if (message.advices) { obj.advices = message.advices.map(e => e ? Advice.toAmino(e) : undefined); } else { - obj.advices = []; + obj.advices = message.advices; } return obj; }, @@ -376,7 +376,7 @@ export const Advice = { }, toAmino(message: Advice): AdviceAmino { const obj: any = {}; - obj.description = message.description; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: AdviceAminoMsg): Advice { diff --git a/__fixtures__/v-next/outputv4/google/api/consumer.ts b/__fixtures__/v-next/outputv4/google/api/consumer.ts index ac14aaa414..bf377fdf76 100644 --- a/__fixtures__/v-next/outputv4/google/api/consumer.ts +++ b/__fixtures__/v-next/outputv4/google/api/consumer.ts @@ -222,7 +222,7 @@ export const ProjectProperties = { if (message.properties) { obj.properties = message.properties.map(e => e ? Property.toAmino(e) : undefined); } else { - obj.properties = []; + obj.properties = message.properties; } return obj; }, @@ -334,7 +334,7 @@ export const Property = { message.name = object.name; } if (object.type !== undefined && object.type !== null) { - message.type = property_PropertyTypeFromJSON(object.type); + message.type = object.type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -343,9 +343,9 @@ export const Property = { }, toAmino(message: Property): PropertyAmino { const obj: any = {}; - obj.name = message.name; - obj.type = property_PropertyTypeToJSON(message.type); - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === 0 ? undefined : message.type; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PropertyAminoMsg): Property { diff --git a/__fixtures__/v-next/outputv4/google/api/context.ts b/__fixtures__/v-next/outputv4/google/api/context.ts index 8c87863e0d..e4d582c18c 100644 --- a/__fixtures__/v-next/outputv4/google/api/context.ts +++ b/__fixtures__/v-next/outputv4/google/api/context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Context` defines which contexts an API requests. @@ -211,7 +211,7 @@ export const Context = { if (message.rules) { obj.rules = message.rules.map(e => e ? ContextRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -388,26 +388,26 @@ export const ContextRule = { }, toAmino(message: ContextRule): ContextRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.requested) { obj.requested = message.requested.map(e => e); } else { - obj.requested = []; + obj.requested = message.requested; } if (message.provided) { obj.provided = message.provided.map(e => e); } else { - obj.provided = []; + obj.provided = message.provided; } if (message.allowedRequestExtensions) { obj.allowed_request_extensions = message.allowedRequestExtensions.map(e => e); } else { - obj.allowed_request_extensions = []; + obj.allowed_request_extensions = message.allowedRequestExtensions; } if (message.allowedResponseExtensions) { obj.allowed_response_extensions = message.allowedResponseExtensions.map(e => e); } else { - obj.allowed_response_extensions = []; + obj.allowed_response_extensions = message.allowedResponseExtensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/control.ts b/__fixtures__/v-next/outputv4/google/api/control.ts index c405a1b92f..084229d3cd 100644 --- a/__fixtures__/v-next/outputv4/google/api/control.ts +++ b/__fixtures__/v-next/outputv4/google/api/control.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Selects and configures the service controller used by the service. The @@ -94,7 +94,7 @@ export const Control = { }, toAmino(message: Control): ControlAmino { const obj: any = {}; - obj.environment = omitDefault(message.environment); + obj.environment = message.environment === "" ? undefined : message.environment; return obj; }, fromAminoMsg(object: ControlAminoMsg): Control { diff --git a/__fixtures__/v-next/outputv4/google/api/distribution.ts b/__fixtures__/v-next/outputv4/google/api/distribution.ts index 976cec91cd..50c81443a3 100644 --- a/__fixtures__/v-next/outputv4/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/distribution.ts @@ -524,19 +524,19 @@ export const Distribution = { toAmino(message: Distribution): DistributionAmino { const obj: any = {}; obj.count = message.count ? message.count.toString() : undefined; - obj.mean = message.mean; - obj.sum_of_squared_deviation = message.sumOfSquaredDeviation; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -641,8 +641,8 @@ export const Distribution_Range = { }, toAmino(message: Distribution_Range): Distribution_RangeAmino { const obj: any = {}; - obj.min = message.min; - obj.max = message.max; + obj.min = message.min === 0 ? undefined : message.min; + obj.max = message.max === 0 ? undefined : message.max; return obj; }, fromAminoMsg(object: Distribution_RangeAminoMsg): Distribution_Range { @@ -890,9 +890,9 @@ export const Distribution_BucketOptions_Linear = { }, toAmino(message: Distribution_BucketOptions_Linear): Distribution_BucketOptions_LinearAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.width = message.width; - obj.offset = message.offset; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_LinearAminoMsg): Distribution_BucketOptions_Linear { @@ -1012,9 +1012,9 @@ export const Distribution_BucketOptions_Exponential = { }, toAmino(message: Distribution_BucketOptions_Exponential): Distribution_BucketOptions_ExponentialAmino { const obj: any = {}; - obj.num_finite_buckets = message.numFiniteBuckets; - obj.growth_factor = message.growthFactor; - obj.scale = message.scale; + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_BucketOptions_ExponentialAminoMsg): Distribution_BucketOptions_Exponential { @@ -1120,7 +1120,7 @@ export const Distribution_BucketOptions_Explicit = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, @@ -1247,12 +1247,12 @@ export const Distribution_Exemplar = { }, toAmino(message: Distribution_Exemplar): Distribution_ExemplarAmino { const obj: any = {}; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; if (message.attachments) { obj.attachments = message.attachments.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.attachments = []; + obj.attachments = message.attachments; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/documentation.ts b/__fixtures__/v-next/outputv4/google/api/documentation.ts index af759a04db..77dcae98fc 100644 --- a/__fixtures__/v-next/outputv4/google/api/documentation.ts +++ b/__fixtures__/v-next/outputv4/google/api/documentation.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Documentation` provides the information for describing a service. @@ -403,20 +403,20 @@ export const Documentation = { }, toAmino(message: Documentation): DocumentationAmino { const obj: any = {}; - obj.summary = omitDefault(message.summary); + obj.summary = message.summary === "" ? undefined : message.summary; if (message.pages) { obj.pages = message.pages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.pages = []; + obj.pages = message.pages; } if (message.rules) { obj.rules = message.rules.map(e => e ? DocumentationRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.documentation_root_url = omitDefault(message.documentationRootUrl); - obj.service_root_url = omitDefault(message.serviceRootUrl); - obj.overview = omitDefault(message.overview); + obj.documentation_root_url = message.documentationRootUrl === "" ? undefined : message.documentationRootUrl; + obj.service_root_url = message.serviceRootUrl === "" ? undefined : message.serviceRootUrl; + obj.overview = message.overview === "" ? undefined : message.overview; return obj; }, fromAminoMsg(object: DocumentationAminoMsg): Documentation { @@ -536,9 +536,9 @@ export const DocumentationRule = { }, toAmino(message: DocumentationRule): DocumentationRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.description = omitDefault(message.description); - obj.deprecation_description = omitDefault(message.deprecationDescription); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.description = message.description === "" ? undefined : message.description; + obj.deprecation_description = message.deprecationDescription === "" ? undefined : message.deprecationDescription; return obj; }, fromAminoMsg(object: DocumentationRuleAminoMsg): DocumentationRule { @@ -664,12 +664,12 @@ export const Page = { }, toAmino(message: Page): PageAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.content = message.content === "" ? undefined : message.content; if (message.subpages) { obj.subpages = message.subpages.map(e => e ? Page.toAmino(e) : undefined); } else { - obj.subpages = []; + obj.subpages = message.subpages; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/endpoint.ts b/__fixtures__/v-next/outputv4/google/api/endpoint.ts index 987d102a10..63ea26cf9e 100644 --- a/__fixtures__/v-next/outputv4/google/api/endpoint.ts +++ b/__fixtures__/v-next/outputv4/google/api/endpoint.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Endpoint` describes a network endpoint of a service that serves a set of @@ -203,14 +203,14 @@ export const Endpoint = { }, toAmino(message: Endpoint): EndpointAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.aliases) { obj.aliases = message.aliases.map(e => e); } else { - obj.aliases = []; + obj.aliases = message.aliases; } - obj.target = omitDefault(message.target); - obj.allow_cors = omitDefault(message.allowCors); + obj.target = message.target === "" ? undefined : message.target; + obj.allow_cors = message.allowCors === false ? undefined : message.allowCors; return obj; }, fromAminoMsg(object: EndpointAminoMsg): Endpoint { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts index fcf65dd441..6a5142fdc6 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -349,10 +349,10 @@ export const ParseRequest = { }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -468,7 +468,7 @@ export const ParseResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -617,10 +617,10 @@ export const CheckRequest = { if (message.typeEnv) { obj.type_env = message.typeEnv.map(e => e ? Decl.toAmino(e) : undefined); } else { - obj.type_env = []; + obj.type_env = message.typeEnv; } - obj.container = message.container; - obj.no_std_env = message.noStdEnv; + obj.container = message.container === "" ? undefined : message.container; + obj.no_std_env = message.noStdEnv === false ? undefined : message.noStdEnv; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -736,7 +736,7 @@ export const CheckResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -842,7 +842,7 @@ export const EvalRequest_BindingsEntry = { }, toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; return obj; }, @@ -1028,7 +1028,7 @@ export const EvalRequest = { obj.bindings[k] = ExprValue.toAmino(v); }); } - obj.container = message.container; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { @@ -1144,7 +1144,7 @@ export const EvalResponse = { if (message.issues) { obj.issues = message.issues.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.issues = []; + obj.issues = message.issues; } return obj; }, @@ -1257,7 +1257,7 @@ export const IssueDetails = { fromAmino(object: IssueDetailsAmino): IssueDetails { const message = createBaseIssueDetails(); if (object.severity !== undefined && object.severity !== null) { - message.severity = issueDetails_SeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.position !== undefined && object.position !== null) { message.position = SourcePosition.fromAmino(object.position); @@ -1269,7 +1269,7 @@ export const IssueDetails = { }, toAmino(message: IssueDetails): IssueDetailsAmino { const obj: any = {}; - obj.severity = issueDetails_SeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; obj.id = message.id ? message.id.toString() : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts index 1ce384353f..4a275bcb18 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts @@ -1015,7 +1015,7 @@ export const CheckedExpr = { }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -1271,16 +1271,16 @@ export const Type = { message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1311,15 +1311,15 @@ export const Type = { toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1637,7 +1637,7 @@ export const Type_FunctionType = { if (message.argTypes) { obj.arg_types = message.argTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.arg_types = []; + obj.arg_types = message.argTypes; } return obj; }, @@ -1748,11 +1748,11 @@ export const Type_AbstractType = { }, toAmino(message: Type_AbstractType): Type_AbstractTypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.parameterTypes) { obj.parameter_types = message.parameterTypes.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.parameter_types = []; + obj.parameter_types = message.parameterTypes; } return obj; }, @@ -1877,7 +1877,7 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.ident = message.ident ? Decl_IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? Decl_FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -2005,7 +2005,7 @@ export const Decl_IdentDecl = { const obj: any = {}; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.value = message.value ? Constant.toAmino(message.value) : undefined; - obj.doc = message.doc; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_IdentDeclAminoMsg): Decl_IdentDecl { @@ -2102,7 +2102,7 @@ export const Decl_FunctionDecl = { if (message.overloads) { obj.overloads = message.overloads.map(e => e ? Decl_FunctionDecl_Overload.toAmino(e) : undefined); } else { - obj.overloads = []; + obj.overloads = message.overloads; } return obj; }, @@ -2285,20 +2285,20 @@ export const Decl_FunctionDecl_Overload = { }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -2426,11 +2426,11 @@ export const Reference = { }, toAmino(message: Reference): ReferenceAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.overloadId) { obj.overload_id = message.overloadId.map(e => e); } else { - obj.overload_id = []; + obj.overload_id = message.overloadId; } obj.value = message.value ? Constant.toAmino(message.value) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts index 76572eeb4e..7578b2cf10 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * The state of an evaluation. @@ -251,12 +251,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -365,8 +365,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = omitDefault(message.expr); - obj.value = omitDefault(message.value); + obj.expr = message.expr ? message.expr.toString() : undefined; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -591,7 +591,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -698,7 +698,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e.toString()); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts index 46d1d08a15..fb9adcfcc5 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts @@ -1,6 +1,6 @@ import { Value, ValueSDKType } from "./value"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1alpha1"; /** * Values of intermediate expressions produced when evaluating expression. @@ -153,12 +153,12 @@ export const Explain = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.exprSteps) { obj.expr_steps = message.exprSteps.map(e => e ? Explain_ExprStep.toAmino(e) : undefined); } else { - obj.expr_steps = []; + obj.expr_steps = message.exprSteps; } return obj; }, @@ -265,8 +265,8 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.value_index = omitDefault(message.valueIndex); + obj.id = message.id ? message.id.toString() : undefined; + obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, fromAminoMsg(object: Explain_ExprStepAminoMsg): Explain_ExprStep { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts index 0b30071ed5..8707c2b3cd 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts @@ -937,7 +937,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -1060,8 +1060,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1190,11 +1190,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1292,7 +1292,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1403,11 +1403,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.message_name = message.messageName; + obj.message_name = message.messageName === "" ? undefined : message.messageName; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1551,7 +1551,7 @@ export const Expr_CreateStruct_Entry = { toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.field_key = message.fieldKey; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1747,9 +1747,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1949,7 +1949,7 @@ export const Constant = { fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1979,12 +1979,12 @@ export const Constant = { }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -2093,7 +2093,7 @@ export const SourceInfo_PositionsEntry = { toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; obj.key = message.key ? message.key.toString() : undefined; - obj.value = message.value; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -2442,12 +2442,12 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.syntax_version = message.syntaxVersion; - obj.location = message.location; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2596,10 +2596,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = message.location; - obj.offset = message.offset; - obj.line = message.line; - obj.column = message.column; + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts index 6ff0077e97..a2a4461fbe 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts @@ -369,7 +369,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -408,18 +408,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -523,8 +523,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -621,7 +621,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -719,7 +719,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts index 559bf9b20c..aa5c27d0e9 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/decl.ts @@ -1,6 +1,6 @@ import { Expr, ExprSDKType } from "./expr"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** A declaration. */ export interface Decl { @@ -231,9 +231,9 @@ export const Decl = { }, toAmino(message: Decl): DeclAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.name = omitDefault(message.name); - obj.doc = omitDefault(message.doc); + obj.id = message.id === 0 ? undefined : message.id; + obj.name = message.name === "" ? undefined : message.name; + obj.doc = message.doc === "" ? undefined : message.doc; obj.ident = message.ident ? IdentDecl.toAmino(message.ident) : undefined; obj.function = message.function ? FunctionDecl.toAmino(message.function) : undefined; return obj; @@ -361,12 +361,12 @@ export const DeclType = { }, toAmino(message: DeclType): DeclTypeAmino { const obj: any = {}; - obj.id = omitDefault(message.id); - obj.type = omitDefault(message.type); + obj.id = message.id === 0 ? undefined : message.id; + obj.type = message.type === "" ? undefined : message.type; if (message.typeParams) { obj.type_params = message.typeParams.map(e => e ? DeclType.toAmino(e) : undefined); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } return obj; }, @@ -607,10 +607,10 @@ export const FunctionDecl = { if (message.args) { obj.args = message.args.map(e => e ? IdentDecl.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } obj.return_type = message.returnType ? DeclType.toAmino(message.returnType) : undefined; - obj.receiver_function = omitDefault(message.receiverFunction); + obj.receiver_function = message.receiverFunction === false ? undefined : message.receiverFunction; return obj; }, fromAminoMsg(object: FunctionDeclAminoMsg): FunctionDecl { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts index 0307a76873..a0c78e0fcc 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/eval.ts @@ -1,7 +1,7 @@ import { Value, ValueSDKType } from "./value"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../../helpers"; +import { DeepPartial, isSet } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; /** * The state of an evaluation. @@ -264,12 +264,12 @@ export const EvalState = { if (message.values) { obj.values = message.values.map(e => e ? ExprValue.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } if (message.results) { obj.results = message.results.map(e => e ? EvalState_Result.toAmino(e) : undefined); } else { - obj.results = []; + obj.results = message.results; } return obj; }, @@ -377,7 +377,7 @@ export const EvalState_Result = { toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; obj.expr = message.expr ? IdRef.toAmino(message.expr) : undefined; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { @@ -602,7 +602,7 @@ export const ErrorSet = { if (message.errors) { obj.errors = message.errors.map(e => e ? Status.toAmino(e) : undefined); } else { - obj.errors = []; + obj.errors = message.errors; } return obj; }, @@ -700,7 +700,7 @@ export const UnknownSet = { if (message.exprs) { obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); } else { - obj.exprs = []; + obj.exprs = message.exprs; } return obj; }, @@ -789,7 +789,7 @@ export const IdRef = { }, toAmino(message: IdRef): IdRefAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id === 0 ? undefined : message.id; return obj; }, fromAminoMsg(object: IdRefAminoMsg): IdRef { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts index f19e9fa07b..558ab489b3 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts @@ -513,7 +513,7 @@ export const ParsedExpr = { const obj: any = {}; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.syntax_version = message.syntaxVersion; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; return obj; }, fromAminoMsg(object: ParsedExprAminoMsg): ParsedExpr { @@ -727,7 +727,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === 0 ? undefined : message.id; obj.literal_expr = message.literalExpr ? Literal.toAmino(message.literalExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -822,7 +822,7 @@ export const Expr_Ident = { }, toAmino(message: Expr_Ident): Expr_IdentAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: Expr_IdentAminoMsg): Expr_Ident { @@ -945,8 +945,8 @@ export const Expr_Select = { toAmino(message: Expr_Select): Expr_SelectAmino { const obj: any = {}; obj.operand = message.operand ? Expr.toAmino(message.operand) : undefined; - obj.field = message.field; - obj.test_only = message.testOnly; + obj.field = message.field === "" ? undefined : message.field; + obj.test_only = message.testOnly === false ? undefined : message.testOnly; return obj; }, fromAminoMsg(object: Expr_SelectAminoMsg): Expr_Select { @@ -1075,11 +1075,11 @@ export const Expr_Call = { toAmino(message: Expr_Call): Expr_CallAmino { const obj: any = {}; obj.target = message.target ? Expr.toAmino(message.target) : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; if (message.args) { obj.args = message.args.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.args = []; + obj.args = message.args; } return obj; }, @@ -1177,7 +1177,7 @@ export const Expr_CreateList = { if (message.elements) { obj.elements = message.elements.map(e => e ? Expr.toAmino(e) : undefined); } else { - obj.elements = []; + obj.elements = message.elements; } return obj; }, @@ -1288,11 +1288,11 @@ export const Expr_CreateStruct = { }, toAmino(message: Expr_CreateStruct): Expr_CreateStructAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.entries) { obj.entries = message.entries.map(e => e ? Expr_CreateStruct_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -1433,8 +1433,8 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id; - obj.field_key = message.fieldKey; + obj.id = message.id === 0 ? undefined : message.id; + obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; @@ -1630,9 +1630,9 @@ export const Expr_Comprehension = { }, toAmino(message: Expr_Comprehension): Expr_ComprehensionAmino { const obj: any = {}; - obj.iter_var = message.iterVar; + obj.iter_var = message.iterVar === "" ? undefined : message.iterVar; obj.iter_range = message.iterRange ? Expr.toAmino(message.iterRange) : undefined; - obj.accu_var = message.accuVar; + obj.accu_var = message.accuVar === "" ? undefined : message.accuVar; obj.accu_init = message.accuInit ? Expr.toAmino(message.accuInit) : undefined; obj.loop_condition = message.loopCondition ? Expr.toAmino(message.loopCondition) : undefined; obj.loop_step = message.loopStep ? Expr.toAmino(message.loopStep) : undefined; @@ -1804,7 +1804,7 @@ export const Literal = { fromAmino(object: LiteralAmino): Literal { const message = createBaseLiteral(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -1828,12 +1828,12 @@ export const Literal = { }, toAmino(message: Literal): LiteralAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts index 2b687f0044..afa2dccaf0 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/source.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.expr.v1beta1"; export interface SourceInfo_PositionsEntry { key: number; @@ -163,8 +163,8 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === 0 ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: SourceInfo_PositionsEntryAminoMsg): SourceInfo_PositionsEntry { @@ -336,11 +336,11 @@ export const SourceInfo = { }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = omitDefault(message.location); + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -483,10 +483,10 @@ export const SourcePosition = { }, toAmino(message: SourcePosition): SourcePositionAmino { const obj: any = {}; - obj.location = omitDefault(message.location); - obj.offset = omitDefault(message.offset); - obj.line = omitDefault(message.line); - obj.column = omitDefault(message.column); + obj.location = message.location === "" ? undefined : message.location; + obj.offset = message.offset === 0 ? undefined : message.offset; + obj.line = message.line === 0 ? undefined : message.line; + obj.column = message.column === 0 ? undefined : message.column; return obj; }, fromAminoMsg(object: SourcePositionAminoMsg): SourcePosition { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts index 38649aee4f..9b332a9930 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts @@ -369,7 +369,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -408,18 +408,18 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.enum_value = message.enumValue ? EnumValue.toAmino(message.enumValue) : undefined; obj.object_value = message.objectValue ? Any.toAmino(message.objectValue) : undefined; obj.map_value = message.mapValue ? MapValue.toAmino(message.mapValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; - obj.type_value = message.typeValue; + obj.type_value = message.typeValue === null ? undefined : message.typeValue; return obj; }, fromAminoMsg(object: ValueAminoMsg): Value { @@ -523,8 +523,8 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.type = message.type; - obj.value = message.value; + obj.type = message.type === "" ? undefined : message.type; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: EnumValueAminoMsg): EnumValue { @@ -621,7 +621,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, @@ -719,7 +719,7 @@ export const MapValue = { if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/http.ts b/__fixtures__/v-next/outputv4/google/api/http.ts index 8f4acdbea4..27fefd5395 100644 --- a/__fixtures__/v-next/outputv4/google/api/http.ts +++ b/__fixtures__/v-next/outputv4/google/api/http.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * Defines the HTTP configuration for an API service. It contains a list of @@ -756,9 +756,9 @@ export const Http = { if (message.rules) { obj.rules = message.rules.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.fully_decode_reserved_expansion = omitDefault(message.fullyDecodeReservedExpansion); + obj.fully_decode_reserved_expansion = message.fullyDecodeReservedExpansion === false ? undefined : message.fullyDecodeReservedExpansion; return obj; }, fromAminoMsg(object: HttpAminoMsg): Http { @@ -998,19 +998,19 @@ export const HttpRule = { }, toAmino(message: HttpRule): HttpRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.get = omitDefault(message.get); - obj.put = omitDefault(message.put); - obj.post = omitDefault(message.post); - obj.delete = omitDefault(message.delete); - obj.patch = omitDefault(message.patch); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.get = message.get === null ? undefined : message.get; + obj.put = message.put === null ? undefined : message.put; + obj.post = message.post === null ? undefined : message.post; + obj.delete = message.delete === null ? undefined : message.delete; + obj.patch = message.patch === null ? undefined : message.patch; obj.custom = message.custom ? CustomHttpPattern.toAmino(message.custom) : undefined; - obj.body = omitDefault(message.body); - obj.response_body = omitDefault(message.responseBody); + obj.body = message.body === "" ? undefined : message.body; + obj.response_body = message.responseBody === "" ? undefined : message.responseBody; if (message.additionalBindings) { obj.additional_bindings = message.additionalBindings.map(e => e ? HttpRule.toAmino(e) : undefined); } else { - obj.additional_bindings = []; + obj.additional_bindings = message.additionalBindings; } return obj; }, @@ -1115,8 +1115,8 @@ export const CustomHttpPattern = { }, toAmino(message: CustomHttpPattern): CustomHttpPatternAmino { const obj: any = {}; - obj.kind = omitDefault(message.kind); - obj.path = omitDefault(message.path); + obj.kind = message.kind === "" ? undefined : message.kind; + obj.path = message.path === "" ? undefined : message.path; return obj; }, fromAminoMsg(object: CustomHttpPatternAminoMsg): CustomHttpPattern { diff --git a/__fixtures__/v-next/outputv4/google/api/httpbody.ts b/__fixtures__/v-next/outputv4/google/api/httpbody.ts index 2bc4912c79..bc07994016 100644 --- a/__fixtures__/v-next/outputv4/google/api/httpbody.ts +++ b/__fixtures__/v-next/outputv4/google/api/httpbody.ts @@ -219,12 +219,12 @@ export const HttpBody = { }, toAmino(message: HttpBody): HttpBodyAmino { const obj: any = {}; - obj.content_type = message.contentType; + obj.content_type = message.contentType === "" ? undefined : message.contentType; obj.data = message.data ? base64FromBytes(message.data) : undefined; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/label.ts b/__fixtures__/v-next/outputv4/google/api/label.ts index 10b62de5e0..a26f34855d 100644 --- a/__fixtures__/v-next/outputv4/google/api/label.ts +++ b/__fixtures__/v-next/outputv4/google/api/label.ts @@ -153,7 +153,7 @@ export const LabelDescriptor = { message.key = object.key; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = labelDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.description !== undefined && object.description !== null) { message.description = object.description; @@ -162,9 +162,9 @@ export const LabelDescriptor = { }, toAmino(message: LabelDescriptor): LabelDescriptorAmino { const obj: any = {}; - obj.key = message.key; - obj.value_type = labelDescriptor_ValueTypeToJSON(message.valueType); - obj.description = message.description; + obj.key = message.key === "" ? undefined : message.key; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: LabelDescriptorAminoMsg): LabelDescriptor { diff --git a/__fixtures__/v-next/outputv4/google/api/log.ts b/__fixtures__/v-next/outputv4/google/api/log.ts index 40ce00bae2..aaf0a95b5c 100644 --- a/__fixtures__/v-next/outputv4/google/api/log.ts +++ b/__fixtures__/v-next/outputv4/google/api/log.ts @@ -1,6 +1,6 @@ import { LabelDescriptor, LabelDescriptorSDKType } from "./label"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * A description of a log type. Example in YAML format: @@ -180,14 +180,14 @@ export const LogDescriptor = { }, toAmino(message: LogDescriptor): LogDescriptorAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.description = omitDefault(message.description); - obj.display_name = omitDefault(message.displayName); + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: LogDescriptorAminoMsg): LogDescriptor { diff --git a/__fixtures__/v-next/outputv4/google/api/logging.ts b/__fixtures__/v-next/outputv4/google/api/logging.ts index aac2251a61..640f2aced6 100644 --- a/__fixtures__/v-next/outputv4/google/api/logging.ts +++ b/__fixtures__/v-next/outputv4/google/api/logging.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Logging configuration of the service. @@ -217,12 +217,12 @@ export const Logging = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Logging_LoggingDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -333,11 +333,11 @@ export const Logging_LoggingDestination = { }, toAmino(message: Logging_LoggingDestination): Logging_LoggingDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.logs) { obj.logs = message.logs.map(e => e); } else { - obj.logs = []; + obj.logs = message.logs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/metric.ts b/__fixtures__/v-next/outputv4/google/api/metric.ts index 8529a34f14..e77750b1b5 100644 --- a/__fixtures__/v-next/outputv4/google/api/metric.ts +++ b/__fixtures__/v-next/outputv4/google/api/metric.ts @@ -616,10 +616,10 @@ export const MetricDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.metric_kind !== undefined && object.metric_kind !== null) { - message.metricKind = metricDescriptor_MetricKindFromJSON(object.metric_kind); + message.metricKind = object.metric_kind; } if (object.value_type !== undefined && object.value_type !== null) { - message.valueType = metricDescriptor_ValueTypeFromJSON(object.value_type); + message.valueType = object.value_type; } if (object.unit !== undefined && object.unit !== null) { message.unit = object.unit; @@ -634,31 +634,31 @@ export const MetricDescriptor = { message.metadata = MetricDescriptor_MetricDescriptorMetadata.fromAmino(object.metadata); } if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } message.monitoredResourceTypes = object.monitored_resource_types?.map(e => e) || []; return message; }, toAmino(message: MetricDescriptor): MetricDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.metric_kind = metricDescriptor_MetricKindToJSON(message.metricKind); - obj.value_type = metricDescriptor_ValueTypeToJSON(message.valueType); - obj.unit = message.unit; - obj.description = message.description; - obj.display_name = message.displayName; + obj.metric_kind = message.metricKind === 0 ? undefined : message.metricKind; + obj.value_type = message.valueType === 0 ? undefined : message.valueType; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.description = message.description === "" ? undefined : message.description; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.metadata = message.metadata ? MetricDescriptor_MetricDescriptorMetadata.toAmino(message.metadata) : undefined; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; if (message.monitoredResourceTypes) { obj.monitored_resource_types = message.monitoredResourceTypes.map(e => e); } else { - obj.monitored_resource_types = []; + obj.monitored_resource_types = message.monitoredResourceTypes; } return obj; }, @@ -771,7 +771,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { fromAmino(object: MetricDescriptor_MetricDescriptorMetadataAmino): MetricDescriptor_MetricDescriptorMetadata { const message = createBaseMetricDescriptor_MetricDescriptorMetadata(); if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } if (object.sample_period !== undefined && object.sample_period !== null) { message.samplePeriod = Duration.fromAmino(object.sample_period); @@ -783,7 +783,7 @@ export const MetricDescriptor_MetricDescriptorMetadata = { }, toAmino(message: MetricDescriptor_MetricDescriptorMetadata): MetricDescriptor_MetricDescriptorMetadataAmino { const obj: any = {}; - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; obj.sample_period = message.samplePeriod ? Duration.toAmino(message.samplePeriod) : undefined; obj.ingest_delay = message.ingestDelay ? Duration.toAmino(message.ingestDelay) : undefined; return obj; @@ -888,8 +888,8 @@ export const Metric_LabelsEntry = { }, toAmino(message: Metric_LabelsEntry): Metric_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Metric_LabelsEntryAminoMsg): Metric_LabelsEntry { @@ -1030,7 +1030,7 @@ export const Metric = { }, toAmino(message: Metric): MetricAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts index 9b623d4982..08ce330325 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitored_resource.ts @@ -348,22 +348,22 @@ export const MonitoredResourceDescriptor = { } message.labels = object.labels?.map(e => LabelDescriptor.fromAmino(e)) || []; if (object.launch_stage !== undefined && object.launch_stage !== null) { - message.launchStage = launchStageFromJSON(object.launch_stage); + message.launchStage = object.launch_stage; } return message; }, toAmino(message: MonitoredResourceDescriptor): MonitoredResourceDescriptorAmino { const obj: any = {}; - obj.name = message.name; - obj.type = message.type; - obj.display_name = message.displayName; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.display_name = message.displayName === "" ? undefined : message.displayName; + obj.description = message.description === "" ? undefined : message.description; if (message.labels) { obj.labels = message.labels.map(e => e ? LabelDescriptor.toAmino(e) : undefined); } else { - obj.labels = []; + obj.labels = message.labels; } - obj.launch_stage = launchStageToJSON(message.launchStage); + obj.launch_stage = message.launchStage === 0 ? undefined : message.launchStage; return obj; }, fromAminoMsg(object: MonitoredResourceDescriptorAminoMsg): MonitoredResourceDescriptor { @@ -466,8 +466,8 @@ export const MonitoredResource_LabelsEntry = { }, toAmino(message: MonitoredResource_LabelsEntry): MonitoredResource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResource_LabelsEntryAminoMsg): MonitoredResource_LabelsEntry { @@ -608,7 +608,7 @@ export const MonitoredResource = { }, toAmino(message: MonitoredResource): MonitoredResourceAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -717,8 +717,8 @@ export const MonitoredResourceMetadata_UserLabelsEntry = { }, toAmino(message: MonitoredResourceMetadata_UserLabelsEntry): MonitoredResourceMetadata_UserLabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MonitoredResourceMetadata_UserLabelsEntryAminoMsg): MonitoredResourceMetadata_UserLabelsEntry { diff --git a/__fixtures__/v-next/outputv4/google/api/monitoring.ts b/__fixtures__/v-next/outputv4/google/api/monitoring.ts index 53cfe8bd20..ab5f9b5a3d 100644 --- a/__fixtures__/v-next/outputv4/google/api/monitoring.ts +++ b/__fixtures__/v-next/outputv4/google/api/monitoring.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Monitoring configuration of the service. @@ -265,12 +265,12 @@ export const Monitoring = { if (message.producerDestinations) { obj.producer_destinations = message.producerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.producer_destinations = []; + obj.producer_destinations = message.producerDestinations; } if (message.consumerDestinations) { obj.consumer_destinations = message.consumerDestinations.map(e => e ? Monitoring_MonitoringDestination.toAmino(e) : undefined); } else { - obj.consumer_destinations = []; + obj.consumer_destinations = message.consumerDestinations; } return obj; }, @@ -381,11 +381,11 @@ export const Monitoring_MonitoringDestination = { }, toAmino(message: Monitoring_MonitoringDestination): Monitoring_MonitoringDestinationAmino { const obj: any = {}; - obj.monitored_resource = omitDefault(message.monitoredResource); + obj.monitored_resource = message.monitoredResource === "" ? undefined : message.monitoredResource; if (message.metrics) { obj.metrics = message.metrics.map(e => e); } else { - obj.metrics = []; + obj.metrics = message.metrics; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/quota.ts b/__fixtures__/v-next/outputv4/google/api/quota.ts index b16a69f88d..750cfdfbd4 100644 --- a/__fixtures__/v-next/outputv4/google/api/quota.ts +++ b/__fixtures__/v-next/outputv4/google/api/quota.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault, isObject } from "../../helpers"; +import { DeepPartial, isSet, isObject } from "../../helpers"; export const protobufPackage = "google.api"; /** * Quota configuration helps to achieve fairness and budgeting in service @@ -401,12 +401,12 @@ export const Quota = { if (message.limits) { obj.limits = message.limits.map(e => e ? QuotaLimit.toAmino(e) : undefined); } else { - obj.limits = []; + obj.limits = message.limits; } if (message.metricRules) { obj.metric_rules = message.metricRules.map(e => e ? MetricRule.toAmino(e) : undefined); } else { - obj.metric_rules = []; + obj.metric_rules = message.metricRules; } return obj; }, @@ -512,8 +512,8 @@ export const MetricRule_MetricCostsEntry = { }, toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -654,7 +654,7 @@ export const MetricRule = { }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -765,8 +765,8 @@ export const QuotaLimit_ValuesEntry = { }, toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1041,21 +1041,21 @@ export const QuotaLimit = { }, toAmino(message: QuotaLimit): QuotaLimitAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.description = omitDefault(message.description); - obj.default_limit = omitDefault(message.defaultLimit); - obj.max_limit = omitDefault(message.maxLimit); - obj.free_tier = omitDefault(message.freeTier); - obj.duration = omitDefault(message.duration); - obj.metric = omitDefault(message.metric); - obj.unit = omitDefault(message.unit); + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.duration = message.duration === "" ? undefined : message.duration; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; obj.values = {}; if (message.values) { Object.entries(message.values).forEach(([k, v]) => { obj.values[k] = v.toString(); }); } - obj.display_name = omitDefault(message.displayName); + obj.display_name = message.displayName === "" ? undefined : message.displayName; return obj; }, fromAminoMsg(object: QuotaLimitAminoMsg): QuotaLimit { diff --git a/__fixtures__/v-next/outputv4/google/api/resource.ts b/__fixtures__/v-next/outputv4/google/api/resource.ts index 1ef9b96024..0e4a5e2623 100644 --- a/__fixtures__/v-next/outputv4/google/api/resource.ts +++ b/__fixtures__/v-next/outputv4/google/api/resource.ts @@ -517,7 +517,7 @@ export const ResourceDescriptor = { message.nameField = object.name_field; } if (object.history !== undefined && object.history !== null) { - message.history = resourceDescriptor_HistoryFromJSON(object.history); + message.history = object.history; } if (object.plural !== undefined && object.plural !== null) { message.plural = object.plural; @@ -525,25 +525,25 @@ export const ResourceDescriptor = { if (object.singular !== undefined && object.singular !== null) { message.singular = object.singular; } - message.style = object.style?.map(e => resourceDescriptor_StyleFromJSON(e)) || []; + message.style = object.style?.map(e => e) || []; return message; }, toAmino(message: ResourceDescriptor): ResourceDescriptorAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.pattern) { obj.pattern = message.pattern.map(e => e); } else { - obj.pattern = []; + obj.pattern = message.pattern; } - obj.name_field = message.nameField; - obj.history = resourceDescriptor_HistoryToJSON(message.history); - obj.plural = message.plural; - obj.singular = message.singular; + obj.name_field = message.nameField === "" ? undefined : message.nameField; + obj.history = message.history === 0 ? undefined : message.history; + obj.plural = message.plural === "" ? undefined : message.plural; + obj.singular = message.singular === "" ? undefined : message.singular; if (message.style) { - obj.style = message.style.map(e => resourceDescriptor_StyleToJSON(e)); + obj.style = message.style.map(e => e); } else { - obj.style = []; + obj.style = message.style; } return obj; }, @@ -648,8 +648,8 @@ export const ResourceReference = { }, toAmino(message: ResourceReference): ResourceReferenceAmino { const obj: any = {}; - obj.type = message.type; - obj.child_type = message.childType; + obj.type = message.type === "" ? undefined : message.type; + obj.child_type = message.childType === "" ? undefined : message.childType; return obj; }, fromAminoMsg(object: ResourceReferenceAminoMsg): ResourceReference { diff --git a/__fixtures__/v-next/outputv4/google/api/routing.ts b/__fixtures__/v-next/outputv4/google/api/routing.ts index 60de4d04ae..f045948f92 100644 --- a/__fixtures__/v-next/outputv4/google/api/routing.ts +++ b/__fixtures__/v-next/outputv4/google/api/routing.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * Specifies the routing information that should be sent along with the request @@ -890,7 +890,7 @@ export const RoutingRule = { if (message.routingParameters) { obj.routing_parameters = message.routingParameters.map(e => e ? RoutingParameter.toAmino(e) : undefined); } else { - obj.routing_parameters = []; + obj.routing_parameters = message.routingParameters; } return obj; }, @@ -995,8 +995,8 @@ export const RoutingParameter = { }, toAmino(message: RoutingParameter): RoutingParameterAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.path_template = omitDefault(message.pathTemplate); + obj.field = message.field === "" ? undefined : message.field; + obj.path_template = message.pathTemplate === "" ? undefined : message.pathTemplate; return obj; }, fromAminoMsg(object: RoutingParameterAminoMsg): RoutingParameter { diff --git a/__fixtures__/v-next/outputv4/google/api/service.ts b/__fixtures__/v-next/outputv4/google/api/service.ts index cab3426cb5..0a985a4bd4 100644 --- a/__fixtures__/v-next/outputv4/google/api/service.ts +++ b/__fixtures__/v-next/outputv4/google/api/service.ts @@ -19,7 +19,7 @@ import { SystemParameters, SystemParametersSDKType } from "./system_parameter"; import { SourceInfo, SourceInfoSDKType } from "./source_info"; import { UInt32Value, UInt32ValueSDKType } from "../protobuf/wrappers"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Service` is the root object of Google service configuration schema. It @@ -722,24 +722,24 @@ export const Service = { }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.title = omitDefault(message.title); - obj.producer_project_id = omitDefault(message.producerProjectId); - obj.id = omitDefault(message.id); + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.id = message.id === "" ? undefined : message.id; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } if (message.types) { obj.types = message.types.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.types = []; + obj.types = message.types; } if (message.enums) { obj.enums = message.enums.map(e => e ? Enum.toAmino(e) : undefined); } else { - obj.enums = []; + obj.enums = message.enums; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.backend = message.backend ? Backend.toAmino(message.backend) : undefined; @@ -751,23 +751,23 @@ export const Service = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } obj.control = message.control ? Control.toAmino(message.control) : undefined; if (message.logs) { obj.logs = message.logs.map(e => e ? LogDescriptor.toAmino(e) : undefined); } else { - obj.logs = []; + obj.logs = message.logs; } if (message.metrics) { obj.metrics = message.metrics.map(e => e ? MetricDescriptor.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.billing = message.billing ? Billing.toAmino(message.billing) : undefined; obj.logging = message.logging ? Logging.toAmino(message.logging) : undefined; diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts index 664d72afef..9cfb8461ed 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/check_error.ts @@ -333,7 +333,7 @@ export const CheckError = { fromAmino(object: CheckErrorAmino): CheckError { const message = createBaseCheckError(); if (object.code !== undefined && object.code !== null) { - message.code = checkError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -348,9 +348,9 @@ export const CheckError = { }, toAmino(message: CheckError): CheckErrorAmino { const obj: any = {}; - obj.code = checkError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.detail = message.detail; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.detail = message.detail === "" ? undefined : message.detail; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts index 3080a5924b..14f84eed08 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts @@ -1,6 +1,6 @@ import { Distribution_Exemplar } from "../../distribution"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * Distribution represents a frequency distribution of double-valued sample @@ -416,15 +416,15 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = omitDefault(message.count); - obj.mean = omitDefault(message.mean); - obj.minimum = omitDefault(message.minimum); - obj.maximum = omitDefault(message.maximum); - obj.sum_of_squared_deviation = omitDefault(message.sumOfSquaredDeviation); + obj.count = message.count ? message.count.toString() : undefined; + obj.mean = message.mean === 0 ? undefined : message.mean; + obj.minimum = message.minimum === 0 ? undefined : message.minimum; + obj.maximum = message.maximum === 0 ? undefined : message.maximum; + obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; if (message.bucketCounts) { obj.bucket_counts = message.bucketCounts.map(e => e.toString()); } else { - obj.bucket_counts = []; + obj.bucket_counts = message.bucketCounts; } obj.linear_buckets = message.linearBuckets ? Distribution_LinearBuckets.toAmino(message.linearBuckets) : undefined; obj.exponential_buckets = message.exponentialBuckets ? Distribution_ExponentialBuckets.toAmino(message.exponentialBuckets) : undefined; @@ -432,7 +432,7 @@ export const Distribution = { if (message.exemplars) { obj.exemplars = message.exemplars.map(e => e ? Distribution_Exemplar.toAmino(e) : undefined); } else { - obj.exemplars = []; + obj.exemplars = message.exemplars; } return obj; }, @@ -553,9 +553,9 @@ export const Distribution_LinearBuckets = { }, toAmino(message: Distribution_LinearBuckets): Distribution_LinearBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.width = omitDefault(message.width); - obj.offset = omitDefault(message.offset); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.width = message.width === 0 ? undefined : message.width; + obj.offset = message.offset === 0 ? undefined : message.offset; return obj; }, fromAminoMsg(object: Distribution_LinearBucketsAminoMsg): Distribution_LinearBuckets { @@ -675,9 +675,9 @@ export const Distribution_ExponentialBuckets = { }, toAmino(message: Distribution_ExponentialBuckets): Distribution_ExponentialBucketsAmino { const obj: any = {}; - obj.num_finite_buckets = omitDefault(message.numFiniteBuckets); - obj.growth_factor = omitDefault(message.growthFactor); - obj.scale = omitDefault(message.scale); + obj.num_finite_buckets = message.numFiniteBuckets === 0 ? undefined : message.numFiniteBuckets; + obj.growth_factor = message.growthFactor === 0 ? undefined : message.growthFactor; + obj.scale = message.scale === 0 ? undefined : message.scale; return obj; }, fromAminoMsg(object: Distribution_ExponentialBucketsAminoMsg): Distribution_ExponentialBuckets { @@ -783,7 +783,7 @@ export const Distribution_ExplicitBuckets = { if (message.bounds) { obj.bounds = message.bounds.map(e => e); } else { - obj.bounds = []; + obj.bounds = message.bounds; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts index 3a9339b98d..6908f69686 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v1"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -406,21 +406,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = omitDefault(message.requestMethod); - obj.request_url = omitDefault(message.requestUrl); - obj.request_size = omitDefault(message.requestSize); - obj.status = omitDefault(message.status); - obj.response_size = omitDefault(message.responseSize); - obj.user_agent = omitDefault(message.userAgent); - obj.remote_ip = omitDefault(message.remoteIp); - obj.server_ip = omitDefault(message.serverIp); - obj.referer = omitDefault(message.referer); + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; + obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = omitDefault(message.cacheLookup); - obj.cache_hit = omitDefault(message.cacheHit); - obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); - obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); - obj.protocol = omitDefault(message.protocol); + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; + obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts index 7203011747..4fdb683fb5 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts @@ -261,8 +261,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -535,7 +535,7 @@ export const LogEntry = { message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -573,12 +573,12 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -586,7 +586,7 @@ export const LogEntry = { }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -725,10 +725,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -850,9 +850,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts index 6f369d68b9..53dc5f8432 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts @@ -176,8 +176,8 @@ export const MetricValue_LabelsEntry = { }, toAmino(message: MetricValue_LabelsEntry): MetricValue_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: MetricValue_LabelsEntryAminoMsg): MetricValue_LabelsEntry { @@ -428,10 +428,10 @@ export const MetricValue = { } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.bool_value = message.boolValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; return obj; }, @@ -542,11 +542,11 @@ export const MetricValueSet = { }, toAmino(message: MetricValueSet): MetricValueSetAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; if (message.metricValues) { obj.metric_values = message.metricValues.map(e => e ? MetricValue.toAmino(e) : undefined); } else { - obj.metric_values = []; + obj.metric_values = message.metricValues; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts index 0f16196025..f35cf14063 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/operation.ts @@ -243,8 +243,8 @@ export const Operation_LabelsEntry = { }, toAmino(message: Operation_LabelsEntry): Operation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: Operation_LabelsEntryAminoMsg): Operation_LabelsEntry { @@ -524,16 +524,16 @@ export const Operation = { message.metricValueSets = object.metric_value_sets?.map(e => MetricValueSet.fromAmino(e)) || []; message.logEntries = object.log_entries?.map(e => LogEntry.fromAmino(e)) || []; if (object.importance !== undefined && object.importance !== null) { - message.importance = operation_ImportanceFromJSON(object.importance); + message.importance = object.importance; } message.extensions = object.extensions?.map(e => Any.fromAmino(e)) || []; return message; }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.operation_name = message.operationName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.operation_name = message.operationName === "" ? undefined : message.operationName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.labels = {}; @@ -545,18 +545,18 @@ export const Operation = { if (message.metricValueSets) { obj.metric_value_sets = message.metricValueSets.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.metric_value_sets = []; + obj.metric_value_sets = message.metricValueSets; } if (message.logEntries) { obj.log_entries = message.logEntries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.log_entries = []; + obj.log_entries = message.logEntries; } - obj.importance = operation_ImportanceToJSON(message.importance); + obj.importance = message.importance === 0 ? undefined : message.importance; if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts index b4e44edf6a..932a0e3206 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/quota_controller.ts @@ -453,9 +453,9 @@ export const AllocateQuotaRequest = { }, toAmino(message: AllocateQuotaRequest): AllocateQuotaRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.allocate_operation = message.allocateOperation ? QuotaOperation.toAmino(message.allocateOperation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaRequestAminoMsg): AllocateQuotaRequest { @@ -558,8 +558,8 @@ export const QuotaOperation_LabelsEntry = { }, toAmino(message: QuotaOperation_LabelsEntry): QuotaOperation_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOperation_LabelsEntryAminoMsg): QuotaOperation_LabelsEntry { @@ -764,15 +764,15 @@ export const QuotaOperation = { }, {}); message.quotaMetrics = object.quota_metrics?.map(e => MetricValueSet.fromAmino(e)) || []; if (object.quota_mode !== undefined && object.quota_mode !== null) { - message.quotaMode = quotaOperation_QuotaModeFromJSON(object.quota_mode); + message.quotaMode = object.quota_mode; } return message; }, toAmino(message: QuotaOperation): QuotaOperationAmino { const obj: any = {}; - obj.operation_id = message.operationId; - obj.method_name = message.methodName; - obj.consumer_id = message.consumerId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; + obj.method_name = message.methodName === "" ? undefined : message.methodName; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -782,9 +782,9 @@ export const QuotaOperation = { if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.quota_mode = quotaOperation_QuotaModeToJSON(message.quotaMode); + obj.quota_mode = message.quotaMode === 0 ? undefined : message.quotaMode; return obj; }, fromAminoMsg(object: QuotaOperationAminoMsg): QuotaOperation { @@ -932,18 +932,18 @@ export const AllocateQuotaResponse = { }, toAmino(message: AllocateQuotaResponse): AllocateQuotaResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.allocateErrors) { obj.allocate_errors = message.allocateErrors.map(e => e ? QuotaError.toAmino(e) : undefined); } else { - obj.allocate_errors = []; + obj.allocate_errors = message.allocateErrors; } if (message.quotaMetrics) { obj.quota_metrics = message.quotaMetrics.map(e => e ? MetricValueSet.toAmino(e) : undefined); } else { - obj.quota_metrics = []; + obj.quota_metrics = message.quotaMetrics; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: AllocateQuotaResponseAminoMsg): AllocateQuotaResponse { @@ -1066,7 +1066,7 @@ export const QuotaError = { fromAmino(object: QuotaErrorAmino): QuotaError { const message = createBaseQuotaError(); if (object.code !== undefined && object.code !== null) { - message.code = quotaError_CodeFromJSON(object.code); + message.code = object.code; } if (object.subject !== undefined && object.subject !== null) { message.subject = object.subject; @@ -1081,9 +1081,9 @@ export const QuotaError = { }, toAmino(message: QuotaError): QuotaErrorAmino { const obj: any = {}; - obj.code = quotaError_CodeToJSON(message.code); - obj.subject = message.subject; - obj.description = message.description; + obj.code = message.code === 0 ? undefined : message.code; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts index 5e388e7e04..0b5467322d 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts @@ -395,9 +395,9 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.operation = message.operation ? Operation.toAmino(message.operation) : undefined; - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -557,14 +557,14 @@ export const CheckResponse = { }, toAmino(message: CheckResponse): CheckResponseAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; if (message.checkErrors) { obj.check_errors = message.checkErrors.map(e => e ? CheckError.toAmino(e) : undefined); } else { - obj.check_errors = []; + obj.check_errors = message.checkErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; obj.check_info = message.checkInfo ? CheckResponse_CheckInfo.toAmino(message.checkInfo) : undefined; return obj; }, @@ -680,7 +680,7 @@ export const CheckResponse_CheckInfo = { if (message.unusedArguments) { obj.unused_arguments = message.unusedArguments.map(e => e); } else { - obj.unused_arguments = []; + obj.unused_arguments = message.unusedArguments; } obj.consumer_info = message.consumerInfo ? CheckResponse_ConsumerInfo.toAmino(message.consumerInfo) : undefined; return obj; @@ -797,7 +797,7 @@ export const CheckResponse_ConsumerInfo = { message.projectNumber = BigInt(object.project_number); } if (object.type !== undefined && object.type !== null) { - message.type = checkResponse_ConsumerInfo_ConsumerTypeFromJSON(object.type); + message.type = object.type; } if (object.consumer_number !== undefined && object.consumer_number !== null) { message.consumerNumber = BigInt(object.consumer_number); @@ -807,7 +807,7 @@ export const CheckResponse_ConsumerInfo = { toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; - obj.type = checkResponse_ConsumerInfo_ConsumerTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; return obj; }, @@ -934,13 +934,13 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.service_config_id = message.serviceConfigId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; return obj; }, fromAminoMsg(object: ReportRequestAminoMsg): ReportRequest { @@ -1069,10 +1069,10 @@ export const ReportResponse = { if (message.reportErrors) { obj.report_errors = message.reportErrors.map(e => e ? ReportResponse_ReportError.toAmino(e) : undefined); } else { - obj.report_errors = []; + obj.report_errors = message.reportErrors; } - obj.service_config_id = message.serviceConfigId; - obj.service_rollout_id = message.serviceRolloutId; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; + obj.service_rollout_id = message.serviceRolloutId === "" ? undefined : message.serviceRolloutId; return obj; }, fromAminoMsg(object: ReportResponseAminoMsg): ReportResponse { @@ -1178,7 +1178,7 @@ export const ReportResponse_ReportError = { }, toAmino(message: ReportResponse_ReportError): ReportResponse_ReportErrorAmino { const obj: any = {}; - obj.operation_id = message.operationId; + obj.operation_id = message.operationId === "" ? undefined : message.operationId; obj.status = message.status ? Status.toAmino(message.status) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts index c083ebfa9b..aa0391be97 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v2/service_controller.ts @@ -1,7 +1,7 @@ import { AttributeContext, AttributeContextSDKType } from "../../../rpc/context/attribute_context"; import { Status, StatusSDKType } from "../../../rpc/status"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../../../helpers"; +import { isSet, DeepPartial, isObject } from "../../../../helpers"; export const protobufPackage = "google.api.servicecontrol.v2"; /** Request message for the Check method. */ export interface CheckRequest { @@ -305,15 +305,15 @@ export const CheckRequest = { }, toAmino(message: CheckRequest): CheckRequestAmino { const obj: any = {}; - obj.service_name = omitDefault(message.serviceName); - obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; obj.attributes = message.attributes ? AttributeContext.toAmino(message.attributes) : undefined; if (message.resources) { obj.resources = message.resources.map(e => e ? ResourceInfo.toAmino(e) : undefined); } else { - obj.resources = []; + obj.resources = message.resources; } - obj.flags = omitDefault(message.flags); + obj.flags = message.flags === "" ? undefined : message.flags; return obj; }, fromAminoMsg(object: CheckRequestAminoMsg): CheckRequest { @@ -465,11 +465,11 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.type = omitDefault(message.type); - obj.permission = omitDefault(message.permission); - obj.container = omitDefault(message.container); - obj.location = omitDefault(message.location); + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; + obj.permission = message.permission === "" ? undefined : message.permission; + obj.container = message.container === "" ? undefined : message.container; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -572,8 +572,8 @@ export const CheckResponse_HeadersEntry = { }, toAmino(message: CheckResponse_HeadersEntry): CheckResponse_HeadersEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: CheckResponse_HeadersEntryAminoMsg): CheckResponse_HeadersEntry { @@ -848,12 +848,12 @@ export const ReportRequest = { }, toAmino(message: ReportRequest): ReportRequestAmino { const obj: any = {}; - obj.service_name = omitDefault(message.serviceName); - obj.service_config_id = omitDefault(message.serviceConfigId); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.service_config_id = message.serviceConfigId === "" ? undefined : message.serviceConfigId; if (message.operations) { obj.operations = message.operations.map(e => e ? AttributeContext.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts index a0489b7055..7f9a439da8 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/resources.ts @@ -682,8 +682,8 @@ export const ManagedService = { }, toAmino(message: ManagedService): ManagedServiceAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.producer_project_id = message.producerProjectId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; return obj; }, fromAminoMsg(object: ManagedServiceAminoMsg): ManagedService { @@ -834,14 +834,14 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } if (message.steps) { obj.steps = message.steps.map(e => e ? OperationMetadata_Step.toAmino(e) : undefined); } else { - obj.steps = []; + obj.steps = message.steps; } - obj.progress_percentage = message.progressPercentage; + obj.progress_percentage = message.progressPercentage === 0 ? undefined : message.progressPercentage; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -940,14 +940,14 @@ export const OperationMetadata_Step = { message.description = object.description; } if (object.status !== undefined && object.status !== null) { - message.status = operationMetadata_StatusFromJSON(object.status); + message.status = object.status; } return message; }, toAmino(message: OperationMetadata_Step): OperationMetadata_StepAmino { const obj: any = {}; - obj.description = message.description; - obj.status = operationMetadata_StatusToJSON(message.status); + obj.description = message.description === "" ? undefined : message.description; + obj.status = message.status === 0 ? undefined : message.status; return obj; }, fromAminoMsg(object: OperationMetadata_StepAminoMsg): OperationMetadata_Step { @@ -1058,7 +1058,7 @@ export const Diagnostic = { message.location = object.location; } if (object.kind !== undefined && object.kind !== null) { - message.kind = diagnostic_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.message !== undefined && object.message !== null) { message.message = object.message; @@ -1067,9 +1067,9 @@ export const Diagnostic = { }, toAmino(message: Diagnostic): DiagnosticAmino { const obj: any = {}; - obj.location = message.location; - obj.kind = diagnostic_KindToJSON(message.kind); - obj.message = message.message; + obj.location = message.location === "" ? undefined : message.location; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: DiagnosticAminoMsg): Diagnostic { @@ -1179,11 +1179,11 @@ export const ConfigSource = { }, toAmino(message: ConfigSource): ConfigSourceAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.files) { obj.files = message.files.map(e => e ? ConfigFile.toAmino(e) : undefined); } else { - obj.files = []; + obj.files = message.files; } return obj; }, @@ -1298,15 +1298,15 @@ export const ConfigFile = { message.fileContents = bytesFromBase64(object.file_contents); } if (object.file_type !== undefined && object.file_type !== null) { - message.fileType = configFile_FileTypeFromJSON(object.file_type); + message.fileType = object.file_type; } return message; }, toAmino(message: ConfigFile): ConfigFileAmino { const obj: any = {}; - obj.file_path = message.filePath; + obj.file_path = message.filePath === "" ? undefined : message.filePath; obj.file_contents = message.fileContents ? base64FromBytes(message.fileContents) : undefined; - obj.file_type = configFile_FileTypeToJSON(message.fileType); + obj.file_type = message.fileType === 0 ? undefined : message.fileType; return obj; }, fromAminoMsg(object: ConfigFileAminoMsg): ConfigFile { @@ -1394,7 +1394,7 @@ export const ConfigRef = { }, toAmino(message: ConfigRef): ConfigRefAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: ConfigRefAminoMsg): ConfigRef { @@ -1491,7 +1491,7 @@ export const ChangeReport = { if (message.configChanges) { obj.config_changes = message.configChanges.map(e => e ? ConfigChange.toAmino(e) : undefined); } else { - obj.config_changes = []; + obj.config_changes = message.configChanges; } return obj; }, @@ -1665,7 +1665,7 @@ export const Rollout = { message.createdBy = object.created_by; } if (object.status !== undefined && object.status !== null) { - message.status = rollout_RolloutStatusFromJSON(object.status); + message.status = object.status; } if (object.traffic_percent_strategy !== undefined && object.traffic_percent_strategy !== null) { message.trafficPercentStrategy = Rollout_TrafficPercentStrategy.fromAmino(object.traffic_percent_strategy); @@ -1680,13 +1680,13 @@ export const Rollout = { }, toAmino(message: Rollout): RolloutAmino { const obj: any = {}; - obj.rollout_id = message.rolloutId; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; - obj.created_by = message.createdBy; - obj.status = rollout_RolloutStatusToJSON(message.status); + obj.created_by = message.createdBy === "" ? undefined : message.createdBy; + obj.status = message.status === 0 ? undefined : message.status; obj.traffic_percent_strategy = message.trafficPercentStrategy ? Rollout_TrafficPercentStrategy.toAmino(message.trafficPercentStrategy) : undefined; obj.delete_service_strategy = message.deleteServiceStrategy ? Rollout_DeleteServiceStrategy.toAmino(message.deleteServiceStrategy) : undefined; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: RolloutAminoMsg): Rollout { @@ -1789,8 +1789,8 @@ export const Rollout_TrafficPercentStrategy_PercentagesEntry = { }, toAmino(message: Rollout_TrafficPercentStrategy_PercentagesEntry): Rollout_TrafficPercentStrategy_PercentagesEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Rollout_TrafficPercentStrategy_PercentagesEntryAminoMsg): Rollout_TrafficPercentStrategy_PercentagesEntry { diff --git a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts index 0eef3cf142..a5b9a64b21 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicemanagement/v1/servicemanager.ts @@ -562,10 +562,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.producer_project_id = message.producerProjectId; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.consumer_id = message.consumerId; + obj.producer_project_id = message.producerProjectId === "" ? undefined : message.producerProjectId; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.consumer_id = message.consumerId === "" ? undefined : message.consumerId; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -678,9 +678,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? ManagedService.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -768,7 +768,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -946,7 +946,7 @@ export const DeleteServiceRequest = { }, toAmino(message: DeleteServiceRequest): DeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: DeleteServiceRequestAminoMsg): DeleteServiceRequest { @@ -1034,7 +1034,7 @@ export const UndeleteServiceRequest = { }, toAmino(message: UndeleteServiceRequest): UndeleteServiceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; return obj; }, fromAminoMsg(object: UndeleteServiceRequestAminoMsg): UndeleteServiceRequest { @@ -1238,15 +1238,15 @@ export const GetServiceConfigRequest = { message.configId = object.config_id; } if (object.view !== undefined && object.view !== null) { - message.view = getServiceConfigRequest_ConfigViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetServiceConfigRequest): GetServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.config_id = message.configId; - obj.view = getServiceConfigRequest_ConfigViewToJSON(message.view); + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.config_id = message.configId === "" ? undefined : message.configId; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetServiceConfigRequestAminoMsg): GetServiceConfigRequest { @@ -1366,9 +1366,9 @@ export const ListServiceConfigsRequest = { }, toAmino(message: ListServiceConfigsRequest): ListServiceConfigsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListServiceConfigsRequestAminoMsg): ListServiceConfigsRequest { @@ -1481,9 +1481,9 @@ export const ListServiceConfigsResponse = { if (message.serviceConfigs) { obj.service_configs = message.serviceConfigs.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.service_configs = []; + obj.service_configs = message.serviceConfigs; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceConfigsResponseAminoMsg): ListServiceConfigsResponse { @@ -1589,7 +1589,7 @@ export const CreateServiceConfigRequest = { }, toAmino(message: CreateServiceConfigRequest): CreateServiceConfigRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.service_config = message.serviceConfig ? Service.toAmino(message.serviceConfig) : undefined; return obj; }, @@ -1712,9 +1712,9 @@ export const SubmitConfigSourceRequest = { }, toAmino(message: SubmitConfigSourceRequest): SubmitConfigSourceRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.config_source = message.configSource ? ConfigSource.toAmino(message.configSource) : undefined; - obj.validate_only = message.validateOnly; + obj.validate_only = message.validateOnly === false ? undefined : message.validateOnly; return obj; }, fromAminoMsg(object: SubmitConfigSourceRequestAminoMsg): SubmitConfigSourceRequest { @@ -1910,7 +1910,7 @@ export const CreateServiceRolloutRequest = { }, toAmino(message: CreateServiceRolloutRequest): CreateServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; obj.rollout = message.rollout ? Rollout.toAmino(message.rollout) : undefined; return obj; }, @@ -2047,10 +2047,10 @@ export const ListServiceRolloutsRequest = { }, toAmino(message: ListServiceRolloutsRequest): ListServiceRolloutsRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; - obj.filter = message.filter; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServiceRolloutsRequestAminoMsg): ListServiceRolloutsRequest { @@ -2163,9 +2163,9 @@ export const ListServiceRolloutsResponse = { if (message.rollouts) { obj.rollouts = message.rollouts.map(e => e ? Rollout.toAmino(e) : undefined); } else { - obj.rollouts = []; + obj.rollouts = message.rollouts; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServiceRolloutsResponseAminoMsg): ListServiceRolloutsResponse { @@ -2269,8 +2269,8 @@ export const GetServiceRolloutRequest = { }, toAmino(message: GetServiceRolloutRequest): GetServiceRolloutRequestAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.rollout_id = message.rolloutId; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.rollout_id = message.rolloutId === "" ? undefined : message.rolloutId; return obj; }, fromAminoMsg(object: GetServiceRolloutRequestAminoMsg): GetServiceRolloutRequest { @@ -2527,17 +2527,17 @@ export const GenerateConfigReportResponse = { }, toAmino(message: GenerateConfigReportResponse): GenerateConfigReportResponseAmino { const obj: any = {}; - obj.service_name = message.serviceName; - obj.id = message.id; + obj.service_name = message.serviceName === "" ? undefined : message.serviceName; + obj.id = message.id === "" ? undefined : message.id; if (message.changeReports) { obj.change_reports = message.changeReports.map(e => e ? ChangeReport.toAmino(e) : undefined); } else { - obj.change_reports = []; + obj.change_reports = message.changeReports; } if (message.diagnostics) { obj.diagnostics = message.diagnostics.map(e => e ? Diagnostic.toAmino(e) : undefined); } else { - obj.diagnostics = []; + obj.diagnostics = message.diagnostics; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts index 92ed28996a..024c546cb1 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/resources.ts @@ -283,16 +283,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -552,12 +552,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -566,12 +566,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -670,7 +670,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts index 19687a0bad..2d43ff4fd6 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1/serviceusage.ts @@ -414,7 +414,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -618,15 +618,15 @@ export const DisableServiceRequest = { message.disableDependentServices = object.disable_dependent_services; } if (object.check_if_service_has_usage !== undefined && object.check_if_service_has_usage !== null) { - message.checkIfServiceHasUsage = disableServiceRequest_CheckIfServiceHasUsageFromJSON(object.check_if_service_has_usage); + message.checkIfServiceHasUsage = object.check_if_service_has_usage; } return message; }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.disable_dependent_services = message.disableDependentServices; - obj.check_if_service_has_usage = disableServiceRequest_CheckIfServiceHasUsageToJSON(message.checkIfServiceHasUsage); + obj.name = message.name === "" ? undefined : message.name; + obj.disable_dependent_services = message.disableDependentServices === false ? undefined : message.disableDependentServices; + obj.check_if_service_has_usage = message.checkIfServiceHasUsage === 0 ? undefined : message.checkIfServiceHasUsage; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -804,7 +804,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -940,10 +940,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1056,9 +1056,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1168,11 +1168,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1292,12 +1292,12 @@ export const BatchEnableServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } if (message.failures) { obj.failures = message.failures.map(e => e ? BatchEnableServicesResponse_EnableFailure.toAmino(e) : undefined); } else { - obj.failures = []; + obj.failures = message.failures; } return obj; }, @@ -1402,8 +1402,8 @@ export const BatchEnableServicesResponse_EnableFailure = { }, toAmino(message: BatchEnableServicesResponse_EnableFailure): BatchEnableServicesResponse_EnableFailureAmino { const obj: any = {}; - obj.service_id = message.serviceId; - obj.error_message = message.errorMessage; + obj.service_id = message.serviceId === "" ? undefined : message.serviceId; + obj.error_message = message.errorMessage === "" ? undefined : message.errorMessage; return obj; }, fromAminoMsg(object: BatchEnableServicesResponse_EnableFailureAminoMsg): BatchEnableServicesResponse_EnableFailure { @@ -1513,11 +1513,11 @@ export const BatchGetServicesRequest = { }, toAmino(message: BatchGetServicesRequest): BatchGetServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.names) { obj.names = message.names.map(e => e); } else { - obj.names = []; + obj.names = message.names; } return obj; }, @@ -1615,7 +1615,7 @@ export const BatchGetServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts index 6d82be44c5..d4583eb019 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts @@ -777,16 +777,16 @@ export const Service = { message.config = ServiceConfig.fromAmino(object.config); } if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: Service): ServiceAmino { const obj: any = {}; - obj.name = message.name; - obj.parent = message.parent; + obj.name = message.name === "" ? undefined : message.name; + obj.parent = message.parent === "" ? undefined : message.parent; obj.config = message.config ? ServiceConfig.toAmino(message.config) : undefined; - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: ServiceAminoMsg): Service { @@ -1046,12 +1046,12 @@ export const ServiceConfig = { }, toAmino(message: ServiceConfig): ServiceConfigAmino { const obj: any = {}; - obj.name = message.name; - obj.title = message.title; + obj.name = message.name === "" ? undefined : message.name; + obj.title = message.title === "" ? undefined : message.title; if (message.apis) { obj.apis = message.apis.map(e => e ? Api.toAmino(e) : undefined); } else { - obj.apis = []; + obj.apis = message.apis; } obj.documentation = message.documentation ? Documentation.toAmino(message.documentation) : undefined; obj.quota = message.quota ? Quota.toAmino(message.quota) : undefined; @@ -1060,12 +1060,12 @@ export const ServiceConfig = { if (message.endpoints) { obj.endpoints = message.endpoints.map(e => e ? Endpoint.toAmino(e) : undefined); } else { - obj.endpoints = []; + obj.endpoints = message.endpoints; } if (message.monitoredResources) { obj.monitored_resources = message.monitoredResources.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.monitored_resources = []; + obj.monitored_resources = message.monitoredResources; } obj.monitoring = message.monitoring ? Monitoring.toAmino(message.monitoring) : undefined; return obj; @@ -1164,7 +1164,7 @@ export const OperationMetadata = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -1345,20 +1345,20 @@ export const ConsumerQuotaMetric = { }, toAmino(message: ConsumerQuotaMetric): ConsumerQuotaMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.display_name = message.displayName; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.display_name = message.displayName === "" ? undefined : message.displayName; if (message.consumerQuotaLimits) { obj.consumer_quota_limits = message.consumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.consumer_quota_limits = []; + obj.consumer_quota_limits = message.consumerQuotaLimits; } if (message.descendantConsumerQuotaLimits) { obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits.map(e => e ? ConsumerQuotaLimit.toAmino(e) : undefined); } else { - obj.descendant_consumer_quota_limits = []; + obj.descendant_consumer_quota_limits = message.descendantConsumerQuotaLimits; } - obj.unit = message.unit; + obj.unit = message.unit === "" ? undefined : message.unit; return obj; }, fromAminoMsg(object: ConsumerQuotaMetricAminoMsg): ConsumerQuotaMetric { @@ -1532,15 +1532,15 @@ export const ConsumerQuotaLimit = { }, toAmino(message: ConsumerQuotaLimit): ConsumerQuotaLimitAmino { const obj: any = {}; - obj.name = message.name; - obj.metric = message.metric; - obj.unit = message.unit; - obj.is_precise = message.isPrecise; - obj.allows_admin_overrides = message.allowsAdminOverrides; + obj.name = message.name === "" ? undefined : message.name; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.is_precise = message.isPrecise === false ? undefined : message.isPrecise; + obj.allows_admin_overrides = message.allowsAdminOverrides === false ? undefined : message.allowsAdminOverrides; if (message.quotaBuckets) { obj.quota_buckets = message.quotaBuckets.map(e => e ? QuotaBucket.toAmino(e) : undefined); } else { - obj.quota_buckets = []; + obj.quota_buckets = message.quotaBuckets; } return obj; }, @@ -1644,8 +1644,8 @@ export const QuotaBucket_DimensionsEntry = { }, toAmino(message: QuotaBucket_DimensionsEntry): QuotaBucket_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaBucket_DimensionsEntryAminoMsg): QuotaBucket_DimensionsEntry { @@ -1973,8 +1973,8 @@ export const QuotaOverride_DimensionsEntry = { }, toAmino(message: QuotaOverride_DimensionsEntry): QuotaOverride_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: QuotaOverride_DimensionsEntryAminoMsg): QuotaOverride_DimensionsEntry { @@ -2181,7 +2181,7 @@ export const QuotaOverride = { }, toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2189,9 +2189,9 @@ export const QuotaOverride = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.admin_override_ancestor = message.adminOverrideAncestor; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.admin_override_ancestor = message.adminOverrideAncestor === "" ? undefined : message.adminOverrideAncestor; return obj; }, fromAminoMsg(object: QuotaOverrideAminoMsg): QuotaOverride { @@ -2288,7 +2288,7 @@ export const OverrideInlineSource = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2392,8 +2392,8 @@ export const AdminQuotaPolicy_DimensionsEntry = { }, toAmino(message: AdminQuotaPolicy_DimensionsEntry): AdminQuotaPolicy_DimensionsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AdminQuotaPolicy_DimensionsEntryAminoMsg): AdminQuotaPolicy_DimensionsEntry { @@ -2600,7 +2600,7 @@ export const AdminQuotaPolicy = { }, toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { @@ -2608,9 +2608,9 @@ export const AdminQuotaPolicy = { obj.dimensions[k] = v; }); } - obj.metric = message.metric; - obj.unit = message.unit; - obj.container = message.container; + obj.metric = message.metric === "" ? undefined : message.metric; + obj.unit = message.unit === "" ? undefined : message.unit; + obj.container = message.container === "" ? undefined : message.container; return obj; }, fromAminoMsg(object: AdminQuotaPolicyAminoMsg): AdminQuotaPolicy { @@ -2714,8 +2714,8 @@ export const ServiceIdentity = { }, toAmino(message: ServiceIdentity): ServiceIdentityAmino { const obj: any = {}; - obj.email = message.email; - obj.unique_id = message.uniqueId; + obj.email = message.email === "" ? undefined : message.email; + obj.unique_id = message.uniqueId === "" ? undefined : message.uniqueId; return obj; }, fromAminoMsg(object: ServiceIdentityAminoMsg): ServiceIdentity { diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts index b10371e498..3ce3566f5d 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/serviceusage.ts @@ -969,7 +969,7 @@ export const EnableServiceRequest = { }, toAmino(message: EnableServiceRequest): EnableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: EnableServiceRequestAminoMsg): EnableServiceRequest { @@ -1057,7 +1057,7 @@ export const DisableServiceRequest = { }, toAmino(message: DisableServiceRequest): DisableServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DisableServiceRequestAminoMsg): DisableServiceRequest { @@ -1145,7 +1145,7 @@ export const GetServiceRequest = { }, toAmino(message: GetServiceRequest): GetServiceRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetServiceRequestAminoMsg): GetServiceRequest { @@ -1281,10 +1281,10 @@ export const ListServicesRequest = { }, toAmino(message: ListServicesRequest): ListServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.filter = message.filter; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: ListServicesRequestAminoMsg): ListServicesRequest { @@ -1397,9 +1397,9 @@ export const ListServicesResponse = { if (message.services) { obj.services = message.services.map(e => e ? Service.toAmino(e) : undefined); } else { - obj.services = []; + obj.services = message.services; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListServicesResponseAminoMsg): ListServicesResponse { @@ -1509,11 +1509,11 @@ export const BatchEnableServicesRequest = { }, toAmino(message: BatchEnableServicesRequest): BatchEnableServicesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; if (message.serviceIds) { obj.service_ids = message.serviceIds.map(e => e); } else { - obj.service_ids = []; + obj.service_ids = message.serviceIds; } return obj; }, @@ -1644,16 +1644,16 @@ export const ListConsumerQuotaMetricsRequest = { message.pageToken = object.page_token; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: ListConsumerQuotaMetricsRequest): ListConsumerQuotaMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; - obj.view = quotaViewToJSON(message.view); + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsRequestAminoMsg): ListConsumerQuotaMetricsRequest { @@ -1766,9 +1766,9 @@ export const ListConsumerQuotaMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? ConsumerQuotaMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerQuotaMetricsResponseAminoMsg): ListConsumerQuotaMetricsResponse { @@ -1866,14 +1866,14 @@ export const GetConsumerQuotaMetricRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaMetricRequest): GetConsumerQuotaMetricRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaMetricRequestAminoMsg): GetConsumerQuotaMetricRequest { @@ -1971,14 +1971,14 @@ export const GetConsumerQuotaLimitRequest = { message.name = object.name; } if (object.view !== undefined && object.view !== null) { - message.view = quotaViewFromJSON(object.view); + message.view = object.view; } return message; }, toAmino(message: GetConsumerQuotaLimitRequest): GetConsumerQuotaLimitRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.view = quotaViewToJSON(message.view); + obj.name = message.name === "" ? undefined : message.name; + obj.view = message.view === 0 ? undefined : message.view; return obj; }, fromAminoMsg(object: GetConsumerQuotaLimitRequestAminoMsg): GetConsumerQuotaLimitRequest { @@ -2126,18 +2126,18 @@ export const CreateAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateAdminOverrideRequest): CreateAdminOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2304,19 +2304,19 @@ export const UpdateAdminOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateAdminOverrideRequest): UpdateAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2447,17 +2447,17 @@ export const DeleteAdminOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteAdminOverrideRequest): DeleteAdminOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -2578,9 +2578,9 @@ export const ListAdminOverridesRequest = { }, toAmino(message: ListAdminOverridesRequest): ListAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesRequestAminoMsg): ListAdminOverridesRequest { @@ -2693,9 +2693,9 @@ export const ListAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListAdminOverridesResponseAminoMsg): ListAdminOverridesResponse { @@ -2792,7 +2792,7 @@ export const BatchCreateAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -2941,18 +2941,18 @@ export const ImportAdminOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportAdminOverridesRequest): ImportAdminOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3050,7 +3050,7 @@ export const ImportAdminOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -3267,18 +3267,18 @@ export const CreateConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: CreateConsumerOverrideRequest): CreateConsumerOverrideRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3445,19 +3445,19 @@ export const UpdateConsumerOverrideRequest = { if (object.update_mask !== undefined && object.update_mask !== null) { message.updateMask = FieldMask.fromAmino(object.update_mask); } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: UpdateConsumerOverrideRequest): UpdateConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.override = message.override ? QuotaOverride.toAmino(message.override) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3588,17 +3588,17 @@ export const DeleteConsumerOverrideRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: DeleteConsumerOverrideRequest): DeleteConsumerOverrideRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.force = message.force; + obj.name = message.name === "" ? undefined : message.name; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -3719,9 +3719,9 @@ export const ListConsumerOverridesRequest = { }, toAmino(message: ListConsumerOverridesRequest): ListConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesRequestAminoMsg): ListConsumerOverridesRequest { @@ -3834,9 +3834,9 @@ export const ListConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListConsumerOverridesResponseAminoMsg): ListConsumerOverridesResponse { @@ -3933,7 +3933,7 @@ export const BatchCreateConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4082,18 +4082,18 @@ export const ImportConsumerOverridesRequest = { if (object.force !== undefined && object.force !== null) { message.force = object.force; } - message.forceOnly = object.force_only?.map(e => quotaSafetyCheckFromJSON(e)) || []; + message.forceOnly = object.force_only?.map(e => e) || []; return message; }, toAmino(message: ImportConsumerOverridesRequest): ImportConsumerOverridesRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.inline_source = message.inlineSource ? OverrideInlineSource.toAmino(message.inlineSource) : undefined; - obj.force = message.force; + obj.force = message.force === false ? undefined : message.force; if (message.forceOnly) { - obj.force_only = message.forceOnly.map(e => quotaSafetyCheckToJSON(e)); + obj.force_only = message.forceOnly.map(e => e); } else { - obj.force_only = []; + obj.force_only = message.forceOnly; } return obj; }, @@ -4191,7 +4191,7 @@ export const ImportConsumerOverridesResponse = { if (message.overrides) { obj.overrides = message.overrides.map(e => e ? QuotaOverride.toAmino(e) : undefined); } else { - obj.overrides = []; + obj.overrides = message.overrides; } return obj; }, @@ -4357,7 +4357,7 @@ export const ImportAdminQuotaPoliciesResponse = { if (message.policies) { obj.policies = message.policies.map(e => e ? AdminQuotaPolicy.toAmino(e) : undefined); } else { - obj.policies = []; + obj.policies = message.policies; } return obj; }, @@ -4718,7 +4718,7 @@ export const GenerateServiceIdentityRequest = { }, toAmino(message: GenerateServiceIdentityRequest): GenerateServiceIdentityRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; return obj; }, fromAminoMsg(object: GenerateServiceIdentityRequestAminoMsg): GenerateServiceIdentityRequest { @@ -4818,14 +4818,14 @@ export const GetServiceIdentityResponse = { message.identity = ServiceIdentity.fromAmino(object.identity); } if (object.state !== undefined && object.state !== null) { - message.state = getServiceIdentityResponse_IdentityStateFromJSON(object.state); + message.state = object.state; } return message; }, toAmino(message: GetServiceIdentityResponse): GetServiceIdentityResponseAmino { const obj: any = {}; obj.identity = message.identity ? ServiceIdentity.toAmino(message.identity) : undefined; - obj.state = getServiceIdentityResponse_IdentityStateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; return obj; }, fromAminoMsg(object: GetServiceIdentityResponseAminoMsg): GetServiceIdentityResponse { diff --git a/__fixtures__/v-next/outputv4/google/api/source_info.ts b/__fixtures__/v-next/outputv4/google/api/source_info.ts index 6744c567c6..9e0ba28110 100644 --- a/__fixtures__/v-next/outputv4/google/api/source_info.ts +++ b/__fixtures__/v-next/outputv4/google/api/source_info.ts @@ -93,7 +93,7 @@ export const SourceInfo = { if (message.sourceFiles) { obj.source_files = message.sourceFiles.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.source_files = []; + obj.source_files = message.sourceFiles; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts index d9380e9206..27679cfc2d 100644 --- a/__fixtures__/v-next/outputv4/google/api/system_parameter.ts +++ b/__fixtures__/v-next/outputv4/google/api/system_parameter.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * ### System parameter configuration @@ -202,7 +202,7 @@ export const SystemParameters = { if (message.rules) { obj.rules = message.rules.map(e => e ? SystemParameterRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -313,11 +313,11 @@ export const SystemParameterRule = { }, toAmino(message: SystemParameterRule): SystemParameterRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); + obj.selector = message.selector === "" ? undefined : message.selector; if (message.parameters) { obj.parameters = message.parameters.map(e => e ? SystemParameter.toAmino(e) : undefined); } else { - obj.parameters = []; + obj.parameters = message.parameters; } return obj; }, @@ -438,9 +438,9 @@ export const SystemParameter = { }, toAmino(message: SystemParameter): SystemParameterAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.http_header = omitDefault(message.httpHeader); - obj.url_query_parameter = omitDefault(message.urlQueryParameter); + obj.name = message.name === "" ? undefined : message.name; + obj.http_header = message.httpHeader === "" ? undefined : message.httpHeader; + obj.url_query_parameter = message.urlQueryParameter === "" ? undefined : message.urlQueryParameter; return obj; }, fromAminoMsg(object: SystemParameterAminoMsg): SystemParameter { diff --git a/__fixtures__/v-next/outputv4/google/api/usage.ts b/__fixtures__/v-next/outputv4/google/api/usage.ts index 73df754340..d855f107fa 100644 --- a/__fixtures__/v-next/outputv4/google/api/usage.ts +++ b/__fixtures__/v-next/outputv4/google/api/usage.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.api"; /** Configuration controlling usage of a service. */ export interface Usage { @@ -243,14 +243,14 @@ export const Usage = { if (message.requirements) { obj.requirements = message.requirements.map(e => e); } else { - obj.requirements = []; + obj.requirements = message.requirements; } if (message.rules) { obj.rules = message.rules.map(e => e ? UsageRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } - obj.producer_notification_channel = omitDefault(message.producerNotificationChannel); + obj.producer_notification_channel = message.producerNotificationChannel === "" ? undefined : message.producerNotificationChannel; return obj; }, fromAminoMsg(object: UsageAminoMsg): Usage { @@ -370,9 +370,9 @@ export const UsageRule = { }, toAmino(message: UsageRule): UsageRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.allow_unregistered_calls = omitDefault(message.allowUnregisteredCalls); - obj.skip_service_control = omitDefault(message.skipServiceControl); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.allow_unregistered_calls = message.allowUnregisteredCalls === false ? undefined : message.allowUnregisteredCalls; + obj.skip_service_control = message.skipServiceControl === false ? undefined : message.skipServiceControl; return obj; }, fromAminoMsg(object: UsageRuleAminoMsg): UsageRule { diff --git a/__fixtures__/v-next/outputv4/google/api/visibility.ts b/__fixtures__/v-next/outputv4/google/api/visibility.ts index dfa4909fdd..c1b47c4efe 100644 --- a/__fixtures__/v-next/outputv4/google/api/visibility.ts +++ b/__fixtures__/v-next/outputv4/google/api/visibility.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "google.api"; /** * `Visibility` defines restrictions for the visibility of service @@ -184,7 +184,7 @@ export const Visibility = { if (message.rules) { obj.rules = message.rules.map(e => e ? VisibilityRule.toAmino(e) : undefined); } else { - obj.rules = []; + obj.rules = message.rules; } return obj; }, @@ -289,8 +289,8 @@ export const VisibilityRule = { }, toAmino(message: VisibilityRule): VisibilityRuleAmino { const obj: any = {}; - obj.selector = omitDefault(message.selector); - obj.restriction = omitDefault(message.restriction); + obj.selector = message.selector === "" ? undefined : message.selector; + obj.restriction = message.restriction === "" ? undefined : message.restriction; return obj; }, fromAminoMsg(object: VisibilityRuleAminoMsg): VisibilityRule { diff --git a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts index 99bb99c389..073190bdac 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.logging.type"; /** * A common proto for logging HTTP requests. Only contains semantics @@ -408,21 +408,21 @@ export const HttpRequest = { }, toAmino(message: HttpRequest): HttpRequestAmino { const obj: any = {}; - obj.request_method = omitDefault(message.requestMethod); - obj.request_url = omitDefault(message.requestUrl); - obj.request_size = omitDefault(message.requestSize); - obj.status = omitDefault(message.status); - obj.response_size = omitDefault(message.responseSize); - obj.user_agent = omitDefault(message.userAgent); - obj.remote_ip = omitDefault(message.remoteIp); - obj.server_ip = omitDefault(message.serverIp); - obj.referer = omitDefault(message.referer); + obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; + obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; + obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.status = message.status === 0 ? undefined : message.status; + obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; + obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; + obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; + obj.referer = message.referer === "" ? undefined : message.referer; obj.latency = message.latency ? Duration.toAmino(message.latency) : undefined; - obj.cache_lookup = omitDefault(message.cacheLookup); - obj.cache_hit = omitDefault(message.cacheHit); - obj.cache_validated_with_origin_server = omitDefault(message.cacheValidatedWithOriginServer); - obj.cache_fill_bytes = omitDefault(message.cacheFillBytes); - obj.protocol = omitDefault(message.protocol); + obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; + obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; + obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; + obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, fromAminoMsg(object: HttpRequestAminoMsg): HttpRequest { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts index f53af495cb..30e86d2510 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts @@ -385,8 +385,8 @@ export const LogEntry_LabelsEntry = { }, toAmino(message: LogEntry_LabelsEntry): LogEntry_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogEntry_LabelsEntryAminoMsg): LogEntry_LabelsEntry { @@ -743,7 +743,7 @@ export const LogEntry = { message.receiveTimestamp = fromTimestamp(Timestamp.fromAmino(object.receive_timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.insert_id !== undefined && object.insert_id !== null) { message.insertId = object.insert_id; @@ -781,15 +781,15 @@ export const LogEntry = { }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.json_payload = message.jsonPayload ? Struct.toAmino(message.jsonPayload) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.receive_timestamp = message.receiveTimestamp ? Timestamp.toAmino(toTimestamp(message.receiveTimestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); - obj.insert_id = message.insertId; + obj.severity = message.severity === 0 ? undefined : message.severity; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; obj.labels = {}; if (message.labels) { @@ -798,9 +798,9 @@ export const LogEntry = { }); } obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; - obj.trace = message.trace; - obj.span_id = message.spanId; - obj.trace_sampled = message.traceSampled; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.span_id = message.spanId === "" ? undefined : message.spanId; + obj.trace_sampled = message.traceSampled === false ? undefined : message.traceSampled; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; obj.split = message.split ? LogSplit.toAmino(message.split) : undefined; return obj; @@ -938,10 +938,10 @@ export const LogEntryOperation = { }, toAmino(message: LogEntryOperation): LogEntryOperationAmino { const obj: any = {}; - obj.id = message.id; - obj.producer = message.producer; - obj.first = message.first; - obj.last = message.last; + obj.id = message.id === "" ? undefined : message.id; + obj.producer = message.producer === "" ? undefined : message.producer; + obj.first = message.first === false ? undefined : message.first; + obj.last = message.last === false ? undefined : message.last; return obj; }, fromAminoMsg(object: LogEntryOperationAminoMsg): LogEntryOperation { @@ -1063,9 +1063,9 @@ export const LogEntrySourceLocation = { }, toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; - obj.file = message.file; + obj.file = message.file === "" ? undefined : message.file; obj.line = message.line ? message.line.toString() : undefined; - obj.function = message.function; + obj.function = message.function === "" ? undefined : message.function; return obj; }, fromAminoMsg(object: LogEntrySourceLocationAminoMsg): LogEntrySourceLocation { @@ -1185,9 +1185,9 @@ export const LogSplit = { }, toAmino(message: LogSplit): LogSplitAmino { const obj: any = {}; - obj.uid = message.uid; - obj.index = message.index; - obj.total_splits = message.totalSplits; + obj.uid = message.uid === "" ? undefined : message.uid; + obj.index = message.index === 0 ? undefined : message.index; + obj.total_splits = message.totalSplits === 0 ? undefined : message.totalSplits; return obj; }, fromAminoMsg(object: LogSplitAminoMsg): LogSplit { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts index bc598cb108..fb3584aab8 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging.ts @@ -612,7 +612,7 @@ export const DeleteLogRequest = { }, toAmino(message: DeleteLogRequest): DeleteLogRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; return obj; }, fromAminoMsg(object: DeleteLogRequestAminoMsg): DeleteLogRequest { @@ -715,8 +715,8 @@ export const WriteLogEntriesRequest_LabelsEntry = { }, toAmino(message: WriteLogEntriesRequest_LabelsEntry): WriteLogEntriesRequest_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: WriteLogEntriesRequest_LabelsEntryAminoMsg): WriteLogEntriesRequest_LabelsEntry { @@ -929,7 +929,7 @@ export const WriteLogEntriesRequest = { }, toAmino(message: WriteLogEntriesRequest): WriteLogEntriesRequestAmino { const obj: any = {}; - obj.log_name = message.logName; + obj.log_name = message.logName === "" ? undefined : message.logName; obj.resource = message.resource ? MonitoredResource.toAmino(message.resource) : undefined; obj.labels = {}; if (message.labels) { @@ -940,10 +940,10 @@ export const WriteLogEntriesRequest = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.partial_success = message.partialSuccess; - obj.dry_run = message.dryRun; + obj.partial_success = message.partialSuccess === false ? undefined : message.partialSuccess; + obj.dry_run = message.dryRun === false ? undefined : message.dryRun; return obj; }, fromAminoMsg(object: WriteLogEntriesRequestAminoMsg): WriteLogEntriesRequest { @@ -1116,7 +1116,7 @@ export const WriteLogEntriesPartialErrors_LogEntryErrorsEntry = { }, toAmino(message: WriteLogEntriesPartialErrors_LogEntryErrorsEntry): WriteLogEntriesPartialErrors_LogEntryErrorsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === 0 ? undefined : message.key; obj.value = message.value ? Status.toAmino(message.value) : undefined; return obj; }, @@ -1408,12 +1408,12 @@ export const ListLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; - obj.order_by = message.orderBy; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.order_by = message.orderBy === "" ? undefined : message.orderBy; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListLogEntriesRequestAminoMsg): ListLogEntriesRequest { @@ -1526,9 +1526,9 @@ export const ListLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogEntriesResponseAminoMsg): ListLogEntriesResponse { @@ -1632,8 +1632,8 @@ export const ListMonitoredResourceDescriptorsRequest = { }, toAmino(message: ListMonitoredResourceDescriptorsRequest): ListMonitoredResourceDescriptorsRequestAmino { const obj: any = {}; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsRequestAminoMsg): ListMonitoredResourceDescriptorsRequest { @@ -1746,9 +1746,9 @@ export const ListMonitoredResourceDescriptorsResponse = { if (message.resourceDescriptors) { obj.resource_descriptors = message.resourceDescriptors.map(e => e ? MonitoredResourceDescriptor.toAmino(e) : undefined); } else { - obj.resource_descriptors = []; + obj.resource_descriptors = message.resourceDescriptors; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListMonitoredResourceDescriptorsResponseAminoMsg): ListMonitoredResourceDescriptorsResponse { @@ -1890,13 +1890,13 @@ export const ListLogsRequest = { }, toAmino(message: ListLogsRequest): ListLogsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_size = message.pageSize; - obj.page_token = message.pageToken; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } return obj; }, @@ -2010,9 +2010,9 @@ export const ListLogsResponse = { if (message.logNames) { obj.log_names = message.logNames.map(e => e); } else { - obj.log_names = []; + obj.log_names = message.logNames; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogsResponseAminoMsg): ListLogsResponse { @@ -2143,9 +2143,9 @@ export const TailLogEntriesRequest = { if (message.resourceNames) { obj.resource_names = message.resourceNames.map(e => e); } else { - obj.resource_names = []; + obj.resource_names = message.resourceNames; } - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; obj.buffer_window = message.bufferWindow ? Duration.toAmino(message.bufferWindow) : undefined; return obj; }, @@ -2265,12 +2265,12 @@ export const TailLogEntriesResponse = { if (message.entries) { obj.entries = message.entries.map(e => e ? LogEntry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } if (message.suppressionInfo) { obj.suppression_info = message.suppressionInfo.map(e => e ? TailLogEntriesResponse_SuppressionInfo.toAmino(e) : undefined); } else { - obj.suppression_info = []; + obj.suppression_info = message.suppressionInfo; } return obj; }, @@ -2366,7 +2366,7 @@ export const TailLogEntriesResponse_SuppressionInfo = { fromAmino(object: TailLogEntriesResponse_SuppressionInfoAmino): TailLogEntriesResponse_SuppressionInfo { const message = createBaseTailLogEntriesResponse_SuppressionInfo(); if (object.reason !== undefined && object.reason !== null) { - message.reason = tailLogEntriesResponse_SuppressionInfo_ReasonFromJSON(object.reason); + message.reason = object.reason; } if (object.suppressed_count !== undefined && object.suppressed_count !== null) { message.suppressedCount = object.suppressed_count; @@ -2375,8 +2375,8 @@ export const TailLogEntriesResponse_SuppressionInfo = { }, toAmino(message: TailLogEntriesResponse_SuppressionInfo): TailLogEntriesResponse_SuppressionInfoAmino { const obj: any = {}; - obj.reason = tailLogEntriesResponse_SuppressionInfo_ReasonToJSON(message.reason); - obj.suppressed_count = message.suppressedCount; + obj.reason = message.reason === 0 ? undefined : message.reason; + obj.suppressed_count = message.suppressedCount === 0 ? undefined : message.suppressedCount; return obj; }, fromAminoMsg(object: TailLogEntriesResponse_SuppressionInfoAminoMsg): TailLogEntriesResponse_SuppressionInfo { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts index 1b93d63270..9cb168f8c8 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts @@ -1936,7 +1936,7 @@ export const LogBucket = { message.locked = object.locked; } if (object.lifecycle_state !== undefined && object.lifecycle_state !== null) { - message.lifecycleState = lifecycleStateFromJSON(object.lifecycle_state); + message.lifecycleState = object.lifecycle_state; } message.restrictedFields = object.restricted_fields?.map(e => e) || []; if (object.cmek_settings !== undefined && object.cmek_settings !== null) { @@ -1946,17 +1946,17 @@ export const LogBucket = { }, toAmino(message: LogBucket): LogBucketAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.retention_days = message.retentionDays; - obj.locked = message.locked; - obj.lifecycle_state = lifecycleStateToJSON(message.lifecycleState); + obj.retention_days = message.retentionDays === 0 ? undefined : message.retentionDays; + obj.locked = message.locked === false ? undefined : message.locked; + obj.lifecycle_state = message.lifecycleState === 0 ? undefined : message.lifecycleState; if (message.restrictedFields) { obj.restricted_fields = message.restrictedFields.map(e => e); } else { - obj.restricted_fields = []; + obj.restricted_fields = message.restrictedFields; } obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; return obj; @@ -2110,11 +2110,11 @@ export const LogView = { }, toAmino(message: LogView): LogViewAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.filter = message.filter; + obj.filter = message.filter === "" ? undefined : message.filter; return obj; }, fromAminoMsg(object: LogViewAminoMsg): LogView { @@ -2365,7 +2365,7 @@ export const LogSink = { } message.exclusions = object.exclusions?.map(e => LogExclusion.fromAmino(e)) || []; if (object.output_version_format !== undefined && object.output_version_format !== null) { - message.outputVersionFormat = logSink_VersionFormatFromJSON(object.output_version_format); + message.outputVersionFormat = object.output_version_format; } if (object.writer_identity !== undefined && object.writer_identity !== null) { message.writerIdentity = object.writer_identity; @@ -2386,19 +2386,19 @@ export const LogSink = { }, toAmino(message: LogSink): LogSinkAmino { const obj: any = {}; - obj.name = message.name; - obj.destination = message.destination; - obj.filter = message.filter; - obj.description = message.description; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.destination = message.destination === "" ? undefined : message.destination; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.description = message.description === "" ? undefined : message.description; + obj.disabled = message.disabled === false ? undefined : message.disabled; if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.output_version_format = logSink_VersionFormatToJSON(message.outputVersionFormat); - obj.writer_identity = message.writerIdentity; - obj.include_children = message.includeChildren; + obj.output_version_format = message.outputVersionFormat === 0 ? undefined : message.outputVersionFormat; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; + obj.include_children = message.includeChildren === false ? undefined : message.includeChildren; obj.bigquery_options = message.bigqueryOptions ? BigQueryOptions.toAmino(message.bigqueryOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; @@ -2505,8 +2505,8 @@ export const BigQueryOptions = { }, toAmino(message: BigQueryOptions): BigQueryOptionsAmino { const obj: any = {}; - obj.use_partitioned_tables = message.usePartitionedTables; - obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning; + obj.use_partitioned_tables = message.usePartitionedTables === false ? undefined : message.usePartitionedTables; + obj.uses_timestamp_column_partitioning = message.usesTimestampColumnPartitioning === false ? undefined : message.usesTimestampColumnPartitioning; return obj; }, fromAminoMsg(object: BigQueryOptionsAminoMsg): BigQueryOptions { @@ -2626,9 +2626,9 @@ export const ListBucketsRequest = { }, toAmino(message: ListBucketsRequest): ListBucketsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListBucketsRequestAminoMsg): ListBucketsRequest { @@ -2741,9 +2741,9 @@ export const ListBucketsResponse = { if (message.buckets) { obj.buckets = message.buckets.map(e => e ? LogBucket.toAmino(e) : undefined); } else { - obj.buckets = []; + obj.buckets = message.buckets; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListBucketsResponseAminoMsg): ListBucketsResponse { @@ -2865,8 +2865,8 @@ export const CreateBucketRequest = { }, toAmino(message: CreateBucketRequest): CreateBucketRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.bucket_id = message.bucketId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.bucket_id = message.bucketId === "" ? undefined : message.bucketId; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; return obj; }, @@ -2991,7 +2991,7 @@ export const UpdateBucketRequest = { }, toAmino(message: UpdateBucketRequest): UpdateBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.bucket = message.bucket ? LogBucket.toAmino(message.bucket) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3081,7 +3081,7 @@ export const GetBucketRequest = { }, toAmino(message: GetBucketRequest): GetBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetBucketRequestAminoMsg): GetBucketRequest { @@ -3169,7 +3169,7 @@ export const DeleteBucketRequest = { }, toAmino(message: DeleteBucketRequest): DeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteBucketRequestAminoMsg): DeleteBucketRequest { @@ -3257,7 +3257,7 @@ export const UndeleteBucketRequest = { }, toAmino(message: UndeleteBucketRequest): UndeleteBucketRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: UndeleteBucketRequestAminoMsg): UndeleteBucketRequest { @@ -3377,9 +3377,9 @@ export const ListViewsRequest = { }, toAmino(message: ListViewsRequest): ListViewsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListViewsRequestAminoMsg): ListViewsRequest { @@ -3492,9 +3492,9 @@ export const ListViewsResponse = { if (message.views) { obj.views = message.views.map(e => e ? LogView.toAmino(e) : undefined); } else { - obj.views = []; + obj.views = message.views; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListViewsResponseAminoMsg): ListViewsResponse { @@ -3616,8 +3616,8 @@ export const CreateViewRequest = { }, toAmino(message: CreateViewRequest): CreateViewRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.view_id = message.viewId; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.view_id = message.viewId === "" ? undefined : message.viewId; obj.view = message.view ? LogView.toAmino(message.view) : undefined; return obj; }, @@ -3742,7 +3742,7 @@ export const UpdateViewRequest = { }, toAmino(message: UpdateViewRequest): UpdateViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.view = message.view ? LogView.toAmino(message.view) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -3832,7 +3832,7 @@ export const GetViewRequest = { }, toAmino(message: GetViewRequest): GetViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetViewRequestAminoMsg): GetViewRequest { @@ -3920,7 +3920,7 @@ export const DeleteViewRequest = { }, toAmino(message: DeleteViewRequest): DeleteViewRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteViewRequestAminoMsg): DeleteViewRequest { @@ -4040,9 +4040,9 @@ export const ListSinksRequest = { }, toAmino(message: ListSinksRequest): ListSinksRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListSinksRequestAminoMsg): ListSinksRequest { @@ -4155,9 +4155,9 @@ export const ListSinksResponse = { if (message.sinks) { obj.sinks = message.sinks.map(e => e ? LogSink.toAmino(e) : undefined); } else { - obj.sinks = []; + obj.sinks = message.sinks; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListSinksResponseAminoMsg): ListSinksResponse { @@ -4245,7 +4245,7 @@ export const GetSinkRequest = { }, toAmino(message: GetSinkRequest): GetSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: GetSinkRequestAminoMsg): GetSinkRequest { @@ -4367,9 +4367,9 @@ export const CreateSinkRequest = { }, toAmino(message: CreateSinkRequest): CreateSinkRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; return obj; }, fromAminoMsg(object: CreateSinkRequestAminoMsg): CreateSinkRequest { @@ -4509,9 +4509,9 @@ export const UpdateSinkRequest = { }, toAmino(message: UpdateSinkRequest): UpdateSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; obj.sink = message.sink ? LogSink.toAmino(message.sink) : undefined; - obj.unique_writer_identity = message.uniqueWriterIdentity; + obj.unique_writer_identity = message.uniqueWriterIdentity === false ? undefined : message.uniqueWriterIdentity; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; }, @@ -4600,7 +4600,7 @@ export const DeleteSinkRequest = { }, toAmino(message: DeleteSinkRequest): DeleteSinkRequestAmino { const obj: any = {}; - obj.sink_name = message.sinkName; + obj.sink_name = message.sinkName === "" ? undefined : message.sinkName; return obj; }, fromAminoMsg(object: DeleteSinkRequestAminoMsg): DeleteSinkRequest { @@ -4768,10 +4768,10 @@ export const LogExclusion = { }, toAmino(message: LogExclusion): LogExclusionAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; return obj; @@ -4893,9 +4893,9 @@ export const ListExclusionsRequest = { }, toAmino(message: ListExclusionsRequest): ListExclusionsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListExclusionsRequestAminoMsg): ListExclusionsRequest { @@ -5008,9 +5008,9 @@ export const ListExclusionsResponse = { if (message.exclusions) { obj.exclusions = message.exclusions.map(e => e ? LogExclusion.toAmino(e) : undefined); } else { - obj.exclusions = []; + obj.exclusions = message.exclusions; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListExclusionsResponseAminoMsg): ListExclusionsResponse { @@ -5098,7 +5098,7 @@ export const GetExclusionRequest = { }, toAmino(message: GetExclusionRequest): GetExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetExclusionRequestAminoMsg): GetExclusionRequest { @@ -5204,7 +5204,7 @@ export const CreateExclusionRequest = { }, toAmino(message: CreateExclusionRequest): CreateExclusionRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; return obj; }, @@ -5329,7 +5329,7 @@ export const UpdateExclusionRequest = { }, toAmino(message: UpdateExclusionRequest): UpdateExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.exclusion = message.exclusion ? LogExclusion.toAmino(message.exclusion) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5419,7 +5419,7 @@ export const DeleteExclusionRequest = { }, toAmino(message: DeleteExclusionRequest): DeleteExclusionRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteExclusionRequestAminoMsg): DeleteExclusionRequest { @@ -5507,7 +5507,7 @@ export const GetCmekSettingsRequest = { }, toAmino(message: GetCmekSettingsRequest): GetCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetCmekSettingsRequestAminoMsg): GetCmekSettingsRequest { @@ -5631,7 +5631,7 @@ export const UpdateCmekSettingsRequest = { }, toAmino(message: UpdateCmekSettingsRequest): UpdateCmekSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.cmek_settings = message.cmekSettings ? CmekSettings.toAmino(message.cmekSettings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -5753,9 +5753,9 @@ export const CmekSettings = { }, toAmino(message: CmekSettings): CmekSettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.service_account_id = message.serviceAccountId; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.service_account_id = message.serviceAccountId === "" ? undefined : message.serviceAccountId; return obj; }, fromAminoMsg(object: CmekSettingsAminoMsg): CmekSettings { @@ -5843,7 +5843,7 @@ export const GetSettingsRequest = { }, toAmino(message: GetSettingsRequest): GetSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetSettingsRequestAminoMsg): GetSettingsRequest { @@ -5967,7 +5967,7 @@ export const UpdateSettingsRequest = { }, toAmino(message: UpdateSettingsRequest): UpdateSettingsRequestAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.settings = message.settings ? Settings.toAmino(message.settings) : undefined; obj.update_mask = message.updateMask ? FieldMask.toAmino(message.updateMask) : undefined; return obj; @@ -6121,11 +6121,11 @@ export const Settings = { }, toAmino(message: Settings): SettingsAmino { const obj: any = {}; - obj.name = message.name; - obj.kms_key_name = message.kmsKeyName; - obj.kms_service_account_id = message.kmsServiceAccountId; - obj.storage_location = message.storageLocation; - obj.disable_default_sink = message.disableDefaultSink; + obj.name = message.name === "" ? undefined : message.name; + obj.kms_key_name = message.kmsKeyName === "" ? undefined : message.kmsKeyName; + obj.kms_service_account_id = message.kmsServiceAccountId === "" ? undefined : message.kmsServiceAccountId; + obj.storage_location = message.storageLocation === "" ? undefined : message.storageLocation; + obj.disable_default_sink = message.disableDefaultSink === false ? undefined : message.disableDefaultSink; return obj; }, fromAminoMsg(object: SettingsAminoMsg): Settings { @@ -6245,9 +6245,9 @@ export const CopyLogEntriesRequest = { }, toAmino(message: CopyLogEntriesRequest): CopyLogEntriesRequestAmino { const obj: any = {}; - obj.name = message.name; - obj.filter = message.filter; - obj.destination = message.destination; + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.destination = message.destination === "" ? undefined : message.destination; return obj; }, fromAminoMsg(object: CopyLogEntriesRequestAminoMsg): CopyLogEntriesRequest { @@ -6415,7 +6415,7 @@ export const CopyLogEntriesMetadata = { message.endTime = fromTimestamp(Timestamp.fromAmino(object.end_time)); } if (object.state !== undefined && object.state !== null) { - message.state = operationStateFromJSON(object.state); + message.state = object.state; } if (object.cancellation_requested !== undefined && object.cancellation_requested !== null) { message.cancellationRequested = object.cancellation_requested; @@ -6435,11 +6435,11 @@ export const CopyLogEntriesMetadata = { const obj: any = {}; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; - obj.state = operationStateToJSON(message.state); - obj.cancellation_requested = message.cancellationRequested; + obj.state = message.state === 0 ? undefined : message.state; + obj.cancellation_requested = message.cancellationRequested === false ? undefined : message.cancellationRequested; obj.request = message.request ? CopyLogEntriesRequest.toAmino(message.request) : undefined; - obj.progress = message.progress; - obj.writer_identity = message.writerIdentity; + obj.progress = message.progress === 0 ? undefined : message.progress; + obj.writer_identity = message.writerIdentity === "" ? undefined : message.writerIdentity; return obj; }, fromAminoMsg(object: CopyLogEntriesMetadataAminoMsg): CopyLogEntriesMetadata { diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts index c527afe2c9..740e2beef9 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_metrics.ts @@ -434,8 +434,8 @@ export const LogMetric_LabelExtractorsEntry = { }, toAmino(message: LogMetric_LabelExtractorsEntry): LogMetric_LabelExtractorsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: LogMetric_LabelExtractorsEntryAminoMsg): LogMetric_LabelExtractorsEntry { @@ -718,18 +718,18 @@ export const LogMetric = { message.updateTime = fromTimestamp(Timestamp.fromAmino(object.update_time)); } if (object.version !== undefined && object.version !== null) { - message.version = logMetric_ApiVersionFromJSON(object.version); + message.version = object.version; } return message; }, toAmino(message: LogMetric): LogMetricAmino { const obj: any = {}; - obj.name = message.name; - obj.description = message.description; - obj.filter = message.filter; - obj.disabled = message.disabled; + obj.name = message.name === "" ? undefined : message.name; + obj.description = message.description === "" ? undefined : message.description; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.disabled = message.disabled === false ? undefined : message.disabled; obj.metric_descriptor = message.metricDescriptor ? MetricDescriptor.toAmino(message.metricDescriptor) : undefined; - obj.value_extractor = message.valueExtractor; + obj.value_extractor = message.valueExtractor === "" ? undefined : message.valueExtractor; obj.label_extractors = {}; if (message.labelExtractors) { Object.entries(message.labelExtractors).forEach(([k, v]) => { @@ -739,7 +739,7 @@ export const LogMetric = { obj.bucket_options = message.bucketOptions ? Distribution_BucketOptions.toAmino(message.bucketOptions) : undefined; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; - obj.version = logMetric_ApiVersionToJSON(message.version); + obj.version = message.version === 0 ? undefined : message.version; return obj; }, fromAminoMsg(object: LogMetricAminoMsg): LogMetric { @@ -859,9 +859,9 @@ export const ListLogMetricsRequest = { }, toAmino(message: ListLogMetricsRequest): ListLogMetricsRequestAmino { const obj: any = {}; - obj.parent = message.parent; - obj.page_token = message.pageToken; - obj.page_size = message.pageSize; + obj.parent = message.parent === "" ? undefined : message.parent; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; return obj; }, fromAminoMsg(object: ListLogMetricsRequestAminoMsg): ListLogMetricsRequest { @@ -974,9 +974,9 @@ export const ListLogMetricsResponse = { if (message.metrics) { obj.metrics = message.metrics.map(e => e ? LogMetric.toAmino(e) : undefined); } else { - obj.metrics = []; + obj.metrics = message.metrics; } - obj.next_page_token = message.nextPageToken; + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListLogMetricsResponseAminoMsg): ListLogMetricsResponse { @@ -1064,7 +1064,7 @@ export const GetLogMetricRequest = { }, toAmino(message: GetLogMetricRequest): GetLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: GetLogMetricRequestAminoMsg): GetLogMetricRequest { @@ -1170,7 +1170,7 @@ export const CreateLogMetricRequest = { }, toAmino(message: CreateLogMetricRequest): CreateLogMetricRequestAmino { const obj: any = {}; - obj.parent = message.parent; + obj.parent = message.parent === "" ? undefined : message.parent; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1277,7 +1277,7 @@ export const UpdateLogMetricRequest = { }, toAmino(message: UpdateLogMetricRequest): UpdateLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; obj.metric = message.metric ? LogMetric.toAmino(message.metric) : undefined; return obj; }, @@ -1366,7 +1366,7 @@ export const DeleteLogMetricRequest = { }, toAmino(message: DeleteLogMetricRequest): DeleteLogMetricRequestAmino { const obj: any = {}; - obj.metric_name = message.metricName; + obj.metric_name = message.metricName === "" ? undefined : message.metricName; return obj; }, fromAminoMsg(object: DeleteLogMetricRequestAminoMsg): DeleteLogMetricRequest { diff --git a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts index f09f3439a9..92d219685d 100644 --- a/__fixtures__/v-next/outputv4/google/longrunning/operations.ts +++ b/__fixtures__/v-next/outputv4/google/longrunning/operations.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { Any, AnySDKType } from "../protobuf/any"; import { Status, StatusSDKType } from "../rpc/status"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.longrunning"; /** * This resource represents a long-running operation that is the result of a @@ -350,9 +350,9 @@ export const Operation = { }, toAmino(message: Operation): OperationAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.metadata = message.metadata ? Any.toAmino(message.metadata) : undefined; - obj.done = omitDefault(message.done); + obj.done = message.done === false ? undefined : message.done; obj.error = message.error ? Status.toAmino(message.error) : undefined; obj.response = message.response ? Any.toAmino(message.response) : undefined; return obj; @@ -442,7 +442,7 @@ export const GetOperationRequest = { }, toAmino(message: GetOperationRequest): GetOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: GetOperationRequestAminoMsg): GetOperationRequest { @@ -578,10 +578,10 @@ export const ListOperationsRequest = { }, toAmino(message: ListOperationsRequest): ListOperationsRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.filter = omitDefault(message.filter); - obj.page_size = omitDefault(message.pageSize); - obj.page_token = omitDefault(message.pageToken); + obj.name = message.name === "" ? undefined : message.name; + obj.filter = message.filter === "" ? undefined : message.filter; + obj.page_size = message.pageSize === 0 ? undefined : message.pageSize; + obj.page_token = message.pageToken === "" ? undefined : message.pageToken; return obj; }, fromAminoMsg(object: ListOperationsRequestAminoMsg): ListOperationsRequest { @@ -694,9 +694,9 @@ export const ListOperationsResponse = { if (message.operations) { obj.operations = message.operations.map(e => e ? Operation.toAmino(e) : undefined); } else { - obj.operations = []; + obj.operations = message.operations; } - obj.next_page_token = omitDefault(message.nextPageToken); + obj.next_page_token = message.nextPageToken === "" ? undefined : message.nextPageToken; return obj; }, fromAminoMsg(object: ListOperationsResponseAminoMsg): ListOperationsResponse { @@ -784,7 +784,7 @@ export const CancelOperationRequest = { }, toAmino(message: CancelOperationRequest): CancelOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: CancelOperationRequestAminoMsg): CancelOperationRequest { @@ -872,7 +872,7 @@ export const DeleteOperationRequest = { }, toAmino(message: DeleteOperationRequest): DeleteOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; return obj; }, fromAminoMsg(object: DeleteOperationRequestAminoMsg): DeleteOperationRequest { @@ -978,7 +978,7 @@ export const WaitOperationRequest = { }, toAmino(message: WaitOperationRequest): WaitOperationRequestAmino { const obj: any = {}; - obj.name = omitDefault(message.name); + obj.name = message.name === "" ? undefined : message.name; obj.timeout = message.timeout ? Duration.toAmino(message.timeout) : undefined; return obj; }, @@ -1083,8 +1083,8 @@ export const OperationInfo = { }, toAmino(message: OperationInfo): OperationInfoAmino { const obj: any = {}; - obj.response_type = omitDefault(message.responseType); - obj.metadata_type = omitDefault(message.metadataType); + obj.response_type = message.responseType === "" ? undefined : message.responseType; + obj.metadata_type = message.metadataType === "" ? undefined : message.metadataType; return obj; }, fromAminoMsg(object: OperationInfoAminoMsg): OperationInfo { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/any.ts b/__fixtures__/v-next/outputv4/google/protobuf/any.ts index d6dba86e23..0517d18b23 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/any.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/any.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, bytesFromBase64, base64FromBytes, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `Any` contains an arbitrary serialized protocol buffer message along with a diff --git a/__fixtures__/v-next/outputv4/google/protobuf/api.ts b/__fixtures__/v-next/outputv4/google/protobuf/api.ts index 8e8f3ca94f..f3fb5a648e 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/api.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/api.ts @@ -467,31 +467,31 @@ export const Api = { } message.mixins = object.mixins?.map(e => Mixin.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Api): ApiAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.methods) { obj.methods = message.methods.map(e => e ? Method.toAmino(e) : undefined); } else { - obj.methods = []; + obj.methods = message.methods; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; if (message.mixins) { obj.mixins = message.mixins.map(e => e ? Mixin.toAmino(e) : undefined); } else { - obj.mixins = []; + obj.mixins = message.mixins; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: ApiAminoMsg): Api { @@ -675,23 +675,23 @@ export const Method = { } message.options = object.options?.map(e => Option.fromAmino(e)) || []; if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Method): MethodAmino { const obj: any = {}; - obj.name = message.name; - obj.request_type_url = message.requestTypeUrl; - obj.request_streaming = message.requestStreaming; - obj.response_type_url = message.responseTypeUrl; - obj.response_streaming = message.responseStreaming; + obj.name = message.name === "" ? undefined : message.name; + obj.request_type_url = message.requestTypeUrl === "" ? undefined : message.requestTypeUrl; + obj.request_streaming = message.requestStreaming === false ? undefined : message.requestStreaming; + obj.response_type_url = message.responseTypeUrl === "" ? undefined : message.responseTypeUrl; + obj.response_streaming = message.responseStreaming === false ? undefined : message.responseStreaming; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: MethodAminoMsg): Method { @@ -795,8 +795,8 @@ export const Mixin = { }, toAmino(message: Mixin): MixinAmino { const obj: any = {}; - obj.name = message.name; - obj.root = message.root; + obj.name = message.name === "" ? undefined : message.name; + obj.root = message.root === "" ? undefined : message.root; return obj; }, fromAminoMsg(object: MixinAminoMsg): Mixin { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts index a58bf8b464..d9afa67558 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/compiler/plugin.ts @@ -1,6 +1,6 @@ import { FileDescriptorProto, FileDescriptorProtoSDKType } from "../descriptor"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "google.protobuf.compiler"; /** The version number of protocol compiler. */ export interface Version { @@ -275,10 +275,10 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.major = omitDefault(message.major); - obj.minor = omitDefault(message.minor); - obj.patch = omitDefault(message.patch); - obj.suffix = omitDefault(message.suffix); + obj.major = message.major === 0 ? undefined : message.major; + obj.minor = message.minor === 0 ? undefined : message.minor; + obj.patch = message.patch === 0 ? undefined : message.patch; + obj.suffix = message.suffix === "" ? undefined : message.suffix; return obj; }, fromAminoMsg(object: VersionAminoMsg): Version { @@ -431,13 +431,13 @@ export const CodeGeneratorRequest = { if (message.fileToGenerate) { obj.file_to_generate = message.fileToGenerate.map(e => e); } else { - obj.file_to_generate = []; + obj.file_to_generate = message.fileToGenerate; } - obj.parameter = omitDefault(message.parameter); + obj.parameter = message.parameter === "" ? undefined : message.parameter; if (message.protoFile) { obj.proto_file = message.protoFile.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.proto_file = []; + obj.proto_file = message.protoFile; } obj.compiler_version = message.compilerVersion ? Version.toAmino(message.compilerVersion) : undefined; return obj; @@ -549,11 +549,11 @@ export const CodeGeneratorResponse = { }, toAmino(message: CodeGeneratorResponse): CodeGeneratorResponseAmino { const obj: any = {}; - obj.error = omitDefault(message.error); + obj.error = message.error === "" ? undefined : message.error; if (message.file) { obj.file = message.file.map(e => e ? CodeGeneratorResponse_File.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -674,9 +674,9 @@ export const CodeGeneratorResponse_File = { }, toAmino(message: CodeGeneratorResponse_File): CodeGeneratorResponse_FileAmino { const obj: any = {}; - obj.name = omitDefault(message.name); - obj.insertion_point = omitDefault(message.insertionPoint); - obj.content = omitDefault(message.content); + obj.name = message.name === "" ? undefined : message.name; + obj.insertion_point = message.insertionPoint === "" ? undefined : message.insertionPoint; + obj.content = message.content === "" ? undefined : message.content; return obj; }, fromAminoMsg(object: CodeGeneratorResponse_FileAminoMsg): CodeGeneratorResponse_File { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts index 31db994ad2..c3f1203ab9 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts @@ -1464,7 +1464,7 @@ export const FileDescriptorSet = { if (message.file) { obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); } else { - obj.file = []; + obj.file = message.file; } return obj; }, @@ -1793,46 +1793,46 @@ export const FileDescriptorProto = { }, toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.package = message.package; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; if (message.dependency) { obj.dependency = message.dependency.map(e => e); } else { - obj.dependency = []; + obj.dependency = message.dependency; } if (message.publicDependency) { obj.public_dependency = message.publicDependency.map(e => e); } else { - obj.public_dependency = []; + obj.public_dependency = message.publicDependency; } if (message.weakDependency) { obj.weak_dependency = message.weakDependency.map(e => e); } else { - obj.weak_dependency = []; + obj.weak_dependency = message.weakDependency; } if (message.messageType) { obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.message_type = []; + obj.message_type = message.messageType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.service) { obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); } else { - obj.service = []; + obj.service = message.service; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; - obj.syntax = message.syntax; + obj.syntax = message.syntax === "" ? undefined : message.syntax; return obj; }, fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { @@ -2114,47 +2114,47 @@ export const DescriptorProto = { }, toAmino(message: DescriptorProto): DescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.field) { obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.field = []; + obj.field = message.field; } if (message.extension) { obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); } else { - obj.extension = []; + obj.extension = message.extension; } if (message.nestedType) { obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); } else { - obj.nested_type = []; + obj.nested_type = message.nestedType; } if (message.enumType) { obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); } else { - obj.enum_type = []; + obj.enum_type = message.enumType; } if (message.extensionRange) { obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); } else { - obj.extension_range = []; + obj.extension_range = message.extensionRange; } if (message.oneofDecl) { obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); } else { - obj.oneof_decl = []; + obj.oneof_decl = message.oneofDecl; } obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -2277,8 +2277,8 @@ export const DescriptorProto_ExtensionRange = { }, toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; return obj; }, @@ -2383,8 +2383,8 @@ export const DescriptorProto_ReservedRange = { }, toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { @@ -2481,7 +2481,7 @@ export const ExtensionRangeOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -2689,10 +2689,10 @@ export const FieldDescriptorProto = { message.number = object.number; } if (object.label !== undefined && object.label !== null) { - message.label = fieldDescriptorProto_LabelFromJSON(object.label); + message.label = object.label; } if (object.type !== undefined && object.type !== null) { - message.type = fieldDescriptorProto_TypeFromJSON(object.type); + message.type = object.type; } if (object.type_name !== undefined && object.type_name !== null) { message.typeName = object.type_name; @@ -2716,15 +2716,15 @@ export const FieldDescriptorProto = { }, toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; - obj.label = fieldDescriptorProto_LabelToJSON(message.label); - obj.type = fieldDescriptorProto_TypeToJSON(message.type); - obj.type_name = message.typeName; - obj.extendee = message.extendee; - obj.default_value = message.defaultValue; - obj.oneof_index = message.oneofIndex; - obj.json_name = message.jsonName; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; return obj; }, @@ -2831,7 +2831,7 @@ export const OneofDescriptorProto = { }, toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; return obj; }, @@ -3004,22 +3004,22 @@ export const EnumDescriptorProto = { }, toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.value) { obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); } else { - obj.value = []; + obj.value = message.value; } obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; if (message.reservedRange) { obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); } else { - obj.reserved_range = []; + obj.reserved_range = message.reservedRange; } if (message.reservedName) { obj.reserved_name = message.reservedName.map(e => e); } else { - obj.reserved_name = []; + obj.reserved_name = message.reservedName; } return obj; }, @@ -3124,8 +3124,8 @@ export const EnumDescriptorProto_EnumReservedRange = { }, toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { const obj: any = {}; - obj.start = message.start; - obj.end = message.end; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { @@ -3247,8 +3247,8 @@ export const EnumValueDescriptorProto = { }, toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; return obj; }, @@ -3377,11 +3377,11 @@ export const ServiceDescriptorProto = { }, toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.method) { obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); } else { - obj.method = []; + obj.method = message.method; } obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; return obj; @@ -3553,12 +3553,12 @@ export const MethodDescriptorProto = { }, toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { const obj: any = {}; - obj.name = message.name; - obj.input_type = message.inputType; - obj.output_type = message.outputType; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; - obj.client_streaming = message.clientStreaming; - obj.server_streaming = message.serverStreaming; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; return obj; }, fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { @@ -3923,7 +3923,7 @@ export const FileOptions = { message.javaStringCheckUtf8 = object.java_string_check_utf8; } if (object.optimize_for !== undefined && object.optimize_for !== null) { - message.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimize_for); + message.optimizeFor = object.optimize_for; } if (object.go_package !== undefined && object.go_package !== null) { message.goPackage = object.go_package; @@ -3972,30 +3972,30 @@ export const FileOptions = { }, toAmino(message: FileOptions): FileOptionsAmino { const obj: any = {}; - obj.java_package = message.javaPackage; - obj.java_outer_classname = message.javaOuterClassname; - obj.java_multiple_files = message.javaMultipleFiles; - obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; - obj.java_string_check_utf8 = message.javaStringCheckUtf8; - obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor); - obj.go_package = message.goPackage; - obj.cc_generic_services = message.ccGenericServices; - obj.java_generic_services = message.javaGenericServices; - obj.py_generic_services = message.pyGenericServices; - obj.php_generic_services = message.phpGenericServices; - obj.deprecated = message.deprecated; - obj.cc_enable_arenas = message.ccEnableArenas; - obj.objc_class_prefix = message.objcClassPrefix; - obj.csharp_namespace = message.csharpNamespace; - obj.swift_prefix = message.swiftPrefix; - obj.php_class_prefix = message.phpClassPrefix; - obj.php_namespace = message.phpNamespace; - obj.php_metadata_namespace = message.phpMetadataNamespace; - obj.ruby_package = message.rubyPackage; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4154,14 +4154,14 @@ export const MessageOptions = { }, toAmino(message: MessageOptions): MessageOptionsAmino { const obj: any = {}; - obj.message_set_wire_format = message.messageSetWireFormat; - obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; - obj.deprecated = message.deprecated; - obj.map_entry = message.mapEntry; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4330,13 +4330,13 @@ export const FieldOptions = { fromAmino(object: FieldOptionsAmino): FieldOptions { const message = createBaseFieldOptions(); if (object.ctype !== undefined && object.ctype !== null) { - message.ctype = fieldOptions_CTypeFromJSON(object.ctype); + message.ctype = object.ctype; } if (object.packed !== undefined && object.packed !== null) { message.packed = object.packed; } if (object.jstype !== undefined && object.jstype !== null) { - message.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + message.jstype = object.jstype; } if (object.lazy !== undefined && object.lazy !== null) { message.lazy = object.lazy; @@ -4352,16 +4352,16 @@ export const FieldOptions = { }, toAmino(message: FieldOptions): FieldOptionsAmino { const obj: any = {}; - obj.ctype = fieldOptions_CTypeToJSON(message.ctype); - obj.packed = message.packed; - obj.jstype = fieldOptions_JSTypeToJSON(message.jstype); - obj.lazy = message.lazy; - obj.deprecated = message.deprecated; - obj.weak = message.weak; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4459,7 +4459,7 @@ export const OneofOptions = { if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4586,12 +4586,12 @@ export const EnumOptions = { }, toAmino(message: EnumOptions): EnumOptionsAmino { const obj: any = {}; - obj.allow_alias = message.allowAlias; - obj.deprecated = message.deprecated; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4702,11 +4702,11 @@ export const EnumValueOptions = { }, toAmino(message: EnumValueOptions): EnumValueOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4817,11 +4817,11 @@ export const ServiceOptions = { }, toAmino(message: ServiceOptions): ServiceOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -4941,19 +4941,19 @@ export const MethodOptions = { message.deprecated = object.deprecated; } if (object.idempotency_level !== undefined && object.idempotency_level !== null) { - message.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotency_level); + message.idempotencyLevel = object.idempotency_level; } message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; return message; }, toAmino(message: MethodOptions): MethodOptionsAmino { const obj: any = {}; - obj.deprecated = message.deprecated; - obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel); + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; if (message.uninterpretedOption) { obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); } else { - obj.uninterpreted_option = []; + obj.uninterpreted_option = message.uninterpretedOption; } return obj; }, @@ -5151,14 +5151,14 @@ export const UninterpretedOption = { if (message.name) { obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); } else { - obj.name = []; + obj.name = message.name; } - obj.identifier_value = message.identifierValue; + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; - obj.double_value = message.doubleValue; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; - obj.aggregate_value = message.aggregateValue; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; return obj; }, fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { @@ -5262,8 +5262,8 @@ export const UninterpretedOption_NamePart = { }, toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { const obj: any = {}; - obj.name_part = message.namePart; - obj.is_extension = message.isExtension; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; return obj; }, fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { @@ -5360,7 +5360,7 @@ export const SourceCodeInfo = { if (message.location) { obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); } else { - obj.location = []; + obj.location = message.location; } return obj; }, @@ -5552,19 +5552,19 @@ export const SourceCodeInfo_Location = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } if (message.span) { obj.span = message.span.map(e => e); } else { - obj.span = []; + obj.span = message.span; } - obj.leading_comments = message.leadingComments; - obj.trailing_comments = message.trailingComments; + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; if (message.leadingDetachedComments) { obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); } else { - obj.leading_detached_comments = []; + obj.leading_detached_comments = message.leadingDetachedComments; } return obj; }, @@ -5662,7 +5662,7 @@ export const GeneratedCodeInfo = { if (message.annotation) { obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); } else { - obj.annotation = []; + obj.annotation = message.annotation; } return obj; }, @@ -5817,11 +5817,11 @@ export const GeneratedCodeInfo_Annotation = { if (message.path) { obj.path = message.path.map(e => e); } else { - obj.path = []; + obj.path = message.path; } - obj.source_file = message.sourceFile; - obj.begin = message.begin; - obj.end = message.end; + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; return obj; }, fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts index 52458b7c77..4e2c2d81a4 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/duration.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/duration.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Duration represents a signed, fixed-length span of time represented diff --git a/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts b/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts index 9b2c3c999a..1c21f0603a 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/field_mask.ts @@ -492,7 +492,7 @@ export const FieldMask = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts index 62337967a2..88cf9c3e3b 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/source_context.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * `SourceContext` represents information about the source of a @@ -92,7 +92,7 @@ export const SourceContext = { }, toAmino(message: SourceContext): SourceContextAmino { const obj: any = {}; - obj.file_name = omitDefault(message.fileName); + obj.file_name = message.fileName === "" ? undefined : message.fileName; return obj; }, fromAminoMsg(object: SourceContextAminoMsg): SourceContext { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts index 2f0d398820..4a433eedd9 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/struct.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/struct.ts @@ -229,7 +229,7 @@ export const Struct_FieldsEntry = { }, toAmino(message: Struct_FieldsEntry): Struct_FieldsEntryAmino { const obj: any = {}; - obj.key = message.key; + obj.key = message.key === "" ? undefined : message.key; obj.value = message.value ? Value.toAmino(message.value) : undefined; return obj; }, @@ -511,7 +511,7 @@ export const Value = { fromAmino(object: ValueAmino): Value { const message = createBaseValue(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.number_value !== undefined && object.number_value !== null) { message.numberValue = object.number_value; @@ -532,10 +532,10 @@ export const Value = { }, toAmino(message: Value): ValueAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.number_value = message.numberValue; - obj.string_value = message.stringValue; - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.number_value = message.numberValue === null ? undefined : message.numberValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.struct_value = message.structValue ? Struct.toAmino(message.structValue) : undefined; obj.list_value = message.listValue ? ListValue.toAmino(message.listValue) : undefined; return obj; @@ -634,7 +634,7 @@ export const ListValue = { if (message.values) { obj.values = message.values.map(e => e ? Value.toAmino(e) : undefined); } else { - obj.values = []; + obj.values = message.values; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts index bfe9efd85f..377db6b10b 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/timestamp.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, fromJsonTimestamp, omitDefault, fromTimestamp } from "../../helpers"; +import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * A Timestamp represents a point in time independent of any time zone or local diff --git a/__fixtures__/v-next/outputv4/google/protobuf/type.ts b/__fixtures__/v-next/outputv4/google/protobuf/type.ts index c58dc587d6..2d773bfb19 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/type.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/type.ts @@ -551,30 +551,30 @@ export const Type = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Type): TypeAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.fields) { obj.fields = message.fields.map(e => e ? Field.toAmino(e) : undefined); } else { - obj.fields = []; + obj.fields = message.fields; } if (message.oneofs) { obj.oneofs = message.oneofs.map(e => e); } else { - obj.oneofs = []; + obj.oneofs = message.oneofs; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: TypeAminoMsg): Type { @@ -781,10 +781,10 @@ export const Field = { fromAmino(object: FieldAmino): Field { const message = createBaseField(); if (object.kind !== undefined && object.kind !== null) { - message.kind = field_KindFromJSON(object.kind); + message.kind = object.kind; } if (object.cardinality !== undefined && object.cardinality !== null) { - message.cardinality = field_CardinalityFromJSON(object.cardinality); + message.cardinality = object.cardinality; } if (object.number !== undefined && object.number !== null) { message.number = object.number; @@ -812,20 +812,20 @@ export const Field = { }, toAmino(message: Field): FieldAmino { const obj: any = {}; - obj.kind = field_KindToJSON(message.kind); - obj.cardinality = field_CardinalityToJSON(message.cardinality); - obj.number = message.number; - obj.name = message.name; - obj.type_url = message.typeUrl; - obj.oneof_index = message.oneofIndex; - obj.packed = message.packed; + obj.kind = message.kind === 0 ? undefined : message.kind; + obj.cardinality = message.cardinality === 0 ? undefined : message.cardinality; + obj.number = message.number === 0 ? undefined : message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.type_url = message.typeUrl === "" ? undefined : message.typeUrl; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.packed = message.packed === false ? undefined : message.packed; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } - obj.json_name = message.jsonName; - obj.default_value = message.defaultValue; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; return obj; }, fromAminoMsg(object: FieldAminoMsg): Field { @@ -985,25 +985,25 @@ export const Enum = { message.sourceContext = SourceContext.fromAmino(object.source_context); } if (object.syntax !== undefined && object.syntax !== null) { - message.syntax = syntaxFromJSON(object.syntax); + message.syntax = object.syntax; } return message; }, toAmino(message: Enum): EnumAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; if (message.enumvalue) { obj.enumvalue = message.enumvalue.map(e => e ? EnumValue.toAmino(e) : undefined); } else { - obj.enumvalue = []; + obj.enumvalue = message.enumvalue; } if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } obj.source_context = message.sourceContext ? SourceContext.toAmino(message.sourceContext) : undefined; - obj.syntax = syntaxToJSON(message.syntax); + obj.syntax = message.syntax === 0 ? undefined : message.syntax; return obj; }, fromAminoMsg(object: EnumAminoMsg): Enum { @@ -1129,12 +1129,12 @@ export const EnumValue = { }, toAmino(message: EnumValue): EnumValueAmino { const obj: any = {}; - obj.name = message.name; - obj.number = message.number; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; if (message.options) { obj.options = message.options.map(e => e ? Option.toAmino(e) : undefined); } else { - obj.options = []; + obj.options = message.options; } return obj; }, @@ -1241,7 +1241,7 @@ export const Option = { }, toAmino(message: Option): OptionAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.value = message.value ? Any.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts index 48cd06945e..814ea49c4c 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "google.protobuf"; /** * Wrapper message for `double`. @@ -259,7 +259,7 @@ export const DoubleValue = { }, toAmino(message: DoubleValue): DoubleValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: DoubleValueAminoMsg): DoubleValue { @@ -347,7 +347,7 @@ export const FloatValue = { }, toAmino(message: FloatValue): FloatValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: FloatValueAminoMsg): FloatValue { @@ -437,7 +437,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -527,7 +527,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { @@ -615,7 +615,7 @@ export const Int32Value = { }, toAmino(message: Int32Value): Int32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: Int32ValueAminoMsg): Int32Value { @@ -703,7 +703,7 @@ export const UInt32Value = { }, toAmino(message: UInt32Value): UInt32ValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === 0 ? undefined : message.value; return obj; }, fromAminoMsg(object: UInt32ValueAminoMsg): UInt32Value { @@ -791,7 +791,7 @@ export const BoolValue = { }, toAmino(message: BoolValue): BoolValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === false ? undefined : message.value; return obj; }, fromAminoMsg(object: BoolValueAminoMsg): BoolValue { @@ -879,7 +879,7 @@ export const StringValue = { }, toAmino(message: StringValue): StringValueAmino { const obj: any = {}; - obj.value = omitDefault(message.value); + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: StringValueAminoMsg): StringValue { diff --git a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts index 4be65bc155..0165405e0a 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts @@ -788,7 +788,7 @@ export const AttributeContext = { if (message.extensions) { obj.extensions = message.extensions.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.extensions = []; + obj.extensions = message.extensions; } return obj; }, @@ -892,8 +892,8 @@ export const AttributeContext_Peer_LabelsEntry = { }, toAmino(message: AttributeContext_Peer_LabelsEntry): AttributeContext_Peer_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Peer_LabelsEntryAminoMsg): AttributeContext_Peer_LabelsEntry { @@ -1084,7 +1084,7 @@ export const AttributeContext_Peer = { }, toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; - obj.ip = message.ip; + obj.ip = message.ip === "" ? undefined : message.ip; obj.port = message.port ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { @@ -1092,8 +1092,8 @@ export const AttributeContext_Peer = { obj.labels[k] = v; }); } - obj.principal = message.principal; - obj.region_code = message.regionCode; + obj.principal = message.principal === "" ? undefined : message.principal; + obj.region_code = message.regionCode === "" ? undefined : message.regionCode; return obj; }, fromAminoMsg(object: AttributeContext_PeerAminoMsg): AttributeContext_Peer { @@ -1229,10 +1229,10 @@ export const AttributeContext_Api = { }, toAmino(message: AttributeContext_Api): AttributeContext_ApiAmino { const obj: any = {}; - obj.service = message.service; - obj.operation = message.operation; - obj.protocol = message.protocol; - obj.version = message.version; + obj.service = message.service === "" ? undefined : message.service; + obj.operation = message.operation === "" ? undefined : message.operation; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: AttributeContext_ApiAminoMsg): AttributeContext_Api { @@ -1398,18 +1398,18 @@ export const AttributeContext_Auth = { }, toAmino(message: AttributeContext_Auth): AttributeContext_AuthAmino { const obj: any = {}; - obj.principal = message.principal; + obj.principal = message.principal === "" ? undefined : message.principal; if (message.audiences) { obj.audiences = message.audiences.map(e => e); } else { - obj.audiences = []; + obj.audiences = message.audiences; } - obj.presenter = message.presenter; + obj.presenter = message.presenter === "" ? undefined : message.presenter; obj.claims = message.claims ? Struct.toAmino(message.claims) : undefined; if (message.accessLevels) { obj.access_levels = message.accessLevels.map(e => e); } else { - obj.access_levels = []; + obj.access_levels = message.accessLevels; } return obj; }, @@ -1513,8 +1513,8 @@ export const AttributeContext_Request_HeadersEntry = { }, toAmino(message: AttributeContext_Request_HeadersEntry): AttributeContext_Request_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Request_HeadersEntryAminoMsg): AttributeContext_Request_HeadersEntry { @@ -1819,22 +1819,22 @@ export const AttributeContext_Request = { }, toAmino(message: AttributeContext_Request): AttributeContext_RequestAmino { const obj: any = {}; - obj.id = message.id; - obj.method = message.method; + obj.id = message.id === "" ? undefined : message.id; + obj.method = message.method === "" ? undefined : message.method; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { obj.headers[k] = v; }); } - obj.path = message.path; - obj.host = message.host; - obj.scheme = message.scheme; - obj.query = message.query; + obj.path = message.path === "" ? undefined : message.path; + obj.host = message.host === "" ? undefined : message.host; + obj.scheme = message.scheme === "" ? undefined : message.scheme; + obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.size = message.size ? message.size.toString() : undefined; - obj.protocol = message.protocol; - obj.reason = message.reason; + obj.protocol = message.protocol === "" ? undefined : message.protocol; + obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; return obj; }, @@ -1938,8 +1938,8 @@ export const AttributeContext_Response_HeadersEntry = { }, toAmino(message: AttributeContext_Response_HeadersEntry): AttributeContext_Response_HeadersEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Response_HeadersEntryAminoMsg): AttributeContext_Response_HeadersEntry { @@ -2246,8 +2246,8 @@ export const AttributeContext_Resource_LabelsEntry = { }, toAmino(message: AttributeContext_Resource_LabelsEntry): AttributeContext_Resource_LabelsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_LabelsEntryAminoMsg): AttributeContext_Resource_LabelsEntry { @@ -2344,8 +2344,8 @@ export const AttributeContext_Resource_AnnotationsEntry = { }, toAmino(message: AttributeContext_Resource_AnnotationsEntry): AttributeContext_Resource_AnnotationsEntryAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: AttributeContext_Resource_AnnotationsEntryAminoMsg): AttributeContext_Resource_AnnotationsEntry { @@ -2689,28 +2689,28 @@ export const AttributeContext_Resource = { }, toAmino(message: AttributeContext_Resource): AttributeContext_ResourceAmino { const obj: any = {}; - obj.service = message.service; - obj.name = message.name; - obj.type = message.type; + obj.service = message.service === "" ? undefined : message.service; + obj.name = message.name === "" ? undefined : message.name; + obj.type = message.type === "" ? undefined : message.type; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { obj.labels[k] = v; }); } - obj.uid = message.uid; + obj.uid = message.uid === "" ? undefined : message.uid; obj.annotations = {}; if (message.annotations) { Object.entries(message.annotations).forEach(([k, v]) => { obj.annotations[k] = v; }); } - obj.display_name = message.displayName; + obj.display_name = message.displayName === "" ? undefined : message.displayName; obj.create_time = message.createTime ? Timestamp.toAmino(toTimestamp(message.createTime)) : undefined; obj.update_time = message.updateTime ? Timestamp.toAmino(toTimestamp(message.updateTime)) : undefined; obj.delete_time = message.deleteTime ? Timestamp.toAmino(toTimestamp(message.deleteTime)) : undefined; - obj.etag = message.etag; - obj.location = message.location; + obj.etag = message.etag === "" ? undefined : message.etag; + obj.location = message.location === "" ? undefined : message.location; return obj; }, fromAminoMsg(object: AttributeContext_ResourceAminoMsg): AttributeContext_Resource { diff --git a/__fixtures__/v-next/outputv4/google/rpc/error_details.ts b/__fixtures__/v-next/outputv4/google/rpc/error_details.ts index 1e18cab750..e0f767f60a 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/error_details.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/error_details.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, isObject } from "../../helpers"; +import { isSet, DeepPartial, isObject } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * Describes when the clients can retry a failed request. Clients could ignore @@ -649,9 +649,9 @@ export const DebugInfo = { if (message.stackEntries) { obj.stack_entries = message.stackEntries.map(e => e); } else { - obj.stack_entries = []; + obj.stack_entries = message.stackEntries; } - obj.detail = omitDefault(message.detail); + obj.detail = message.detail === "" ? undefined : message.detail; return obj; }, fromAminoMsg(object: DebugInfoAminoMsg): DebugInfo { @@ -748,7 +748,7 @@ export const QuotaFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? QuotaFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -853,8 +853,8 @@ export const QuotaFailure_Violation = { }, toAmino(message: QuotaFailure_Violation): QuotaFailure_ViolationAmino { const obj: any = {}; - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: QuotaFailure_ViolationAminoMsg): QuotaFailure_Violation { @@ -957,8 +957,8 @@ export const ErrorInfo_MetadataEntry = { }, toAmino(message: ErrorInfo_MetadataEntry): ErrorInfo_MetadataEntryAmino { const obj: any = {}; - obj.key = omitDefault(message.key); - obj.value = omitDefault(message.value); + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: ErrorInfo_MetadataEntryAminoMsg): ErrorInfo_MetadataEntry { @@ -1115,8 +1115,8 @@ export const ErrorInfo = { }, toAmino(message: ErrorInfo): ErrorInfoAmino { const obj: any = {}; - obj.reason = omitDefault(message.reason); - obj.domain = omitDefault(message.domain); + obj.reason = message.reason === "" ? undefined : message.reason; + obj.domain = message.domain === "" ? undefined : message.domain; obj.metadata = {}; if (message.metadata) { Object.entries(message.metadata).forEach(([k, v]) => { @@ -1219,7 +1219,7 @@ export const PreconditionFailure = { if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -1340,9 +1340,9 @@ export const PreconditionFailure_Violation = { }, toAmino(message: PreconditionFailure_Violation): PreconditionFailure_ViolationAmino { const obj: any = {}; - obj.type = omitDefault(message.type); - obj.subject = omitDefault(message.subject); - obj.description = omitDefault(message.description); + obj.type = message.type === "" ? undefined : message.type; + obj.subject = message.subject === "" ? undefined : message.subject; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: PreconditionFailure_ViolationAminoMsg): PreconditionFailure_Violation { @@ -1439,7 +1439,7 @@ export const BadRequest = { if (message.fieldViolations) { obj.field_violations = message.fieldViolations.map(e => e ? BadRequest_FieldViolation.toAmino(e) : undefined); } else { - obj.field_violations = []; + obj.field_violations = message.fieldViolations; } return obj; }, @@ -1544,8 +1544,8 @@ export const BadRequest_FieldViolation = { }, toAmino(message: BadRequest_FieldViolation): BadRequest_FieldViolationAmino { const obj: any = {}; - obj.field = omitDefault(message.field); - obj.description = omitDefault(message.description); + obj.field = message.field === "" ? undefined : message.field; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: BadRequest_FieldViolationAminoMsg): BadRequest_FieldViolation { @@ -1649,8 +1649,8 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.request_id = omitDefault(message.requestId); - obj.serving_data = omitDefault(message.servingData); + obj.request_id = message.requestId === "" ? undefined : message.requestId; + obj.serving_data = message.servingData === "" ? undefined : message.servingData; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1786,10 +1786,10 @@ export const ResourceInfo = { }, toAmino(message: ResourceInfo): ResourceInfoAmino { const obj: any = {}; - obj.resource_type = omitDefault(message.resourceType); - obj.resource_name = omitDefault(message.resourceName); - obj.owner = omitDefault(message.owner); - obj.description = omitDefault(message.description); + obj.resource_type = message.resourceType === "" ? undefined : message.resourceType; + obj.resource_name = message.resourceName === "" ? undefined : message.resourceName; + obj.owner = message.owner === "" ? undefined : message.owner; + obj.description = message.description === "" ? undefined : message.description; return obj; }, fromAminoMsg(object: ResourceInfoAminoMsg): ResourceInfo { @@ -1886,7 +1886,7 @@ export const Help = { if (message.links) { obj.links = message.links.map(e => e ? Help_Link.toAmino(e) : undefined); } else { - obj.links = []; + obj.links = message.links; } return obj; }, @@ -1991,8 +1991,8 @@ export const Help_Link = { }, toAmino(message: Help_Link): Help_LinkAmino { const obj: any = {}; - obj.description = omitDefault(message.description); - obj.url = omitDefault(message.url); + obj.description = message.description === "" ? undefined : message.description; + obj.url = message.url === "" ? undefined : message.url; return obj; }, fromAminoMsg(object: Help_LinkAminoMsg): Help_Link { @@ -2096,8 +2096,8 @@ export const LocalizedMessage = { }, toAmino(message: LocalizedMessage): LocalizedMessageAmino { const obj: any = {}; - obj.locale = omitDefault(message.locale); - obj.message = omitDefault(message.message); + obj.locale = message.locale === "" ? undefined : message.locale; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: LocalizedMessageAminoMsg): LocalizedMessage { diff --git a/__fixtures__/v-next/outputv4/google/rpc/status.ts b/__fixtures__/v-next/outputv4/google/rpc/status.ts index f3ff14458a..bab5c2f9c8 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/status.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/status.ts @@ -1,6 +1,6 @@ import { Any, AnySDKType } from "../protobuf/any"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "google.rpc"; /** * The `Status` type defines a logical error model that is suitable for @@ -151,12 +151,12 @@ export const Status = { }, toAmino(message: Status): StatusAmino { const obj: any = {}; - obj.code = omitDefault(message.code); - obj.message = omitDefault(message.message); + obj.code = message.code === 0 ? undefined : message.code; + obj.message = message.message === "" ? undefined : message.message; if (message.details) { obj.details = message.details.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.details = []; + obj.details = message.details; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts index 0cfd39016c..5b0b9efa32 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/genesis.ts @@ -1,6 +1,6 @@ import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** GenesisState defines the ibc-transfer genesis state */ export interface GenesisState { @@ -127,11 +127,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); + obj.port_id = message.portId === "" ? undefined : message.portId; if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts index fa0e716d44..96cd23516d 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/query.ts @@ -1,7 +1,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } from "../../../../cosmos/base/query/v1beta1/pagination"; import { DenomTrace, DenomTraceSDKType, Params, ParamsSDKType } from "./transfer"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * QueryDenomTraceRequest is the request type for the Query/DenomTrace RPC @@ -172,7 +172,7 @@ export const QueryDenomTraceRequest = { }, toAmino(message: QueryDenomTraceRequest): QueryDenomTraceRequestAmino { const obj: any = {}; - obj.hash = omitDefault(message.hash); + obj.hash = message.hash === "" ? undefined : message.hash; return obj; }, fromAminoMsg(object: QueryDenomTraceRequestAminoMsg): QueryDenomTraceRequest { @@ -485,7 +485,7 @@ export const QueryDenomTracesResponse = { if (message.denomTraces) { obj.denom_traces = message.denomTraces.map(e => e ? DenomTrace.toAmino(e) : undefined); } else { - obj.denom_traces = []; + obj.denom_traces = message.denomTraces; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts index cb6174d421..8a098f7429 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/transfer.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * DenomTrace contains the base denomination for ICS20 fungible tokens and the @@ -143,8 +143,8 @@ export const DenomTrace = { }, toAmino(message: DenomTrace): DenomTraceAmino { const obj: any = {}; - obj.path = omitDefault(message.path); - obj.base_denom = omitDefault(message.baseDenom); + obj.path = message.path === "" ? undefined : message.path; + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: DenomTraceAminoMsg): DenomTrace { @@ -254,8 +254,8 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.send_enabled = omitDefault(message.sendEnabled); - obj.receive_enabled = omitDefault(message.receiveEnabled); + obj.send_enabled = message.sendEnabled === false ? undefined : message.sendEnabled; + obj.receive_enabled = message.receiveEnabled === false ? undefined : message.receiveEnabled; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index 3f350560f0..9a150e19d7 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: { + token: token == null ? token : { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: BigInt(timeout_height.revision_height || "0"), revisionNumber: BigInt(timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(timeout_timestamp) + timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : BigInt(timeout_timestamp) }; } } diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts index 18458894f2..a833616377 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v1"; /** * MsgTransfer defines a msg to transfer fungible tokens (i.e Coins) between @@ -227,13 +227,13 @@ export const MsgTransfer = { }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = omitDefault(message.sourcePort); - obj.source_channel = omitDefault(message.sourceChannel); + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); + obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts index 8b69c56594..2a1111cf41 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v2/packet.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.applications.transfer.v2"; /** * FungibleTokenPacketData defines a struct for the packet payload @@ -148,10 +148,10 @@ export const FungibleTokenPacketData = { }, toAmino(message: FungibleTokenPacketData): FungibleTokenPacketDataAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.amount = omitDefault(message.amount); - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.amount = message.amount === "" ? undefined : message.amount; + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; return obj; }, fromAminoMsg(object: FungibleTokenPacketDataAminoMsg): FungibleTokenPacketData { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts index 8aea9c46ed..8a19cbb071 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts @@ -427,10 +427,10 @@ export const Channel = { fromAmino(object: ChannelAmino): Channel { const message = createBaseChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -443,15 +443,15 @@ export const Channel = { }, toAmino(message: Channel): ChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: ChannelAminoMsg): Channel { @@ -627,10 +627,10 @@ export const IdentifiedChannel = { fromAmino(object: IdentifiedChannelAmino): IdentifiedChannel { const message = createBaseIdentifiedChannel(); if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -649,17 +649,17 @@ export const IdentifiedChannel = { }, toAmino(message: IdentifiedChannel): IdentifiedChannelAmino { const obj: any = {}; - obj.state = stateToJSON(message.state); - obj.ordering = orderToJSON(message.ordering); + obj.state = message.state === 0 ? undefined : message.state; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; if (message.connectionHops) { obj.connection_hops = message.connectionHops.map(e => e); } else { - obj.connection_hops = []; + obj.connection_hops = message.connectionHops; } - obj.version = message.version; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.version = message.version === "" ? undefined : message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: IdentifiedChannelAminoMsg): IdentifiedChannel { @@ -769,8 +769,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: CounterpartyAminoMsg): Counterparty { @@ -983,10 +983,10 @@ export const Packet = { toAmino(message: Packet): PacketAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.source_port = message.sourcePort; - obj.source_channel = message.sourceChannel; - obj.destination_port = message.destinationPort; - obj.destination_channel = message.destinationChannel; + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; + obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; + obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; @@ -1133,8 +1133,8 @@ export const PacketState = { }, toAmino(message: PacketState): PacketStateAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -1247,7 +1247,7 @@ export const Acknowledgement = { toAmino(message: Acknowledgement): AcknowledgementAmino { const obj: any = {}; obj.result = message.result ? base64FromBytes(message.result) : undefined; - obj.error = message.error; + obj.error = message.error === null ? undefined : message.error; return obj; }, fromAminoMsg(object: AcknowledgementAminoMsg): Acknowledgement { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts index 779d4a8d28..229991d01f 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedChannel, IdentifiedChannelSDKType, PacketState, PacketStateSDKType } from "./channel"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.channel.v1"; /** GenesisState defines the ibc channel submodule's genesis state. */ export interface GenesisState { @@ -279,39 +279,39 @@ export const GenesisState = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } if (message.receipts) { obj.receipts = message.receipts.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.receipts = []; + obj.receipts = message.receipts; } if (message.sendSequences) { obj.send_sequences = message.sendSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.send_sequences = []; + obj.send_sequences = message.sendSequences; } if (message.recvSequences) { obj.recv_sequences = message.recvSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.recv_sequences = []; + obj.recv_sequences = message.recvSequences; } if (message.ackSequences) { obj.ack_sequences = message.ackSequences.map(e => e ? PacketSequence.toAmino(e) : undefined); } else { - obj.ack_sequences = []; + obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = omitDefault(message.nextChannelSequence); + obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -439,9 +439,9 @@ export const PacketSequence = { }, toAmino(message: PacketSequence): PacketSequenceAmino { const obj: any = {}; - obj.port_id = omitDefault(message.portId); - obj.channel_id = omitDefault(message.channelId); - obj.sequence = omitDefault(message.sequence); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts index b4a5916f73..7326d28aaa 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts @@ -713,8 +713,8 @@ export const QueryChannelRequest = { }, toAmino(message: QueryChannelRequest): QueryChannelRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelRequestAminoMsg): QueryChannelRequest { @@ -1081,7 +1081,7 @@ export const QueryChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1196,7 +1196,7 @@ export const QueryConnectionChannelsRequest = { }, toAmino(message: QueryConnectionChannelsRequest): QueryConnectionChannelsRequestAmino { const obj: any = {}; - obj.connection = message.connection; + obj.connection = message.connection === "" ? undefined : message.connection; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1336,7 +1336,7 @@ export const QueryConnectionChannelsResponse = { if (message.channels) { obj.channels = message.channels.map(e => e ? IdentifiedChannel.toAmino(e) : undefined); } else { - obj.channels = []; + obj.channels = message.channels; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -1449,8 +1449,8 @@ export const QueryChannelClientStateRequest = { }, toAmino(message: QueryChannelClientStateRequest): QueryChannelClientStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryChannelClientStateRequestAminoMsg): QueryChannelClientStateRequest { @@ -1728,8 +1728,8 @@ export const QueryChannelConsensusStateRequest = { }, toAmino(message: QueryChannelConsensusStateRequest): QueryChannelConsensusStateRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1878,7 +1878,7 @@ export const QueryChannelConsensusStateResponse = { toAmino(message: QueryChannelConsensusStateResponse): QueryChannelConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2008,8 +2008,8 @@ export const QueryPacketCommitmentRequest = { }, toAmino(message: QueryPacketCommitmentRequest): QueryPacketCommitmentRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2268,8 +2268,8 @@ export const QueryPacketCommitmentsRequest = { }, toAmino(message: QueryPacketCommitmentsRequest): QueryPacketCommitmentsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2409,7 +2409,7 @@ export const QueryPacketCommitmentsResponse = { if (message.commitments) { obj.commitments = message.commitments.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.commitments = []; + obj.commitments = message.commitments; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -2540,8 +2540,8 @@ export const QueryPacketReceiptRequest = { }, toAmino(message: QueryPacketReceiptRequest): QueryPacketReceiptRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -2670,7 +2670,7 @@ export const QueryPacketReceiptResponse = { }, toAmino(message: QueryPacketReceiptResponse): QueryPacketReceiptResponseAmino { const obj: any = {}; - obj.received = message.received; + obj.received = message.received === false ? undefined : message.received; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; @@ -2800,8 +2800,8 @@ export const QueryPacketAcknowledgementRequest = { }, toAmino(message: QueryPacketAcknowledgementRequest): QueryPacketAcknowledgementRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; return obj; }, @@ -3091,13 +3091,13 @@ export const QueryPacketAcknowledgementsRequest = { }, toAmino(message: QueryPacketAcknowledgementsRequest): QueryPacketAcknowledgementsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3237,7 +3237,7 @@ export const QueryPacketAcknowledgementsResponse = { if (message.acknowledgements) { obj.acknowledgements = message.acknowledgements.map(e => e ? PacketState.toAmino(e) : undefined); } else { - obj.acknowledgements = []; + obj.acknowledgements = message.acknowledgements; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -3381,12 +3381,12 @@ export const QueryUnreceivedPacketsRequest = { }, toAmino(message: QueryUnreceivedPacketsRequest): QueryUnreceivedPacketsRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetCommitmentSequences) { obj.packet_commitment_sequences = message.packetCommitmentSequences.map(e => e.toString()); } else { - obj.packet_commitment_sequences = []; + obj.packet_commitment_sequences = message.packetCommitmentSequences; } return obj; }, @@ -3517,7 +3517,7 @@ export const QueryUnreceivedPacketsResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3660,12 +3660,12 @@ export const QueryUnreceivedAcksRequest = { }, toAmino(message: QueryUnreceivedAcksRequest): QueryUnreceivedAcksRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; if (message.packetAckSequences) { obj.packet_ack_sequences = message.packetAckSequences.map(e => e.toString()); } else { - obj.packet_ack_sequences = []; + obj.packet_ack_sequences = message.packetAckSequences; } return obj; }, @@ -3796,7 +3796,7 @@ export const QueryUnreceivedAcksResponse = { if (message.sequences) { obj.sequences = message.sequences.map(e => e.toString()); } else { - obj.sequences = []; + obj.sequences = message.sequences; } obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; @@ -3908,8 +3908,8 @@ export const QueryNextSequenceReceiveRequest = { }, toAmino(message: QueryNextSequenceReceiveRequest): QueryNextSequenceReceiveRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; return obj; }, fromAminoMsg(object: QueryNextSequenceReceiveRequestAminoMsg): QueryNextSequenceReceiveRequest { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index 70454ca48a..2ff50c2822 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: { - state: stateFromJSON(channel.state), - ordering: orderFromJSON(channel.ordering), - counterparty: { + channel: channel == null ? channel : { + state: channel.state == null ? channel.state : stateFromJSON(channel.state), + ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), + counterparty: channel.counterparty == null ? channel.counterparty : { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: BigInt(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), signer }; } @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: BigInt(next_sequence_recv), + nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), signer }; } @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: { - sequence: BigInt(packet.sequence), + packet: packet == null ? packet : { + sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: BigInt(packet.timeout_timestamp) + timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts index 1ccc6579e9..78b3c99694 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts @@ -438,9 +438,9 @@ export const MsgChannelOpenInit = { }, toAmino(message: MsgChannelOpenInit): MsgChannelOpenInitAmino { const obj: any = {}; - obj.port_id = message.portId; + obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenInitAminoMsg): MsgChannelOpenInit { @@ -708,13 +708,13 @@ export const MsgChannelOpenTry = { }, toAmino(message: MsgChannelOpenTry): MsgChannelOpenTryAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.previous_channel_id = message.previousChannelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.previous_channel_id = message.previousChannelId === "" ? undefined : message.previousChannelId; obj.channel = message.channel ? Channel.toAmino(message.channel) : undefined; - obj.counterparty_version = message.counterpartyVersion; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenTryAminoMsg): MsgChannelOpenTry { @@ -980,13 +980,13 @@ export const MsgChannelOpenAck = { }, toAmino(message: MsgChannelOpenAck): MsgChannelOpenAckAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.counterparty_channel_id = message.counterpartyChannelId; - obj.counterparty_version = message.counterpartyVersion; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.counterparty_channel_id = message.counterpartyChannelId === "" ? undefined : message.counterpartyChannelId; + obj.counterparty_version = message.counterpartyVersion === "" ? undefined : message.counterpartyVersion; obj.proof_try = message.proofTry ? base64FromBytes(message.proofTry) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenAckAminoMsg): MsgChannelOpenAck { @@ -1220,11 +1220,11 @@ export const MsgChannelOpenConfirm = { }, toAmino(message: MsgChannelOpenConfirm): MsgChannelOpenConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelOpenConfirmAminoMsg): MsgChannelOpenConfirm { @@ -1424,9 +1424,9 @@ export const MsgChannelCloseInit = { }, toAmino(message: MsgChannelCloseInit): MsgChannelCloseInitAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; - obj.signer = message.signer; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseInitAminoMsg): MsgChannelCloseInit { @@ -1660,11 +1660,11 @@ export const MsgChannelCloseConfirm = { }, toAmino(message: MsgChannelCloseConfirm): MsgChannelCloseConfirmAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.channel_id = message.channelId; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.channel_id = message.channelId === "" ? undefined : message.channelId; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgChannelCloseConfirmAminoMsg): MsgChannelCloseConfirm { @@ -1887,7 +1887,7 @@ export const MsgRecvPacket = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_commitment = message.proofCommitment ? base64FromBytes(message.proofCommitment) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgRecvPacketAminoMsg): MsgRecvPacket { @@ -2129,7 +2129,7 @@ export const MsgTimeout = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutAminoMsg): MsgTimeout { @@ -2388,7 +2388,7 @@ export const MsgTimeoutOnClose = { obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgTimeoutOnCloseAminoMsg): MsgTimeoutOnClose { @@ -2628,7 +2628,7 @@ export const MsgAcknowledgement = { obj.acknowledgement = message.acknowledgement ? base64FromBytes(message.acknowledgement) : undefined; obj.proof_acked = message.proofAcked ? base64FromBytes(message.proofAcked) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgAcknowledgementAminoMsg): MsgAcknowledgement { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts index 2d56a7fb95..ab02de0478 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts @@ -1,7 +1,7 @@ import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Plan, PlanSDKType } from "../../../../cosmos/upgrade/v1beta1/upgrade"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * IdentifiedClientState defines a client state with an additional client @@ -274,7 +274,7 @@ export const IdentifiedClientState = { }, toAmino(message: IdentifiedClientState): IdentifiedClientStateAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; return obj; }, @@ -506,11 +506,11 @@ export const ClientConsensusStates = { }, toAmino(message: ClientConsensusStates): ClientConsensusStatesAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } return obj; }, @@ -653,10 +653,10 @@ export const ClientUpdateProposal = { }, toAmino(message: ClientUpdateProposal): ClientUpdateProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); - obj.subject_client_id = omitDefault(message.subjectClientId); - obj.substitute_client_id = omitDefault(message.substituteClientId); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; + obj.subject_client_id = message.subjectClientId === "" ? undefined : message.subjectClientId; + obj.substitute_client_id = message.substituteClientId === "" ? undefined : message.substituteClientId; return obj; }, fromAminoMsg(object: ClientUpdateProposalAminoMsg): ClientUpdateProposal { @@ -802,8 +802,8 @@ export const UpgradeProposal = { }, toAmino(message: UpgradeProposal): UpgradeProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.plan = message.plan ? Plan.toAmino(message.plan) : undefined; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -915,8 +915,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { @@ -1019,7 +1019,7 @@ export const Params = { if (message.allowedClients) { obj.allowed_clients = message.allowedClients.map(e => e); } else { - obj.allowed_clients = []; + obj.allowed_clients = message.allowedClients; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts index 69bfca0435..52eff4f978 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedClientState, IdentifiedClientStateSDKType, ClientConsensusStates, ClientConsensusStatesSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** GenesisState defines the ibc client submodule's genesis state. */ export interface GenesisState { @@ -245,21 +245,21 @@ export const GenesisState = { if (message.clients) { obj.clients = message.clients.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.clients = []; + obj.clients = message.clients; } if (message.clientsConsensus) { obj.clients_consensus = message.clientsConsensus.map(e => e ? ClientConsensusStates.toAmino(e) : undefined); } else { - obj.clients_consensus = []; + obj.clients_consensus = message.clientsConsensus; } if (message.clientsMetadata) { obj.clients_metadata = message.clientsMetadata.map(e => e ? IdentifiedGenesisMetadata.toAmino(e) : undefined); } else { - obj.clients_metadata = []; + obj.clients_metadata = message.clientsMetadata; } obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.create_localhost = omitDefault(message.createLocalhost); - obj.next_client_sequence = omitDefault(message.nextClientSequence); + obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; + obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -486,11 +486,11 @@ export const IdentifiedGenesisMetadata = { }, toAmino(message: IdentifiedGenesisMetadata): IdentifiedGenesisMetadataAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.clientMetadata) { obj.client_metadata = message.clientMetadata.map(e => e ? GenesisMetadata.toAmino(e) : undefined); } else { - obj.client_metadata = []; + obj.client_metadata = message.clientMetadata; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts index d7e37057a9..753af92de0 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts @@ -2,7 +2,7 @@ import { PageRequest, PageRequestSDKType, PageResponse, PageResponseSDKType } fr import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType, IdentifiedClientState, IdentifiedClientStateSDKType, ConsensusStateWithHeight, ConsensusStateWithHeightSDKType, Params, ParamsSDKType } from "./client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../../helpers"; export const protobufPackage = "ibc.core.client.v1"; /** * QueryClientStateRequest is the request type for the Query/ClientState RPC @@ -398,7 +398,7 @@ export const QueryClientStateRequest = { }, toAmino(message: QueryClientStateRequest): QueryClientStateRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStateRequestAminoMsg): QueryClientStateRequest { @@ -747,7 +747,7 @@ export const QueryClientStatesResponse = { if (message.clientStates) { obj.client_states = message.clientStates.map(e => e ? IdentifiedClientState.toAmino(e) : undefined); } else { - obj.client_states = []; + obj.client_states = message.clientStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -895,10 +895,10 @@ export const QueryConsensusStateRequest = { }, toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); - obj.latest_height = omitDefault(message.latestHeight); + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, fromAminoMsg(object: QueryConsensusStateRequestAminoMsg): QueryConsensusStateRequest { @@ -1142,7 +1142,7 @@ export const QueryConsensusStatesRequest = { }, toAmino(message: QueryConsensusStatesRequest): QueryConsensusStatesRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1264,7 +1264,7 @@ export const QueryConsensusStatesResponse = { if (message.consensusStates) { obj.consensus_states = message.consensusStates.map(e => e ? ConsensusStateWithHeight.toAmino(e) : undefined); } else { - obj.consensus_states = []; + obj.consensus_states = message.consensusStates; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1360,7 +1360,7 @@ export const QueryClientStatusRequest = { }, toAmino(message: QueryClientStatusRequest): QueryClientStatusRequestAmino { const obj: any = {}; - obj.client_id = omitDefault(message.clientId); + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientStatusRequestAminoMsg): QueryClientStatusRequest { @@ -1454,7 +1454,7 @@ export const QueryClientStatusResponse = { }, toAmino(message: QueryClientStatusResponse): QueryClientStatusResponseAmino { const obj: any = {}; - obj.status = omitDefault(message.status); + obj.status = message.status === "" ? undefined : message.status; return obj; }, fromAminoMsg(object: QueryClientStatusResponseAminoMsg): QueryClientStatusResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts index da58249ba9..4d5ea3aac3 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts @@ -81,11 +81,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -116,7 +116,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: { + header: header == null ? header : { typeUrl: header.type_url, value: header.value }, @@ -159,11 +159,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: { + consensusState: consensus_state == null ? consensus_state : { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -196,7 +196,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: { + misbehaviour: misbehaviour == null ? misbehaviour : { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts index 5dbf86d41e..37a65a4678 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.ts @@ -256,7 +256,7 @@ export const MsgCreateClient = { const obj: any = {}; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgCreateClientAminoMsg): MsgCreateClient { @@ -458,9 +458,9 @@ export const MsgUpdateClient = { }, toAmino(message: MsgUpdateClient): MsgUpdateClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header = message.header ? Any.toAmino(message.header) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpdateClientAminoMsg): MsgUpdateClient { @@ -712,12 +712,12 @@ export const MsgUpgradeClient = { }, toAmino(message: MsgUpgradeClient): MsgUpgradeClientAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; obj.proof_upgrade_client = message.proofUpgradeClient ? base64FromBytes(message.proofUpgradeClient) : undefined; obj.proof_upgrade_consensus_state = message.proofUpgradeConsensusState ? base64FromBytes(message.proofUpgradeConsensusState) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgUpgradeClientAminoMsg): MsgUpgradeClient { @@ -919,9 +919,9 @@ export const MsgSubmitMisbehaviour = { }, toAmino(message: MsgSubmitMisbehaviour): MsgSubmitMisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.misbehaviour = message.misbehaviour ? Any.toAmino(message.misbehaviour) : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgSubmitMisbehaviourAminoMsg): MsgSubmitMisbehaviour { diff --git a/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts b/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts index 8f41402d5f..6cb04bf163 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/commitment/v1/commitment.ts @@ -350,7 +350,7 @@ export const MerklePath = { if (message.keyPath) { obj.key_path = message.keyPath.map(e => e); } else { - obj.key_path = []; + obj.key_path = message.keyPath; } return obj; }, @@ -454,7 +454,7 @@ export const MerkleProof = { if (message.proofs) { obj.proofs = message.proofs.map(e => e ? CommitmentProof.toAmino(e) : undefined); } else { - obj.proofs = []; + obj.proofs = message.proofs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts index 0337c623e7..965fa427e4 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts @@ -359,7 +359,7 @@ export const ConnectionEnd = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -371,13 +371,13 @@ export const ConnectionEnd = { }, toAmino(message: ConnectionEnd): ConnectionEndAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -551,7 +551,7 @@ export const IdentifiedConnection = { } message.versions = object.versions?.map(e => Version.fromAmino(e)) || []; if (object.state !== undefined && object.state !== null) { - message.state = stateFromJSON(object.state); + message.state = object.state; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -563,14 +563,14 @@ export const IdentifiedConnection = { }, toAmino(message: IdentifiedConnection): IdentifiedConnectionAmino { const obj: any = {}; - obj.id = message.id; - obj.client_id = message.clientId; + obj.id = message.id === "" ? undefined : message.id; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.versions) { obj.versions = message.versions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.versions = []; + obj.versions = message.versions; } - obj.state = stateToJSON(message.state); + obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; return obj; @@ -700,8 +700,8 @@ export const Counterparty = { }, toAmino(message: Counterparty): CounterpartyAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.connection_id = message.connectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.prefix = message.prefix ? MerklePrefix.toAmino(message.prefix) : undefined; return obj; }, @@ -805,7 +805,7 @@ export const ClientPaths = { if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -922,11 +922,11 @@ export const ConnectionPaths = { }, toAmino(message: ConnectionPaths): ConnectionPathsAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; if (message.paths) { obj.paths = message.paths.map(e => e); } else { - obj.paths = []; + obj.paths = message.paths; } return obj; }, @@ -1043,11 +1043,11 @@ export const Version = { }, toAmino(message: Version): VersionAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; if (message.features) { obj.features = message.features.map(e => e); } else { - obj.features = []; + obj.features = message.features; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts index 94d887d783..8280f6b8e5 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts @@ -1,6 +1,6 @@ import { IdentifiedConnection, IdentifiedConnectionSDKType, ConnectionPaths, ConnectionPathsSDKType, Params, ParamsSDKType } from "./connection"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.core.connection.v1"; /** GenesisState defines the ibc connection submodule's genesis state. */ export interface GenesisState { @@ -157,14 +157,14 @@ export const GenesisState = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } if (message.clientConnectionPaths) { obj.client_connection_paths = message.clientConnectionPaths.map(e => e ? ConnectionPaths.toAmino(e) : undefined); } else { - obj.client_connection_paths = []; + obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = omitDefault(message.nextConnectionSequence); + obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts index 6d3534fc5b..ec6bc9cb01 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts @@ -302,7 +302,7 @@ export const QueryConnectionRequest = { }, toAmino(message: QueryConnectionRequest): QueryConnectionRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionRequestAminoMsg): QueryConnectionRequest { @@ -669,7 +669,7 @@ export const QueryConnectionsResponse = { if (message.connections) { obj.connections = message.connections.map(e => e ? IdentifiedConnection.toAmino(e) : undefined); } else { - obj.connections = []; + obj.connections = message.connections; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; obj.height = message.height ? Height.toAmino(message.height) : {}; @@ -766,7 +766,7 @@ export const QueryClientConnectionsRequest = { }, toAmino(message: QueryClientConnectionsRequest): QueryClientConnectionsRequestAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; return obj; }, fromAminoMsg(object: QueryClientConnectionsRequestAminoMsg): QueryClientConnectionsRequest { @@ -903,7 +903,7 @@ export const QueryClientConnectionsResponse = { if (message.connectionPaths) { obj.connection_paths = message.connectionPaths.map(e => e); } else { - obj.connection_paths = []; + obj.connection_paths = message.connectionPaths; } obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1000,7 +1000,7 @@ export const QueryConnectionClientStateRequest = { }, toAmino(message: QueryConnectionClientStateRequest): QueryConnectionClientStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; return obj; }, fromAminoMsg(object: QueryConnectionClientStateRequestAminoMsg): QueryConnectionClientStateRequest { @@ -1262,7 +1262,7 @@ export const QueryConnectionConsensusStateRequest = { }, toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; @@ -1411,7 +1411,7 @@ export const QueryConnectionConsensusStateResponse = { toAmino(message: QueryConnectionConsensusStateResponse): QueryConnectionConsensusStateResponseAmino { const obj: any = {}; obj.consensus_state = message.consensusState ? Any.toAmino(message.consensusState) : undefined; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 0684a87c34..01fe9e5e6a 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - delayPeriod: BigInt(delay_period), + delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), signer }; } @@ -201,19 +201,19 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: { + counterparty: counterparty == null ? counterparty : { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: { + prefix: counterparty.prefix == null ? counterparty.prefix : { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: BigInt(delay_period), - counterpartyVersions: counterparty_versions.map(el0 => ({ + delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + counterpartyVersions: counterparty_versions.map?.(el0 => ({ identifier: el0.identifier, features: el0.features })), @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: { + version: version == null ? version : { identifier: version.identifier, features: version.features }, - clientState: { + clientState: client_state == null ? client_state : { typeUrl: client_state.type_url, value: client_state.value }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts index 76220be7c7..b327cae029 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts @@ -330,11 +330,11 @@ export const MsgConnectionOpenInit = { }, toAmino(message: MsgConnectionOpenInit): MsgConnectionOpenInitAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenInitAminoMsg): MsgConnectionOpenInit { @@ -694,22 +694,22 @@ export const MsgConnectionOpenTry = { }, toAmino(message: MsgConnectionOpenTry): MsgConnectionOpenTryAmino { const obj: any = {}; - obj.client_id = message.clientId; - obj.previous_connection_id = message.previousConnectionId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; + obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { - obj.counterparty_versions = []; + obj.counterparty_versions = message.counterpartyVersions; } obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; obj.proof_init = message.proofInit ? base64FromBytes(message.proofInit) : undefined; obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenTryAminoMsg): MsgConnectionOpenTry { @@ -1029,8 +1029,8 @@ export const MsgConnectionOpenAck = { }, toAmino(message: MsgConnectionOpenAck): MsgConnectionOpenAckAmino { const obj: any = {}; - obj.connection_id = message.connectionId; - obj.counterparty_connection_id = message.counterpartyConnectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.counterparty_connection_id = message.counterpartyConnectionId === "" ? undefined : message.counterpartyConnectionId; obj.version = message.version ? Version.toAmino(message.version) : undefined; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; @@ -1038,7 +1038,7 @@ export const MsgConnectionOpenAck = { obj.proof_client = message.proofClient ? base64FromBytes(message.proofClient) : undefined; obj.proof_consensus = message.proofConsensus ? base64FromBytes(message.proofConsensus) : undefined; obj.consensus_height = message.consensusHeight ? Height.toAmino(message.consensusHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenAckAminoMsg): MsgConnectionOpenAck { @@ -1256,10 +1256,10 @@ export const MsgConnectionOpenConfirm = { }, toAmino(message: MsgConnectionOpenConfirm): MsgConnectionOpenConfirmAmino { const obj: any = {}; - obj.connection_id = message.connectionId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.proof_ack = message.proofAck ? base64FromBytes(message.proofAck) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.signer = message.signer; + obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, fromAminoMsg(object: MsgConnectionOpenConfirmAminoMsg): MsgConnectionOpenConfirm { diff --git a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts index b1336bf73d..6c07efd0d6 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/port/v1/query.ts @@ -166,7 +166,7 @@ export const QueryAppVersionRequest = { message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -178,11 +178,11 @@ export const QueryAppVersionRequest = { }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -292,8 +292,8 @@ export const QueryAppVersionResponse = { }, toAmino(message: QueryAppVersionResponse): QueryAppVersionResponseAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.version = message.version; + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.version = message.version === "" ? undefined : message.version; return obj; }, fromAminoMsg(object: QueryAppVersionResponseAminoMsg): QueryAppVersionResponse { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts index 208277efa4..2fe9922ee8 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/localhost/v1/localhost.ts @@ -1,6 +1,6 @@ import { Height, HeightSDKType } from "../../../core/client/v1/client"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "ibc.lightclients.localhost.v1"; /** * ClientState defines a loopback (localhost) client. It requires (read-only) @@ -111,7 +111,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = omitDefault(message.chainId); + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? Height.toAmino(message.height) : {}; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts index 977ea64a47..eb3629e7b1 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts @@ -562,7 +562,7 @@ export const ClientState = { obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -693,7 +693,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -862,7 +862,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1010,7 +1010,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1145,7 +1145,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1158,7 +1158,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1426,7 +1426,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1437,8 +1437,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1552,7 +1552,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts index e97e9da8cd..a2b744046e 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts @@ -558,9 +558,9 @@ export const ClientState = { toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.is_frozen = message.isFrozen; + obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; - obj.allow_update_after_proposal = message.allowUpdateAfterProposal; + obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -691,7 +691,7 @@ export const ConsensusState = { toAmino(message: ConsensusState): ConsensusStateAmino { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; - obj.diversifier = message.diversifier; + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; }, @@ -860,7 +860,7 @@ export const Header = { obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderAminoMsg): Header { @@ -1008,7 +1008,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; @@ -1143,7 +1143,7 @@ export const SignatureAndData = { message.signature = bytesFromBase64(object.signature); } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1156,7 +1156,7 @@ export const SignatureAndData = { toAmino(message: SignatureAndData): SignatureAndDataAmino { const obj: any = {}; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; - obj.data_type = dataTypeToJSON(message.dataType); + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; return obj; @@ -1424,7 +1424,7 @@ export const SignBytes = { message.diversifier = object.diversifier; } if (object.data_type !== undefined && object.data_type !== null) { - message.dataType = dataTypeFromJSON(object.data_type); + message.dataType = object.data_type; } if (object.data !== undefined && object.data !== null) { message.data = bytesFromBase64(object.data); @@ -1435,8 +1435,8 @@ export const SignBytes = { const obj: any = {}; obj.sequence = message.sequence ? message.sequence.toString() : undefined; obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; - obj.diversifier = message.diversifier; - obj.data_type = dataTypeToJSON(message.dataType); + obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; + obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, @@ -1550,7 +1550,7 @@ export const HeaderData = { toAmino(message: HeaderData): HeaderDataAmino { const obj: any = {}; obj.new_pub_key = message.newPubKey ? Any.toAmino(message.newPubKey) : undefined; - obj.new_diversifier = message.newDiversifier; + obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; return obj; }, fromAminoMsg(object: HeaderDataAminoMsg): HeaderData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts index c9f9afcefe..2caa3c6e01 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts @@ -432,7 +432,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -442,15 +442,15 @@ export const ClientState = { if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = message.allowUpdateAfterExpiry; - obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour; + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -710,7 +710,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.client_id = message.clientId; + obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.header_1 = message.header1 ? Header.toAmino(message.header1) : undefined; obj.header_2 = message.header2 ? Header.toAmino(message.header2) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts index e588224908..5bc987ed93 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/claim.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.claim.v1beta1"; export enum Action { ActionAddLiquidity = 0, @@ -189,16 +189,16 @@ export const ClaimRecord = { }, toAmino(message: ClaimRecord): ClaimRecordAmino { const obj: any = {}; - obj.address = omitDefault(message.address); + obj.address = message.address === "" ? undefined : message.address; if (message.initialClaimableAmount) { obj.initial_claimable_amount = message.initialClaimableAmount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_claimable_amount = []; + obj.initial_claimable_amount = message.initialClaimableAmount; } if (message.actionCompleted) { obj.action_completed = message.actionCompleted.map(e => e); } else { - obj.action_completed = []; + obj.action_completed = message.actionCompleted; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts index 0046900270..5a1a0a2411 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/genesis.ts @@ -139,7 +139,7 @@ export const GenesisState = { if (message.claimRecords) { obj.claim_records = message.claimRecords.map(e => e ? ClaimRecord.toAmino(e) : undefined); } else { - obj.claim_records = []; + obj.claim_records = message.claimRecords; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts index d3a558fa67..71c8eb7b1d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/params.ts @@ -146,7 +146,7 @@ export const Params = { obj.airdrop_start_time = message.airdropStartTime ? Timestamp.toAmino(toTimestamp(message.airdropStartTime)) : undefined; obj.duration_until_decay = message.durationUntilDecay ? Duration.toAmino(message.durationUntilDecay) : undefined; obj.duration_of_decay = message.durationOfDecay ? Duration.toAmino(message.durationOfDecay) : undefined; - obj.claim_denom = message.claimDenom; + obj.claim_denom = message.claimDenom === "" ? undefined : message.claimDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts index cfece6f557..760b9bf353 100644 --- a/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/claim/v1beta1/query.ts @@ -260,7 +260,7 @@ export const QueryModuleAccountBalanceResponse = { if (message.moduleAccountBalance) { obj.moduleAccountBalance = message.moduleAccountBalance.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.moduleAccountBalance = []; + obj.moduleAccountBalance = message.moduleAccountBalance; } return obj; }, @@ -525,7 +525,7 @@ export const QueryClaimRecordRequest = { }, toAmino(message: QueryClaimRecordRequest): QueryClaimRecordRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryClaimRecordRequestAminoMsg): QueryClaimRecordRequest { @@ -725,14 +725,14 @@ export const QueryClaimableForActionRequest = { message.address = object.address; } if (object.action !== undefined && object.action !== null) { - message.action = actionFromJSON(object.action); + message.action = object.action; } return message; }, toAmino(message: QueryClaimableForActionRequest): QueryClaimableForActionRequestAmino { const obj: any = {}; - obj.address = message.address; - obj.action = actionToJSON(message.action); + obj.address = message.address === "" ? undefined : message.address; + obj.action = message.action === 0 ? undefined : message.action; return obj; }, fromAminoMsg(object: QueryClaimableForActionRequestAminoMsg): QueryClaimableForActionRequest { @@ -835,7 +835,7 @@ export const QueryClaimableForActionResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -930,7 +930,7 @@ export const QueryTotalClaimableRequest = { }, toAmino(message: QueryTotalClaimableRequest): QueryTotalClaimableRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: QueryTotalClaimableRequestAminoMsg): QueryTotalClaimableRequest { @@ -1033,7 +1033,7 @@ export const QueryTotalClaimableResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts index e41039e504..c55d1e3936 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts @@ -261,12 +261,12 @@ export const EpochInfo = { }, toAmino(message: EpochInfo): EpochInfoAmino { const obj: any = {}; - obj.identifier = message.identifier; + obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; - obj.epoch_counting_started = message.epochCountingStarted; + obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; return obj; }, @@ -370,7 +370,7 @@ export const GenesisState = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts index 1f50c1e4b9..efeb5c1186 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts @@ -1,6 +1,6 @@ import { EpochInfo, EpochInfoSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.epochs.v1beta1"; export interface QueryEpochsInfoRequest {} export interface QueryEpochsInfoRequestProtoMsg { @@ -190,7 +190,7 @@ export const QueryEpochsInfoResponse = { if (message.epochs) { obj.epochs = message.epochs.map(e => e ? EpochInfo.toAmino(e) : undefined); } else { - obj.epochs = []; + obj.epochs = message.epochs; } return obj; }, @@ -285,7 +285,7 @@ export const QueryCurrentEpochRequest = { }, toAmino(message: QueryCurrentEpochRequest): QueryCurrentEpochRequestAmino { const obj: any = {}; - obj.identifier = omitDefault(message.identifier); + obj.identifier = message.identifier === "" ? undefined : message.identifier; return obj; }, fromAminoMsg(object: QueryCurrentEpochRequestAminoMsg): QueryCurrentEpochRequest { @@ -381,7 +381,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = omitDefault(message.currentEpoch); + obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts index d5df8c4c97..d7cd0c8597 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -2,7 +2,7 @@ import { Timestamp, TimestampSDKType } from "../../../../google/protobuf/timesta import { Duration, DurationSDKType } from "../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** @@ -296,12 +296,12 @@ export const SmoothWeightChangeParams = { if (message.initialPoolWeights) { obj.initial_pool_weights = message.initialPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.initial_pool_weights = []; + obj.initial_pool_weights = message.initialPoolWeights; } if (message.targetPoolWeights) { obj.target_pool_weights = message.targetPoolWeights.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.target_pool_weights = []; + obj.target_pool_weights = message.targetPoolWeights; } return obj; }, @@ -430,8 +430,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = message.swapFee; - obj.exit_fee = message.exitFee; + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); obj.smooth_weight_change_params = message.smoothWeightChangeParams ? SmoothWeightChangeParams.toAmino(message.smoothWeightChangeParams) : undefined; return obj; }, @@ -545,7 +545,7 @@ export const PoolAsset = { toAmino(message: PoolAsset): PoolAssetAmino { const obj: any = {}; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.weight = message.weight; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: PoolAssetAminoMsg): PoolAsset { @@ -747,17 +747,17 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = message.futurePoolGovernor; + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.total_weight = message.totalWeight; + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e481a8e582..4b691b23cc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -1,6 +1,7 @@ //@ts-nocheck import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType, SmoothWeightChangeParams, SmoothWeightChangeParamsSDKType } from "../balancerPool"; import { AminoMsg } from "@cosmjs/amino"; +import { omitDefault, padDecimal } from "../../../../../helpers"; import { Duration, DurationSDKType } from "../../../../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../../../../cosmos/base/v1beta1/coin"; import { MsgCreateBalancerPool, MsgCreateBalancerPoolSDKType } from "./tx"; @@ -53,10 +54,10 @@ export const AminoConverter = { futurePoolGovernor }: MsgCreateBalancerPool): MsgCreateBalancerPoolAminoType["value"] => { return { - sender, + sender: omitDefault(sender), pool_params: { - swap_fee: poolParams.swapFee, - exit_fee: poolParams.exitFee, + swap_fee: padDecimal(poolParams.swapFee), + exit_fee: padDecimal(poolParams.exitFee), smooth_weight_change_params: { start_time: poolParams.smoothWeightChangeParams.startTime, duration: (poolParams.smoothWeightChangeParams.duration * 1_000_000_000).toString(), @@ -65,14 +66,14 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), target_pool_weights: poolParams.smoothWeightChangeParams.targetPoolWeights.map(el0 => ({ token: { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })) } }, @@ -81,9 +82,9 @@ export const AminoConverter = { denom: el0.token.denom, amount: el0.token.amount }, - weight: el0.weight + weight: omitDefault(el0.weight) })), - future_pool_governor: futurePoolGovernor + future_pool_governor: omitDefault(futurePoolGovernor) }; }, fromAmino: ({ @@ -94,24 +95,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: { + smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { startTime: pool_params.smooth_weight_change_params.start_time, - duration: { + duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: { + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: { + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, @@ -119,8 +120,8 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map(el0 => ({ - token: { + poolAssets: pool_assets.map?.(el0 => ({ + token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts index 59ecfe2f1d..84eb8cdd7f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -1,6 +1,6 @@ import { PoolParams, PoolParamsSDKType, PoolAsset, PoolAssetSDKType } from "../balancerPool"; import { BinaryReader, BinaryWriter } from "../../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../../helpers"; +import { isSet, DeepPartial } from "../../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.balancer.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateBalancerPool { @@ -157,14 +157,14 @@ export const MsgCreateBalancerPool = { }, toAmino(message: MsgCreateBalancerPool): MsgCreateBalancerPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.poolAssets) { obj.pool_assets = message.poolAssets.map(e => e ? PoolAsset.toAmino(e) : undefined); } else { - obj.pool_assets = []; + obj.pool_assets = message.poolAssets; } - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolAminoMsg): MsgCreateBalancerPool { @@ -260,7 +260,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 92c6ee8607..0402a1d98d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** * PoolParams defined the parameters that will be managed by the pool @@ -152,8 +152,8 @@ export const PoolParams = { }, toAmino(message: PoolParams): PoolParamsAmino { const obj: any = {}; - obj.swap_fee = padDecimal(message.swapFee); - obj.exit_fee = padDecimal(message.exitFee); + obj.swap_fee = padDecimal(message.swapFee) === "" ? undefined : padDecimal(message.swapFee); + obj.exit_fee = padDecimal(message.exitFee) === "" ? undefined : padDecimal(message.exitFee); return obj; }, fromAminoMsg(object: PoolParamsAminoMsg): PoolParams { @@ -386,22 +386,22 @@ export const Pool = { }, toAmino(message: Pool): PoolAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.id = omitDefault(message.id); + obj.address = message.address === "" ? undefined : message.address; + obj.id = message.id ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; if (message.poolLiquidity) { obj.pool_liquidity = message.poolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_liquidity = []; + obj.pool_liquidity = message.poolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.scaling_factor_controller = omitDefault(message.scalingFactorController); + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: PoolAminoMsg): Pool { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 65a3763636..69b805b629 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -65,15 +65,15 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: { + poolParams: pool_params == null ? pool_params : { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map(el0 => BigInt(el0)), + scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -99,8 +99,8 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: BigInt(pool_id), - scalingFactors: scaling_factors.map(el0 => BigInt(el0)) + poolId: pool_id == null ? pool_id : BigInt(pool_id), + scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)) }; } } diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts index 5a7a6e4082..0fe4465e12 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts @@ -1,7 +1,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../../helpers"; +import { isSet, DeepPartial } from "../../../../helpers"; export const protobufPackage = "osmosis.gamm.poolmodels.stableswap.v1beta1"; /** ===================== MsgCreatePool */ export interface MsgCreateStableswapPool { @@ -237,20 +237,20 @@ export const MsgCreateStableswapPool = { }, toAmino(message: MsgCreateStableswapPool): MsgCreateStableswapPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; if (message.initialPoolLiquidity) { obj.initial_pool_liquidity = message.initialPoolLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_pool_liquidity = []; + obj.initial_pool_liquidity = message.initialPoolLiquidity; } if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } - obj.future_pool_governor = omitDefault(message.futurePoolGovernor); - obj.scaling_factor_controller = omitDefault(message.scalingFactorController); + obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; + obj.scaling_factor_controller = message.scalingFactorController === "" ? undefined : message.scalingFactorController; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolAminoMsg): MsgCreateStableswapPool { @@ -346,7 +346,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -489,12 +489,12 @@ export const MsgStableSwapAdjustScalingFactors = { }, toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { - obj.scaling_factors = []; + obj.scaling_factors = message.scalingFactors; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts index 668c6221ff..a167293adc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** Params holds parameters for the incentives module */ export interface Params { @@ -110,7 +110,7 @@ export const Params = { if (message.poolCreationFee) { obj.pool_creation_fee = message.poolCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.pool_creation_fee = []; + obj.pool_creation_fee = message.poolCreationFee; } return obj; }, @@ -250,9 +250,9 @@ export const GenesisState = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } - obj.next_pool_number = omitDefault(message.nextPoolNumber); + obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts index 49a05fb8ba..c6a83f0e1d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./tx"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** =============================== Pool */ export interface QueryPoolRequest { @@ -452,7 +452,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -765,7 +765,7 @@ export const QueryPoolsResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -937,7 +937,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = omitDefault(message.numPools); + obj.num_pools = message.numPools ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1033,7 +1033,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1127,7 +1127,7 @@ export const QueryPoolTypeResponse = { }, toAmino(message: QueryPoolTypeResponse): QueryPoolTypeResponseAmino { const obj: any = {}; - obj.pool_type = omitDefault(message.poolType); + obj.pool_type = message.poolType === "" ? undefined : message.poolType; return obj; }, fromAminoMsg(object: QueryPoolTypeResponseAminoMsg): QueryPoolTypeResponse { @@ -1245,11 +1245,11 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -1366,11 +1366,11 @@ export const QueryCalcJoinPoolSharesResponse = { }, toAmino(message: QueryCalcJoinPoolSharesResponse): QueryCalcJoinPoolSharesResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1483,8 +1483,8 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: QueryCalcExitPoolCoinsFromSharesRequestAminoMsg): QueryCalcExitPoolCoinsFromSharesRequest { @@ -1587,7 +1587,7 @@ export const QueryCalcExitPoolCoinsFromSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } return obj; }, @@ -1684,7 +1684,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1876,7 +1876,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -1979,7 +1979,7 @@ export const QueryTotalPoolLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, @@ -2076,7 +2076,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2290,11 +2290,11 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_in = []; + obj.tokens_in = message.tokensIn; } return obj; }, @@ -2414,9 +2414,9 @@ export const QueryCalcJoinPoolNoSwapSharesResponse = { if (message.tokensOut) { obj.tokens_out = message.tokensOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.tokens_out = []; + obj.tokens_out = message.tokensOut; } - obj.shares_out = omitDefault(message.sharesOut); + obj.shares_out = message.sharesOut === "" ? undefined : message.sharesOut; return obj; }, fromAminoMsg(object: QueryCalcJoinPoolNoSwapSharesResponseAminoMsg): QueryCalcJoinPoolNoSwapSharesResponse { @@ -2544,9 +2544,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -2683,9 +2683,9 @@ export const QueryPoolsWithFilterRequest = { if (message.minLiquidity) { obj.min_liquidity = message.minLiquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_liquidity = []; + obj.min_liquidity = message.minLiquidity; } - obj.pool_type = omitDefault(message.poolType); + obj.pool_type = message.poolType === "" ? undefined : message.poolType; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2807,7 +2807,7 @@ export const QueryPoolsWithFilterResponse = { if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -2903,7 +2903,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { @@ -3053,13 +3053,13 @@ export const QuerySwapExactAmountInRequest = { }, toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_in = omitDefault(message.tokenIn); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } return obj; }, @@ -3154,7 +3154,7 @@ export const QuerySwapExactAmountInResponse = { }, toAmino(message: QuerySwapExactAmountInResponse): QuerySwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountInResponseAminoMsg): QuerySwapExactAmountInResponse { @@ -3304,14 +3304,14 @@ export const QuerySwapExactAmountOutRequest = { }, toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_out = omitDefault(message.tokenOut); + obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutRequestAminoMsg): QuerySwapExactAmountOutRequest { @@ -3405,7 +3405,7 @@ export const QuerySwapExactAmountOutResponse = { }, toAmino(message: QuerySwapExactAmountOutResponse): QuerySwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: QuerySwapExactAmountOutResponseAminoMsg): QuerySwapExactAmountOutResponse { @@ -3582,7 +3582,7 @@ export const QueryTotalLiquidityResponse = { if (message.liquidity) { obj.liquidity = message.liquidity.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.liquidity = []; + obj.liquidity = message.liquidity; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index fb977802b3..f8828244da 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -128,9 +128,9 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map(el0 => ({ + tokenInMaxs: token_in_maxs.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -163,9 +163,9 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map(el0 => ({ + tokenOutMins: token_out_mins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -201,11 +201,11 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: { + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -242,12 +242,12 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: { + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount } @@ -280,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: BigInt(pool_id), - tokenIn: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -315,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -348,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: BigInt(pool_id), - tokenOut: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount }, @@ -383,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts index b69b34c20c..096beac3dc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v1beta1"; /** * ===================== MsgJoinPool @@ -393,13 +393,13 @@ export const MsgJoinPool = { }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -516,11 +516,11 @@ export const MsgJoinPoolResponse = { }, toAmino(message: MsgJoinPoolResponse): MsgJoinPoolResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenIn) { obj.token_in = message.tokenIn.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in = []; + obj.token_in = message.tokenIn; } return obj; }, @@ -671,13 +671,13 @@ export const MsgExitPool = { }, toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out_mins = []; + obj.token_out_mins = message.tokenOutMins; } return obj; }, @@ -781,7 +781,7 @@ export const MsgExitPoolResponse = { if (message.tokenOut) { obj.token_out = message.tokenOut.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_out = []; + obj.token_out = message.tokenOut; } return obj; }, @@ -894,8 +894,8 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, fromAminoMsg(object: SwapAmountInRouteAminoMsg): SwapAmountInRoute { @@ -1045,14 +1045,14 @@ export const MsgSwapExactAmountIn = { }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -1146,7 +1146,7 @@ export const MsgSwapExactAmountInResponse = { }, toAmino(message: MsgSwapExactAmountInResponse): MsgSwapExactAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInResponseAminoMsg): MsgSwapExactAmountInResponse { @@ -1258,8 +1258,8 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, fromAminoMsg(object: SwapAmountOutRouteAminoMsg): SwapAmountOutRoute { @@ -1409,13 +1409,13 @@ export const MsgSwapExactAmountOut = { }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, @@ -1510,7 +1510,7 @@ export const MsgSwapExactAmountOutResponse = { }, toAmino(message: MsgSwapExactAmountOutResponse): MsgSwapExactAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountOutResponseAminoMsg): MsgSwapExactAmountOutResponse { @@ -1656,10 +1656,10 @@ export const MsgJoinSwapExternAmountIn = { }, toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.share_out_min_amount = omitDefault(message.shareOutMinAmount); + obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInAminoMsg): MsgJoinSwapExternAmountIn { @@ -1753,7 +1753,7 @@ export const MsgJoinSwapExternAmountInResponse = { }, toAmino(message: MsgJoinSwapExternAmountInResponse): MsgJoinSwapExternAmountInResponseAmino { const obj: any = {}; - obj.share_out_amount = omitDefault(message.shareOutAmount); + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapExternAmountInResponseAminoMsg): MsgJoinSwapExternAmountInResponse { @@ -1913,11 +1913,11 @@ export const MsgJoinSwapShareAmountOut = { }, toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_in_denom = omitDefault(message.tokenInDenom); - obj.share_out_amount = omitDefault(message.shareOutAmount); - obj.token_in_max_amount = omitDefault(message.tokenInMaxAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutAminoMsg): MsgJoinSwapShareAmountOut { @@ -2011,7 +2011,7 @@ export const MsgJoinSwapShareAmountOutResponse = { }, toAmino(message: MsgJoinSwapShareAmountOutResponse): MsgJoinSwapShareAmountOutResponseAmino { const obj: any = {}; - obj.token_in_amount = omitDefault(message.tokenInAmount); + obj.token_in_amount = message.tokenInAmount === "" ? undefined : message.tokenInAmount; return obj; }, fromAminoMsg(object: MsgJoinSwapShareAmountOutResponseAminoMsg): MsgJoinSwapShareAmountOutResponse { @@ -2171,11 +2171,11 @@ export const MsgExitSwapShareAmountIn = { }, toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); - obj.token_out_denom = omitDefault(message.tokenOutDenom); - obj.share_in_amount = omitDefault(message.shareInAmount); - obj.token_out_min_amount = omitDefault(message.tokenOutMinAmount); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInAminoMsg): MsgExitSwapShareAmountIn { @@ -2269,7 +2269,7 @@ export const MsgExitSwapShareAmountInResponse = { }, toAmino(message: MsgExitSwapShareAmountInResponse): MsgExitSwapShareAmountInResponseAmino { const obj: any = {}; - obj.token_out_amount = omitDefault(message.tokenOutAmount); + obj.token_out_amount = message.tokenOutAmount === "" ? undefined : message.tokenOutAmount; return obj; }, fromAminoMsg(object: MsgExitSwapShareAmountInResponseAminoMsg): MsgExitSwapShareAmountInResponse { @@ -2415,10 +2415,10 @@ export const MsgExitSwapExternAmountOut = { }, toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; - obj.share_in_max_amount = omitDefault(message.shareInMaxAmount); + obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutAminoMsg): MsgExitSwapExternAmountOut { @@ -2512,7 +2512,7 @@ export const MsgExitSwapExternAmountOutResponse = { }, toAmino(message: MsgExitSwapExternAmountOutResponse): MsgExitSwapExternAmountOutResponseAmino { const obj: any = {}; - obj.share_in_amount = omitDefault(message.shareInAmount); + obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, fromAminoMsg(object: MsgExitSwapExternAmountOutResponseAminoMsg): MsgExitSwapExternAmountOutResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts index 49647eb657..0793fc0d01 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.gamm.v2"; /** * QuerySpotPriceRequest defines the gRPC request structure for a SpotPrice @@ -145,9 +145,9 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.base_asset_denom = omitDefault(message.baseAssetDenom); - obj.quote_asset_denom = omitDefault(message.quoteAssetDenom); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; + obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; }, fromAminoMsg(object: QuerySpotPriceRequestAminoMsg): QuerySpotPriceRequest { @@ -241,7 +241,7 @@ export const QuerySpotPriceResponse = { }, toAmino(message: QuerySpotPriceResponse): QuerySpotPriceResponseAmino { const obj: any = {}; - obj.spot_price = omitDefault(message.spotPrice); + obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, fromAminoMsg(object: QuerySpotPriceResponseAminoMsg): QuerySpotPriceResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts index 1d47276d45..0988ddc5f2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/ibc-rate-limit/v1beta1/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.ibcratelimit.v1beta1"; /** Params defines the parameters for the ibc-rate-limit module. */ export interface Params { @@ -82,7 +82,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.contract_address = omitDefault(message.contractAddress); + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts index baddae7a6b..9081c6e243 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts @@ -278,12 +278,12 @@ export const Gauge = { toAmino(message: Gauge): GaugeAmino { const obj: any = {}; obj.id = message.id ? message.id.toString() : undefined; - obj.is_perpetual = message.isPerpetual; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -291,7 +291,7 @@ export const Gauge = { if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.distributed_coins = []; + obj.distributed_coins = message.distributedCoins; } return obj; }, @@ -395,7 +395,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts index 779b7319f5..da04c4968a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts @@ -2,7 +2,7 @@ import { Params, ParamsSDKType } from "./params"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** * GenesisState defines the incentives module's various parameters when first @@ -175,14 +175,14 @@ export const GenesisState = { if (message.gauges) { obj.gauges = message.gauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.gauges = []; + obj.gauges = message.gauges; } if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = omitDefault(message.lastGaugeId); + obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts index aed1525a37..8a9358b50c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/params.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; /** Params holds parameters for the incentives module */ export interface Params { @@ -86,7 +86,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.distr_epoch_identifier = omitDefault(message.distrEpochIdentifier); + obj.distr_epoch_identifier = message.distrEpochIdentifier === "" ? undefined : message.distrEpochIdentifier; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts index 30c2c8091b..f7c21c9cd7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts @@ -3,7 +3,7 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Gauge, GaugeSDKType } from "./gauge"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../helpers"; +import { DeepPartial, isSet } from "../../helpers"; export const protobufPackage = "osmosis.incentives"; export interface ModuleToDistributeCoinsRequest {} export interface ModuleToDistributeCoinsRequestProtoMsg { @@ -378,7 +378,7 @@ export const ModuleToDistributeCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -475,7 +475,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = omitDefault(message.id); + obj.id = message.id ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -788,7 +788,7 @@ export const GaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1007,7 +1007,7 @@ export const ActiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1121,7 +1121,7 @@ export const ActiveGaugesPerDenomRequest = { }, toAmino(message: ActiveGaugesPerDenomRequest): ActiveGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1243,7 +1243,7 @@ export const ActiveGaugesPerDenomResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1462,7 +1462,7 @@ export const UpcomingGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1576,7 +1576,7 @@ export const UpcomingGaugesPerDenomRequest = { }, toAmino(message: UpcomingGaugesPerDenomRequest): UpcomingGaugesPerDenomRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1698,7 +1698,7 @@ export const UpcomingGaugesPerDenomResponse = { if (message.upcomingGauges) { obj.upcoming_gauges = message.upcomingGauges.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.upcoming_gauges = []; + obj.upcoming_gauges = message.upcomingGauges; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1843,13 +1843,13 @@ export const RewardsEstRequest = { }, toAmino(message: RewardsEstRequest): RewardsEstRequestAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; if (message.lockIds) { obj.lock_ids = message.lockIds.map(e => e.toString()); } else { - obj.lock_ids = []; + obj.lock_ids = message.lockIds; } - obj.end_epoch = omitDefault(message.endEpoch); + obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { @@ -1952,7 +1952,7 @@ export const RewardsEstResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -2130,7 +2130,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index 96b42471f0..094567f886 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -78,21 +78,21 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: { - lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: distribute_to == null ? distribute_to : { + lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: { + duration: distribute_to.duration == null ? distribute_to.duration : { seconds: BigInt(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, timestamp: distribute_to.timestamp }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: BigInt(num_epochs_paid_over) + numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : BigInt(num_epochs_paid_over) }; } }, @@ -119,8 +119,8 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: BigInt(gauge_id), - rewards: rewards.map(el0 => ({ + gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), + rewards: rewards.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts index 2413baf192..8bd45ca411 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts @@ -234,13 +234,13 @@ export const MsgCreateGauge = { }, toAmino(message: MsgCreateGauge): MsgCreateGaugeAmino { const obj: any = {}; - obj.is_perpetual = message.isPerpetual; - obj.owner = message.owner; + obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; + obj.owner = message.owner === "" ? undefined : message.owner; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; @@ -451,12 +451,12 @@ export const MsgAddToGauge = { }, toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.rewards = []; + obj.rewards = message.rewards; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts index 534ffa22fd..8a142aa777 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts @@ -1,6 +1,6 @@ import { PeriodLock, PeriodLockSDKType, SyntheticLock, SyntheticLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; /** GenesisState defines the lockup module's genesis state. */ export interface GenesisState { @@ -133,16 +133,16 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = omitDefault(message.lastLockId); + obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts index 3741a3798b..893e285ca6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts @@ -316,13 +316,13 @@ export const PeriodLock = { toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; obj.ID = message.ID ? message.ID.toString() : undefined; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -452,7 +452,7 @@ export const QueryCondition = { fromAmino(object: QueryConditionAmino): QueryCondition { const message = createBaseQueryCondition(); if (object.lock_query_type !== undefined && object.lock_query_type !== null) { - message.lockQueryType = lockQueryTypeFromJSON(object.lock_query_type); + message.lockQueryType = object.lock_query_type; } if (object.denom !== undefined && object.denom !== null) { message.denom = object.denom; @@ -467,8 +467,8 @@ export const QueryCondition = { }, toAmino(message: QueryCondition): QueryConditionAmino { const obj: any = {}; - obj.lock_query_type = lockQueryTypeToJSON(message.lockQueryType); - obj.denom = message.denom; + obj.lock_query_type = message.lockQueryType === 0 ? undefined : message.lockQueryType; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; @@ -617,7 +617,7 @@ export const SyntheticLock = { toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; - obj.synth_denom = message.synthDenom; + obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts index 6688646110..76927d2be8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/params.ts @@ -89,7 +89,7 @@ export const Params = { if (message.forceUnlockAllowedAddresses) { obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses.map(e => e); } else { - obj.force_unlock_allowed_addresses = []; + obj.force_unlock_allowed_addresses = message.forceUnlockAllowedAddresses; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts index 8d5341ea32..096af91e0d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts @@ -508,7 +508,7 @@ export const ModuleBalanceResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -686,7 +686,7 @@ export const ModuleLockedAmountResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -781,7 +781,7 @@ export const AccountUnlockableCoinsRequest = { }, toAmino(message: AccountUnlockableCoinsRequest): AccountUnlockableCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockableCoinsRequestAminoMsg): AccountUnlockableCoinsRequest { @@ -884,7 +884,7 @@ export const AccountUnlockableCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -979,7 +979,7 @@ export const AccountUnlockingCoinsRequest = { }, toAmino(message: AccountUnlockingCoinsRequest): AccountUnlockingCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountUnlockingCoinsRequestAminoMsg): AccountUnlockingCoinsRequest { @@ -1082,7 +1082,7 @@ export const AccountUnlockingCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1177,7 +1177,7 @@ export const AccountLockedCoinsRequest = { }, toAmino(message: AccountLockedCoinsRequest): AccountLockedCoinsRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: AccountLockedCoinsRequestAminoMsg): AccountLockedCoinsRequest { @@ -1280,7 +1280,7 @@ export const AccountLockedCoinsResponse = { if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1391,7 +1391,7 @@ export const AccountLockedPastTimeRequest = { }, toAmino(message: AccountLockedPastTimeRequest): AccountLockedPastTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1495,7 +1495,7 @@ export const AccountLockedPastTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1606,7 +1606,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedPastTimeNotUnlockingOnlyRequest): AccountLockedPastTimeNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1710,7 +1710,7 @@ export const AccountLockedPastTimeNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -1821,7 +1821,7 @@ export const AccountUnlockedBeforeTimeRequest = { }, toAmino(message: AccountUnlockedBeforeTimeRequest): AccountUnlockedBeforeTimeRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -1925,7 +1925,7 @@ export const AccountUnlockedBeforeTimeResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2052,9 +2052,9 @@ export const AccountLockedPastTimeDenomRequest = { }, toAmino(message: AccountLockedPastTimeDenomRequest): AccountLockedPastTimeDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedPastTimeDenomRequestAminoMsg): AccountLockedPastTimeDenomRequest { @@ -2157,7 +2157,7 @@ export const AccountLockedPastTimeDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -2270,7 +2270,7 @@ export const LockedDenomRequest = { }, toAmino(message: LockedDenomRequest): LockedDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2365,7 +2365,7 @@ export const LockedDenomResponse = { }, toAmino(message: LockedDenomResponse): LockedDenomResponseAmino { const obj: any = {}; - obj.amount = message.amount; + obj.amount = message.amount === "" ? undefined : message.amount; return obj; }, fromAminoMsg(object: LockedDenomResponseAminoMsg): LockedDenomResponse { @@ -2756,7 +2756,7 @@ export const SyntheticLockupsByLockupIDResponse = { if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2869,7 +2869,7 @@ export const AccountLockedLongerDurationRequest = { }, toAmino(message: AccountLockedLongerDurationRequest): AccountLockedLongerDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -2973,7 +2973,7 @@ export const AccountLockedLongerDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3086,7 +3086,7 @@ export const AccountLockedDurationRequest = { }, toAmino(message: AccountLockedDurationRequest): AccountLockedDurationRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3190,7 +3190,7 @@ export const AccountLockedDurationResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3303,7 +3303,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyRequest = { }, toAmino(message: AccountLockedLongerDurationNotUnlockingOnlyRequest): AccountLockedLongerDurationNotUnlockingOnlyRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -3407,7 +3407,7 @@ export const AccountLockedLongerDurationNotUnlockingOnlyResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, @@ -3536,9 +3536,9 @@ export const AccountLockedLongerDurationDenomRequest = { }, toAmino(message: AccountLockedLongerDurationDenomRequest): AccountLockedLongerDurationDenomRequestAmino { const obj: any = {}; - obj.owner = message.owner; + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AccountLockedLongerDurationDenomRequestAminoMsg): AccountLockedLongerDurationDenomRequest { @@ -3641,7 +3641,7 @@ export const AccountLockedLongerDurationDenomResponse = { if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.locks = []; + obj.locks = message.locks; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index 9545e07ec2..8a0babacb9 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -82,11 +82,11 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: { + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -133,8 +133,8 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: BigInt(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : BigInt(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -161,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: BigInt(ID), - duration: { + ID: ID == null ? ID : BigInt(ID), + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -192,8 +192,8 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: BigInt(ID), - coins: coins.map(el0 => ({ + ID: ID == null ? ID : BigInt(ID), + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts index ea7497afd5..95df255a3b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.lockup"; export interface MsgLockTokens { owner: string; @@ -251,12 +251,12 @@ export const MsgLockTokens = { }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -353,7 +353,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -447,7 +447,7 @@ export const MsgBeginUnlockingAll = { }, toAmino(message: MsgBeginUnlockingAll): MsgBeginUnlockingAllAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; return obj; }, fromAminoMsg(object: MsgBeginUnlockingAllAminoMsg): MsgBeginUnlockingAll { @@ -550,7 +550,7 @@ export const MsgBeginUnlockingAllResponse = { if (message.unlocks) { obj.unlocks = message.unlocks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { - obj.unlocks = []; + obj.unlocks = message.unlocks; } return obj; }, @@ -685,12 +685,12 @@ export const MsgBeginUnlocking = { }, toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -785,7 +785,7 @@ export const MsgBeginUnlockingResponse = { }, toAmino(message: MsgBeginUnlockingResponse): MsgBeginUnlockingResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgBeginUnlockingResponseAminoMsg): MsgBeginUnlockingResponse { @@ -915,8 +915,8 @@ export const MsgExtendLockup = { }, toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1011,7 +1011,7 @@ export const MsgExtendLockupResponse = { }, toAmino(message: MsgExtendLockupResponse): MsgExtendLockupResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgExtendLockupResponseAminoMsg): MsgExtendLockupResponse { @@ -1145,12 +1145,12 @@ export const MsgForceUnlock = { }, toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); - obj.ID = omitDefault(message.ID); + obj.owner = message.owner === "" ? undefined : message.owner; + obj.ID = message.ID ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -1245,7 +1245,7 @@ export const MsgForceUnlockResponse = { }, toAmino(message: MsgForceUnlockResponse): MsgForceUnlockResponseAmino { const obj: any = {}; - obj.success = omitDefault(message.success); + obj.success = message.success === false ? undefined : message.success; return obj; }, fromAminoMsg(object: MsgForceUnlockResponseAminoMsg): MsgForceUnlockResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts index b8ba299669..e2474a70b7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { Minter, MinterSDKType, Params, ParamsSDKType } from "./mint"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** GenesisState defines the mint module's genesis state. */ export interface GenesisState { @@ -133,7 +133,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = omitDefault(message.reductionStartedEpoch); + obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts index 066c43dcd0..d585343399 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts @@ -1,6 +1,6 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; import { Decimal } from "@cosmjs/math"; -import { isSet, DeepPartial, padDecimal, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../../helpers"; export const protobufPackage = "osmosis.mint.v1beta1"; /** Minter represents the minting state. */ export interface Minter { @@ -200,7 +200,7 @@ export const Minter = { }, toAmino(message: Minter): MinterAmino { const obj: any = {}; - obj.epoch_provisions = padDecimal(message.epochProvisions); + obj.epoch_provisions = padDecimal(message.epochProvisions) === "" ? undefined : padDecimal(message.epochProvisions); return obj; }, fromAminoMsg(object: MinterAminoMsg): Minter { @@ -310,8 +310,8 @@ export const WeightedAddress = { }, toAmino(message: WeightedAddress): WeightedAddressAmino { const obj: any = {}; - obj.address = omitDefault(message.address); - obj.weight = padDecimal(message.weight); + obj.address = message.address === "" ? undefined : message.address; + obj.weight = padDecimal(message.weight) === "" ? undefined : padDecimal(message.weight); return obj; }, fromAminoMsg(object: WeightedAddressAminoMsg): WeightedAddress { @@ -453,10 +453,10 @@ export const DistributionProportions = { }, toAmino(message: DistributionProportions): DistributionProportionsAmino { const obj: any = {}; - obj.staking = padDecimal(message.staking); - obj.pool_incentives = padDecimal(message.poolIncentives); - obj.developer_rewards = padDecimal(message.developerRewards); - obj.community_pool = padDecimal(message.communityPool); + obj.staking = padDecimal(message.staking) === "" ? undefined : padDecimal(message.staking); + obj.pool_incentives = padDecimal(message.poolIncentives) === "" ? undefined : padDecimal(message.poolIncentives); + obj.developer_rewards = padDecimal(message.developerRewards) === "" ? undefined : padDecimal(message.developerRewards); + obj.community_pool = padDecimal(message.communityPool) === "" ? undefined : padDecimal(message.communityPool); return obj; }, fromAminoMsg(object: DistributionProportionsAminoMsg): DistributionProportions { @@ -674,18 +674,18 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.mint_denom = omitDefault(message.mintDenom); - obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions); - obj.epoch_identifier = omitDefault(message.epochIdentifier); - obj.reduction_period_in_epochs = omitDefault(message.reductionPeriodInEpochs); - obj.reduction_factor = padDecimal(message.reductionFactor); + obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; + obj.genesis_epoch_provisions = padDecimal(message.genesisEpochProvisions) === "" ? undefined : padDecimal(message.genesisEpochProvisions); + obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_factor = padDecimal(message.reductionFactor) === "" ? undefined : padDecimal(message.reductionFactor); obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers.map(e => e ? WeightedAddress.toAmino(e) : undefined); } else { - obj.weighted_developer_rewards_receivers = []; + obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = omitDefault(message.mintingRewardsDistributionStartEpoch); + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts index b29808c96d..0315f713e4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/genesis.ts @@ -155,7 +155,7 @@ export const GenesisState = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } obj.distr_info = message.distrInfo ? DistrInfo.toAmino(message.distrInfo) : undefined; obj.pool_to_gauges = message.poolToGauges ? PoolToGauges.toAmino(message.poolToGauges) : undefined; diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts index 54d87beb55..ed45704525 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { DistrRecord, DistrRecordSDKType } from "./incentives"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; /** * ReplacePoolIncentivesProposal is a gov Content type for updating the pool @@ -173,12 +173,12 @@ export const ReplacePoolIncentivesProposal = { }, toAmino(message: ReplacePoolIncentivesProposal): ReplacePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -311,12 +311,12 @@ export const UpdatePoolIncentivesProposal = { }, toAmino(message: UpdatePoolIncentivesProposal): UpdatePoolIncentivesProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts index 1d6bdd4dbb..d300003020 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface Params { /** @@ -145,7 +145,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minted_denom = omitDefault(message.mintedDenom); + obj.minted_denom = message.mintedDenom === "" ? undefined : message.mintedDenom; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -248,7 +248,7 @@ export const LockableDurationsInfo = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -365,11 +365,11 @@ export const DistrInfo = { }, toAmino(message: DistrInfo): DistrInfoAmino { const obj: any = {}; - obj.total_weight = omitDefault(message.totalWeight); + obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; if (message.records) { obj.records = message.records.map(e => e ? DistrRecord.toAmino(e) : undefined); } else { - obj.records = []; + obj.records = message.records; } return obj; }, @@ -482,8 +482,8 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = omitDefault(message.gaugeId); - obj.weight = omitDefault(message.weight); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, fromAminoMsg(object: DistrRecordAminoMsg): DistrRecord { @@ -615,8 +615,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); - obj.gauge_id = omitDefault(message.gaugeId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -720,7 +720,7 @@ export const PoolToGauges = { if (message.poolToGauge) { obj.pool_to_gauge = message.poolToGauge.map(e => e ? PoolToGauge.toAmino(e) : undefined); } else { - obj.pool_to_gauge = []; + obj.pool_to_gauge = message.poolToGauge; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts index e9e01d14ab..296e0a744e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts @@ -2,7 +2,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { DistrInfo, DistrInfoSDKType, Params, ParamsSDKType } from "./incentives"; import { Gauge, GaugeSDKType } from "../../incentives/gauge"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.poolincentives.v1beta1"; export interface QueryGaugeIdsRequest { poolId: bigint; @@ -203,7 +203,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -306,7 +306,7 @@ export const QueryGaugeIdsResponse = { if (message.gaugeIdsWithDuration) { obj.gauge_ids_with_duration = message.gaugeIdsWithDuration.map(e => e ? QueryGaugeIdsResponse_GaugeIdWithDuration.toAmino(e) : undefined); } else { - obj.gauge_ids_with_duration = []; + obj.gauge_ids_with_duration = message.gaugeIdsWithDuration; } return obj; }, @@ -437,9 +437,9 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = omitDefault(message.gaugeId); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.gauge_incentive_percentage = omitDefault(message.gaugeIncentivePercentage); + obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; }, fromAminoMsg(object: QueryGaugeIdsResponse_GaugeIdWithDurationAminoMsg): QueryGaugeIdsResponse_GaugeIdWithDuration { @@ -956,7 +956,7 @@ export const QueryLockableDurationsResponse = { if (message.lockableDurations) { obj.lockable_durations = message.lockableDurations.map(e => e ? Duration.toAmino(e) : undefined); } else { - obj.lockable_durations = []; + obj.lockable_durations = message.lockableDurations; } return obj; }, @@ -1163,9 +1163,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = omitDefault(message.poolId); + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = omitDefault(message.gaugeId); + obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { @@ -1268,7 +1268,7 @@ export const QueryIncentivizedPoolsResponse = { if (message.incentivizedPools) { obj.incentivized_pools = message.incentivizedPools.map(e => e ? IncentivizedPool.toAmino(e) : undefined); } else { - obj.incentivized_pools = []; + obj.incentivized_pools = message.incentivizedPools; } return obj; }, @@ -1446,7 +1446,7 @@ export const QueryExternalIncentiveGaugesResponse = { if (message.data) { obj.data = message.data.map(e => e ? Gauge.toAmino(e) : undefined); } else { - obj.data = []; + obj.data = message.data; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts b/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts index a5d833729c..e87e04aa8f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts +++ b/__fixtures__/v-next/outputv4/osmosis/sumtree/v1beta1/tree.ts @@ -111,7 +111,7 @@ export const Node = { if (message.children) { obj.children = message.children.map(e => e ? Child.toAmino(e) : undefined); } else { - obj.children = []; + obj.children = message.children; } return obj; }, @@ -223,7 +223,7 @@ export const Child = { toAmino(message: Child): ChildAmino { const obj: any = {}; obj.index = message.index ? base64FromBytes(message.index) : undefined; - obj.accumulation = message.accumulation; + obj.accumulation = message.accumulation === "" ? undefined : message.accumulation; return obj; }, fromAminoMsg(object: ChildAminoMsg): Child { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts index 6dfe23c838..1d4e6d244a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/genesis.ts @@ -198,22 +198,22 @@ export const GenesisState = { if (message.superfluidAssets) { obj.superfluid_assets = message.superfluidAssets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.superfluid_assets = []; + obj.superfluid_assets = message.superfluidAssets; } if (message.osmoEquivalentMultipliers) { obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers.map(e => e ? OsmoEquivalentMultiplierRecord.toAmino(e) : undefined); } else { - obj.osmo_equivalent_multipliers = []; + obj.osmo_equivalent_multipliers = message.osmoEquivalentMultipliers; } if (message.intermediaryAccounts) { obj.intermediary_accounts = message.intermediaryAccounts.map(e => e ? SuperfluidIntermediaryAccount.toAmino(e) : undefined); } else { - obj.intermediary_accounts = []; + obj.intermediary_accounts = message.intermediaryAccounts; } if (message.intemediaryAccountConnections) { obj.intemediary_account_connections = message.intemediaryAccountConnections.map(e => e ? LockIdIntermediaryAccountConnection.toAmino(e) : undefined); } else { - obj.intemediary_account_connections = []; + obj.intemediary_account_connections = message.intemediaryAccountConnections; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts index 67e090fcc8..f8aae493a2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/params.ts @@ -89,7 +89,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor); + obj.minimum_risk_factor = padDecimal(message.minimumRiskFactor) === "" ? undefined : padDecimal(message.minimumRiskFactor); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts index 2e84dbdb3a..023c4bb8bc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts @@ -587,7 +587,7 @@ export const AssetTypeRequest = { }, toAmino(message: AssetTypeRequest): AssetTypeRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetTypeRequestAminoMsg): AssetTypeRequest { @@ -675,13 +675,13 @@ export const AssetTypeResponse = { fromAmino(object: AssetTypeResponseAmino): AssetTypeResponse { const message = createBaseAssetTypeResponse(); if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: AssetTypeResponse): AssetTypeResponseAmino { const obj: any = {}; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: AssetTypeResponseAminoMsg): AssetTypeResponse { @@ -858,7 +858,7 @@ export const AllAssetsResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -953,7 +953,7 @@ export const AssetMultiplierRequest = { }, toAmino(message: AssetMultiplierRequest): AssetMultiplierRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: AssetMultiplierRequestAminoMsg): AssetMultiplierRequest { @@ -1193,10 +1193,10 @@ export const SuperfluidIntermediaryAccountInfo = { }, toAmino(message: SuperfluidIntermediaryAccountInfo): SuperfluidIntermediaryAccountInfoAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountInfoAminoMsg): SuperfluidIntermediaryAccountInfo { @@ -1413,7 +1413,7 @@ export const AllIntermediaryAccountsResponse = { if (message.accounts) { obj.accounts = message.accounts.map(e => e ? SuperfluidIntermediaryAccountInfo.toAmino(e) : undefined); } else { - obj.accounts = []; + obj.accounts = message.accounts; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -1701,7 +1701,7 @@ export const QueryTotalDelegationByValidatorForDenomRequest = { }, toAmino(message: QueryTotalDelegationByValidatorForDenomRequest): QueryTotalDelegationByValidatorForDenomRequestAmino { const obj: any = {}; - obj.denom = message.denom; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryTotalDelegationByValidatorForDenomRequestAminoMsg): QueryTotalDelegationByValidatorForDenomRequest { @@ -1804,7 +1804,7 @@ export const QueryTotalDelegationByValidatorForDenomResponse = { if (message.assets) { obj.assets = message.assets.map(e => e ? Delegations.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -1931,9 +1931,9 @@ export const Delegations = { }, toAmino(message: Delegations): DelegationsAmino { const obj: any = {}; - obj.val_addr = message.valAddr; - obj.amount_sfsd = message.amountSfsd; - obj.osmo_equivalent = message.osmoEquivalent; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; + obj.amount_sfsd = message.amountSfsd === "" ? undefined : message.amountSfsd; + obj.osmo_equivalent = message.osmoEquivalent === "" ? undefined : message.osmoEquivalent; return obj; }, fromAminoMsg(object: DelegationsAminoMsg): Delegations { @@ -2101,7 +2101,7 @@ export const TotalSuperfluidDelegationsResponse = { }, toAmino(message: TotalSuperfluidDelegationsResponse): TotalSuperfluidDelegationsResponseAmino { const obj: any = {}; - obj.total_delegations = message.totalDelegations; + obj.total_delegations = message.totalDelegations === "" ? undefined : message.totalDelegations; return obj; }, fromAminoMsg(object: TotalSuperfluidDelegationsResponseAminoMsg): TotalSuperfluidDelegationsResponse { @@ -2227,9 +2227,9 @@ export const SuperfluidDelegationAmountRequest = { }, toAmino(message: SuperfluidDelegationAmountRequest): SuperfluidDelegationAmountRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationAmountRequestAminoMsg): SuperfluidDelegationAmountRequest { @@ -2332,7 +2332,7 @@ export const SuperfluidDelegationAmountResponse = { if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.amount = []; + obj.amount = message.amount; } return obj; }, @@ -2427,7 +2427,7 @@ export const SuperfluidDelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidDelegationsByDelegatorRequest): SuperfluidDelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByDelegatorRequestAminoMsg): SuperfluidDelegationsByDelegatorRequest { @@ -2570,12 +2570,12 @@ export const SuperfluidDelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -2687,8 +2687,8 @@ export const SuperfluidUndelegationsByDelegatorRequest = { }, toAmino(message: SuperfluidUndelegationsByDelegatorRequest): SuperfluidUndelegationsByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.denom = message.denom; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidUndelegationsByDelegatorRequestAminoMsg): SuperfluidUndelegationsByDelegatorRequest { @@ -2835,17 +2835,17 @@ export const SuperfluidUndelegationsByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.totalUndelegatedCoins) { obj.total_undelegated_coins = message.totalUndelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_undelegated_coins = []; + obj.total_undelegated_coins = message.totalUndelegatedCoins; } if (message.syntheticLocks) { obj.synthetic_locks = message.syntheticLocks.map(e => e ? SyntheticLock.toAmino(e) : undefined); } else { - obj.synthetic_locks = []; + obj.synthetic_locks = message.syntheticLocks; } return obj; }, @@ -2956,8 +2956,8 @@ export const SuperfluidDelegationsByValidatorDenomRequest = { }, toAmino(message: SuperfluidDelegationsByValidatorDenomRequest): SuperfluidDelegationsByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: SuperfluidDelegationsByValidatorDenomRequestAminoMsg): SuperfluidDelegationsByValidatorDenomRequest { @@ -3060,7 +3060,7 @@ export const SuperfluidDelegationsByValidatorDenomResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } return obj; }, @@ -3171,8 +3171,8 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomRequest = { }, toAmino(message: EstimateSuperfluidDelegatedAmountByValidatorDenomRequest): EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAmino { const obj: any = {}; - obj.validator_address = message.validatorAddress; - obj.denom = message.denom; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: EstimateSuperfluidDelegatedAmountByValidatorDenomRequestAminoMsg): EstimateSuperfluidDelegatedAmountByValidatorDenomRequest { @@ -3275,7 +3275,7 @@ export const EstimateSuperfluidDelegatedAmountByValidatorDenomResponse = { if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } return obj; }, @@ -3370,7 +3370,7 @@ export const QueryTotalDelegationByDelegatorRequest = { }, toAmino(message: QueryTotalDelegationByDelegatorRequest): QueryTotalDelegationByDelegatorRequestAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; return obj; }, fromAminoMsg(object: QueryTotalDelegationByDelegatorRequestAminoMsg): QueryTotalDelegationByDelegatorRequest { @@ -3535,17 +3535,17 @@ export const QueryTotalDelegationByDelegatorResponse = { if (message.superfluidDelegationRecords) { obj.superfluid_delegation_records = message.superfluidDelegationRecords.map(e => e ? SuperfluidDelegationRecord.toAmino(e) : undefined); } else { - obj.superfluid_delegation_records = []; + obj.superfluid_delegation_records = message.superfluidDelegationRecords; } if (message.delegationResponse) { obj.delegation_response = message.delegationResponse.map(e => e ? DelegationResponse.toAmino(e) : undefined); } else { - obj.delegation_response = []; + obj.delegation_response = message.delegationResponse; } if (message.totalDelegatedCoins) { obj.total_delegated_coins = message.totalDelegatedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.total_delegated_coins = []; + obj.total_delegated_coins = message.totalDelegatedCoins; } obj.total_equivalent_staked_amount = message.totalEquivalentStakedAmount ? Coin.toAmino(message.totalEquivalentStakedAmount) : undefined; return obj; @@ -3733,7 +3733,7 @@ export const QueryUnpoolWhitelistResponse = { if (message.poolIds) { obj.pool_ids = message.poolIds.map(e => e.toString()); } else { - obj.pool_ids = []; + obj.pool_ids = message.poolIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts index 93f755735d..8e9cdeeb9b 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial } from "../../helpers"; +import { isSet, DeepPartial, padDecimal } from "../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.superfluid"; /** @@ -250,14 +250,14 @@ export const SuperfluidAsset = { message.denom = object.denom; } if (object.asset_type !== undefined && object.asset_type !== null) { - message.assetType = superfluidAssetTypeFromJSON(object.asset_type); + message.assetType = object.asset_type; } return message; }, toAmino(message: SuperfluidAsset): SuperfluidAssetAmino { const obj: any = {}; - obj.denom = message.denom; - obj.asset_type = superfluidAssetTypeToJSON(message.assetType); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.asset_type = message.assetType === 0 ? undefined : message.assetType; return obj; }, fromAminoMsg(object: SuperfluidAssetAminoMsg): SuperfluidAsset { @@ -385,8 +385,8 @@ export const SuperfluidIntermediaryAccount = { }, toAmino(message: SuperfluidIntermediaryAccount): SuperfluidIntermediaryAccountAmino { const obj: any = {}; - obj.denom = message.denom; - obj.val_addr = message.valAddr; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; return obj; }, @@ -516,8 +516,8 @@ export const OsmoEquivalentMultiplierRecord = { toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; - obj.denom = message.denom; - obj.multiplier = message.multiplier; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.multiplier = padDecimal(message.multiplier) === "" ? undefined : padDecimal(message.multiplier); return obj; }, fromAminoMsg(object: OsmoEquivalentMultiplierRecordAminoMsg): OsmoEquivalentMultiplierRecord { @@ -663,8 +663,8 @@ export const SuperfluidDelegationRecord = { }, toAmino(message: SuperfluidDelegationRecord): SuperfluidDelegationRecordAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.delegation_amount = message.delegationAmount ? Coin.toAmino(message.delegationAmount) : undefined; obj.equivalent_staked_amount = message.equivalentStakedAmount ? Coin.toAmino(message.equivalentStakedAmount) : undefined; return obj; @@ -779,7 +779,7 @@ export const LockIdIntermediaryAccountConnection = { toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; obj.lock_id = message.lockId ? message.lockId.toString() : undefined; - obj.intermediary_account = message.intermediaryAccount; + obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, fromAminoMsg(object: LockIdIntermediaryAccountConnectionAminoMsg): LockIdIntermediaryAccountConnection { @@ -891,7 +891,7 @@ export const UnpoolWhitelistedPools = { if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 06225ca5cd..7c3be9a269 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: BigInt(lock_id), + lockId: lock_id == null ? lock_id : BigInt(lock_id), valAddr: val_addr }; } @@ -86,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: BigInt(lock_id) + lockId: lock_id == null ? lock_id : BigInt(lock_id) }; } }, @@ -107,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: BigInt(lock_id) + lockId: lock_id == null ? lock_id : BigInt(lock_id) }; } }, @@ -134,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: BigInt(pool_id) + poolId: pool_id == null ? pool_id : BigInt(pool_id) }; } } diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts index a6b10fb294..510ec0f9ff 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts @@ -1,6 +1,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "osmosis.superfluid"; export interface MsgSuperfluidDelegate { sender: string; @@ -237,9 +237,9 @@ export const MsgSuperfluidDelegate = { }, toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); - obj.val_addr = omitDefault(message.valAddr); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgSuperfluidDelegateAminoMsg): MsgSuperfluidDelegate { @@ -425,8 +425,8 @@ export const MsgSuperfluidUndelegate = { }, toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -612,8 +612,8 @@ export const MsgSuperfluidUnbondLock = { }, toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.lock_id = omitDefault(message.lockId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.lock_id = message.lockId ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -819,13 +819,13 @@ export const MsgLockAndSuperfluidDelegate = { }, toAmino(message: MsgLockAndSuperfluidDelegate): MsgLockAndSuperfluidDelegateAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } - obj.val_addr = omitDefault(message.valAddr); + obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateAminoMsg): MsgLockAndSuperfluidDelegate { @@ -921,7 +921,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = omitDefault(message.ID); + obj.ID = message.ID ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1033,8 +1033,8 @@ export const MsgUnPoolWhitelistedPool = { }, toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.pool_id = omitDefault(message.poolId); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.pool_id = message.poolId ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { @@ -1146,7 +1146,7 @@ export const MsgUnPoolWhitelistedPoolResponse = { if (message.exitedLockIds) { obj.exited_lock_ids = message.exitedLockIds.map(e => e.toString()); } else { - obj.exited_lock_ids = []; + obj.exited_lock_ids = message.exitedLockIds; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts index 5299a2656d..bd15a1eac4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { SuperfluidAsset, SuperfluidAssetSDKType } from "../superfluid"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.superfluid.v1beta1"; /** * SetSuperfluidAssetsProposal is a gov Content type to update the superfluid @@ -177,12 +177,12 @@ export const SetSuperfluidAssetsProposal = { }, toAmino(message: SetSuperfluidAssetsProposal): SetSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.assets) { obj.assets = message.assets.map(e => e ? SuperfluidAsset.toAmino(e) : undefined); } else { - obj.assets = []; + obj.assets = message.assets; } return obj; }, @@ -315,12 +315,12 @@ export const RemoveSuperfluidAssetsProposal = { }, toAmino(message: RemoveSuperfluidAssetsProposal): RemoveSuperfluidAssetsProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.superfluidAssetDenoms) { obj.superfluid_asset_denoms = message.superfluidAssetDenoms.map(e => e); } else { - obj.superfluid_asset_denoms = []; + obj.superfluid_asset_denoms = message.superfluidAssetDenoms; } return obj; }, @@ -478,14 +478,14 @@ export const UpdateUnpoolWhiteListProposal = { }, toAmino(message: UpdateUnpoolWhiteListProposal): UpdateUnpoolWhiteListProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.ids) { obj.ids = message.ids.map(e => e.toString()); } else { - obj.ids = []; + obj.ids = message.ids; } - obj.is_overwrite = omitDefault(message.isOverwrite); + obj.is_overwrite = message.isOverwrite === false ? undefined : message.isOverwrite; return obj; }, fromAminoMsg(object: UpdateUnpoolWhiteListProposalAminoMsg): UpdateUnpoolWhiteListProposal { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts index 11f691b14e..05d6c404d5 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/authorityMetadata.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * DenomAuthorityMetadata specifies metadata for addresses that have specific @@ -91,7 +91,7 @@ export const DenomAuthorityMetadata = { }, toAmino(message: DenomAuthorityMetadata): DenomAuthorityMetadataAmino { const obj: any = {}; - obj.admin = omitDefault(message.admin); + obj.admin = message.admin === "" ? undefined : message.admin; return obj; }, fromAminoMsg(object: DenomAuthorityMetadataAminoMsg): DenomAuthorityMetadata { diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts index 7cbfcc52e2..37b436e896 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** GenesisState defines the tokenfactory module's genesis state. */ export interface GenesisState { @@ -137,7 +137,7 @@ export const GenesisState = { if (message.factoryDenoms) { obj.factory_denoms = message.factoryDenoms.map(e => e ? GenesisDenom.toAmino(e) : undefined); } else { - obj.factory_denoms = []; + obj.factory_denoms = message.factoryDenoms; } return obj; }, @@ -250,7 +250,7 @@ export const GenesisDenom = { }, toAmino(message: GenesisDenom): GenesisDenomAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; obj.authority_metadata = message.authorityMetadata ? DenomAuthorityMetadata.toAmino(message.authorityMetadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts index 7deb5a8423..ec74dead0e 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/params.ts @@ -92,7 +92,7 @@ export const Params = { if (message.denomCreationFee) { obj.denom_creation_fee = message.denomCreationFee.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.denom_creation_fee = []; + obj.denom_creation_fee = message.denomCreationFee; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts index cb15acc05e..c1efa97f11 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Params, ParamsSDKType } from "./params"; import { DenomAuthorityMetadata, DenomAuthorityMetadataSDKType } from "./authorityMetadata"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault } from "../../../helpers"; +import { DeepPartial, isSet } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** QueryParamsRequest is the request type for the Query/Params RPC method. */ export interface QueryParamsRequest {} @@ -335,7 +335,7 @@ export const QueryDenomAuthorityMetadataRequest = { }, toAmino(message: QueryDenomAuthorityMetadataRequest): QueryDenomAuthorityMetadataRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomAuthorityMetadataRequestAminoMsg): QueryDenomAuthorityMetadataRequest { @@ -525,7 +525,7 @@ export const QueryDenomsFromCreatorRequest = { }, toAmino(message: QueryDenomsFromCreatorRequest): QueryDenomsFromCreatorRequestAmino { const obj: any = {}; - obj.creator = omitDefault(message.creator); + obj.creator = message.creator === "" ? undefined : message.creator; return obj; }, fromAminoMsg(object: QueryDenomsFromCreatorRequestAminoMsg): QueryDenomsFromCreatorRequest { @@ -628,7 +628,7 @@ export const QueryDenomsFromCreatorResponse = { if (message.denoms) { obj.denoms = message.denoms.map(e => e); } else { - obj.denoms = []; + obj.denoms = message.denoms; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index 8f2a82e542..49e38cc8ab 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -101,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -190,9 +190,9 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: { + metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map(el1 => ({ + denomUnits: metadata.denom_units.map?.(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts index 71fc872731..1d5e1ca9f6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.tokenfactory.v1beta1"; /** * MsgCreateDenom defines the message structure for the CreateDenom gRPC service @@ -263,8 +263,8 @@ export const MsgCreateDenom = { }, toAmino(message: MsgCreateDenom): MsgCreateDenomAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.subdenom = omitDefault(message.subdenom); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.subdenom = message.subdenom === "" ? undefined : message.subdenom; return obj; }, fromAminoMsg(object: MsgCreateDenomAminoMsg): MsgCreateDenom { @@ -358,7 +358,7 @@ export const MsgCreateDenomResponse = { }, toAmino(message: MsgCreateDenomResponse): MsgCreateDenomResponseAmino { const obj: any = {}; - obj.new_token_denom = omitDefault(message.newTokenDenom); + obj.new_token_denom = message.newTokenDenom === "" ? undefined : message.newTokenDenom; return obj; }, fromAminoMsg(object: MsgCreateDenomResponseAminoMsg): MsgCreateDenomResponse { @@ -470,7 +470,7 @@ export const MsgMint = { }, toAmino(message: MsgMint): MsgMintAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -657,7 +657,7 @@ export const MsgBurn = { }, toAmino(message: MsgBurn): MsgBurnAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.amount = message.amount ? Coin.toAmino(message.amount) : undefined; return obj; }, @@ -858,9 +858,9 @@ export const MsgChangeAdmin = { }, toAmino(message: MsgChangeAdmin): MsgChangeAdminAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.denom = omitDefault(message.denom); - obj.new_admin = omitDefault(message.newAdmin); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.denom = message.denom === "" ? undefined : message.denom; + obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, fromAminoMsg(object: MsgChangeAdminAminoMsg): MsgChangeAdmin { @@ -1046,7 +1046,7 @@ export const MsgSetDenomMetadata = { }, toAmino(message: MsgSetDenomMetadata): MsgSetDenomMetadataAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.metadata = message.metadata ? Metadata.toAmino(message.metadata) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts index c0351f54b7..6a972ec472 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/genesis.ts @@ -1,7 +1,7 @@ import { Duration, DurationSDKType } from "../../../google/protobuf/duration"; import { TwapRecord, TwapRecordSDKType } from "./twap_record"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.twap.v1beta1"; /** Params holds parameters for the twap module */ export interface Params { @@ -120,7 +120,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.prune_epoch_identifier = omitDefault(message.pruneEpochIdentifier); + obj.prune_epoch_identifier = message.pruneEpochIdentifier === "" ? undefined : message.pruneEpochIdentifier; obj.record_history_keep_period = message.recordHistoryKeepPeriod ? Duration.toAmino(message.recordHistoryKeepPeriod) : undefined; return obj; }, @@ -242,7 +242,7 @@ export const GenesisState = { if (message.twaps) { obj.twaps = message.twaps.map(e => e ? TwapRecord.toAmino(e) : undefined); } else { - obj.twaps = []; + obj.twaps = message.twaps; } obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts index 2cce0d9899..27961fa180 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Params, ParamsSDKType } from "./genesis"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; export interface ArithmeticTwapRequest { @@ -210,8 +210,8 @@ export const ArithmeticTwapRequest = { toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; return obj; @@ -307,7 +307,7 @@ export const ArithmeticTwapResponse = { }, toAmino(message: ArithmeticTwapResponse): ArithmeticTwapResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapResponseAminoMsg): ArithmeticTwapResponse { @@ -452,8 +452,8 @@ export const ArithmeticTwapToNowRequest = { toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.base_asset = message.baseAsset; - obj.quote_asset = message.quoteAsset; + obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; + obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; return obj; }, @@ -548,7 +548,7 @@ export const ArithmeticTwapToNowResponse = { }, toAmino(message: ArithmeticTwapToNowResponse): ArithmeticTwapToNowResponseAmino { const obj: any = {}; - obj.arithmetic_twap = message.arithmeticTwap; + obj.arithmetic_twap = padDecimal(message.arithmeticTwap) === "" ? undefined : padDecimal(message.arithmeticTwap); return obj; }, fromAminoMsg(object: ArithmeticTwapToNowResponseAminoMsg): ArithmeticTwapToNowResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts index 4ea22c0220..59fcabcc49 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts @@ -1,6 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { toTimestamp, fromTimestamp, isSet, DeepPartial } from "../../../helpers"; +import { toTimestamp, fromTimestamp, isSet, DeepPartial, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.twap.v1beta1"; /** @@ -283,14 +283,14 @@ export const TwapRecord = { toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.asset0_denom = message.asset0Denom; - obj.asset1_denom = message.asset1Denom; - obj.height = message.height ? message.height.toString() : undefined; + obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; + obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; + obj.height = message.height ? message.height.toString() : "0"; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.p0_last_spot_price = message.p0LastSpotPrice; - obj.p1_last_spot_price = message.p1LastSpotPrice; - obj.p0_arithmetic_twap_accumulator = message.p0ArithmeticTwapAccumulator; - obj.p1_arithmetic_twap_accumulator = message.p1ArithmeticTwapAccumulator; + obj.p0_last_spot_price = padDecimal(message.p0LastSpotPrice) === "" ? undefined : padDecimal(message.p0LastSpotPrice); + obj.p1_last_spot_price = padDecimal(message.p1LastSpotPrice) === "" ? undefined : padDecimal(message.p1LastSpotPrice); + obj.p0_arithmetic_twap_accumulator = padDecimal(message.p0ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p0ArithmeticTwapAccumulator); + obj.p1_arithmetic_twap_accumulator = padDecimal(message.p1ArithmeticTwapAccumulator) === "" ? undefined : padDecimal(message.p1ArithmeticTwapAccumulator); obj.last_error_time = message.lastErrorTime ? Timestamp.toAmino(toTimestamp(message.lastErrorTime)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts index 50c80cbc10..4a8467c23d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * FeeToken is a struct that specifies a coin denom, and pool ID pair. @@ -112,8 +112,8 @@ export const FeeToken = { }, toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); - obj.poolID = omitDefault(message.poolID); + obj.denom = message.denom === "" ? undefined : message.denom; + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts index 7b14937356..871256595a 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/genesis.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** GenesisState defines the txfees module's genesis state. */ export interface GenesisState { @@ -107,11 +107,11 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.basedenom = omitDefault(message.basedenom); + obj.basedenom = message.basedenom === "" ? undefined : message.basedenom; if (message.feetokens) { obj.feetokens = message.feetokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.feetokens = []; + obj.feetokens = message.feetokens; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts index d0a0d59e89..7dcaf01d98 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/gov.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "osmosis.txfees.v1beta1"; /** * UpdateFeeTokenProposal is a gov Content type for adding a new whitelisted fee @@ -133,8 +133,8 @@ export const UpdateFeeTokenProposal = { }, toAmino(message: UpdateFeeTokenProposal): UpdateFeeTokenProposalAmino { const obj: any = {}; - obj.title = omitDefault(message.title); - obj.description = omitDefault(message.description); + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; obj.feetoken = message.feetoken ? FeeToken.toAmino(message.feetoken) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts index 50af130dce..e2484fa928 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts @@ -1,6 +1,6 @@ import { FeeToken, FeeTokenSDKType } from "./feetoken"; import { BinaryReader, BinaryWriter } from "../../../binary"; -import { DeepPartial, isSet, omitDefault, padDecimal } from "../../../helpers"; +import { DeepPartial, isSet, padDecimal } from "../../../helpers"; import { Decimal } from "@cosmjs/math"; export const protobufPackage = "osmosis.txfees.v1beta1"; export interface QueryFeeTokensRequest {} @@ -245,7 +245,7 @@ export const QueryFeeTokensResponse = { if (message.feeTokens) { obj.fee_tokens = message.feeTokens.map(e => e ? FeeToken.toAmino(e) : undefined); } else { - obj.fee_tokens = []; + obj.fee_tokens = message.feeTokens; } return obj; }, @@ -340,7 +340,7 @@ export const QueryDenomSpotPriceRequest = { }, toAmino(message: QueryDenomSpotPriceRequest): QueryDenomSpotPriceRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomSpotPriceRequestAminoMsg): QueryDenomSpotPriceRequest { @@ -452,8 +452,8 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); - obj.spot_price = padDecimal(message.spotPrice); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.spot_price = padDecimal(message.spotPrice) === "" ? undefined : padDecimal(message.spotPrice); return obj; }, fromAminoMsg(object: QueryDenomSpotPriceResponseAminoMsg): QueryDenomSpotPriceResponse { @@ -547,7 +547,7 @@ export const QueryDenomPoolIdRequest = { }, toAmino(message: QueryDenomPoolIdRequest): QueryDenomPoolIdRequestAmino { const obj: any = {}; - obj.denom = omitDefault(message.denom); + obj.denom = message.denom === "" ? undefined : message.denom; return obj; }, fromAminoMsg(object: QueryDenomPoolIdRequestAminoMsg): QueryDenomPoolIdRequest { @@ -643,7 +643,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = omitDefault(message.poolID); + obj.poolID = message.poolID ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { @@ -811,7 +811,7 @@ export const QueryBaseDenomResponse = { }, toAmino(message: QueryBaseDenomResponse): QueryBaseDenomResponseAmino { const obj: any = {}; - obj.base_denom = omitDefault(message.baseDenom); + obj.base_denom = message.baseDenom === "" ? undefined : message.baseDenom; return obj; }, fromAminoMsg(object: QueryBaseDenomResponseAminoMsg): QueryBaseDenomResponse { diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts index 50923a519e..04a1eac3b4 100644 --- a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts @@ -1342,7 +1342,7 @@ export const RequestEcho = { }, toAmino(message: RequestEcho): RequestEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: RequestEchoAminoMsg): RequestEcho { @@ -1534,7 +1534,7 @@ export const RequestInfo = { }, toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; - obj.version = message.version; + obj.version = message.version === "" ? undefined : message.version; obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; return obj; @@ -1640,8 +1640,8 @@ export const RequestSetOption = { }, toAmino(message: RequestSetOption): RequestSetOptionAmino { const obj: any = {}; - obj.key = message.key; - obj.value = message.value; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value === "" ? undefined : message.value; return obj; }, fromAminoMsg(object: RequestSetOptionAminoMsg): RequestSetOption { @@ -1820,12 +1820,12 @@ export const RequestInitChain = { toAmino(message: RequestInitChain): RequestInitChainAmino { const obj: any = {}; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.consensus_params = message.consensusParams ? ConsensusParams.toAmino(message.consensusParams) : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; @@ -1967,9 +1967,9 @@ export const RequestQuery = { toAmino(message: RequestQuery): RequestQueryAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.path = message.path; + obj.path = message.path === "" ? undefined : message.path; obj.height = message.height ? message.height.toString() : undefined; - obj.prove = message.prove; + obj.prove = message.prove === false ? undefined : message.prove; return obj; }, fromAminoMsg(object: RequestQueryAminoMsg): RequestQuery { @@ -2121,7 +2121,7 @@ export const RequestBeginBlock = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } return obj; }, @@ -2220,14 +2220,14 @@ export const RequestCheckTx = { message.tx = bytesFromBase64(object.tx); } if (object.type !== undefined && object.type !== null) { - message.type = checkTxTypeFromJSON(object.type); + message.type = object.type; } return message; }, toAmino(message: RequestCheckTx): RequestCheckTxAmino { const obj: any = {}; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; - obj.type = checkTxTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; return obj; }, fromAminoMsg(object: RequestCheckTxAminoMsg): RequestCheckTx { @@ -2771,8 +2771,8 @@ export const RequestLoadSnapshotChunk = { toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunk = message.chunk; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; }, fromAminoMsg(object: RequestLoadSnapshotChunkAminoMsg): RequestLoadSnapshotChunk { @@ -2892,9 +2892,9 @@ export const RequestApplySnapshotChunk = { }, toAmino(message: RequestApplySnapshotChunk): RequestApplySnapshotChunkAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.chunk = message.chunk ? base64FromBytes(message.chunk) : undefined; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; return obj; }, fromAminoMsg(object: RequestApplySnapshotChunkAminoMsg): RequestApplySnapshotChunk { @@ -3357,7 +3357,7 @@ export const ResponseException = { }, toAmino(message: ResponseException): ResponseExceptionAmino { const obj: any = {}; - obj.error = message.error; + obj.error = message.error === "" ? undefined : message.error; return obj; }, fromAminoMsg(object: ResponseExceptionAminoMsg): ResponseException { @@ -3445,7 +3445,7 @@ export const ResponseEcho = { }, toAmino(message: ResponseEcho): ResponseEchoAmino { const obj: any = {}; - obj.message = message.message; + obj.message = message.message === "" ? undefined : message.message; return obj; }, fromAminoMsg(object: ResponseEchoAminoMsg): ResponseEcho { @@ -3669,8 +3669,8 @@ export const ResponseInfo = { }, toAmino(message: ResponseInfo): ResponseInfoAmino { const obj: any = {}; - obj.data = message.data; - obj.version = message.version; + obj.data = message.data === "" ? undefined : message.data; + obj.version = message.version === "" ? undefined : message.version; obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; @@ -3793,9 +3793,9 @@ export const ResponseSetOption = { }, toAmino(message: ResponseSetOption): ResponseSetOptionAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; return obj; }, fromAminoMsg(object: ResponseSetOptionAminoMsg): ResponseSetOption { @@ -3927,7 +3927,7 @@ export const ResponseInitChain = { if (message.validators) { obj.validators = message.validators.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.app_hash = message.appHash ? base64FromBytes(message.appHash) : undefined; return obj; @@ -4151,15 +4151,15 @@ export const ResponseQuery = { }, toAmino(message: ResponseQuery): ResponseQueryAmino { const obj: any = {}; - obj.code = message.code; - obj.log = message.log; - obj.info = message.info; + obj.code = message.code === 0 ? undefined : message.code; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.index = message.index ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; obj.height = message.height ? message.height.toString() : undefined; - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseQueryAminoMsg): ResponseQuery { @@ -4256,7 +4256,7 @@ export const ResponseBeginBlock = { if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -4467,18 +4467,18 @@ export const ResponseCheckTx = { }, toAmino(message: ResponseCheckTx): ResponseCheckTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseCheckTxAminoMsg): ResponseCheckTx { @@ -4688,18 +4688,18 @@ export const ResponseDeliverTx = { }, toAmino(message: ResponseDeliverTx): ResponseDeliverTxAmino { const obj: any = {}; - obj.code = message.code; + obj.code = message.code === 0 ? undefined : message.code; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.log = message.log; - obj.info = message.info; + obj.log = message.log === "" ? undefined : message.log; + obj.info = message.info === "" ? undefined : message.info; obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } - obj.codespace = message.codespace; + obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, fromAminoMsg(object: ResponseDeliverTxAminoMsg): ResponseDeliverTx { @@ -4836,13 +4836,13 @@ export const ResponseEndBlock = { if (message.validatorUpdates) { obj.validator_updates = message.validatorUpdates.map(e => e ? ValidatorUpdate.toAmino(e) : undefined); } else { - obj.validator_updates = []; + obj.validator_updates = message.validatorUpdates; } obj.consensus_param_updates = message.consensusParamUpdates ? ConsensusParams.toAmino(message.consensusParamUpdates) : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { - obj.events = []; + obj.events = message.events; } return obj; }, @@ -5047,7 +5047,7 @@ export const ResponseListSnapshots = { if (message.snapshots) { obj.snapshots = message.snapshots.map(e => e ? Snapshot.toAmino(e) : undefined); } else { - obj.snapshots = []; + obj.snapshots = message.snapshots; } return obj; }, @@ -5130,13 +5130,13 @@ export const ResponseOfferSnapshot = { fromAmino(object: ResponseOfferSnapshotAmino): ResponseOfferSnapshot { const message = createBaseResponseOfferSnapshot(); if (object.result !== undefined && object.result !== null) { - message.result = responseOfferSnapshot_ResultFromJSON(object.result); + message.result = object.result; } return message; }, toAmino(message: ResponseOfferSnapshot): ResponseOfferSnapshotAmino { const obj: any = {}; - obj.result = responseOfferSnapshot_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; return obj; }, fromAminoMsg(object: ResponseOfferSnapshotAminoMsg): ResponseOfferSnapshot { @@ -5357,7 +5357,7 @@ export const ResponseApplySnapshotChunk = { fromAmino(object: ResponseApplySnapshotChunkAmino): ResponseApplySnapshotChunk { const message = createBaseResponseApplySnapshotChunk(); if (object.result !== undefined && object.result !== null) { - message.result = responseApplySnapshotChunk_ResultFromJSON(object.result); + message.result = object.result; } message.refetchChunks = object.refetch_chunks?.map(e => e) || []; message.rejectSenders = object.reject_senders?.map(e => e) || []; @@ -5365,16 +5365,16 @@ export const ResponseApplySnapshotChunk = { }, toAmino(message: ResponseApplySnapshotChunk): ResponseApplySnapshotChunkAmino { const obj: any = {}; - obj.result = responseApplySnapshotChunk_ResultToJSON(message.result); + obj.result = message.result === 0 ? undefined : message.result; if (message.refetchChunks) { obj.refetch_chunks = message.refetchChunks.map(e => e); } else { - obj.refetch_chunks = []; + obj.refetch_chunks = message.refetchChunks; } if (message.rejectSenders) { obj.reject_senders = message.rejectSenders.map(e => e); } else { - obj.reject_senders = []; + obj.reject_senders = message.rejectSenders; } return obj; }, @@ -5741,11 +5741,11 @@ export const LastCommitInfo = { }, toAmino(message: LastCommitInfo): LastCommitInfoAmino { const obj: any = {}; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; if (message.votes) { obj.votes = message.votes.map(e => e ? VoteInfo.toAmino(e) : undefined); } else { - obj.votes = []; + obj.votes = message.votes; } return obj; }, @@ -5856,11 +5856,11 @@ export const Event = { }, toAmino(message: Event): EventAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; if (message.attributes) { obj.attributes = message.attributes.map(e => e ? EventAttribute.toAmino(e) : undefined); } else { - obj.attributes = []; + obj.attributes = message.attributes; } return obj; }, @@ -5983,7 +5983,7 @@ export const EventAttribute = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.index = message.index; + obj.index = message.index === false ? undefined : message.index; return obj; }, fromAminoMsg(object: EventAttributeAminoMsg): EventAttribute { @@ -6124,7 +6124,7 @@ export const TxResult = { toAmino(message: TxResult): TxResultAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; return obj; @@ -6449,7 +6449,7 @@ export const VoteInfo = { toAmino(message: VoteInfo): VoteInfoAmino { const obj: any = {}; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.signed_last_block = message.signedLastBlock; + obj.signed_last_block = message.signedLastBlock === false ? undefined : message.signedLastBlock; return obj; }, fromAminoMsg(object: VoteInfoAminoMsg): VoteInfo { @@ -6589,7 +6589,7 @@ export const Evidence = { fromAmino(object: EvidenceAmino): Evidence { const message = createBaseEvidence(); if (object.type !== undefined && object.type !== null) { - message.type = evidenceTypeFromJSON(object.type); + message.type = object.type; } if (object.validator !== undefined && object.validator !== null) { message.validator = Validator.fromAmino(object.validator); @@ -6607,7 +6607,7 @@ export const Evidence = { }, toAmino(message: Evidence): EvidenceAmino { const obj: any = {}; - obj.type = evidenceTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; @@ -6766,8 +6766,8 @@ export const Snapshot = { toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.format = message.format; - obj.chunks = message.chunks; + obj.format = message.format === 0 ? undefined : message.format; + obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; obj.metadata = message.metadata ? base64FromBytes(message.metadata) : undefined; return obj; diff --git a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts index 8cdc44a66c..6393e6860c 100644 --- a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts @@ -214,7 +214,7 @@ export const Proof = { if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); } else { - obj.aunts = []; + obj.aunts = message.aunts; } return obj; }, @@ -442,9 +442,9 @@ export const DominoOp = { }, toAmino(message: DominoOp): DominoOpAmino { const obj: any = {}; - obj.key = message.key; - obj.input = message.input; - obj.output = message.output; + obj.key = message.key === "" ? undefined : message.key; + obj.input = message.input === "" ? undefined : message.input; + obj.output = message.output === "" ? undefined : message.output; return obj; }, fromAminoMsg(object: DominoOpAminoMsg): DominoOp { @@ -564,7 +564,7 @@ export const ProofOp = { }, toAmino(message: ProofOp): ProofOpAmino { const obj: any = {}; - obj.type = message.type; + obj.type = message.type === "" ? undefined : message.type; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; @@ -663,7 +663,7 @@ export const ProofOps = { if (message.ops) { obj.ops = message.ops.map(e => e ? ProofOp.toAmino(e) : undefined); } else { - obj.ops = []; + obj.ops = message.ops; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts index 8baf7cc8ea..ca7ef79b7b 100644 --- a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../../helpers"; +import { isSet, DeepPartial } from "../../../helpers"; export const protobufPackage = "tendermint.libs.bits"; export interface BitArray { bits: bigint; @@ -115,11 +115,11 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = omitDefault(message.bits); + obj.bits = message.bits ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { - obj.elems = []; + obj.elems = message.elems; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts index 87704a15a3..2303697558 100644 --- a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts @@ -396,12 +396,12 @@ export const NodeInfo = { toAmino(message: NodeInfo): NodeInfoAmino { const obj: any = {}; obj.protocol_version = message.protocolVersion ? ProtocolVersion.toAmino(message.protocolVersion) : undefined; - obj.node_id = message.nodeId; - obj.listen_addr = message.listenAddr; - obj.network = message.network; - obj.version = message.version; + obj.node_id = message.nodeId === "" ? undefined : message.nodeId; + obj.listen_addr = message.listenAddr === "" ? undefined : message.listenAddr; + obj.network = message.network === "" ? undefined : message.network; + obj.version = message.version === "" ? undefined : message.version; obj.channels = message.channels ? base64FromBytes(message.channels) : undefined; - obj.moniker = message.moniker; + obj.moniker = message.moniker === "" ? undefined : message.moniker; obj.other = message.other ? NodeInfoOther.toAmino(message.other) : undefined; return obj; }, @@ -506,8 +506,8 @@ export const NodeInfoOther = { }, toAmino(message: NodeInfoOther): NodeInfoOtherAmino { const obj: any = {}; - obj.tx_index = message.txIndex; - obj.rpc_address = message.rpcAddress; + obj.tx_index = message.txIndex === "" ? undefined : message.txIndex; + obj.rpc_address = message.rpcAddress === "" ? undefined : message.rpcAddress; return obj; }, fromAminoMsg(object: NodeInfoOtherAminoMsg): NodeInfoOther { @@ -633,11 +633,11 @@ export const PeerInfo = { }, toAmino(message: PeerInfo): PeerInfoAmino { const obj: any = {}; - obj.id = message.id; + obj.id = message.id === "" ? undefined : message.id; if (message.addressInfo) { obj.address_info = message.addressInfo.map(e => e ? PeerAddressInfo.toAmino(e) : undefined); } else { - obj.address_info = []; + obj.address_info = message.addressInfo; } obj.last_connected = message.lastConnected ? Timestamp.toAmino(toTimestamp(message.lastConnected)) : undefined; return obj; @@ -775,10 +775,10 @@ export const PeerAddressInfo = { }, toAmino(message: PeerAddressInfo): PeerAddressInfoAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.last_dial_success = message.lastDialSuccess ? Timestamp.toAmino(toTimestamp(message.lastDialSuccess)) : undefined; obj.last_dial_failure = message.lastDialFailure ? Timestamp.toAmino(toTimestamp(message.lastDialFailure)) : undefined; - obj.dial_failures = message.dialFailures; + obj.dial_failures = message.dialFailures === 0 ? undefined : message.dialFailures; return obj; }, fromAminoMsg(object: PeerAddressInfoAminoMsg): PeerAddressInfo { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts index a9ad7c29eb..5543313c32 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts @@ -489,7 +489,7 @@ export const LightClientAttackEvidence = { if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.byzantine_validators = []; + obj.byzantine_validators = message.byzantineValidators; } obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -589,7 +589,7 @@ export const EvidenceList = { if (message.evidence) { obj.evidence = message.evidence.map(e => e ? Evidence.toAmino(e) : undefined); } else { - obj.evidence = []; + obj.evidence = message.evidence; } return obj; }, diff --git a/__fixtures__/v-next/outputv4/tendermint/types/params.ts b/__fixtures__/v-next/outputv4/tendermint/types/params.ts index 3fb9fd0d7a..7ac17d0710 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/params.ts @@ -1,6 +1,6 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.types"; /** * ConsensusParams contains consensus critical parameters that determine the @@ -396,9 +396,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = omitDefault(message.maxBytes); - obj.max_gas = omitDefault(message.maxGas); - obj.time_iota_ms = omitDefault(message.timeIotaMs); + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -524,9 +524,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = omitDefault(message.maxAgeNumBlocks); + obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = omitDefault(message.maxBytes); + obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -623,7 +623,7 @@ export const ValidatorParams = { if (message.pubKeyTypes) { obj.pub_key_types = message.pubKeyTypes.map(e => e); } else { - obj.pub_key_types = []; + obj.pub_key_types = message.pubKeyTypes; } return obj; }, @@ -714,7 +714,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = omitDefault(message.appVersion); + obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -822,8 +822,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = omitDefault(message.blockMaxBytes); - obj.block_max_gas = omitDefault(message.blockMaxGas); + obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/types.ts b/__fixtures__/v-next/outputv4/tendermint/types/types.ts index c0418b78ed..1c6e685520 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/types.ts @@ -433,7 +433,7 @@ export const PartSetHeader = { }, toAmino(message: PartSetHeader): PartSetHeaderAmino { const obj: any = {}; - obj.total = message.total; + obj.total = message.total === 0 ? undefined : message.total; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, @@ -556,7 +556,7 @@ export const Part = { }, toAmino(message: Part): PartAmino { const obj: any = {}; - obj.index = message.index; + obj.index = message.index === 0 ? undefined : message.index; obj.bytes = message.bytes ? base64FromBytes(message.bytes) : undefined; obj.proof = message.proof ? Proof.toAmino(message.proof) : undefined; return obj; @@ -968,7 +968,7 @@ export const Header = { toAmino(message: Header): HeaderAmino { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; - obj.chain_id = message.chainId; + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.height = message.height ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; @@ -1077,7 +1077,7 @@ export const Data = { if (message.txs) { obj.txs = message.txs.map(e => base64FromBytes(e)); } else { - obj.txs = []; + obj.txs = message.txs; } return obj; }, @@ -1255,7 +1255,7 @@ export const Vote = { fromAmino(object: VoteAmino): Vote { const message = createBaseVote(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1282,13 +1282,13 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; - obj.validator_index = message.validatorIndex; + obj.validator_index = message.validatorIndex === 0 ? undefined : message.validatorIndex; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; return obj; }, @@ -1436,12 +1436,12 @@ export const Commit = { toAmino(message: Commit): CommitAmino { const obj: any = {}; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; + obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { obj.signatures = message.signatures.map(e => e ? CommitSig.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -1563,7 +1563,7 @@ export const CommitSig = { fromAmino(object: CommitSigAmino): CommitSig { const message = createBaseCommitSig(); if (object.block_id_flag !== undefined && object.block_id_flag !== null) { - message.blockIdFlag = blockIDFlagFromJSON(object.block_id_flag); + message.blockIdFlag = object.block_id_flag; } if (object.validator_address !== undefined && object.validator_address !== null) { message.validatorAddress = bytesFromBase64(object.validator_address); @@ -1578,7 +1578,7 @@ export const CommitSig = { }, toAmino(message: CommitSig): CommitSigAmino { const obj: any = {}; - obj.block_id_flag = blockIDFlagToJSON(message.blockIdFlag); + obj.block_id_flag = message.blockIdFlag === 0 ? undefined : message.blockIdFlag; obj.validator_address = message.validatorAddress ? base64FromBytes(message.validatorAddress) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; @@ -1745,7 +1745,7 @@ export const Proposal = { fromAmino(object: ProposalAmino): Proposal { const message = createBaseProposal(); if (object.type !== undefined && object.type !== null) { - message.type = signedMsgTypeFromJSON(object.type); + message.type = object.type; } if (object.height !== undefined && object.height !== null) { message.height = BigInt(object.height); @@ -1769,10 +1769,10 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.type = signedMsgTypeToJSON(message.type); + obj.type = message.type === 0 ? undefined : message.type; obj.height = message.height ? message.height.toString() : undefined; - obj.round = message.round; - obj.pol_round = message.polRound; + obj.round = message.round === 0 ? undefined : message.round; + obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; diff --git a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts index 1f2429e701..e4dcd1df7b 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts @@ -1,6 +1,6 @@ import { PublicKey, PublicKeySDKType } from "../crypto/keys"; import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault, bytesFromBase64, base64FromBytes } from "../../helpers"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../helpers"; export const protobufPackage = "tendermint.types"; export interface ValidatorSet { validators: Validator[]; @@ -158,10 +158,10 @@ export const ValidatorSet = { if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { - obj.validators = []; + obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = omitDefault(message.totalVotingPower); + obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -305,8 +305,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); - obj.proposer_priority = omitDefault(message.proposerPriority); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -415,7 +415,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = omitDefault(message.votingPower); + obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv4/tendermint/version/types.ts b/__fixtures__/v-next/outputv4/tendermint/version/types.ts index 430acfed5b..a4fa8adb2e 100644 --- a/__fixtures__/v-next/outputv4/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/version/types.ts @@ -1,5 +1,5 @@ import { BinaryReader, BinaryWriter } from "../../binary"; -import { isSet, DeepPartial, omitDefault } from "../../helpers"; +import { isSet, DeepPartial } from "../../helpers"; export const protobufPackage = "tendermint.version"; /** * App includes the protocol and software version for the application. @@ -132,8 +132,8 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = omitDefault(message.protocol); - obj.software = omitDefault(message.software); + obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.software = message.software === "" ? undefined : message.software; return obj; }, fromAminoMsg(object: AppAminoMsg): App { @@ -241,8 +241,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = omitDefault(message.block); - obj.app = omitDefault(message.app); + obj.block = message.block ? message.block.toString() : undefined; + obj.app = message.app ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap index d1f0725087..f0aab1797e 100644 --- a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap @@ -19,7 +19,7 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` }: MsgDoFunThingAminoType["value"]): MsgDoFunThing => { return { address, - myEnumField: fancyEnumTypeFromJSON(myEnumField) + myEnumField: myEnumField == null ? myEnumField : fancyEnumTypeFromJSON(myEnumField) }; } } diff --git a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap index 6b9051ee98..f6f4737e0d 100644 --- a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap @@ -88,9 +88,9 @@ exports[`cosmos/staking/v1beta1 Delegation 1`] = ` }, toAmino(message: Delegation): DelegationAmino { const obj: any = {}; - obj.delegator_address = message.delegatorAddress; - obj.validator_address = message.validatorAddress; - obj.shares = message.shares; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; + obj.shares = padDecimal(message.shares) === "" ? undefined : padDecimal(message.shares); return obj; }, fromAminoMsg(object: DelegationAminoMsg): Delegation { @@ -303,7 +303,7 @@ exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptors 1`] = ` if (message.signatures) { obj.signatures = message.signatures.map(e => e ? SignatureDescriptor.toAmino(e) : undefined); } else { - obj.signatures = []; + obj.signatures = message.signatures; } return obj; }, @@ -424,7 +424,7 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` message.signDoc = SignDocDirectAux.fromAmino(object.sign_doc); } if (object.mode !== undefined && object.mode !== null) { - message.mode = signModeFromJSON(object.mode); + message.mode = object.mode; } if (object.sig !== undefined && object.sig !== null) { message.sig = bytesFromBase64(object.sig); @@ -433,9 +433,9 @@ exports[`cosmos/tx/v1beta1/tx AuxSignerData 1`] = ` }, toAmino(message: AuxSignerData): AuxSignerDataAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.sign_doc = message.signDoc ? SignDocDirectAux.toAmino(message.signDoc) : undefined; - obj.mode = signModeToJSON(message.mode); + obj.mode = message.mode === 0 ? undefined : message.mode; obj.sig = message.sig ? base64FromBytes(message.sig) : undefined; return obj; }, @@ -668,12 +668,12 @@ exports[`cosmwasm/wasm/v1/proposal 1`] = ` }, toAmino(message: PinCodesProposal): PinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -804,12 +804,12 @@ exports[`cosmwasm/wasm/v1/proposal 2`] = ` }, toAmino(message: UnpinCodesProposal): UnpinCodesProposalAmino { const obj: any = {}; - obj.title = message.title; - obj.description = message.description; + obj.title = message.title === "" ? undefined : message.title; + obj.description = message.description === "" ? undefined : message.description; if (message.codeIds) { obj.code_ids = message.codeIds.map(e => e.toString()); } else { - obj.code_ids = []; + obj.code_ids = message.codeIds; } return obj; }, @@ -911,7 +911,7 @@ exports[`cosmwasm/wasm/v1/query 1`] = ` }, toAmino(message: QueryRawContractStateRequest): QueryRawContractStateRequestAmino { const obj: any = {}; - obj.address = message.address; + obj.address = message.address === "" ? undefined : message.address; obj.query_data = message.queryData ? base64FromBytes(message.queryData) : undefined; return obj; }, @@ -1056,13 +1056,13 @@ exports[`evmos/fees/v1/tx 1`] = ` }, toAmino(message: MsgRegisterDevFeeInfo): MsgRegisterDevFeeInfoAmino { const obj: any = {}; - obj.contract_address = message.contractAddress; - obj.deployer_address = message.deployerAddress; - obj.withdraw_address = message.withdrawAddress; + obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; + obj.deployer_address = message.deployerAddress === "" ? undefined : message.deployerAddress; + obj.withdraw_address = message.withdrawAddress === "" ? undefined : message.withdrawAddress; if (message.nonces) { obj.nonces = message.nonces.map(e => e.toString()); } else { - obj.nonces = []; + obj.nonces = message.nonces; } return obj; }, @@ -1186,10 +1186,10 @@ exports[`google/api/expr/conformance/v1alpha1/conformance_service ParseRequest 1 }, toAmino(message: ParseRequest): ParseRequestAmino { const obj: any = {}; - obj.cel_source = message.celSource; - obj.syntax_version = message.syntaxVersion; - obj.source_location = message.sourceLocation; - obj.disable_macros = message.disableMacros; + obj.cel_source = message.celSource === "" ? undefined : message.celSource; + obj.syntax_version = message.syntaxVersion === "" ? undefined : message.syntaxVersion; + obj.source_location = message.sourceLocation === "" ? undefined : message.sourceLocation; + obj.disable_macros = message.disableMacros === false ? undefined : message.disableMacros; return obj; }, fromAminoMsg(object: ParseRequestAminoMsg): ParseRequest { @@ -1352,20 +1352,20 @@ exports[`google/api/expr/v1alpha1/checked Decl_FunctionDecl_Overload MapType 1`] }, toAmino(message: Decl_FunctionDecl_Overload): Decl_FunctionDecl_OverloadAmino { const obj: any = {}; - obj.overload_id = message.overloadId; + obj.overload_id = message.overloadId === "" ? undefined : message.overloadId; if (message.params) { obj.params = message.params.map(e => e ? Type.toAmino(e) : undefined); } else { - obj.params = []; + obj.params = message.params; } if (message.typeParams) { obj.type_params = message.typeParams.map(e => e); } else { - obj.type_params = []; + obj.type_params = message.typeParams; } obj.result_type = message.resultType ? Type.toAmino(message.resultType) : undefined; - obj.is_instance_function = message.isInstanceFunction; - obj.doc = message.doc; + obj.is_instance_function = message.isInstanceFunction === false ? undefined : message.isInstanceFunction; + obj.doc = message.doc === "" ? undefined : message.doc; return obj; }, fromAminoMsg(object: Decl_FunctionDecl_OverloadAminoMsg): Decl_FunctionDecl_Overload { @@ -1575,16 +1575,16 @@ exports[`google/api/expr/v1alpha1/checked Type 1`] = ` message.dyn = Empty.fromAmino(object.dyn); } if (object.null !== undefined && object.null !== null) { - message.null = nullValueFromJSON(object.null); + message.null = object.null; } if (object.primitive !== undefined && object.primitive !== null) { - message.primitive = type_PrimitiveTypeFromJSON(object.primitive); + message.primitive = object.primitive; } if (object.wrapper !== undefined && object.wrapper !== null) { - message.wrapper = type_PrimitiveTypeFromJSON(object.wrapper); + message.wrapper = object.wrapper; } if (object.well_known !== undefined && object.well_known !== null) { - message.wellKnown = type_WellKnownTypeFromJSON(object.well_known); + message.wellKnown = object.well_known; } if (object.list_type !== undefined && object.list_type !== null) { message.listType = Type_ListType.fromAmino(object.list_type); @@ -1615,15 +1615,15 @@ exports[`google/api/expr/v1alpha1/checked Type 1`] = ` toAmino(message: Type): TypeAmino { const obj: any = {}; obj.dyn = message.dyn ? Empty.toAmino(message.dyn) : undefined; - obj.null = nullValueToJSON(message.null); - obj.primitive = type_PrimitiveTypeToJSON(message.primitive); - obj.wrapper = type_PrimitiveTypeToJSON(message.wrapper); - obj.well_known = type_WellKnownTypeToJSON(message.wellKnown); + obj.null = message.null === null ? undefined : message.null; + obj.primitive = message.primitive === null ? undefined : message.primitive; + obj.wrapper = message.wrapper === null ? undefined : message.wrapper; + obj.well_known = message.wellKnown === null ? undefined : message.wellKnown; obj.list_type = message.listType ? Type_ListType.toAmino(message.listType) : undefined; obj.map_type = message.mapType ? Type_MapType.toAmino(message.mapType) : undefined; obj.function = message.function ? Type_FunctionType.toAmino(message.function) : undefined; - obj.message_type = message.messageType; - obj.type_param = message.typeParam; + obj.message_type = message.messageType === null ? undefined : message.messageType; + obj.type_param = message.typeParam === null ? undefined : message.typeParam; obj.type = message.type ? Type.toAmino(message.type) : undefined; obj.error = message.error ? Empty.toAmino(message.error) : undefined; obj.abstract_type = message.abstractType ? Type_AbstractType.toAmino(message.abstractType) : undefined; @@ -1948,7 +1948,7 @@ exports[`google/api/expr/v1alpha1/checked typeHash (Long) CheckedExpr 1`] = ` }); } obj.source_info = message.sourceInfo ? SourceInfo.toAmino(message.sourceInfo) : undefined; - obj.expr_version = message.exprVersion; + obj.expr_version = message.exprVersion === "" ? undefined : message.exprVersion; obj.expr = message.expr ? Expr.toAmino(message.expr) : undefined; return obj; }, @@ -2116,7 +2116,7 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` fromAmino(object: ConstantAmino): Constant { const message = createBaseConstant(); if (object.null_value !== undefined && object.null_value !== null) { - message.nullValue = nullValueFromJSON(object.null_value); + message.nullValue = object.null_value; } if (object.bool_value !== undefined && object.bool_value !== null) { message.boolValue = object.bool_value; @@ -2146,12 +2146,12 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` }, toAmino(message: Constant): ConstantAmino { const obj: any = {}; - obj.null_value = nullValueToJSON(message.nullValue); - obj.bool_value = message.boolValue; + obj.null_value = message.nullValue === null ? undefined : message.nullValue; + obj.bool_value = message.boolValue === null ? undefined : message.boolValue; obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; - obj.double_value = message.doubleValue; - obj.string_value = message.stringValue; + obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; + obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; obj.duration_value = message.durationValue ? Duration.toAmino(message.durationValue) : undefined; obj.timestamp_value = message.timestampValue ? Timestamp.toAmino(toTimestamp(message.timestampValue)) : undefined; @@ -2342,7 +2342,7 @@ exports[`google/api/expr/v1alpha1/value MapValue 1`] = ` if (message.entries) { obj.entries = message.entries.map(e => e ? MapValue_Entry.toAmino(e) : undefined); } else { - obj.entries = []; + obj.entries = message.entries; } return obj; }, @@ -2507,11 +2507,11 @@ exports[`google/api/expr/v1beta1/source 1`] = ` }, toAmino(message: SourceInfo): SourceInfoAmino { const obj: any = {}; - obj.location = message.location; + obj.location = message.location === "" ? undefined : message.location; if (message.lineOffsets) { obj.line_offsets = message.lineOffsets.map(e => e); } else { - obj.line_offsets = []; + obj.line_offsets = message.lineOffsets; } obj.positions = {}; if (message.positions) { @@ -2651,7 +2651,7 @@ exports[`google/api/quota keyType 1`] = ` }, toAmino(message: MetricRule): MetricRuleAmino { const obj: any = {}; - obj.selector = message.selector; + obj.selector = message.selector === "" ? undefined : message.selector; obj.metric_costs = {}; if (message.metricCosts) { Object.entries(message.metricCosts).forEach(([k, v]) => { @@ -2894,7 +2894,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` message.timestamp = fromTimestamp(Timestamp.fromAmino(object.timestamp)); } if (object.severity !== undefined && object.severity !== null) { - message.severity = logSeverityFromJSON(object.severity); + message.severity = object.severity; } if (object.http_request !== undefined && object.http_request !== null) { message.httpRequest = HttpRequest.fromAmino(object.http_request); @@ -2932,12 +2932,12 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` }, toAmino(message: LogEntry): LogEntryAmino { const obj: any = {}; - obj.name = message.name; + obj.name = message.name === "" ? undefined : message.name; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; - obj.severity = logSeverityToJSON(message.severity); + obj.severity = message.severity === 0 ? undefined : message.severity; obj.http_request = message.httpRequest ? HttpRequest.toAmino(message.httpRequest) : undefined; - obj.trace = message.trace; - obj.insert_id = message.insertId; + obj.trace = message.trace === "" ? undefined : message.trace; + obj.insert_id = message.insertId === "" ? undefined : message.insertId; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -2945,7 +2945,7 @@ exports[`google/api/servicecontrol/v1/log_entry LogEntry 1`] = ` }); } obj.proto_payload = message.protoPayload ? Any.toAmino(message.protoPayload) : undefined; - obj.text_payload = message.textPayload; + obj.text_payload = message.textPayload === null ? undefined : message.textPayload; obj.struct_payload = message.structPayload ? Struct.toAmino(message.structPayload) : undefined; obj.operation = message.operation ? LogEntryOperation.toAmino(message.operation) : undefined; obj.source_location = message.sourceLocation ? LogEntrySourceLocation.toAmino(message.sourceLocation) : undefined; @@ -3052,7 +3052,7 @@ exports[`google/rpc/error_details name collisions 2`] = ` if (message.violations) { obj.violations = message.violations.map(e => e ? PreconditionFailure_Violation.toAmino(e) : undefined); } else { - obj.violations = []; + obj.violations = message.violations; } return obj; }, @@ -3178,7 +3178,7 @@ exports[`ibc/core/port/v1/query 1`] = ` message.connectionId = object.connection_id; } if (object.ordering !== undefined && object.ordering !== null) { - message.ordering = orderFromJSON(object.ordering); + message.ordering = object.ordering; } if (object.counterparty !== undefined && object.counterparty !== null) { message.counterparty = Counterparty.fromAmino(object.counterparty); @@ -3190,11 +3190,11 @@ exports[`ibc/core/port/v1/query 1`] = ` }, toAmino(message: QueryAppVersionRequest): QueryAppVersionRequestAmino { const obj: any = {}; - obj.port_id = message.portId; - obj.connection_id = message.connectionId; - obj.ordering = orderToJSON(message.ordering); + obj.port_id = message.portId === "" ? undefined : message.portId; + obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; + obj.ordering = message.ordering === 0 ? undefined : message.ordering; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.proposed_version = message.proposedVersion; + obj.proposed_version = message.proposedVersion === "" ? undefined : message.proposedVersion; return obj; }, fromAminoMsg(object: QueryAppVersionRequestAminoMsg): QueryAppVersionRequest { @@ -3285,22 +3285,12 @@ exports[`ibc/core/port/v1/query 2`] = ` "name": "Counterparty", "type": "typeImport", }, - { - "import": "ibc/core/channel/v1/channel.proto", - "name": "orderFromJSON", - "type": "fromJSONEnum", - }, { "import": "ibc/core/channel/v1/channel.proto", "importedAs": "Counterparty", "name": "Counterparty", "type": "typeImport", }, - { - "import": "ibc/core/channel/v1/channel.proto", - "name": "orderToJSON", - "type": "toJSONEnum", - }, { "import": "ibc/core/channel/v1/channel.proto", "importedAs": "Counterparty", @@ -3609,6 +3599,18 @@ exports[`ibc/core/types/v1/genesis name collisions 3`] = ` "name": "GenesisState", "type": "typeImport", }, + { + "import": "ibc/core/client/v1/genesis.proto", + "importedAs": "GenesisState1", + "name": "GenesisState", + "type": "typeImport", + }, + { + "import": "ibc/core/connection/v1/genesis.proto", + "importedAs": "GenesisState2", + "name": "GenesisState", + "type": "typeImport", + }, { "import": "ibc/core/connection/v1/genesis.proto", "importedAs": "GenesisState2", @@ -3621,6 +3623,12 @@ exports[`ibc/core/types/v1/genesis name collisions 3`] = ` "name": "GenesisState", "type": "typeImport", }, + { + "import": "ibc/core/channel/v1/genesis.proto", + "importedAs": "GenesisState3", + "name": "GenesisState", + "type": "typeImport", + }, ] `; @@ -3707,7 +3715,7 @@ exports[`osmosis/gamm/v1beta1/query 1`] = ` if (message.pools) { obj.pools = message.pools.map(e => e ? Any.toAmino(e) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; @@ -3844,13 +3852,13 @@ exports[`osmosis/gamm/v1beta1/tx MsgJoinPool 1`] = ` }, toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.share_out_amount = message.shareOutAmount; + obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.token_in_maxs = []; + obj.token_in_maxs = message.tokenInMaxs; } return obj; }, @@ -3986,14 +3994,14 @@ exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountIn 1`] = ` }, toAmino(message: MsgSwapExactAmountIn): MsgSwapExactAmountInAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; - obj.token_out_min_amount = message.tokenOutMinAmount; + obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; return obj; }, fromAminoMsg(object: MsgSwapExactAmountInAminoMsg): MsgSwapExactAmountIn { @@ -4128,13 +4136,13 @@ exports[`osmosis/gamm/v1beta1/tx MsgSwapExactAmountOut 1`] = ` }, toAmino(message: MsgSwapExactAmountOut): MsgSwapExactAmountOutAmino { const obj: any = {}; - obj.sender = message.sender; + obj.sender = message.sender === "" ? undefined : message.sender; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { - obj.routes = []; + obj.routes = message.routes; } - obj.token_in_max_amount = message.tokenInMaxAmount; + obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; return obj; }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap index 4d7e8f1642..e64bdc8966 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap @@ -141,10 +141,10 @@ exports[`cosmos/authz/v1beta1/authz date 4`] = ` }: Grant): GrantAminoType["value"] => { return { authorization: { - type_url: authorization.typeUrl, + type_url: omitDefault(authorization.typeUrl), value: authorization.value }, - expiration + expiration: expiration }; }, fromAmino: ({ @@ -152,7 +152,7 @@ exports[`cosmos/authz/v1beta1/authz date 4`] = ` expiration }: GrantAminoType["value"]): Grant => { return { - authorization: { + authorization: authorization == null ? authorization : { typeUrl: authorization.type_url, value: authorization.value }, @@ -304,10 +304,10 @@ exports[`cosmos/authz/v1beta1/authz timestamp 4`] = ` }: Grant): GrantAminoType["value"] => { return { authorization: { - type_url: authorization.typeUrl, + type_url: omitDefault(authorization.typeUrl), value: authorization.value }, - expiration + expiration: expiration }; }, fromAmino: ({ @@ -315,7 +315,7 @@ exports[`cosmos/authz/v1beta1/authz timestamp 4`] = ` expiration }: GrantAminoType["value"]): Grant => { return { - authorization: { + authorization: authorization == null ? authorization : { typeUrl: authorization.type_url, value: authorization.value }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap index 86226f4524..85dfd62ada 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap @@ -29,8 +29,8 @@ exports[`cosmwasm/wasm/v1/tx MsgExecuteContract 1`] = ` return { sender, contract, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -75,10 +75,10 @@ exports[`cosmwasm/wasm/v1/tx MsgInstantiateContract 1`] = ` return { sender, admin, - codeId: BigInt(code_id), + codeId: code_id == null ? code_id : BigInt(code_id), label, - msg: toUtf8(JSON.stringify(msg)), - funds: funds.map(el0 => ({ + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + funds: funds.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -114,8 +114,8 @@ exports[`cosmwasm/wasm/v1/tx MsgMigrateContract 1`] = ` return { sender, contract, - codeId: BigInt(code_id), - msg: toUtf8(JSON.stringify(msg)) + codeId: code_id == null ? code_id : BigInt(code_id), + msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) }; } } @@ -147,9 +147,9 @@ exports[`cosmwasm/wasm/v1/tx MsgStoreCode 1`] = ` }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: fromBase64(wasm_byte_code), - instantiatePermission: { - permission: accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), + instantiatePermission: instantiate_permission == null ? instantiate_permission : { + permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap index 4dbcab9c39..4c22a4a96e 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/duration.gov.test.ts.snap @@ -51,7 +51,7 @@ exports[`Duraation: duration DepositParams 1`] = ` if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; @@ -131,7 +131,7 @@ exports[`Duration: string DepositParams 1`] = ` if (message.minDeposit) { obj.min_deposit = message.minDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.min_deposit = []; + obj.min_deposit = message.minDeposit; } obj.max_deposit_period = message.maxDepositPeriod ? Duration.toAmino(message.maxDepositPeriod) : undefined; return obj; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap index 8d82d2c7ab..b3161ba9cf 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap @@ -102,12 +102,12 @@ exports[`osmosis/lockup/tx duration 2`] = ` }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -177,11 +177,11 @@ exports[`osmosis/lockup/tx duration 4`] = ` }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: { + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -293,12 +293,12 @@ exports[`osmosis/lockup/tx string 2`] = ` }, toAmino(message: MsgLockTokens): MsgLockTokensAmino { const obj: any = {}; - obj.owner = omitDefault(message.owner); + obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.coins = []; + obj.coins = message.coins; } return obj; }, @@ -365,11 +365,11 @@ exports[`osmosis/lockup/tx string 4`] = ` }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: { + duration: duration == null ? duration : { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map(el0 => ({ + coins: coins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap index 3319ca7889..86dbb80dae 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/misc.overall.test.ts.snap @@ -275,16 +275,16 @@ exports[`misc/eval_request date 1`] = ` obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, @@ -581,16 +581,16 @@ exports[`misc/eval_request timestamp 1`] = ` obj.refs[k] = IdRef.toAmino(v); }); } - obj.test_num = message.testNum; - obj.test_string = message.testString; - obj.test_bool = message.testBool; + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; - obj.id = message.id; - obj.name = message.name; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; if (message.testArray) { obj.test_array = message.testArray.map(e => e); } else { - obj.test_array = []; + obj.test_array = message.testArray; } return obj; }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap index 2c2f48b47c..1ce631e081 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap @@ -258,7 +258,7 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 2`] = ` }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = omitDefault(message.chainId); + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -268,15 +268,15 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 2`] = ` if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); - obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -425,19 +425,19 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` }: ClientStateAminoType["value"]): ClientState => { return { chainId: chain_id, - trustLevel: { - numerator: BigInt(trust_level.numerator), - denominator: BigInt(trust_level.denominator) + trustLevel: trust_level == null ? trust_level : { + numerator: trust_level.numerator == null ? trust_level.numerator : BigInt(trust_level.numerator), + denominator: trust_level.denominator == null ? trust_level.denominator : BigInt(trust_level.denominator) }, - trustingPeriod: { + trustingPeriod: trusting_period == null ? trusting_period : { seconds: BigInt(Math.floor(parseInt(trusting_period) / 1_000_000_000)), nanos: parseInt(trusting_period) % 1_000_000_000 }, - unbondingPeriod: { + unbondingPeriod: unbonding_period == null ? unbonding_period : { seconds: BigInt(Math.floor(parseInt(unbonding_period) / 1_000_000_000)), nanos: parseInt(unbonding_period) % 1_000_000_000 }, - maxClockDrift: { + maxClockDrift: max_clock_drift == null ? max_clock_drift : { seconds: BigInt(Math.floor(parseInt(max_clock_drift) / 1_000_000_000)), nanos: parseInt(max_clock_drift) % 1_000_000_000 }, @@ -449,21 +449,21 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` revisionHeight: BigInt(latest_height.revision_height || "0"), revisionNumber: BigInt(latest_height.revision_number || "0") } : undefined, - proofSpecs: proof_specs.map(el0 => ({ - leafSpec: { - hash: hashOpFromJSON(el0.leaf_spec.hash), - prehashKey: hashOpFromJSON(el0.leaf_spec.prehash_key), - prehashValue: hashOpFromJSON(el0.leaf_spec.prehash_value), - length: lengthOpFromJSON(el0.leaf_spec.length), + proofSpecs: proof_specs.map?.(el0 => ({ + leafSpec: el0.leaf_spec == null ? el0.leaf_spec : { + hash: el0.leaf_spec.hash == null ? el0.leaf_spec.hash : hashOpFromJSON(el0.leaf_spec.hash), + prehashKey: el0.leaf_spec.prehash_key == null ? el0.leaf_spec.prehash_key : hashOpFromJSON(el0.leaf_spec.prehash_key), + prehashValue: el0.leaf_spec.prehash_value == null ? el0.leaf_spec.prehash_value : hashOpFromJSON(el0.leaf_spec.prehash_value), + length: el0.leaf_spec.length == null ? el0.leaf_spec.length : lengthOpFromJSON(el0.leaf_spec.length), prefix: el0.leaf_spec.prefix }, - innerSpec: { + innerSpec: el0.inner_spec == null ? el0.inner_spec : { childOrder: el0.inner_spec.child_order, childSize: el0.inner_spec.child_size, minPrefixLength: el0.inner_spec.min_prefix_length, maxPrefixLength: el0.inner_spec.max_prefix_length, emptyChild: el0.inner_spec.empty_child, - hash: hashOpFromJSON(el0.inner_spec.hash) + hash: el0.inner_spec.hash == null ? el0.inner_spec.hash : hashOpFromJSON(el0.inner_spec.hash) }, maxDepth: el0.max_depth, minDepth: el0.min_depth @@ -735,7 +735,7 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 2`] = ` }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.chain_id = omitDefault(message.chainId); + obj.chain_id = message.chainId === "" ? undefined : message.chainId; obj.trust_level = message.trustLevel ? Fraction.toAmino(message.trustLevel) : undefined; obj.trusting_period = message.trustingPeriod ? Duration.toAmino(message.trustingPeriod) : undefined; obj.unbonding_period = message.unbondingPeriod ? Duration.toAmino(message.unbondingPeriod) : undefined; @@ -745,15 +745,15 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 2`] = ` if (message.proofSpecs) { obj.proof_specs = message.proofSpecs.map(e => e ? ProofSpec.toAmino(e) : undefined); } else { - obj.proof_specs = []; + obj.proof_specs = message.proofSpecs; } if (message.upgradePath) { obj.upgrade_path = message.upgradePath.map(e => e); } else { - obj.upgrade_path = []; + obj.upgrade_path = message.upgradePath; } - obj.allow_update_after_expiry = omitDefault(message.allowUpdateAfterExpiry); - obj.allow_update_after_misbehaviour = omitDefault(message.allowUpdateAfterMisbehaviour); + obj.allow_update_after_expiry = message.allowUpdateAfterExpiry === false ? undefined : message.allowUpdateAfterExpiry; + obj.allow_update_after_misbehaviour = message.allowUpdateAfterMisbehaviour === false ? undefined : message.allowUpdateAfterMisbehaviour; return obj; }, fromAminoMsg(object: ClientStateAminoMsg): ClientState { @@ -893,19 +893,19 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` }: ClientStateAminoType["value"]): ClientState => { return { chainId: chain_id, - trustLevel: { - numerator: BigInt(trust_level.numerator), - denominator: BigInt(trust_level.denominator) + trustLevel: trust_level == null ? trust_level : { + numerator: trust_level.numerator == null ? trust_level.numerator : BigInt(trust_level.numerator), + denominator: trust_level.denominator == null ? trust_level.denominator : BigInt(trust_level.denominator) }, - trustingPeriod: { + trustingPeriod: trusting_period == null ? trusting_period : { seconds: BigInt(Math.floor(parseInt(trusting_period) / 1_000_000_000)), nanos: parseInt(trusting_period) % 1_000_000_000 }, - unbondingPeriod: { + unbondingPeriod: unbonding_period == null ? unbonding_period : { seconds: BigInt(Math.floor(parseInt(unbonding_period) / 1_000_000_000)), nanos: parseInt(unbonding_period) % 1_000_000_000 }, - maxClockDrift: { + maxClockDrift: max_clock_drift == null ? max_clock_drift : { seconds: BigInt(Math.floor(parseInt(max_clock_drift) / 1_000_000_000)), nanos: parseInt(max_clock_drift) % 1_000_000_000 }, @@ -917,21 +917,21 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` revisionHeight: BigInt(latest_height.revision_height || "0"), revisionNumber: BigInt(latest_height.revision_number || "0") } : undefined, - proofSpecs: proof_specs.map(el0 => ({ - leafSpec: { - hash: hashOpFromJSON(el0.leaf_spec.hash), - prehashKey: hashOpFromJSON(el0.leaf_spec.prehash_key), - prehashValue: hashOpFromJSON(el0.leaf_spec.prehash_value), - length: lengthOpFromJSON(el0.leaf_spec.length), + proofSpecs: proof_specs.map?.(el0 => ({ + leafSpec: el0.leaf_spec == null ? el0.leaf_spec : { + hash: el0.leaf_spec.hash == null ? el0.leaf_spec.hash : hashOpFromJSON(el0.leaf_spec.hash), + prehashKey: el0.leaf_spec.prehash_key == null ? el0.leaf_spec.prehash_key : hashOpFromJSON(el0.leaf_spec.prehash_key), + prehashValue: el0.leaf_spec.prehash_value == null ? el0.leaf_spec.prehash_value : hashOpFromJSON(el0.leaf_spec.prehash_value), + length: el0.leaf_spec.length == null ? el0.leaf_spec.length : lengthOpFromJSON(el0.leaf_spec.length), prefix: el0.leaf_spec.prefix }, - innerSpec: { + innerSpec: el0.inner_spec == null ? el0.inner_spec : { childOrder: el0.inner_spec.child_order, childSize: el0.inner_spec.child_size, minPrefixLength: el0.inner_spec.min_prefix_length, maxPrefixLength: el0.inner_spec.max_prefix_length, emptyChild: el0.inner_spec.empty_child, - hash: hashOpFromJSON(el0.inner_spec.hash) + hash: el0.inner_spec.hash == null ? el0.inner_spec.hash : hashOpFromJSON(el0.inner_spec.hash) }, maxDepth: el0.max_depth, minDepth: el0.min_depth diff --git a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap index b9a8f44ac3..c320dcd2f8 100644 --- a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap @@ -46,14 +46,14 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: { + commission: commission == null ? commission : { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -62,7 +62,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: { + value: value == null ? value : { denom: value.denom, amount: value.amount } @@ -97,7 +97,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: { + description: description == null ? description : { moniker: description.moniker, identity: description.identity, website: description.website, @@ -134,7 +134,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -169,7 +169,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -200,7 +200,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: { + amount: amount == null ? amount : { denom: amount.denom, amount: amount.amount } @@ -237,7 +237,7 @@ exports[`evmos/fees/v1/tx AminoConverter 1`] = ` contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map(el0 => BigInt(el0)) + nonces: nonces.map?.(el0 => BigInt(el0)) }; } }, @@ -318,9 +318,9 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map(el0 => ({ + tokenInMaxs: token_in_maxs.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -353,9 +353,9 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map(el0 => ({ + tokenOutMins: token_out_mins.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -391,11 +391,11 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: { + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -432,12 +432,12 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map(el0 => ({ - poolId: BigInt(el0.pool_id), + routes: routes.map?.(el0 => ({ + poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: { + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount } @@ -470,8 +470,8 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: BigInt(pool_id), - tokenIn: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenIn: token_in == null ? token_in : { denom: token_in.denom, amount: token_in.amount }, @@ -505,7 +505,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -538,7 +538,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: BigInt(pool_id), + poolId: pool_id == null ? pool_id : BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount @@ -571,8 +571,8 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: BigInt(pool_id), - tokenOut: { + poolId: pool_id == null ? pool_id : BigInt(pool_id), + tokenOut: token_out == null ? token_out : { denom: token_out.denom, amount: token_out.amount }, diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap index 6d3bed024e..43db950af3 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap @@ -22,9 +22,9 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` }: MsgDoFunThingAminoType["value"]): MsgDoFunThing => { return { address, - awesome: { + awesome: awesome == null ? awesome : { address: awesome.address, - myYolo0: myAwesomeType_FancyEnumTypeFromJSON(awesome.myYolo0) + myYolo0: awesome.myYolo0 == null ? awesome.myYolo0 : myAwesomeType_FancyEnumTypeFromJSON(awesome.myYolo0) } }; } diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap index 45e8fb865d..a1e36459d2 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap @@ -30,17 +30,17 @@ exports[`cosmology/example/c AminoConverter 1`] = ` }: MsgTypePackageCAminoType["value"]): MsgTypePackageC => { return { address, - awesome: { + awesome: awesome == null ? awesome : { address: awesome.address, - myYolo0: msgTypePackageB_EnumTypePackageBFromJSON(awesome.myYolo0), - anotherField: { - myType: { + myYolo0: awesome.myYolo0 == null ? awesome.myYolo0 : msgTypePackageB_EnumTypePackageBFromJSON(awesome.myYolo0), + anotherField: awesome.anotherField == null ? awesome.anotherField : { + myType: awesome.anotherField.myType == null ? awesome.anotherField.myType : { address: awesome.anotherField.myType.address, - someCoolField: msgTypePackageA_EnumPackageAFromJSON(awesome.anotherField.myType.someCoolField), - otherField: msgTypePackageA_EnumDuplicateNameFromJSON(awesome.anotherField.myType.otherField) + someCoolField: awesome.anotherField.myType.someCoolField == null ? awesome.anotherField.myType.someCoolField : msgTypePackageA_EnumPackageAFromJSON(awesome.anotherField.myType.someCoolField), + otherField: awesome.anotherField.myType.otherField == null ? awesome.anotherField.myType.otherField : msgTypePackageA_EnumDuplicateNameFromJSON(awesome.anotherField.myType.otherField) } }, - otherField: msgTypePackageB_EnumDuplicateNameFromJSON(awesome.otherField) + otherField: awesome.otherField == null ? awesome.otherField : msgTypePackageB_EnumDuplicateNameFromJSON(awesome.otherField) } }; } diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap index f9c57052f9..c6968d4804 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap @@ -27,11 +27,11 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: { + content: content == null ? content : { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map(el0 => ({ + initialDeposit: initial_deposit.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -58,9 +58,9 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - option: voteOptionFromJSON(option) + option: option == null ? option : voteOptionFromJSON(option) }; } }, @@ -86,10 +86,10 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map(el0 => ({ - option: voteOptionFromJSON(el0.option), + options: options.map?.(el0 => ({ + option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -117,9 +117,9 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: BigInt(proposal_id), + proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map(el0 => ({ + amount: amount.map?.(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap index e89e9c5dd3..8303432a82 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap @@ -160,8 +160,8 @@ exports[`Height 1`] = ` }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = omitDefault(message.revisionNumber); - obj.revision_height = omitDefault(message.revisionHeight); + obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { @@ -334,9 +334,9 @@ exports[`MsgCreateValidator 1`] = ` const obj: any = {}; obj.description = message.description ? Description.toAmino(message.description) : undefined; obj.commission = message.commission ? CommissionRates.toAmino(message.commission) : undefined; - obj.min_self_delegation = omitDefault(message.minSelfDelegation); - obj.delegator_address = omitDefault(message.delegatorAddress); - obj.validator_address = omitDefault(message.validatorAddress); + obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; + obj.delegator_address = message.delegatorAddress === "" ? undefined : message.delegatorAddress; + obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; obj.value = message.value ? Coin.toAmino(message.value) : undefined; return obj; @@ -453,7 +453,7 @@ exports[`MsgStoreCode 1`] = ` }, toAmino(message: MsgStoreCode): MsgStoreCodeAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); + obj.sender = message.sender === "" ? undefined : message.sender; obj.wasm_byte_code = message.wasmByteCode ? toBase64(message.wasmByteCode) : undefined; obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; return obj; @@ -580,9 +580,9 @@ exports[`MsgSubmitProposal 1`] = ` if (message.initialDeposit) { obj.initial_deposit = message.initialDeposit.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.initial_deposit = []; + obj.initial_deposit = message.initialDeposit; } - obj.proposer = omitDefault(message.proposer); + obj.proposer = message.proposer === "" ? undefined : message.proposer; return obj; }, fromAminoMsg(object: MsgSubmitProposalAminoMsg): MsgSubmitProposal { @@ -753,13 +753,13 @@ exports[`MsgTransfer 1`] = ` }, toAmino(message: MsgTransfer): MsgTransferAmino { const obj: any = {}; - obj.source_port = omitDefault(message.sourcePort); - obj.source_channel = omitDefault(message.sourceChannel); + obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; + obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.token = message.token ? Coin.toAmino(message.token) : undefined; - obj.sender = omitDefault(message.sender); - obj.receiver = omitDefault(message.receiver); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = omitDefault(message.timeoutTimestamp); + obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap b/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap index c22f881b73..c069876226 100644 --- a/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap +++ b/packages/ast/src/encoding/proto/__tests__/__snapshots__/contracts.test.ts.snap @@ -122,13 +122,13 @@ exports[`MsgExecuteContract interface 2`] = ` }, toAmino(message: MsgExecuteContract): MsgExecuteContractAmino { const obj: any = {}; - obj.sender = omitDefault(message.sender); - obj.contract = omitDefault(message.contract); + obj.sender = message.sender === "" ? undefined : message.sender; + obj.contract = message.contract === "" ? undefined : message.contract; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); } else { - obj.funds = []; + obj.funds = message.funds; } return obj; }, diff --git a/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap b/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap index c1171fa356..72c900fde0 100644 --- a/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap +++ b/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-decoder.test.ts.snap @@ -113,7 +113,7 @@ exports[`PoolI objects 1`] = ` if (message.pools) { obj.pools = message.pools.map(e => e ? PoolI_ToAmino((e as Any)) : undefined); } else { - obj.pools = []; + obj.pools = message.pools; } obj.pagination = message.pagination ? PageResponse.toAmino(message.pagination) : undefined; return obj; diff --git a/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-from-amino.test.ts.snap b/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-from-amino.test.ts.snap index 5090e39cac..68a3eeca22 100644 --- a/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-from-amino.test.ts.snap +++ b/packages/ast/src/encoding/proto/implements/__tests__/__snapshots__/interface-from-amino.test.ts.snap @@ -1,13 +1,13 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`MsgCreateValidator MsgCreateValidator 1`] = ` -"export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino) => { +"export const Cosmos_cryptoPubKey_FromAmino = (content: AnyAmino): Any => { return encodePubkey(content); };" `; exports[`ProposalContent ProposalContent 1`] = ` -"export const ProposalContentI_FromAmino = (content: AnyAmino) => { +"export const ProposalContentI_FromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/v1/TextProposal": return Any.fromPartial({ @@ -66,7 +66,7 @@ exports[`ProposalContent ProposalContent 1`] = ` `; exports[`ProposalContent ProposalContent helper 1`] = ` -"export const ProposalContentI_fromAmino = (content: AnyAmino) => { +"export const ProposalContentI_fromAmino = (content: AnyAmino): Any => { switch (content.type) { case "cosmos-sdk/TextProposal": return Any.fromPartial({ diff --git a/packages/telescope/types/cmds.d.ts b/packages/telescope/types/cmds.d.ts index 18db70bcd0..de787190d0 100644 --- a/packages/telescope/types/cmds.d.ts +++ b/packages/telescope/types/cmds.d.ts @@ -4,6 +4,6 @@ export namespace Commands { export { _commands_transpile as transpile }; } export const Contracts: typeof Contracts; -import _commands_generate from "./commands/generate"; -import _commands_install from "./commands/install"; -import _commands_transpile from "./commands/transpile"; +import _commands_generate from './commands/generate'; +import _commands_install from './commands/install'; +import _commands_transpile from './commands/transpile'; From 536618f27ff9c341e8db5c85bf0f5d96ddc4725e Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Fri, 12 Jan 2024 06:00:07 +0800 Subject: [PATCH 16/24] add tests and gen code --- .../cosmos/authz/v1beta1/tx.amino.ts | 20 + .../cosmos/authz/v1beta1/tx.registry.ts | 112 + .../cosmos/authz/v1beta1/tx.rpc.msg.ts | 53 + .../cosmos/authz/v1beta1/tx.ts | 880 +++ .../cosmos/bundle.ts | 26 +- .../cosmos/client.ts | 39 + .../cosmos/rpc.tx.ts | 12 + .../gogoproto/bundle.ts | 4 +- .../google/bundle.ts | 10 +- .../misc/output-impl-interfaces-gen/index.ts | 1 + .../gogoproto/bundle.ts | 4 +- .../google/bundle.ts | 20 +- .../index.ts | 1 + .../misc/amino_fields.ts | 2564 ++++++++ .../misc/bundle.ts | 18 +- .../misc/client.ts | 47 + .../misc/eval_request.ts | 1286 +--- .../misc/rpc.tx.ts | 8 + .../misc/tx.amino.ts | 9 + .../misc/tx.registry.ts | 51 + .../misc/tx.rpc.msg.ts | 23 + .../misc/tx.ts | 248 + .../amino-interface/gogoproto/bundle.ts | 4 +- .../amino-interface/google/bundle.ts | 20 +- .../amino-interface/index.ts | 1 + .../amino-interface/misc/amino_fields.ts | 2564 ++++++++ .../amino-interface/misc/bundle.ts | 18 +- .../amino-interface/misc/client.ts | 47 + .../amino-interface/misc/eval_request.ts | 1286 +--- .../amino-interface/misc/rpc.tx.ts | 8 + .../amino-interface/misc/tx.amino.ts | 9 + .../amino-interface/misc/tx.registry.ts | 51 + .../amino-interface/misc/tx.rpc.msg.ts | 23 + .../amino-interface/misc/tx.ts | 248 + .../output-proto-amino/amino-legacy/binary.ts | 534 ++ .../output-proto-amino/amino-legacy/extern.ts | 33 + .../amino-legacy/gogoproto/bundle.ts | 4 + .../amino-legacy/gogoproto/gogo.ts | 1 + .../google/api/expr/v1alpha1/eval.ts | 211 + .../amino-legacy/google/bundle.ts | 20 + .../amino-legacy/google/protobuf/any.ts | 311 + .../google/protobuf/descriptor.ts | 5842 +++++++++++++++++ .../amino-legacy/google/protobuf/duration.ts | 249 + .../amino-legacy/google/protobuf/timestamp.ts | 291 + .../amino-legacy/helpers.ts | 260 + .../output-proto-amino/amino-legacy/index.ts | 17 + .../amino-legacy/misc/amino_fields.ts | 2387 +++++++ .../amino-legacy/misc/bundle.ts | 18 + .../amino-legacy/misc/client.ts | 47 + .../amino-legacy/misc/eval_request.ts | 851 +++ .../amino-legacy/misc/rpc.tx.ts | 8 + .../amino-legacy/misc/tx.amino.ts | 489 ++ .../amino-legacy/misc/tx.registry.ts | 51 + .../amino-legacy/misc/tx.rpc.msg.ts | 23 + .../amino-legacy/misc/tx.ts | 209 + .../output-proto-amino/amino-legacy/mobx.ts | 82 + .../amino-legacy/pinia-endpoint.ts | 22 + .../amino-legacy/react-query.ts | 71 + .../output-proto-amino/amino-legacy/utf8.ts | 148 + .../output-proto-amino/amino-legacy/varint.ts | 488 ++ .../amino-msg-no-func/gogoproto/bundle.ts | 4 +- .../amino-msg-no-func/google/bundle.ts | 20 +- .../amino-msg-no-func/index.ts | 1 + .../amino-msg-no-func/misc/amino_fields.ts | 2527 +++++++ .../amino-msg-no-func/misc/bundle.ts | 18 +- .../amino-msg-no-func/misc/client.ts | 47 + .../amino-msg-no-func/misc/eval_request.ts | 1266 +--- .../amino-msg-no-func/misc/rpc.tx.ts | 8 + .../amino-msg-no-func/misc/tx.amino.ts | 9 + .../amino-msg-no-func/misc/tx.registry.ts | 51 + .../amino-msg-no-func/misc/tx.rpc.msg.ts | 23 + .../amino-msg-no-func/misc/tx.ts | 227 + .../amino-msg-with-func/gogoproto/bundle.ts | 4 +- .../amino-msg-with-func/google/bundle.ts | 20 +- .../amino-msg-with-func/index.ts | 1 + .../amino-msg-with-func/misc/amino_fields.ts | 2527 +++++++ .../amino-msg-with-func/misc/bundle.ts | 18 +- .../amino-msg-with-func/misc/client.ts | 47 + .../amino-msg-with-func/misc/eval_request.ts | 1266 +--- .../amino-msg-with-func/misc/rpc.tx.ts | 8 + .../amino-msg-with-func/misc/tx.amino.ts | 9 + .../amino-msg-with-func/misc/tx.registry.ts | 51 + .../amino-msg-with-func/misc/tx.rpc.msg.ts | 23 + .../amino-msg-with-func/misc/tx.ts | 227 + .../gogoproto/bundle.ts | 4 +- .../amino-no-msg-with-func/google/bundle.ts | 20 +- .../amino-no-msg-with-func/index.ts | 1 + .../misc/amino_fields.ts | 2513 +++++++ .../amino-no-msg-with-func/misc/bundle.ts | 18 +- .../amino-no-msg-with-func/misc/client.ts | 47 + .../misc/eval_request.ts | 1259 +--- .../amino-no-msg-with-func/misc/rpc.tx.ts | 8 + .../amino-no-msg-with-func/misc/tx.amino.ts | 9 + .../misc/tx.registry.ts | 51 + .../amino-no-msg-with-func/misc/tx.rpc.msg.ts | 23 + .../amino-no-msg-with-func/misc/tx.ts | 213 + .../gogoproto/bundle.ts | 4 +- .../no-amino-legacy-no-proto/google/bundle.ts | 20 +- .../misc/amino_fields.ts | 1907 ++++++ .../no-amino-legacy-no-proto/misc/bundle.ts | 14 +- .../misc/eval_request.ts | 955 +-- .../no-amino-legacy-no-proto/misc/rpc.tx.ts | 8 + .../misc/tx.rpc.msg.ts | 23 + .../no-amino-legacy-no-proto/misc/tx.ts | 147 + .../no-amino-legacy/gogoproto/bundle.ts | 4 +- .../no-amino-legacy/google/bundle.ts | 20 +- .../no-amino-legacy/misc/amino_fields.ts | 2387 +++++++ .../no-amino-legacy/misc/bundle.ts | 14 +- .../no-amino-legacy/misc/eval_request.ts | 1196 +--- .../no-amino-legacy/misc/rpc.tx.ts | 8 + .../no-amino-legacy/misc/tx.rpc.msg.ts | 23 + .../no-amino-legacy/misc/tx.ts | 209 + .../no-amino-no-proto/gogoproto/bundle.ts | 4 +- .../no-amino-no-proto/google/bundle.ts | 20 +- .../no-amino-no-proto/misc/amino_fields.ts | 1907 ++++++ .../no-amino-no-proto/misc/bundle.ts | 14 +- .../no-amino-no-proto/misc/eval_request.ts | 955 +-- .../no-amino-no-proto/misc/rpc.tx.ts | 8 + .../no-amino-no-proto/misc/tx.rpc.msg.ts | 23 + .../no-amino-no-proto/misc/tx.ts | 147 + .../no-amino/gogoproto/bundle.ts | 4 +- .../no-amino/google/bundle.ts | 20 +- .../no-amino/misc/amino_fields.ts | 2387 +++++++ .../no-amino/misc/bundle.ts | 14 +- .../no-amino/misc/eval_request.ts | 1196 +--- .../no-amino/misc/rpc.tx.ts | 8 + .../no-amino/misc/tx.rpc.msg.ts | 23 + .../output-proto-amino/no-amino/misc/tx.ts | 209 + .../proto-only-legacy/gogoproto/bundle.ts | 4 +- .../proto-only-legacy/google/bundle.ts | 20 +- .../proto-only-legacy/misc/amino_fields.ts | 1939 ++++++ .../proto-only-legacy/misc/bundle.ts | 14 +- .../proto-only-legacy/misc/eval_request.ts | 971 +-- .../proto-only-legacy/misc/rpc.tx.ts | 8 + .../proto-only-legacy/misc/tx.rpc.msg.ts | 23 + .../proto-only-legacy/misc/tx.ts | 179 + .../proto-only/gogoproto/bundle.ts | 4 +- .../proto-only/google/bundle.ts | 20 +- .../proto-only/misc/amino_fields.ts | 1939 ++++++ .../proto-only/misc/bundle.ts | 14 +- .../proto-only/misc/eval_request.ts | 971 +-- .../proto-only/misc/rpc.tx.ts | 8 + .../proto-only/misc/tx.rpc.msg.ts | 23 + .../output-proto-amino/proto-only/misc/tx.ts | 179 + __fixtures__/misc/output/index.ts | 1 + __fixtures__/misc/output/misc/amino_fields.ts | 2527 +++++++ __fixtures__/misc/output/misc/bundle.ts | 18 +- __fixtures__/misc/output/misc/client.ts | 47 + __fixtures__/misc/output/misc/eval_request.ts | 1266 +--- __fixtures__/misc/output/misc/rpc.tx.ts | 8 + __fixtures__/misc/output/misc/tx.amino.ts | 9 + __fixtures__/misc/output/misc/tx.registry.ts | 51 + __fixtures__/misc/output/misc/tx.rpc.msg.ts | 23 + __fixtures__/misc/output/misc/tx.ts | 227 + .../cosmos/authz/v1beta1/tx.proto | 71 + .../misc/proto/misc/amino_fields.proto | 362 + .../misc/proto/misc/eval_request.proto | 177 - __fixtures__/misc/proto/misc/tx.proto | 25 + .../src/encoding/amino/to-amino-json/index.ts | 2 + .../impl-interfaces.test.ts.snap | 4 +- packages/telescope/__tests__/misc.test.ts | 25 + 161 files changed, 45779 insertions(+), 14208 deletions(-) create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.amino.ts create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/cosmos/client.ts create mode 100644 __fixtures__/misc/output-impl-interfaces-gen/cosmos/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/client.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/client.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/binary.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/extern.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/gogo.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/index.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/client.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/mobx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/pinia-endpoint.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/react-query.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/utf8.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/varint.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/client.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/client.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/client.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only-legacy/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts create mode 100644 __fixtures__/misc/output/misc/amino_fields.ts create mode 100644 __fixtures__/misc/output/misc/client.ts create mode 100644 __fixtures__/misc/output/misc/rpc.tx.ts create mode 100644 __fixtures__/misc/output/misc/tx.amino.ts create mode 100644 __fixtures__/misc/output/misc/tx.registry.ts create mode 100644 __fixtures__/misc/output/misc/tx.rpc.msg.ts create mode 100644 __fixtures__/misc/output/misc/tx.ts create mode 100644 __fixtures__/misc/proto-impl-interfaces/cosmos/authz/v1beta1/tx.proto create mode 100644 __fixtures__/misc/proto/misc/amino_fields.proto create mode 100644 __fixtures__/misc/proto/misc/tx.proto diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.amino.ts new file mode 100644 index 0000000000..046b599313 --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.amino.ts @@ -0,0 +1,20 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; +export const AminoConverter = { + "/cosmos.authz.v1beta1.MsgGrant": { + aminoType: "cosmos-sdk/MsgGrant", + toAmino: MsgGrant.toAmino, + fromAmino: MsgGrant.fromAmino + }, + "/cosmos.authz.v1beta1.MsgExec": { + aminoType: "cosmos-sdk/MsgExec", + toAmino: MsgExec.toAmino, + fromAmino: MsgExec.fromAmino + }, + "/cosmos.authz.v1beta1.MsgRevoke": { + aminoType: "cosmos-sdk/MsgRevoke", + toAmino: MsgRevoke.toAmino, + fromAmino: MsgRevoke.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts new file mode 100644 index 0000000000..92557e5cad --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.registry.ts @@ -0,0 +1,112 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { MsgGrant, MsgGrantSDKType, MsgExec, MsgExecSDKType, MsgRevoke, MsgRevokeSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/cosmos.authz.v1beta1.MsgGrant", MsgGrant], ["/cosmos.authz.v1beta1.MsgExec", MsgExec], ["/cosmos.authz.v1beta1.MsgRevoke", MsgRevoke]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(value).finish() + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(value).finish() + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(value).finish() + }; + } + }, + withTypeUrl: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value + }; + } + }, + toJSON: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.toJSON(value) + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.toJSON(value) + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.toJSON(value) + }; + } + }, + fromJSON: { + grant(value: any) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.fromJSON(value) + }; + }, + exec(value: any) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.fromJSON(value) + }; + }, + revoke(value: any) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.fromJSON(value) + }; + } + }, + fromPartial: { + grant(value: MsgGrant) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.fromPartial(value) + }; + }, + exec(value: MsgExec) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.fromPartial(value) + }; + }, + revoke(value: MsgRevoke) { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts new file mode 100644 index 0000000000..dc90606b47 --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.rpc.msg.ts @@ -0,0 +1,53 @@ +import { Grant, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { Rpc } from "../../../helpers"; +import { BinaryReader } from "../../../binary"; +import { MsgGrant, MsgGrantSDKType, MsgGrantResponse, MsgGrantResponseSDKType, MsgExec, MsgExecSDKType, MsgExecResponse, MsgExecResponseSDKType, MsgRevoke, MsgRevokeSDKType, MsgRevokeResponse, MsgRevokeResponseSDKType } from "./tx"; +/** Msg defines the authz Msg service. */ +export interface Msg { + /** + * Grant grants the provided authorization to the grantee on the granter's + * account with the provided expiration time. If there is already a grant + * for the given (granter, grantee, Authorization) triple, then the grant + * will be overwritten. + */ + grant(request: MsgGrant): Promise; + /** + * Exec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ + exec(request: MsgExec): Promise; + /** + * Revoke revokes any authorization corresponding to the provided method name on the + * granter's account that has been granted to the grantee. + */ + revoke(request: MsgRevoke): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.grant = this.grant.bind(this); + this.exec = this.exec.bind(this); + this.revoke = this.revoke.bind(this); + } + grant(request: MsgGrant): Promise { + const data = MsgGrant.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Grant", data); + return promise.then(data => MsgGrantResponse.decode(new BinaryReader(data))); + } + exec(request: MsgExec): Promise { + const data = MsgExec.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Exec", data); + return promise.then(data => MsgExecResponse.decode(new BinaryReader(data))); + } + revoke(request: MsgRevoke): Promise { + const data = MsgRevoke.encode(request).finish(); + const promise = this.rpc.request("cosmos.authz.v1beta1.Msg", "Revoke", data); + return promise.then(data => MsgRevokeResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts new file mode 100644 index 0000000000..0bbf246e2a --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/authz/v1beta1/tx.ts @@ -0,0 +1,880 @@ +import { Grant, GrantAmino, GrantSDKType } from "./authz"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../../../google/protobuf/any"; +import { BinaryReader, BinaryWriter } from "../../../binary"; +import { isSet, DeepPartial, bytesFromBase64, base64FromBytes } from "../../../helpers"; +import { GlobalDecoderRegistry } from "../../../registry"; +export const protobufPackage = "cosmos.authz.v1beta1"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrant { + granter: string; + grantee: string; + grant: Grant; +} +export interface MsgGrantProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrantAmino { + granter?: string; + grantee?: string; + grant?: GrantAmino; +} +export interface MsgGrantAminoMsg { + type: "cosmos-sdk/MsgGrant"; + value: MsgGrantAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface MsgGrantSDKType { + granter: string; + grantee: string; + grant: GrantSDKType; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponse { + results: Uint8Array[]; +} +export interface MsgExecResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse"; + value: Uint8Array; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseAmino { + results?: string[]; +} +export interface MsgExecResponseAminoMsg { + type: "cosmos-sdk/MsgExecResponse"; + value: MsgExecResponseAmino; +} +/** MsgExecResponse defines the Msg/MsgExecResponse response type. */ +export interface MsgExecResponseSDKType { + results: Uint8Array[]; +} +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExec { + grantee: string; + /** + * Authorization Msg requests to execute. Each msg must implement Authorization interface + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: (Any)[] | Any[]; +} +export interface MsgExecProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgExec"; + value: Uint8Array; +} +export type MsgExecEncoded = Omit & { + /** + * Authorization Msg requests to execute. Each msg must implement Authorization interface + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs: (AnyProtoMsg)[]; +}; +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExecAmino { + grantee?: string; + /** + * Authorization Msg requests to execute. Each msg must implement Authorization interface + * The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + * triple and validate it. + */ + msgs?: AnyAmino[]; +} +export interface MsgExecAminoMsg { + type: "cosmos-sdk/MsgExec"; + value: MsgExecAmino; +} +/** + * MsgExec attempts to execute the provided messages using + * authorizations granted to the grantee. Each message should have only + * one signer corresponding to the granter of the authorization. + */ +export interface MsgExecSDKType { + grantee: string; + msgs: (AnySDKType)[]; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponse {} +export interface MsgGrantResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseAmino {} +export interface MsgGrantResponseAminoMsg { + type: "cosmos-sdk/MsgGrantResponse"; + value: MsgGrantResponseAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgGrantResponseSDKType {} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevoke { + granter: string; + grantee: string; + msgTypeUrl: string; +} +export interface MsgRevokeProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke"; + value: Uint8Array; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevokeAmino { + granter?: string; + grantee?: string; + msg_type_url?: string; +} +export interface MsgRevokeAminoMsg { + type: "cosmos-sdk/MsgRevoke"; + value: MsgRevokeAmino; +} +/** + * MsgRevoke revokes any authorization with the provided sdk.Msg type on the + * granter's account with that has been granted to the grantee. + */ +export interface MsgRevokeSDKType { + granter: string; + grantee: string; + msg_type_url: string; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponse {} +export interface MsgRevokeResponseProtoMsg { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse"; + value: Uint8Array; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseAmino {} +export interface MsgRevokeResponseAminoMsg { + type: "cosmos-sdk/MsgRevokeResponse"; + value: MsgRevokeResponseAmino; +} +/** MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. */ +export interface MsgRevokeResponseSDKType {} +function createBaseMsgGrant(): MsgGrant { + return { + granter: "", + grantee: "", + grant: Grant.fromPartial({}) + }; +} +export const MsgGrant = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + aminoType: "cosmos-sdk/MsgGrant", + is(o: any): o is MsgGrant { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.is(o.grant)); + }, + isSDK(o: any): o is MsgGrantSDKType { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isSDK(o.grant)); + }, + isAmino(o: any): o is MsgGrantAmino { + return o && (o.$typeUrl === MsgGrant.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && Grant.isAmino(o.grant)); + }, + encode(message: MsgGrant, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.grant !== undefined) { + Grant.encode(message.grant, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrant { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrant(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.grant = Grant.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgGrant { + const obj = createBaseMsgGrant(); + if (isSet(object.granter)) obj.granter = String(object.granter); + if (isSet(object.grantee)) obj.grantee = String(object.grantee); + if (isSet(object.grant)) obj.grant = Grant.fromJSON(object.grant); + return obj; + }, + toJSON(message: MsgGrant): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.grant !== undefined && (obj.grant = message.grant ? Grant.toJSON(message.grant) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): MsgGrant { + const message = createBaseMsgGrant(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + if (object.grant !== undefined && object.grant !== null) { + message.grant = Grant.fromPartial(object.grant); + } + return message; + }, + fromSDK(object: MsgGrantSDKType): MsgGrant { + return { + granter: object?.granter, + grantee: object?.grantee, + grant: object.grant ? Grant.fromSDK(object.grant) : undefined + }; + }, + fromSDKJSON(object: any): MsgGrantSDKType { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + grant: isSet(object.grant) ? Grant.fromSDKJSON(object.grant) : undefined + }; + }, + toSDK(message: MsgGrant): MsgGrantSDKType { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + message.grant !== undefined && (obj.grant = message.grant ? Grant.toSDK(message.grant) : undefined); + return obj; + }, + fromAmino(object: MsgGrantAmino): MsgGrant { + const message = createBaseMsgGrant(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.grant !== undefined && object.grant !== null) { + message.grant = Grant.fromAmino(object.grant); + } + return message; + }, + toAmino(message: MsgGrant): MsgGrantAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.grant = message.grant ? Grant.toAmino(message.grant) : undefined; + return obj; + }, + fromAminoMsg(object: MsgGrantAminoMsg): MsgGrant { + return MsgGrant.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrant): MsgGrantAminoMsg { + return { + type: "cosmos-sdk/MsgGrant", + value: MsgGrant.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantProtoMsg): MsgGrant { + return MsgGrant.decode(message.value); + }, + toProto(message: MsgGrant): Uint8Array { + return MsgGrant.encode(message).finish(); + }, + toProtoMsg(message: MsgGrant): MsgGrantProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrant", + value: MsgGrant.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgGrant.typeUrl, MsgGrant); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrant.aminoType, MsgGrant.typeUrl); +function createBaseMsgExecResponse(): MsgExecResponse { + return { + results: [] + }; +} +export const MsgExecResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + aminoType: "cosmos-sdk/MsgExecResponse", + is(o: any): o is MsgExecResponse { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isSDK(o: any): o is MsgExecResponseSDKType { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + isAmino(o: any): o is MsgExecResponseAmino { + return o && (o.$typeUrl === MsgExecResponse.typeUrl || Array.isArray(o.results) && (!o.results.length || o.results[0] instanceof Uint8Array || typeof o.results[0] === "string")); + }, + encode(message: MsgExecResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.results) { + writer.uint32(10).bytes(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExecResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExecResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.results.push(reader.bytes()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgExecResponse { + const obj = createBaseMsgExecResponse(); + if (Array.isArray(object?.results)) obj.results = object.results.map((e: any) => bytesFromBase64(e)); + return obj; + }, + toJSON(message: MsgExecResponse): unknown { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.results = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => e) || []; + return message; + }, + fromSDK(object: MsgExecResponseSDKType): MsgExecResponse { + return { + results: Array.isArray(object?.results) ? object.results.map((e: any) => e) : [] + }; + }, + fromSDKJSON(object: any): MsgExecResponseSDKType { + return { + results: Array.isArray(object?.results) ? object.results.map((e: any) => bytesFromBase64(e)) : [] + }; + }, + toSDK(message: MsgExecResponse): MsgExecResponseSDKType { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => e); + } else { + obj.results = []; + } + return obj; + }, + fromAmino(object: MsgExecResponseAmino): MsgExecResponse { + const message = createBaseMsgExecResponse(); + message.results = object.results?.map(e => bytesFromBase64(e)) || []; + return message; + }, + toAmino(message: MsgExecResponse): MsgExecResponseAmino { + const obj: any = {}; + if (message.results) { + obj.results = message.results.map(e => base64FromBytes(e)); + } else { + obj.results = message.results; + } + return obj; + }, + fromAminoMsg(object: MsgExecResponseAminoMsg): MsgExecResponse { + return MsgExecResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgExecResponse): MsgExecResponseAminoMsg { + return { + type: "cosmos-sdk/MsgExecResponse", + value: MsgExecResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecResponseProtoMsg): MsgExecResponse { + return MsgExecResponse.decode(message.value); + }, + toProto(message: MsgExecResponse): Uint8Array { + return MsgExecResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgExecResponse): MsgExecResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExecResponse", + value: MsgExecResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExecResponse.typeUrl, MsgExecResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExecResponse.aminoType, MsgExecResponse.typeUrl); +function createBaseMsgExec(): MsgExec { + return { + grantee: "", + msgs: [] + }; +} +export const MsgExec = { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + aminoType: "cosmos-sdk/MsgExec", + is(o: any): o is MsgExec { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.is(o.msgs[0]))); + }, + isSDK(o: any): o is MsgExecSDKType { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isSDK(o.msgs[0]))); + }, + isAmino(o: any): o is MsgExecAmino { + return o && (o.$typeUrl === MsgExec.typeUrl || typeof o.grantee === "string" && Array.isArray(o.msgs) && (!o.msgs.length || Any.isAmino(o.msgs[0]))); + }, + encode(message: MsgExec, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.grantee !== "") { + writer.uint32(10).string(message.grantee); + } + for (const v of message.msgs) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgExec { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgExec(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.grantee = reader.string(); + break; + case 2: + message.msgs.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgExec { + const obj = createBaseMsgExec(); + if (isSet(object.grantee)) obj.grantee = String(object.grantee); + if (Array.isArray(object?.msgs)) obj.msgs = object.msgs.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + return obj; + }, + toJSON(message: MsgExec): unknown { + const obj: any = {}; + message.grantee !== undefined && (obj.grantee = message.grantee); + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + fromPartial(object: DeepPartial): MsgExec { + const message = createBaseMsgExec(); + message.grantee = object.grantee ?? ""; + message.msgs = object.msgs?.map(e => (Any.fromPartial(e) as any)) || []; + return message; + }, + fromSDK(object: MsgExecSDKType): MsgExec { + return { + grantee: object?.grantee, + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): MsgExecSDKType { + return { + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msgs: Array.isArray(object?.msgs) ? object.msgs.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: MsgExec): MsgExecSDKType { + const obj: any = {}; + obj.grantee = message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.msgs = []; + } + return obj; + }, + fromAmino(object: MsgExecAmino): MsgExec { + const message = createBaseMsgExec(); + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + message.msgs = object.msgs?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: MsgExec): MsgExecAmino { + const obj: any = {}; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + if (message.msgs) { + obj.msgs = message.msgs.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.msgs = message.msgs; + } + return obj; + }, + fromAminoMsg(object: MsgExecAminoMsg): MsgExec { + return MsgExec.fromAmino(object.value); + }, + toAminoMsg(message: MsgExec): MsgExecAminoMsg { + return { + type: "cosmos-sdk/MsgExec", + value: MsgExec.toAmino(message) + }; + }, + fromProtoMsg(message: MsgExecProtoMsg): MsgExec { + return MsgExec.decode(message.value); + }, + toProto(message: MsgExec): Uint8Array { + return MsgExec.encode(message).finish(); + }, + toProtoMsg(message: MsgExec): MsgExecProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgExec", + value: MsgExec.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgExec.typeUrl, MsgExec); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgExec.aminoType, MsgExec.typeUrl); +function createBaseMsgGrantResponse(): MsgGrantResponse { + return {}; +} +export const MsgGrantResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + aminoType: "cosmos-sdk/MsgGrantResponse", + is(o: any): o is MsgGrantResponse { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isSDK(o: any): o is MsgGrantResponseSDKType { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + isAmino(o: any): o is MsgGrantResponseAmino { + return o && o.$typeUrl === MsgGrantResponse.typeUrl; + }, + encode(_: MsgGrantResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgGrantResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgGrantResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgGrantResponse { + const obj = createBaseMsgGrantResponse(); + return obj; + }, + toJSON(_: MsgGrantResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + fromSDK(_: MsgGrantResponseSDKType): MsgGrantResponse { + return {}; + }, + fromSDKJSON(_: any): MsgGrantResponseSDKType { + return {}; + }, + toSDK(_: MsgGrantResponse): MsgGrantResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgGrantResponseAmino): MsgGrantResponse { + const message = createBaseMsgGrantResponse(); + return message; + }, + toAmino(_: MsgGrantResponse): MsgGrantResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgGrantResponseAminoMsg): MsgGrantResponse { + return MsgGrantResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgGrantResponse): MsgGrantResponseAminoMsg { + return { + type: "cosmos-sdk/MsgGrantResponse", + value: MsgGrantResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgGrantResponseProtoMsg): MsgGrantResponse { + return MsgGrantResponse.decode(message.value); + }, + toProto(message: MsgGrantResponse): Uint8Array { + return MsgGrantResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgGrantResponse): MsgGrantResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgGrantResponse", + value: MsgGrantResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgGrantResponse.typeUrl, MsgGrantResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgGrantResponse.aminoType, MsgGrantResponse.typeUrl); +function createBaseMsgRevoke(): MsgRevoke { + return { + granter: "", + grantee: "", + msgTypeUrl: "" + }; +} +export const MsgRevoke = { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + aminoType: "cosmos-sdk/MsgRevoke", + is(o: any): o is MsgRevoke { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msgTypeUrl === "string"); + }, + isSDK(o: any): o is MsgRevokeSDKType { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + isAmino(o: any): o is MsgRevokeAmino { + return o && (o.$typeUrl === MsgRevoke.typeUrl || typeof o.granter === "string" && typeof o.grantee === "string" && typeof o.msg_type_url === "string"); + }, + encode(message: MsgRevoke, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.granter !== "") { + writer.uint32(10).string(message.granter); + } + if (message.grantee !== "") { + writer.uint32(18).string(message.grantee); + } + if (message.msgTypeUrl !== "") { + writer.uint32(26).string(message.msgTypeUrl); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevoke { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevoke(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.granter = reader.string(); + break; + case 2: + message.grantee = reader.string(); + break; + case 3: + message.msgTypeUrl = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MsgRevoke { + const obj = createBaseMsgRevoke(); + if (isSet(object.granter)) obj.granter = String(object.granter); + if (isSet(object.grantee)) obj.grantee = String(object.grantee); + if (isSet(object.msgTypeUrl)) obj.msgTypeUrl = String(object.msgTypeUrl); + return obj; + }, + toJSON(message: MsgRevoke): unknown { + const obj: any = {}; + message.granter !== undefined && (obj.granter = message.granter); + message.grantee !== undefined && (obj.grantee = message.grantee); + message.msgTypeUrl !== undefined && (obj.msgTypeUrl = message.msgTypeUrl); + return obj; + }, + fromPartial(object: DeepPartial): MsgRevoke { + const message = createBaseMsgRevoke(); + message.granter = object.granter ?? ""; + message.grantee = object.grantee ?? ""; + message.msgTypeUrl = object.msgTypeUrl ?? ""; + return message; + }, + fromSDK(object: MsgRevokeSDKType): MsgRevoke { + return { + granter: object?.granter, + grantee: object?.grantee, + msgTypeUrl: object?.msg_type_url + }; + }, + fromSDKJSON(object: any): MsgRevokeSDKType { + return { + granter: isSet(object.granter) ? String(object.granter) : "", + grantee: isSet(object.grantee) ? String(object.grantee) : "", + msg_type_url: isSet(object.msg_type_url) ? String(object.msg_type_url) : "" + }; + }, + toSDK(message: MsgRevoke): MsgRevokeSDKType { + const obj: any = {}; + obj.granter = message.granter; + obj.grantee = message.grantee; + obj.msg_type_url = message.msgTypeUrl; + return obj; + }, + fromAmino(object: MsgRevokeAmino): MsgRevoke { + const message = createBaseMsgRevoke(); + if (object.granter !== undefined && object.granter !== null) { + message.granter = object.granter; + } + if (object.grantee !== undefined && object.grantee !== null) { + message.grantee = object.grantee; + } + if (object.msg_type_url !== undefined && object.msg_type_url !== null) { + message.msgTypeUrl = object.msg_type_url; + } + return message; + }, + toAmino(message: MsgRevoke): MsgRevokeAmino { + const obj: any = {}; + obj.granter = message.granter === "" ? undefined : message.granter; + obj.grantee = message.grantee === "" ? undefined : message.grantee; + obj.msg_type_url = message.msgTypeUrl === "" ? undefined : message.msgTypeUrl; + return obj; + }, + fromAminoMsg(object: MsgRevokeAminoMsg): MsgRevoke { + return MsgRevoke.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevoke): MsgRevokeAminoMsg { + return { + type: "cosmos-sdk/MsgRevoke", + value: MsgRevoke.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeProtoMsg): MsgRevoke { + return MsgRevoke.decode(message.value); + }, + toProto(message: MsgRevoke): Uint8Array { + return MsgRevoke.encode(message).finish(); + }, + toProtoMsg(message: MsgRevoke): MsgRevokeProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevoke", + value: MsgRevoke.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRevoke.typeUrl, MsgRevoke); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevoke.aminoType, MsgRevoke.typeUrl); +function createBaseMsgRevokeResponse(): MsgRevokeResponse { + return {}; +} +export const MsgRevokeResponse = { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + aminoType: "cosmos-sdk/MsgRevokeResponse", + is(o: any): o is MsgRevokeResponse { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isSDK(o: any): o is MsgRevokeResponseSDKType { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + isAmino(o: any): o is MsgRevokeResponseAmino { + return o && o.$typeUrl === MsgRevokeResponse.typeUrl; + }, + encode(_: MsgRevokeResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgRevokeResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgRevokeResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgRevokeResponse { + const obj = createBaseMsgRevokeResponse(); + return obj; + }, + toJSON(_: MsgRevokeResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + fromSDK(_: MsgRevokeResponseSDKType): MsgRevokeResponse { + return {}; + }, + fromSDKJSON(_: any): MsgRevokeResponseSDKType { + return {}; + }, + toSDK(_: MsgRevokeResponse): MsgRevokeResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgRevokeResponseAmino): MsgRevokeResponse { + const message = createBaseMsgRevokeResponse(); + return message; + }, + toAmino(_: MsgRevokeResponse): MsgRevokeResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgRevokeResponseAminoMsg): MsgRevokeResponse { + return MsgRevokeResponse.fromAmino(object.value); + }, + toAminoMsg(message: MsgRevokeResponse): MsgRevokeResponseAminoMsg { + return { + type: "cosmos-sdk/MsgRevokeResponse", + value: MsgRevokeResponse.toAmino(message) + }; + }, + fromProtoMsg(message: MsgRevokeResponseProtoMsg): MsgRevokeResponse { + return MsgRevokeResponse.decode(message.value); + }, + toProto(message: MsgRevokeResponse): Uint8Array { + return MsgRevokeResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgRevokeResponse): MsgRevokeResponseProtoMsg { + return { + typeUrl: "/cosmos.authz.v1beta1.MsgRevokeResponse", + value: MsgRevokeResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgRevokeResponse.typeUrl, MsgRevokeResponse); +GlobalDecoderRegistry.registerAminoProtoMapping(MsgRevokeResponse.aminoType, MsgRevokeResponse.typeUrl); \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts index da37b05655..7c4eb22122 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bundle.ts @@ -1,22 +1,34 @@ import * as _2 from "./authz/v1beta1/authz"; -import * as _3 from "./bank/v1beta1/authz"; -import * as _4 from "./bank/v1beta1/tx"; -import * as _5 from "./base/v1beta1/coin"; +import * as _3 from "./authz/v1beta1/tx"; +import * as _4 from "./bank/v1beta1/authz"; +import * as _5 from "./bank/v1beta1/tx"; +import * as _6 from "./base/v1beta1/coin"; +import * as _11 from "./authz/v1beta1/tx.amino"; +import * as _12 from "./authz/v1beta1/tx.registry"; +import * as _13 from "./authz/v1beta1/tx.rpc.msg"; +import * as _14 from "./rpc.tx"; export namespace cosmos { export namespace authz { export const v1beta1 = { - ..._2 + ..._2, + ..._3, + ..._11, + ..._12, + ..._13 }; } export namespace bank { export const v1beta1 = { - ..._3, - ..._4 + ..._4, + ..._5 }; } export namespace base { export const v1beta1 = { - ..._5 + ..._6 }; } + export const ClientFactory = { + ..._14 + }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/client.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/client.ts new file mode 100644 index 0000000000..32dc31e54c --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/client.ts @@ -0,0 +1,39 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as cosmosAuthzV1beta1TxRegistry from "./authz/v1beta1/tx.registry"; +import * as cosmosAuthzV1beta1TxAmino from "./authz/v1beta1/tx.amino"; +export const cosmosAminoConverters = { + ...cosmosAuthzV1beta1TxAmino.AminoConverter +}; +export const cosmosProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...cosmosAuthzV1beta1TxRegistry.registry]; +export const getSigningCosmosClientOptions = (): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...cosmosProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...cosmosAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningCosmosClient = async ({ + rpcEndpoint, + signer +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; +}) => { + const { + registry, + aminoTypes + } = getSigningCosmosClientOptions(); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/rpc.tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/rpc.tx.ts new file mode 100644 index 0000000000..9dcab132c4 --- /dev/null +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/rpc.tx.ts @@ -0,0 +1,12 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + cosmos: { + authz: { + v1beta1: new (await import("./authz/v1beta1/tx.rpc.msg")).MsgClientImpl(rpc) + } + } +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/gogoproto/bundle.ts b/__fixtures__/misc/output-impl-interfaces-gen/gogoproto/bundle.ts index 8f08215a70..3a745a9194 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _6 from "./gogo"; +import * as _7 from "./gogo"; export const gogoproto = { - ..._6 + ..._7 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/bundle.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/bundle.ts index c2ad9cb2c4..c3cd829c54 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/bundle.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/bundle.ts @@ -1,10 +1,10 @@ -import * as _7 from "./protobuf/any"; -import * as _8 from "./protobuf/timestamp"; -import * as _9 from "./protobuf/descriptor"; +import * as _8 from "./protobuf/any"; +import * as _9 from "./protobuf/timestamp"; +import * as _10 from "./protobuf/descriptor"; export namespace google { export const protobuf = { - ..._7, ..._8, - ..._9 + ..._9, + ..._10 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-impl-interfaces-gen/index.ts b/__fixtures__/misc/output-impl-interfaces-gen/index.ts index 3ff5aa57a1..428c279669 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/index.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/index.ts @@ -7,6 +7,7 @@ export * from "./akash/bundle"; export * from "./cosmos_proto/bundle"; export * from "./cosmos/bundle"; +export * from "./cosmos/client"; export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./extern"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts index 30ace67e82..0ca519309d 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _77 from "./gogo"; +import * as _144 from "./gogo"; export const gogoproto = { - ..._77 + ..._144 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts index 0a43bb2157..d93e55ceaa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _78 from "./api/expr/v1alpha1/eval"; -import * as _79 from "./protobuf/any"; -import * as _80 from "./protobuf/duration"; -import * as _81 from "./protobuf/timestamp"; -import * as _82 from "./protobuf/descriptor"; +import * as _145 from "./api/expr/v1alpha1/eval"; +import * as _146 from "./protobuf/any"; +import * as _147 from "./protobuf/duration"; +import * as _148 from "./protobuf/timestamp"; +import * as _149 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._78 + ..._145 }; } } export const protobuf = { - ..._79, - ..._80, - ..._81, - ..._82 + ..._146, + ..._147, + ..._148, + ..._149 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts index 92aab61b12..4895daf3a4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/index.ts @@ -7,6 +7,7 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; +export * from "./misc/client"; export * from "./extern"; export * from "./react-query"; export * from "./mobx"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts new file mode 100644 index 0000000000..7513eae787 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts @@ -0,0 +1,2564 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, GenericAuthorization, GenericAuthorizationProtoMsg, GenericAuthorizationSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; +import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { GlobalDecoderRegistry } from "../registry"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: GenericAuthorization | Any | undefined; + dOAuth: GenericAuthorization | Any | undefined; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any | undefined; + dOPubkey: Any | undefined; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: (GenericAuthorization | Any)[] | Any[]; + dOAuths: (GenericAuthorization | Any)[] | Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export type AminoEncodingTestForDontOmitEncoded = Omit & { + /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + dOAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + /** pubkey */pubkey?: AnyProtoMsg | undefined; + dOPubkey?: AnyProtoMsg | undefined; + /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; + dOAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; +}; +export interface AminoEncodingTestForDontOmitAmino { + /** scalar */ + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + /** bigint */ + big: string; + d_o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + d_o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + d_o_auth: AnyAmino; + /** bytes */ + salt: string; + d_o_salt: string; + /** raw bytes */ + raw: any; + d_o_raw: any; + /** wasm bytes */ + wasm: string; + d_o_wasm: string; + /** enum */ + opt: VoteOption; + d_o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + d_o_period: DurationAmino; + /** timestamp */ + date?: string; + d_o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + d_o_pubkey: AnyAmino; + /** array scalar */ + nums: number[]; + d_o_nums: number[]; + /** array bigint */ + bigs: string[]; + d_o_bigs: string[]; + /** array bytes */ + salts: string[]; + d_o_salts: string[]; + /** array raw bytes */ + raws: any[]; + d_o_raws: any[]; + /** array wasm bytes */ + wasms: string[]; + d_o_wasms: string[]; + /** array enum */ + opts: VoteOption[]; + d_o_opts: VoteOption[]; + /** array duration */ + periods: DurationAmino[]; + d_o_periods: DurationAmino[]; + /** array protoType */ + protos: AccessConfigAmino[]; + d_o_protos: AccessConfigAmino[]; + /** array anyType */ + auths: AnyAmino[]; + d_o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForDontOmitAminoMsg { + type: "/misc.AminoEncodingTestForDontOmit"; + value: AminoEncodingTestForDontOmitAmino; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: GenericAuthorizationSDKType | AnySDKType | undefined; + d_o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType | undefined; + d_o_pubkey: AnySDKType | undefined; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: (GenericAuthorizationSDKType | AnySDKType)[]; + d_o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: GenericAuthorization | Any | undefined; + oAuth: GenericAuthorization | Any | undefined; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any | undefined; + oPubkey: Any | undefined; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: (GenericAuthorization | Any)[] | Any[]; + oAuths: (GenericAuthorization | Any)[] | Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export type AminoEncodingTestForOmitEncoded = Omit & { + /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + oAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + /** pubkey */pubkey?: AnyProtoMsg | undefined; + oPubkey?: AnyProtoMsg | undefined; + /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; + oAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; +}; +export interface AminoEncodingTestForOmitAmino { + /** scalar */ + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + /** bigint */ + big: string; + o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + o_auth: AnyAmino; + /** bytes */ + salt: string; + o_salt: string; + /** raw bytes */ + raw: any; + o_raw: any; + /** wasm bytes */ + wasm: string; + o_wasm: string; + /** enum */ + opt: VoteOption; + o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + o_period: DurationAmino; + /** timestamp */ + date?: string; + o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + o_pubkey: AnyAmino; + /** array scalar */ + nums: number[]; + o_nums: number[]; + /** array bigint */ + bigs: string[]; + o_bigs: string[]; + /** array bytes */ + salts: string[]; + o_salts: string[]; + /** array raw bytes */ + raws: any[]; + o_raws: any[]; + /** array wasm bytes */ + wasms: string[]; + o_wasms: string[]; + /** array enum */ + opts: VoteOption[]; + o_opts: VoteOption[]; + /** array duration */ + periods: DurationAmino[]; + o_periods: DurationAmino[]; + /** array protoType */ + protos: AccessConfigAmino[]; + o_protos: AccessConfigAmino[]; + /** array anyType */ + auths: AnyAmino[]; + o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForOmitAminoMsg { + type: "/misc.AminoEncodingTestForOmit"; + value: AminoEncodingTestForOmitAmino; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: GenericAuthorizationSDKType | AnySDKType | undefined; + o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType | undefined; + o_pubkey: AnySDKType | undefined; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: (GenericAuthorizationSDKType | AnySDKType)[]; + o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + is(o: any): o is AminoEncodingTestForDontOmit { + return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.dOStr === "string" && typeof o.b === "boolean" && typeof o.dOB === "boolean" && typeof o.num === "number" && typeof o.dONum === "number" && typeof o.big === "bigint" && typeof o.dOBig === "bigint" && AccessConfig.is(o.dOProto) && (GenericAuthorization.is(o.dOAuth) || Any.is(o.dOAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.dOSalt instanceof Uint8Array || typeof o.dOSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.dORaw instanceof Uint8Array || typeof o.dORaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.dOWasm instanceof Uint8Array || typeof o.dOWasm === "string") && isSet(o.opt) && isSet(o.dOOpt) && Duration.is(o.dOPeriod) && Timestamp.is(o.dODate) && Any.is(o.dOPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.dONums) && (!o.dONums.length || typeof o.dONums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.dOBigs) && (!o.dOBigs.length || typeof o.dOBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.dOSalts) && (!o.dOSalts.length || o.dOSalts[0] instanceof Uint8Array || typeof o.dOSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.dORaws) && (!o.dORaws.length || o.dORaws[0] instanceof Uint8Array || typeof o.dORaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.dOWasms) && (!o.dOWasms.length || o.dOWasms[0] instanceof Uint8Array || typeof o.dOWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.dOOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.dOPeriods) && (!o.dOPeriods.length || Duration.is(o.dOPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.dOProtos) && (!o.dOProtos.length || AccessConfig.is(o.dOProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.dOAuths) && (!o.dOAuths.length || GenericAuthorization.is(o.dOAuths[0]) || Any.is(o.dOAuths[0]))); + }, + isSDK(o: any): o is AminoEncodingTestForDontOmitSDKType { + return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isSDK(o.d_o_proto) && (GenericAuthorization.isSDK(o.d_o_auth) || Any.isSDK(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isSDK(o.d_o_period) && Timestamp.isSDK(o.d_o_date) && Any.isSDK(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isSDK(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isSDK(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isSDK(o.d_o_auths[0]) || Any.isSDK(o.d_o_auths[0]))); + }, + isAmino(o: any): o is AminoEncodingTestForDontOmitAmino { + return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isAmino(o.d_o_proto) && (GenericAuthorization.isAmino(o.d_o_auth) || Any.isAmino(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isAmino(o.d_o_period) && Timestamp.isAmino(o.d_o_date) && Any.isAmino(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isAmino(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isAmino(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isAmino(o.d_o_auths[0]) || Any.isAmino(o.d_o_auths[0]))); + }, + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.dOAuth), writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.dOPubkey), writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 12: + message.dOAuth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 26: + message.dOPubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + case 46: + message.dOAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = GlobalDecoderRegistry.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = GlobalDecoderRegistry.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? GlobalDecoderRegistry.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? GlobalDecoderRegistry.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = GlobalDecoderRegistry.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = GlobalDecoderRegistry.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => (Any.fromPartial(e) as any)) || []; + message.dOAuths = object.dOAuths?.map(e => (Any.fromPartial(e) as any)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? GlobalDecoderRegistry.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? GlobalDecoderRegistry.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? GlobalDecoderRegistry.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = GlobalDecoderRegistry.fromAminoMsg(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AminoEncodingTestForDontOmit.typeUrl, AminoEncodingTestForDontOmit); +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + is(o: any): o is AminoEncodingTestForOmit { + return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.oStr === "string" && typeof o.b === "boolean" && typeof o.oB === "boolean" && typeof o.num === "number" && typeof o.oNum === "number" && typeof o.big === "bigint" && typeof o.oBig === "bigint" && AccessConfig.is(o.oProto) && (GenericAuthorization.is(o.oAuth) || Any.is(o.oAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.oSalt instanceof Uint8Array || typeof o.oSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.oRaw instanceof Uint8Array || typeof o.oRaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.oWasm instanceof Uint8Array || typeof o.oWasm === "string") && isSet(o.opt) && isSet(o.oOpt) && Duration.is(o.oPeriod) && Timestamp.is(o.oDate) && Any.is(o.oPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.oNums) && (!o.oNums.length || typeof o.oNums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.oBigs) && (!o.oBigs.length || typeof o.oBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.oSalts) && (!o.oSalts.length || o.oSalts[0] instanceof Uint8Array || typeof o.oSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.oRaws) && (!o.oRaws.length || o.oRaws[0] instanceof Uint8Array || typeof o.oRaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.oWasms) && (!o.oWasms.length || o.oWasms[0] instanceof Uint8Array || typeof o.oWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.oOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.oPeriods) && (!o.oPeriods.length || Duration.is(o.oPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.oProtos) && (!o.oProtos.length || AccessConfig.is(o.oProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.oAuths) && (!o.oAuths.length || GenericAuthorization.is(o.oAuths[0]) || Any.is(o.oAuths[0]))); + }, + isSDK(o: any): o is AminoEncodingTestForOmitSDKType { + return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isSDK(o.o_proto) && (GenericAuthorization.isSDK(o.o_auth) || Any.isSDK(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isSDK(o.o_period) && Timestamp.isSDK(o.o_date) && Any.isSDK(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isSDK(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isSDK(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isSDK(o.o_auths[0]) || Any.isSDK(o.o_auths[0]))); + }, + isAmino(o: any): o is AminoEncodingTestForOmitAmino { + return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isAmino(o.o_proto) && (GenericAuthorization.isAmino(o.o_auth) || Any.isAmino(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isAmino(o.o_period) && Timestamp.isAmino(o.o_date) && Any.isAmino(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isAmino(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isAmino(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isAmino(o.o_auths[0]) || Any.isAmino(o.o_auths[0]))); + }, + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.oAuth), writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.oPubkey), writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 12: + message.oAuth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 26: + message.oPubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + case 46: + message.oAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = GlobalDecoderRegistry.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = GlobalDecoderRegistry.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? GlobalDecoderRegistry.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? GlobalDecoderRegistry.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = GlobalDecoderRegistry.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = GlobalDecoderRegistry.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => (Any.fromPartial(e) as any)) || []; + message.oAuths = object.oAuths?.map(e => (Any.fromPartial(e) as any)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? GlobalDecoderRegistry.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? GlobalDecoderRegistry.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? GlobalDecoderRegistry.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = GlobalDecoderRegistry.fromAminoMsg(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + message.oAuths = object.o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; + obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toAminoMsg(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AminoEncodingTestForOmit.typeUrl, AminoEncodingTestForOmit); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts index 4628008d7a..7583508b79 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts @@ -1,4 +1,18 @@ -import * as _83 from "./eval_request"; +import * as _150 from "./amino_fields"; +import * as _151 from "./eval_request"; +import * as _152 from "./tx"; +import * as _153 from "./tx.amino"; +import * as _154 from "./tx.registry"; +import * as _155 from "./tx.rpc.msg"; +import * as _156 from "./rpc.tx"; export const misc = { - ..._83 + ..._150, + ..._151, + ..._152, + ..._153, + ..._154, + ..._155, + ClientFactory: { + ..._156 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/client.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts index 429296cd37..629b2fab0c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/eval_request.ts @@ -1,12 +1,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; +import { isSet, DeepPartial, isObject } from "../helpers"; import { GlobalDecoderRegistry } from "../registry"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -205,200 +200,6 @@ export interface GenericAuthorizationSDKType { $typeUrl?: "/misc.GenericAuthorization"; msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: GenericAuthorization | Any | undefined; - dOAuth: GenericAuthorization | Any | undefined; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any | undefined; - dOPubkey: Any | undefined; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: (GenericAuthorization | Any)[] | Any[]; - dOAuths: (GenericAuthorization | Any)[] | Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export type AminoEncodingTestEncoded = Omit & { - /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - dOAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - /** pubkey */pubkey?: AnyProtoMsg | undefined; - dOPubkey?: AnyProtoMsg | undefined; - /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; - dOAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; -}; -export interface AminoEncodingTestAmino { - /** scalar */ - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - /** bigint */ - big: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt: string; - d_o_salt: string; - /** raw bytes */ - raw: any; - d_o_raw: any; - /** wasm bytes */ - wasm: string; - d_o_wasm: string; - /** enum */ - opt: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms: string[]; - d_o_wasms: string[]; - /** array enum */ - opts: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestAminoMsg { - type: "/misc.AminoEncodingTest"; - value: AminoEncodingTestAmino; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: GenericAuthorizationSDKType | AnySDKType | undefined; - d_o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType | undefined; - d_o_pubkey: AnySDKType | undefined; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: (GenericAuthorizationSDKType | AnySDKType)[]; - d_o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -1137,1087 +938,4 @@ export const GenericAuthorization = { }; } }; -GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - is(o: any): o is AminoEncodingTest { - return o && (o.$typeUrl === AminoEncodingTest.typeUrl || typeof o.str === "string" && typeof o.dOStr === "string" && typeof o.b === "boolean" && typeof o.dOB === "boolean" && typeof o.num === "number" && typeof o.dONum === "number" && typeof o.big === "bigint" && typeof o.dOBig === "bigint" && AccessConfig.is(o.dOProto) && (GenericAuthorization.is(o.dOAuth) || Any.is(o.dOAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.dOSalt instanceof Uint8Array || typeof o.dOSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.dORaw instanceof Uint8Array || typeof o.dORaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.dOWasm instanceof Uint8Array || typeof o.dOWasm === "string") && isSet(o.opt) && isSet(o.dOOpt) && Duration.is(o.dOPeriod) && Timestamp.is(o.dODate) && Any.is(o.dOPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.dONums) && (!o.dONums.length || typeof o.dONums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.dOBigs) && (!o.dOBigs.length || typeof o.dOBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.dOSalts) && (!o.dOSalts.length || o.dOSalts[0] instanceof Uint8Array || typeof o.dOSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.dORaws) && (!o.dORaws.length || o.dORaws[0] instanceof Uint8Array || typeof o.dORaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.dOWasms) && (!o.dOWasms.length || o.dOWasms[0] instanceof Uint8Array || typeof o.dOWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.dOOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.dOPeriods) && (!o.dOPeriods.length || Duration.is(o.dOPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.dOProtos) && (!o.dOProtos.length || AccessConfig.is(o.dOProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.dOAuths) && (!o.dOAuths.length || GenericAuthorization.is(o.dOAuths[0]) || Any.is(o.dOAuths[0]))); - }, - isSDK(o: any): o is AminoEncodingTestSDKType { - return o && (o.$typeUrl === AminoEncodingTest.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isSDK(o.d_o_proto) && (GenericAuthorization.isSDK(o.d_o_auth) || Any.isSDK(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isSDK(o.d_o_period) && Timestamp.isSDK(o.d_o_date) && Any.isSDK(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isSDK(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isSDK(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isSDK(o.d_o_auths[0]) || Any.isSDK(o.d_o_auths[0]))); - }, - isAmino(o: any): o is AminoEncodingTestAmino { - return o && (o.$typeUrl === AminoEncodingTest.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isAmino(o.d_o_proto) && (GenericAuthorization.isAmino(o.d_o_auth) || Any.isAmino(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isAmino(o.d_o_period) && Timestamp.isAmino(o.d_o_date) && Any.isAmino(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isAmino(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isAmino(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isAmino(o.d_o_auths[0]) || Any.isAmino(o.d_o_auths[0]))); - }, - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOAuth), writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOPubkey), writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 12: - message.dOAuth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 26: - message.dOPubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - case 46: - message.dOAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = GlobalDecoderRegistry.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = GlobalDecoderRegistry.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? GlobalDecoderRegistry.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? GlobalDecoderRegistry.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = GlobalDecoderRegistry.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => (Any.fromPartial(e) as any)) || []; - message.dOAuths = object.dOAuths?.map(e => (Any.fromPartial(e) as any)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? GlobalDecoderRegistry.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? GlobalDecoderRegistry.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? GlobalDecoderRegistry.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromAminoMsg(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } -}; -GlobalDecoderRegistry.register(AminoEncodingTest.typeUrl, AminoEncodingTest); \ No newline at end of file +GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.amino.ts new file mode 100644 index 0000000000..0d46c9a916 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.amino.ts @@ -0,0 +1,9 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: InputMsg.toAmino, + fromAmino: InputMsg.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts new file mode 100644 index 0000000000..b66b33f22f --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/tx.ts @@ -0,0 +1,248 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitAmino, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitAmino, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +import { GlobalDecoderRegistry } from "../registry"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgAmino { + d_o_tests: AminoEncodingTestForDontOmitAmino; + o_tests: AminoEncodingTestForOmitAmino; +} +export interface InputMsgAminoMsg { + type: "/misc.InputMsg"; + value: InputMsgAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseAmino {} +export interface MsgResponseAminoMsg { + type: "/misc.MsgResponse"; + value: MsgResponseAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + is(o: any): o is InputMsg { + return o && (o.$typeUrl === InputMsg.typeUrl || AminoEncodingTestForDontOmit.is(o.dOTests) && AminoEncodingTestForOmit.is(o.oTests)); + }, + isSDK(o: any): o is InputMsgSDKType { + return o && (o.$typeUrl === InputMsg.typeUrl || AminoEncodingTestForDontOmit.isSDK(o.d_o_tests) && AminoEncodingTestForOmit.isSDK(o.o_tests)); + }, + isAmino(o: any): o is InputMsgAmino { + return o && (o.$typeUrl === InputMsg.typeUrl || AminoEncodingTestForDontOmit.isAmino(o.d_o_tests) && AminoEncodingTestForOmit.isAmino(o.o_tests)); + }, + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(InputMsg.typeUrl, InputMsg); +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + is(o: any): o is MsgResponse { + return o && o.$typeUrl === MsgResponse.typeUrl; + }, + isSDK(o: any): o is MsgResponseSDKType { + return o && o.$typeUrl === MsgResponse.typeUrl; + }, + isAmino(o: any): o is MsgResponseAmino { + return o && o.$typeUrl === MsgResponse.typeUrl; + }, + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgResponse.typeUrl, MsgResponse); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts index 0a786ca9fc..f9d0d526f4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _70 from "./gogo"; +import * as _131 from "./gogo"; export const gogoproto = { - ..._70 + ..._131 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts index 8800ad45c8..9362b29aa1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _71 from "./api/expr/v1alpha1/eval"; -import * as _72 from "./protobuf/any"; -import * as _73 from "./protobuf/duration"; -import * as _74 from "./protobuf/timestamp"; -import * as _75 from "./protobuf/descriptor"; +import * as _132 from "./api/expr/v1alpha1/eval"; +import * as _133 from "./protobuf/any"; +import * as _134 from "./protobuf/duration"; +import * as _135 from "./protobuf/timestamp"; +import * as _136 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._71 + ..._132 }; } } export const protobuf = { - ..._72, - ..._73, - ..._74, - ..._75 + ..._133, + ..._134, + ..._135, + ..._136 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/index.ts b/__fixtures__/misc/output-proto-amino/amino-interface/index.ts index 92aab61b12..4895daf3a4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/index.ts @@ -7,6 +7,7 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; +export * from "./misc/client"; export * from "./extern"; export * from "./react-query"; export * from "./mobx"; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts new file mode 100644 index 0000000000..03271f77f3 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts @@ -0,0 +1,2564 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, GenericAuthorization, GenericAuthorizationProtoMsg, GenericAuthorizationSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; +import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { GlobalDecoderRegistry } from "../registry"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: GenericAuthorization | Any | undefined; + dOAuth: GenericAuthorization | Any | undefined; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any | undefined; + dOPubkey: Any | undefined; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: (GenericAuthorization | Any)[] | Any[]; + dOAuths: (GenericAuthorization | Any)[] | Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export type AminoEncodingTestForDontOmitEncoded = Omit & { + /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + dOAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + /** pubkey */pubkey?: AnyProtoMsg | undefined; + dOPubkey?: AnyProtoMsg | undefined; + /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; + dOAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; +}; +export interface AminoEncodingTestForDontOmitAmino { + /** scalar */ + str?: string; + d_o_str: string; + b?: boolean; + d_o_b: boolean; + num?: number; + d_o_num: number; + /** bigint */ + big?: string; + d_o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + d_o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + d_o_auth: AnyAmino; + /** bytes */ + salt?: string; + d_o_salt: string; + /** raw bytes */ + raw?: any; + d_o_raw: any; + /** wasm bytes */ + wasm?: string; + d_o_wasm: string; + /** enum */ + opt?: VoteOption; + d_o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + d_o_period: DurationAmino; + /** timestamp */ + date?: string; + d_o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + d_o_pubkey: AnyAmino; + /** array scalar */ + nums?: number[]; + d_o_nums: number[]; + /** array bigint */ + bigs?: string[]; + d_o_bigs: string[]; + /** array bytes */ + salts?: string[]; + d_o_salts: string[]; + /** array raw bytes */ + raws?: any[]; + d_o_raws: any[]; + /** array wasm bytes */ + wasms?: string[]; + d_o_wasms: string[]; + /** array enum */ + opts?: VoteOption[]; + d_o_opts: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + d_o_periods: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + d_o_protos: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + d_o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForDontOmitAminoMsg { + type: "/misc.AminoEncodingTestForDontOmit"; + value: AminoEncodingTestForDontOmitAmino; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: GenericAuthorizationSDKType | AnySDKType | undefined; + d_o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType | undefined; + d_o_pubkey: AnySDKType | undefined; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: (GenericAuthorizationSDKType | AnySDKType)[]; + d_o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: GenericAuthorization | Any | undefined; + oAuth: GenericAuthorization | Any | undefined; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any | undefined; + oPubkey: Any | undefined; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: (GenericAuthorization | Any)[] | Any[]; + oAuths: (GenericAuthorization | Any)[] | Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export type AminoEncodingTestForOmitEncoded = Omit & { + /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + oAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; + /** pubkey */pubkey?: AnyProtoMsg | undefined; + oPubkey?: AnyProtoMsg | undefined; + /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; + oAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; +}; +export interface AminoEncodingTestForOmitAmino { + /** scalar */ + str?: string; + o_str?: string; + b?: boolean; + o_b?: boolean; + num?: number; + o_num?: number; + /** bigint */ + big?: string; + o_big?: string; + /** protoType */ + proto?: AccessConfigAmino; + o_proto?: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + o_auth?: AnyAmino; + /** bytes */ + salt?: string; + o_salt?: string; + /** raw bytes */ + raw?: any; + o_raw?: any; + /** wasm bytes */ + wasm?: string; + o_wasm?: string; + /** enum */ + opt?: VoteOption; + o_opt?: VoteOption; + /** duration */ + period?: DurationAmino; + o_period?: DurationAmino; + /** timestamp */ + date?: string; + o_date?: string; + /** pubkey */ + pubkey?: AnyAmino; + o_pubkey?: AnyAmino; + /** array scalar */ + nums?: number[]; + o_nums?: number[]; + /** array bigint */ + bigs?: string[]; + o_bigs?: string[]; + /** array bytes */ + salts?: string[]; + o_salts?: string[]; + /** array raw bytes */ + raws?: any[]; + o_raws?: any[]; + /** array wasm bytes */ + wasms?: string[]; + o_wasms?: string[]; + /** array enum */ + opts?: VoteOption[]; + o_opts?: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + o_periods?: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + o_protos?: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + o_auths?: AnyAmino[]; +} +export interface AminoEncodingTestForOmitAminoMsg { + type: "/misc.AminoEncodingTestForOmit"; + value: AminoEncodingTestForOmitAmino; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: GenericAuthorizationSDKType | AnySDKType | undefined; + o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType | undefined; + o_pubkey: AnySDKType | undefined; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: (GenericAuthorizationSDKType | AnySDKType)[]; + o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + is(o: any): o is AminoEncodingTestForDontOmit { + return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.dOStr === "string" && typeof o.b === "boolean" && typeof o.dOB === "boolean" && typeof o.num === "number" && typeof o.dONum === "number" && typeof o.big === "bigint" && typeof o.dOBig === "bigint" && AccessConfig.is(o.dOProto) && (GenericAuthorization.is(o.dOAuth) || Any.is(o.dOAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.dOSalt instanceof Uint8Array || typeof o.dOSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.dORaw instanceof Uint8Array || typeof o.dORaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.dOWasm instanceof Uint8Array || typeof o.dOWasm === "string") && isSet(o.opt) && isSet(o.dOOpt) && Duration.is(o.dOPeriod) && Timestamp.is(o.dODate) && Any.is(o.dOPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.dONums) && (!o.dONums.length || typeof o.dONums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.dOBigs) && (!o.dOBigs.length || typeof o.dOBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.dOSalts) && (!o.dOSalts.length || o.dOSalts[0] instanceof Uint8Array || typeof o.dOSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.dORaws) && (!o.dORaws.length || o.dORaws[0] instanceof Uint8Array || typeof o.dORaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.dOWasms) && (!o.dOWasms.length || o.dOWasms[0] instanceof Uint8Array || typeof o.dOWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.dOOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.dOPeriods) && (!o.dOPeriods.length || Duration.is(o.dOPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.dOProtos) && (!o.dOProtos.length || AccessConfig.is(o.dOProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.dOAuths) && (!o.dOAuths.length || GenericAuthorization.is(o.dOAuths[0]) || Any.is(o.dOAuths[0]))); + }, + isSDK(o: any): o is AminoEncodingTestForDontOmitSDKType { + return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isSDK(o.d_o_proto) && (GenericAuthorization.isSDK(o.d_o_auth) || Any.isSDK(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isSDK(o.d_o_period) && Timestamp.isSDK(o.d_o_date) && Any.isSDK(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isSDK(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isSDK(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isSDK(o.d_o_auths[0]) || Any.isSDK(o.d_o_auths[0]))); + }, + isAmino(o: any): o is AminoEncodingTestForDontOmitAmino { + return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isAmino(o.d_o_proto) && (GenericAuthorization.isAmino(o.d_o_auth) || Any.isAmino(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isAmino(o.d_o_period) && Timestamp.isAmino(o.d_o_date) && Any.isAmino(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isAmino(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isAmino(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isAmino(o.d_o_auths[0]) || Any.isAmino(o.d_o_auths[0]))); + }, + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.dOAuth), writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.dOPubkey), writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 12: + message.dOAuth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 26: + message.dOPubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + case 46: + message.dOAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = GlobalDecoderRegistry.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = GlobalDecoderRegistry.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? GlobalDecoderRegistry.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? GlobalDecoderRegistry.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = GlobalDecoderRegistry.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = GlobalDecoderRegistry.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => (Any.fromPartial(e) as any)) || []; + message.dOAuths = object.dOAuths?.map(e => (Any.fromPartial(e) as any)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? GlobalDecoderRegistry.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? GlobalDecoderRegistry.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? GlobalDecoderRegistry.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = GlobalDecoderRegistry.fromAminoMsg(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AminoEncodingTestForDontOmit.typeUrl, AminoEncodingTestForDontOmit); +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + is(o: any): o is AminoEncodingTestForOmit { + return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.oStr === "string" && typeof o.b === "boolean" && typeof o.oB === "boolean" && typeof o.num === "number" && typeof o.oNum === "number" && typeof o.big === "bigint" && typeof o.oBig === "bigint" && AccessConfig.is(o.oProto) && (GenericAuthorization.is(o.oAuth) || Any.is(o.oAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.oSalt instanceof Uint8Array || typeof o.oSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.oRaw instanceof Uint8Array || typeof o.oRaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.oWasm instanceof Uint8Array || typeof o.oWasm === "string") && isSet(o.opt) && isSet(o.oOpt) && Duration.is(o.oPeriod) && Timestamp.is(o.oDate) && Any.is(o.oPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.oNums) && (!o.oNums.length || typeof o.oNums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.oBigs) && (!o.oBigs.length || typeof o.oBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.oSalts) && (!o.oSalts.length || o.oSalts[0] instanceof Uint8Array || typeof o.oSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.oRaws) && (!o.oRaws.length || o.oRaws[0] instanceof Uint8Array || typeof o.oRaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.oWasms) && (!o.oWasms.length || o.oWasms[0] instanceof Uint8Array || typeof o.oWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.oOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.oPeriods) && (!o.oPeriods.length || Duration.is(o.oPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.oProtos) && (!o.oProtos.length || AccessConfig.is(o.oProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.oAuths) && (!o.oAuths.length || GenericAuthorization.is(o.oAuths[0]) || Any.is(o.oAuths[0]))); + }, + isSDK(o: any): o is AminoEncodingTestForOmitSDKType { + return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isSDK(o.o_proto) && (GenericAuthorization.isSDK(o.o_auth) || Any.isSDK(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isSDK(o.o_period) && Timestamp.isSDK(o.o_date) && Any.isSDK(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isSDK(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isSDK(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isSDK(o.o_auths[0]) || Any.isSDK(o.o_auths[0]))); + }, + isAmino(o: any): o is AminoEncodingTestForOmitAmino { + return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isAmino(o.o_proto) && (GenericAuthorization.isAmino(o.o_auth) || Any.isAmino(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isAmino(o.o_period) && Timestamp.isAmino(o.o_date) && Any.isAmino(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isAmino(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isAmino(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isAmino(o.o_auths[0]) || Any.isAmino(o.o_auths[0]))); + }, + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.oAuth), writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(GlobalDecoderRegistry.wrapAny(message.oPubkey), writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 12: + message.oAuth = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 26: + message.oPubkey = GlobalDecoderRegistry.unwrapAny(reader); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + case 46: + message.oAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = GlobalDecoderRegistry.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = GlobalDecoderRegistry.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? GlobalDecoderRegistry.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? GlobalDecoderRegistry.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = GlobalDecoderRegistry.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = GlobalDecoderRegistry.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => (Any.fromPartial(e) as any)) || []; + message.oAuths = object.oAuths?.map(e => (Any.fromPartial(e) as any)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? GlobalDecoderRegistry.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? GlobalDecoderRegistry.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? GlobalDecoderRegistry.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = GlobalDecoderRegistry.fromAminoMsg(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + message.oAuths = object.o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; + obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toAminoMsg(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(AminoEncodingTestForOmit.typeUrl, AminoEncodingTestForOmit); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts index 4515610cb3..d22db63fc2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts @@ -1,4 +1,18 @@ -import * as _76 from "./eval_request"; +import * as _137 from "./amino_fields"; +import * as _138 from "./eval_request"; +import * as _139 from "./tx"; +import * as _140 from "./tx.amino"; +import * as _141 from "./tx.registry"; +import * as _142 from "./tx.rpc.msg"; +import * as _143 from "./rpc.tx"; export const misc = { - ..._76 + ..._137, + ..._138, + ..._139, + ..._140, + ..._141, + ..._142, + ClientFactory: { + ..._143 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/client.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts index ea254726b2..b175b929e4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/eval_request.ts @@ -1,12 +1,7 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; +import { isSet, DeepPartial, isObject } from "../helpers"; import { GlobalDecoderRegistry } from "../registry"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -205,200 +200,6 @@ export interface GenericAuthorizationSDKType { $typeUrl?: "/misc.GenericAuthorization"; msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: GenericAuthorization | Any | undefined; - dOAuth: GenericAuthorization | Any | undefined; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any | undefined; - dOPubkey: Any | undefined; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: (GenericAuthorization | Any)[] | Any[]; - dOAuths: (GenericAuthorization | Any)[] | Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export type AminoEncodingTestEncoded = Omit & { - /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - dOAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - /** pubkey */pubkey?: AnyProtoMsg | undefined; - dOPubkey?: AnyProtoMsg | undefined; - /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; - dOAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; -}; -export interface AminoEncodingTestAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestAminoMsg { - type: "/misc.AminoEncodingTest"; - value: AminoEncodingTestAmino; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: GenericAuthorizationSDKType | AnySDKType | undefined; - d_o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType | undefined; - d_o_pubkey: AnySDKType | undefined; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: (GenericAuthorizationSDKType | AnySDKType)[]; - d_o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -1137,1087 +938,4 @@ export const GenericAuthorization = { }; } }; -GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - is(o: any): o is AminoEncodingTest { - return o && (o.$typeUrl === AminoEncodingTest.typeUrl || typeof o.str === "string" && typeof o.dOStr === "string" && typeof o.b === "boolean" && typeof o.dOB === "boolean" && typeof o.num === "number" && typeof o.dONum === "number" && typeof o.big === "bigint" && typeof o.dOBig === "bigint" && AccessConfig.is(o.dOProto) && (GenericAuthorization.is(o.dOAuth) || Any.is(o.dOAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.dOSalt instanceof Uint8Array || typeof o.dOSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.dORaw instanceof Uint8Array || typeof o.dORaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.dOWasm instanceof Uint8Array || typeof o.dOWasm === "string") && isSet(o.opt) && isSet(o.dOOpt) && Duration.is(o.dOPeriod) && Timestamp.is(o.dODate) && Any.is(o.dOPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.dONums) && (!o.dONums.length || typeof o.dONums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.dOBigs) && (!o.dOBigs.length || typeof o.dOBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.dOSalts) && (!o.dOSalts.length || o.dOSalts[0] instanceof Uint8Array || typeof o.dOSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.dORaws) && (!o.dORaws.length || o.dORaws[0] instanceof Uint8Array || typeof o.dORaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.dOWasms) && (!o.dOWasms.length || o.dOWasms[0] instanceof Uint8Array || typeof o.dOWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.dOOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.dOPeriods) && (!o.dOPeriods.length || Duration.is(o.dOPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.dOProtos) && (!o.dOProtos.length || AccessConfig.is(o.dOProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.dOAuths) && (!o.dOAuths.length || GenericAuthorization.is(o.dOAuths[0]) || Any.is(o.dOAuths[0]))); - }, - isSDK(o: any): o is AminoEncodingTestSDKType { - return o && (o.$typeUrl === AminoEncodingTest.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isSDK(o.d_o_proto) && (GenericAuthorization.isSDK(o.d_o_auth) || Any.isSDK(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isSDK(o.d_o_period) && Timestamp.isSDK(o.d_o_date) && Any.isSDK(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isSDK(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isSDK(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isSDK(o.d_o_auths[0]) || Any.isSDK(o.d_o_auths[0]))); - }, - isAmino(o: any): o is AminoEncodingTestAmino { - return o && (o.$typeUrl === AminoEncodingTest.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isAmino(o.d_o_proto) && (GenericAuthorization.isAmino(o.d_o_auth) || Any.isAmino(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isAmino(o.d_o_period) && Timestamp.isAmino(o.d_o_date) && Any.isAmino(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isAmino(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isAmino(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isAmino(o.d_o_auths[0]) || Any.isAmino(o.d_o_auths[0]))); - }, - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOAuth), writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOPubkey), writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 12: - message.dOAuth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 26: - message.dOPubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - case 46: - message.dOAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = GlobalDecoderRegistry.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = GlobalDecoderRegistry.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? GlobalDecoderRegistry.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? GlobalDecoderRegistry.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = GlobalDecoderRegistry.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => (Any.fromPartial(e) as any)) || []; - message.dOAuths = object.dOAuths?.map(e => (Any.fromPartial(e) as any)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? GlobalDecoderRegistry.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? GlobalDecoderRegistry.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? GlobalDecoderRegistry.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromAminoMsg(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } -}; -GlobalDecoderRegistry.register(AminoEncodingTest.typeUrl, AminoEncodingTest); \ No newline at end of file +GlobalDecoderRegistry.register(GenericAuthorization.typeUrl, GenericAuthorization); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.amino.ts new file mode 100644 index 0000000000..0d46c9a916 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.amino.ts @@ -0,0 +1,9 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: InputMsg.toAmino, + fromAmino: InputMsg.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts new file mode 100644 index 0000000000..fad5c8418c --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/tx.ts @@ -0,0 +1,248 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitAmino, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitAmino, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +import { GlobalDecoderRegistry } from "../registry"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgAmino { + d_o_tests?: AminoEncodingTestForDontOmitAmino; + o_tests?: AminoEncodingTestForOmitAmino; +} +export interface InputMsgAminoMsg { + type: "/misc.InputMsg"; + value: InputMsgAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseAmino {} +export interface MsgResponseAminoMsg { + type: "/misc.MsgResponse"; + value: MsgResponseAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + is(o: any): o is InputMsg { + return o && (o.$typeUrl === InputMsg.typeUrl || AminoEncodingTestForDontOmit.is(o.dOTests) && AminoEncodingTestForOmit.is(o.oTests)); + }, + isSDK(o: any): o is InputMsgSDKType { + return o && (o.$typeUrl === InputMsg.typeUrl || AminoEncodingTestForDontOmit.isSDK(o.d_o_tests) && AminoEncodingTestForOmit.isSDK(o.o_tests)); + }, + isAmino(o: any): o is InputMsgAmino { + return o && (o.$typeUrl === InputMsg.typeUrl || AminoEncodingTestForDontOmit.isAmino(o.d_o_tests) && AminoEncodingTestForOmit.isAmino(o.o_tests)); + }, + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(InputMsg.typeUrl, InputMsg); +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + is(o: any): o is MsgResponse { + return o && o.$typeUrl === MsgResponse.typeUrl; + }, + isSDK(o: any): o is MsgResponseSDKType { + return o && o.$typeUrl === MsgResponse.typeUrl; + }, + isAmino(o: any): o is MsgResponseAmino { + return o && o.$typeUrl === MsgResponse.typeUrl; + }, + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; +GlobalDecoderRegistry.register(MsgResponse.typeUrl, MsgResponse); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/binary.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/binary.ts new file mode 100644 index 0000000000..8ee00df050 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/binary.ts @@ -0,0 +1,534 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// --- + +// Code generated by the command line utilities is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +import { utf8Length, utf8Read, utf8Write } from "./utf8"; +import { + int64ToString, + readInt32, + readUInt32, + uInt64ToString, + varint32read, + varint64read, + writeVarint32, + writeVarint64, + int64FromString, + int64Length, + writeFixed32, + writeByte, + zzDecode, + zzEncode, +} from "./varint"; + +export enum WireType { + Varint = 0, + + Fixed64 = 1, + + Bytes = 2, + + Fixed32 = 5, +} + +// Reader +export interface IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + tag(): [number, WireType, number]; + skip(length?: number): this; + skipType(wireType: number): this; + uint32(): number; + int32(): number; + sint32(): number; + fixed32(): number; + sfixed32(): number; + int64(): bigint; + uint64(): bigint; + sint64(): bigint; + fixed64(): bigint; + sfixed64(): bigint; + float(): number; + double(): number; + bool(): boolean; + bytes(): Uint8Array; + string(): string; +} + +export class BinaryReader implements IBinaryReader { + buf: Uint8Array; + pos: number; + type: number; + len: number; + + assertBounds(): void { + if (this.pos > this.len) throw new RangeError("premature EOF"); + } + + constructor(buf?: ArrayLike) { + this.buf = buf ? new Uint8Array(buf) : new Uint8Array(0); + this.pos = 0; + this.type = 0; + this.len = this.buf.length; + } + + tag(): [number, WireType, number] { + const tag = this.uint32(), + fieldNo = tag >>> 3, + wireType = tag & 7; + if (fieldNo <= 0 || wireType < 0 || wireType > 5) + throw new Error( + "illegal tag: field no " + fieldNo + " wire type " + wireType + ); + return [fieldNo, wireType, tag]; + } + + skip(length?: number) { + if (typeof length === "number") { + if (this.pos + length > this.len) throw indexOutOfRange(this, length); + this.pos += length; + } else { + do { + if (this.pos >= this.len) throw indexOutOfRange(this); + } while (this.buf[this.pos++] & 128); + } + return this; + } + + skipType(wireType: number) { + switch (wireType) { + case WireType.Varint: + this.skip(); + break; + case WireType.Fixed64: + this.skip(8); + break; + case WireType.Bytes: + this.skip(this.uint32()); + break; + case 3: + while ((wireType = this.uint32() & 7) !== 4) { + this.skipType(wireType); + } + break; + case WireType.Fixed32: + this.skip(4); + break; + + /* istanbul ignore next */ + default: + throw Error("invalid wire type " + wireType + " at offset " + this.pos); + } + return this; + } + + uint32(): number { + return varint32read.bind(this)(); + } + + int32(): number { + return this.uint32() | 0; + } + + sint32(): number { + const num = this.uint32(); + return num % 2 === 1 ? (num + 1) / -2 : num / 2; // zigzag encoding + } + + fixed32(): number { + const val = readUInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + sfixed32(): number { + const val = readInt32(this.buf, this.pos); + this.pos += 4; + return val; + } + + int64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(int64ToString(lo, hi)); + } + + uint64(): bigint { + const [lo, hi] = varint64read.bind(this)(); + return BigInt(uInt64ToString(lo, hi)); + } + + sint64(): bigint { + let [lo, hi] = varint64read.bind(this)(); + // zig zag + [lo, hi] = zzDecode(lo, hi); + return BigInt(int64ToString(lo, hi)); + } + + fixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(uInt64ToString(lo, hi)); + } + sfixed64(): bigint { + const lo = this.sfixed32(); + const hi = this.sfixed32(); + return BigInt(int64ToString(lo, hi)); + } + + float(): number { + throw new Error("float not supported"); + } + + double(): number { + throw new Error("double not supported"); + } + + bool(): boolean { + const [lo, hi] = varint64read.bind(this)(); + return lo !== 0 || hi !== 0; + } + + bytes(): Uint8Array { + const len = this.uint32(), + start = this.pos; + this.pos += len; + this.assertBounds(); + return this.buf.subarray(start, start + len); + } + + string(): string { + const bytes = this.bytes(); + return utf8Read(bytes, 0, bytes.length); + } +} + +// Writer +export interface IBinaryWriter { + len: number; + head: IOp; + tail: IOp; + states: State | null; + finish(): Uint8Array; + fork(): IBinaryWriter; + reset(): IBinaryWriter; + ldelim(): IBinaryWriter; + tag(fieldNo: number, type: WireType): IBinaryWriter; + uint32(value: number): IBinaryWriter; + int32(value: number): IBinaryWriter; + sint32(value: number): IBinaryWriter; + int64(value: string | number | bigint): IBinaryWriter; + uint64: (value: string | number | bigint) => IBinaryWriter; + sint64(value: string | number | bigint): IBinaryWriter; + fixed64(value: string | number | bigint): IBinaryWriter; + sfixed64: (value: string | number | bigint) => IBinaryWriter; + bool(value: boolean): IBinaryWriter; + fixed32(value: number): IBinaryWriter; + sfixed32: (value: number) => IBinaryWriter; + float(value: number): IBinaryWriter; + double(value: number): IBinaryWriter; + bytes(value: Uint8Array): IBinaryWriter; + string(value: string): IBinaryWriter; +} + +interface IOp { + len: number; + next?: IOp; + proceed(buf: Uint8Array | number[], pos: number): void; +} + +class Op implements IOp { + fn?: ((val: T, buf: Uint8Array | number[], pos: number) => void) | null; + len: number; + val: T; + next?: IOp; + + constructor( + fn: + | (( + val: T, + buf: Uint8Array | number[], + pos: number + ) => void | undefined | null) + | null, + len: number, + val: T + ) { + this.fn = fn; + this.len = len; + this.val = val; + } + + proceed(buf: Uint8Array | number[], pos: number) { + if (this.fn) { + this.fn(this.val, buf, pos); + } + } +} + +class State { + head: IOp; + tail: IOp; + len: number; + next: State | null; + + constructor(writer: BinaryWriter) { + this.head = writer.head; + this.tail = writer.tail; + this.len = writer.len; + this.next = writer.states; + } +} + +export class BinaryWriter implements IBinaryWriter { + len = 0; + head: IOp; + tail: IOp; + states: State | null; + + constructor() { + this.head = new Op(null, 0, 0); + this.tail = this.head; + this.states = null; + } + + static create() { + return new BinaryWriter(); + } + + static alloc(size: number): Uint8Array | number[] { + if (typeof Uint8Array !== "undefined") { + return pool( + (size) => new Uint8Array(size), + Uint8Array.prototype.subarray + )(size); + } else { + return new Array(size); + } + } + + private _push( + fn: (val: T, buf: Uint8Array | number[], pos: number) => void, + len: number, + val: T + ) { + this.tail = this.tail.next = new Op(fn, len, val); + this.len += len; + return this; + } + + finish(): Uint8Array { + let head = this.head.next, + pos = 0; + const buf = BinaryWriter.alloc(this.len); + while (head) { + head.proceed(buf, pos); + pos += head.len; + head = head.next; + } + return buf as Uint8Array; + } + + fork(): BinaryWriter { + this.states = new State(this); + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + return this; + } + + reset(): BinaryWriter { + if (this.states) { + this.head = this.states.head; + this.tail = this.states.tail; + this.len = this.states.len; + this.states = this.states.next; + } else { + this.head = this.tail = new Op(null, 0, 0); + this.len = 0; + } + return this; + } + + ldelim(): BinaryWriter { + const head = this.head, + tail = this.tail, + len = this.len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } + return this; + } + + tag(fieldNo: number, type: WireType): BinaryWriter { + return this.uint32(((fieldNo << 3) | type) >>> 0); + } + + uint32(value: number): BinaryWriter { + this.len += (this.tail = this.tail.next = + new Op( + writeVarint32, + (value = value >>> 0) < 128 + ? 1 + : value < 16384 + ? 2 + : value < 2097152 + ? 3 + : value < 268435456 + ? 4 + : 5, + value + )).len; + return this; + } + + int32(value: number): BinaryWriter { + return value < 0 + ? this._push(writeVarint64, 10, int64FromString(value.toString())) // 10 bytes per spec + : this.uint32(value); + } + + sint32(value: number): BinaryWriter { + return this.uint32(((value << 1) ^ (value >> 31)) >>> 0); + } + + int64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + // uint64 is the same with int64 + uint64 = BinaryWriter.prototype.int64; + + sint64(value: string | number | bigint): BinaryWriter { + let { lo, hi } = int64FromString(value.toString()); + // zig zag + [lo, hi] = zzEncode(lo, hi); + return this._push(writeVarint64, int64Length(lo, hi), { lo, hi }); + } + + fixed64(value: string | number | bigint): BinaryWriter { + const { lo, hi } = int64FromString(value.toString()); + return this._push(writeFixed32, 4, lo)._push(writeFixed32, 4, hi); + } + + // sfixed64 is the same with fixed64 + sfixed64 = BinaryWriter.prototype.fixed64; + + bool(value: boolean): BinaryWriter { + return this._push(writeByte, 1, value ? 1 : 0); + } + + fixed32(value: number): BinaryWriter { + return this._push(writeFixed32, 4, value >>> 0); + } + + // sfixed32 is the same with fixed32 + sfixed32 = BinaryWriter.prototype.fixed32; + + float(value: number): BinaryWriter { + throw new Error("float not supported" + value); + } + + double(value: number): BinaryWriter { + throw new Error("double not supported" + value); + } + + bytes(value: Uint8Array): BinaryWriter { + const len = value.length >>> 0; + if (!len) return this._push(writeByte, 1, 0); + return this.uint32(len)._push(writeBytes, len, value); + } + + string(value: string): BinaryWriter { + const len = utf8Length(value); + return len + ? this.uint32(len)._push(utf8Write, len, value) + : this._push(writeByte, 1, 0); + } +} + +function writeBytes( + val: Uint8Array | number[], + buf: Uint8Array | number[], + pos: number +) { + if (typeof Uint8Array !== "undefined") { + (buf as Uint8Array).set(val, pos); + } else { + for (let i = 0; i < val.length; ++i) buf[pos + i] = val[i]; + } +} + +function pool( + alloc: (size: number) => Uint8Array, + slice: (begin?: number, end?: number) => Uint8Array, + size?: number +): (size: number) => Uint8Array { + const SIZE = size || 8192; + const MAX = SIZE >>> 1; + let slab: Uint8Array | null = null; + let offset = SIZE; + return function pool_alloc(size): Uint8Array { + if (size < 1 || size > MAX) return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + const buf: Uint8Array = slice.call(slab, offset, (offset += size)); + if (offset & 7) + // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + +function indexOutOfRange(reader: BinaryReader, writeLength?: number) { + return RangeError( + "index out of range: " + + reader.pos + + " + " + + (writeLength || 1) + + " > " + + reader.len + ); +} diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts new file mode 100644 index 0000000000..5a04a17323 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/extern.ts @@ -0,0 +1,33 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + +import { QueryClient, createProtobufRpcClient, ProtobufRpcClient } from '@cosmjs/stargate' +import { Tendermint34Client, HttpEndpoint } from "@cosmjs/tendermint-rpc"; + +const _rpcClients: Record = {}; + +export const getRpcEndpointKey = (rpcEndpoint: string | HttpEndpoint) => { + if (typeof rpcEndpoint === 'string') { + return rpcEndpoint; + } else if (!!rpcEndpoint) { + //@ts-ignore + return rpcEndpoint.url; + } +} + +export const getRpcClient = async (rpcEndpoint: string | HttpEndpoint) => { + const key = getRpcEndpointKey(rpcEndpoint); + if (!key) return; + if (_rpcClients.hasOwnProperty(key)) { + return _rpcClients[key]; + } + const tmClient = await Tendermint34Client.connect(rpcEndpoint); + //@ts-ignore + const client = new QueryClient(tmClient); + const rpc = createProtobufRpcClient(client); + _rpcClients[key] = rpc; + return rpc; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts new file mode 100644 index 0000000000..9b9fc6d670 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts @@ -0,0 +1,4 @@ +import * as _35 from "./gogo"; +export const gogoproto = { + ..._35 +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/gogo.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/gogo.ts new file mode 100644 index 0000000000..693da49fc4 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/gogo.ts @@ -0,0 +1 @@ +export {} \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts new file mode 100644 index 0000000000..50b92187a5 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/api/expr/v1alpha1/eval.ts @@ -0,0 +1,211 @@ +import { BinaryReader, BinaryWriter } from "../../../../binary"; +import { DeepPartial, isSet } from "../../../../helpers"; +export const protobufPackage = "google.api.expr.v1alpha1"; +export interface ExprValue { + /** The ids of the expressions with unknown values. */ + exprs: IdRef[]; +} +export interface ExprValueProtoMsg { + typeUrl: "/google.api.expr.v1alpha1.ExprValue"; + value: Uint8Array; +} +export interface ExprValueSDKType { + exprs: IdRefSDKType[]; +} +export interface IdRef { + /** The expression id. */ + id: number; +} +export interface IdRefProtoMsg { + typeUrl: "/google.api.expr.v1alpha1.IdRef"; + value: Uint8Array; +} +export interface IdRefSDKType { + id: number; +} +function createBaseExprValue(): ExprValue { + return { + exprs: [] + }; +} +export const ExprValue = { + typeUrl: "/google.api.expr.v1alpha1.ExprValue", + encode(message: ExprValue, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.exprs) { + IdRef.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExprValue { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExprValue(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.exprs.push(IdRef.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ExprValue { + const obj = createBaseExprValue(); + if (Array.isArray(object?.exprs)) obj.exprs = object.exprs.map((e: any) => IdRef.fromJSON(e)); + return obj; + }, + toJSON(message: ExprValue): unknown { + const obj: any = {}; + if (message.exprs) { + obj.exprs = message.exprs.map(e => e ? IdRef.toJSON(e) : undefined); + } else { + obj.exprs = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ExprValue { + const message = createBaseExprValue(); + message.exprs = object.exprs?.map(e => IdRef.fromPartial(e)) || []; + return message; + }, + fromSDK(object: ExprValueSDKType): ExprValue { + return { + exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): ExprValueSDKType { + return { + exprs: Array.isArray(object?.exprs) ? object.exprs.map((e: any) => IdRef.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: ExprValue): ExprValueSDKType { + const obj: any = {}; + if (message.exprs) { + obj.exprs = message.exprs.map(e => e ? IdRef.toSDK(e) : undefined); + } else { + obj.exprs = []; + } + return obj; + }, + fromAmino(object: ExprValueAmino): ExprValue { + const message = createBaseExprValue(); + message.exprs = object.exprs?.map(e => IdRef.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExprValue): ExprValueAmino { + const obj: any = {}; + if (message.exprs) { + obj.exprs = message.exprs.map(e => e ? IdRef.toAmino(e) : undefined); + } else { + obj.exprs = message.exprs; + } + return obj; + }, + fromAminoMsg(object: ExprValueAminoMsg): ExprValue { + return ExprValue.fromAmino(object.value); + }, + fromProtoMsg(message: ExprValueProtoMsg): ExprValue { + return ExprValue.decode(message.value); + }, + toProto(message: ExprValue): Uint8Array { + return ExprValue.encode(message).finish(); + }, + toProtoMsg(message: ExprValue): ExprValueProtoMsg { + return { + typeUrl: "/google.api.expr.v1alpha1.ExprValue", + value: ExprValue.encode(message).finish() + }; + } +}; +function createBaseIdRef(): IdRef { + return { + id: 0 + }; +} +export const IdRef = { + typeUrl: "/google.api.expr.v1alpha1.IdRef", + encode(message: IdRef, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.id !== 0) { + writer.uint32(8).int32(message.id); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): IdRef { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseIdRef(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.id = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): IdRef { + const obj = createBaseIdRef(); + if (isSet(object.id)) obj.id = Number(object.id); + return obj; + }, + toJSON(message: IdRef): unknown { + const obj: any = {}; + message.id !== undefined && (obj.id = Math.round(message.id)); + return obj; + }, + fromPartial(object: DeepPartial): IdRef { + const message = createBaseIdRef(); + message.id = object.id ?? 0; + return message; + }, + fromSDK(object: IdRefSDKType): IdRef { + return { + id: object?.id + }; + }, + fromSDKJSON(object: any): IdRefSDKType { + return { + id: isSet(object.id) ? Number(object.id) : 0 + }; + }, + toSDK(message: IdRef): IdRefSDKType { + const obj: any = {}; + obj.id = message.id; + return obj; + }, + fromAmino(object: IdRefAmino): IdRef { + const message = createBaseIdRef(); + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + return message; + }, + toAmino(message: IdRef): IdRefAmino { + const obj: any = {}; + obj.id = message.id === 0 ? undefined : message.id; + return obj; + }, + fromAminoMsg(object: IdRefAminoMsg): IdRef { + return IdRef.fromAmino(object.value); + }, + fromProtoMsg(message: IdRefProtoMsg): IdRef { + return IdRef.decode(message.value); + }, + toProto(message: IdRef): Uint8Array { + return IdRef.encode(message).finish(); + }, + toProtoMsg(message: IdRef): IdRefProtoMsg { + return { + typeUrl: "/google.api.expr.v1alpha1.IdRef", + value: IdRef.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts new file mode 100644 index 0000000000..39ebd5c73e --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts @@ -0,0 +1,20 @@ +import * as _36 from "./api/expr/v1alpha1/eval"; +import * as _37 from "./protobuf/any"; +import * as _38 from "./protobuf/duration"; +import * as _39 from "./protobuf/timestamp"; +import * as _40 from "./protobuf/descriptor"; +export namespace google { + export namespace api { + export namespace expr { + export const v1alpha1 = { + ..._36 + }; + } + } + export const protobuf = { + ..._37, + ..._38, + ..._39, + ..._40 + }; +} \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts new file mode 100644 index 0000000000..70aebe41cd --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/any.ts @@ -0,0 +1,311 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../../helpers"; +export const protobufPackage = "google.protobuf"; +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface Any { + $typeUrl?: "/google.protobuf.Any"; + /** + * A URL/resource name that uniquely identifies the type of the serialized + * protocol buffer message. This string must contain at least + * one "/" character. The last segment of the URL's path must represent + * the fully qualified name of the type (as in + * `path/google.protobuf.Duration`). The name should be in a canonical form + * (e.g., leading "." is not accepted). + * + * In practice, teams usually precompile into the binary all types that they + * expect it to use in the context of Any. However, for URLs which use the + * scheme `http`, `https`, or no scheme, one can optionally set up a type + * server that maps type URLs to message definitions as follows: + * + * * If no scheme is provided, `https` is assumed. + * * An HTTP GET on the URL must yield a [google.protobuf.Type][] + * value in binary format, or produce an error. + * * Applications are allowed to cache lookup results based on the + * URL, or have them precompiled into a binary to avoid any + * lookup. Therefore, binary compatibility needs to be preserved + * on changes to types. (Use versioned type names to manage + * breaking changes.) + * + * Note: this functionality is not currently available in the official + * protobuf release, and it is not used for type URLs beginning with + * type.googleapis.com. + * + * Schemes other than `http`, `https` (or the empty scheme) might be + * used with implementation specific semantics. + */ + typeUrl: string; + /** Must be a valid serialized protocol buffer of the above specified type. */ + value: Uint8Array; +} +export interface AnyProtoMsg { + typeUrl: "/google.protobuf.Any"; + value: Uint8Array; +} +/** + * `Any` contains an arbitrary serialized protocol buffer message along with a + * URL that describes the type of the serialized message. + * + * Protobuf library provides support to pack/unpack Any values in the form + * of utility functions or additional generated methods of the Any type. + * + * Example 1: Pack and unpack a message in C++. + * + * Foo foo = ...; + * Any any; + * any.PackFrom(foo); + * ... + * if (any.UnpackTo(&foo)) { + * ... + * } + * + * Example 2: Pack and unpack a message in Java. + * + * Foo foo = ...; + * Any any = Any.pack(foo); + * ... + * if (any.is(Foo.class)) { + * foo = any.unpack(Foo.class); + * } + * + * Example 3: Pack and unpack a message in Python. + * + * foo = Foo(...) + * any = Any() + * any.Pack(foo) + * ... + * if any.Is(Foo.DESCRIPTOR): + * any.Unpack(foo) + * ... + * + * Example 4: Pack and unpack a message in Go + * + * foo := &pb.Foo{...} + * any, err := ptypes.MarshalAny(foo) + * ... + * foo := &pb.Foo{} + * if err := ptypes.UnmarshalAny(any, foo); err != nil { + * ... + * } + * + * The pack methods provided by protobuf library will by default use + * 'type.googleapis.com/full.type.name' as the type URL and the unpack + * methods only use the fully qualified type name after the last '/' + * in the type URL, for example "foo.bar.com/x/y.z" will yield type + * name "y.z". + * + * + * JSON + * ==== + * The JSON representation of an `Any` value uses the regular + * representation of the deserialized, embedded message, with an + * additional field `@type` which contains the type URL. Example: + * + * package google.profile; + * message Person { + * string first_name = 1; + * string last_name = 2; + * } + * + * { + * "@type": "type.googleapis.com/google.profile.Person", + * "firstName": , + * "lastName": + * } + * + * If the embedded message type is well-known and has a custom JSON + * representation, that representation will be embedded adding a field + * `value` which holds the custom JSON in addition to the `@type` + * field. Example (for message [google.protobuf.Duration][]): + * + * { + * "@type": "type.googleapis.com/google.protobuf.Duration", + * "value": "1.212s" + * } + */ +export interface AnySDKType { + $typeUrl?: "/google.protobuf.Any"; + type_url: string; + value: Uint8Array; +} +function createBaseAny(): Any { + return { + $typeUrl: "/google.protobuf.Any", + typeUrl: "", + value: new Uint8Array() + }; +} +export const Any = { + typeUrl: "/google.protobuf.Any", + encode(message: Any, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.typeUrl !== "") { + writer.uint32(10).string(message.typeUrl); + } + if (message.value.length !== 0) { + writer.uint32(18).bytes(message.value); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Any { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAny(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.typeUrl = reader.string(); + break; + case 2: + message.value = reader.bytes(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Any { + const obj = createBaseAny(); + if (isSet(object.typeUrl)) obj.typeUrl = String(object.typeUrl); + if (isSet(object.value)) obj.value = bytesFromBase64(object.value); + return obj; + }, + 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 = createBaseAny(); + message.typeUrl = object.typeUrl ?? ""; + message.value = object.value ?? new Uint8Array(); + return message; + }, + fromSDK(object: AnySDKType): Any { + return { + typeUrl: object?.type_url, + value: object?.value + }; + }, + fromSDKJSON(object: any): AnySDKType { + return { + type_url: isSet(object.type_url) ? String(object.type_url) : "", + value: isSet(object.value) ? bytesFromBase64(object.value) : new Uint8Array() + }; + }, + toSDK(message: Any): AnySDKType { + const obj: any = {}; + obj.type_url = message.typeUrl; + obj.value = message.value; + return obj; + }, + fromAmino(object: AnyAmino): Any { + return { + typeUrl: object.type, + value: object.value + }; + }, + toAmino(message: Any): AnyAmino { + const obj: any = {}; + obj.type = message.typeUrl; + obj.value = message.value; + return obj; + }, + fromAminoMsg(object: AnyAminoMsg): Any { + return Any.fromAmino(object.value); + }, + fromProtoMsg(message: AnyProtoMsg): Any { + return Any.decode(message.value); + }, + toProto(message: Any): Uint8Array { + return Any.encode(message).finish(); + }, + toProtoMsg(message: Any): AnyProtoMsg { + return { + typeUrl: "/google.protobuf.Any", + value: Any.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts new file mode 100644 index 0000000000..69375952f9 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts @@ -0,0 +1,5842 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { DeepPartial, isSet, bytesFromBase64, base64FromBytes } from "../../helpers"; +export const protobufPackage = "google.protobuf"; +export enum FieldDescriptorProto_Type { + /** + * TYPE_DOUBLE - 0 is reserved for errors. + * Order is weird for historical reasons. + */ + TYPE_DOUBLE = 1, + TYPE_FLOAT = 2, + /** + * TYPE_INT64 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + * negative values are likely. + */ + TYPE_INT64 = 3, + TYPE_UINT64 = 4, + /** + * TYPE_INT32 - Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + * negative values are likely. + */ + TYPE_INT32 = 5, + TYPE_FIXED64 = 6, + TYPE_FIXED32 = 7, + TYPE_BOOL = 8, + TYPE_STRING = 9, + /** + * TYPE_GROUP - Tag-delimited aggregate. + * Group type is deprecated and not supported in proto3. However, Proto3 + * implementations should still be able to parse the group wire format and + * treat group fields as unknown fields. + */ + TYPE_GROUP = 10, + TYPE_MESSAGE = 11, + /** TYPE_BYTES - New in version 2. */ + TYPE_BYTES = 12, + TYPE_UINT32 = 13, + TYPE_ENUM = 14, + TYPE_SFIXED32 = 15, + TYPE_SFIXED64 = 16, + /** TYPE_SINT32 - Uses ZigZag encoding. */ + TYPE_SINT32 = 17, + /** TYPE_SINT64 - Uses ZigZag encoding. */ + TYPE_SINT64 = 18, + UNRECOGNIZED = -1, +} +export const FieldDescriptorProto_TypeSDKType = FieldDescriptorProto_Type; +export function fieldDescriptorProto_TypeFromJSON(object: any): FieldDescriptorProto_Type { + switch (object) { + case 1: + case "TYPE_DOUBLE": + return FieldDescriptorProto_Type.TYPE_DOUBLE; + case 2: + case "TYPE_FLOAT": + return FieldDescriptorProto_Type.TYPE_FLOAT; + case 3: + case "TYPE_INT64": + return FieldDescriptorProto_Type.TYPE_INT64; + case 4: + case "TYPE_UINT64": + return FieldDescriptorProto_Type.TYPE_UINT64; + case 5: + case "TYPE_INT32": + return FieldDescriptorProto_Type.TYPE_INT32; + case 6: + case "TYPE_FIXED64": + return FieldDescriptorProto_Type.TYPE_FIXED64; + case 7: + case "TYPE_FIXED32": + return FieldDescriptorProto_Type.TYPE_FIXED32; + case 8: + case "TYPE_BOOL": + return FieldDescriptorProto_Type.TYPE_BOOL; + case 9: + case "TYPE_STRING": + return FieldDescriptorProto_Type.TYPE_STRING; + case 10: + case "TYPE_GROUP": + return FieldDescriptorProto_Type.TYPE_GROUP; + case 11: + case "TYPE_MESSAGE": + return FieldDescriptorProto_Type.TYPE_MESSAGE; + case 12: + case "TYPE_BYTES": + return FieldDescriptorProto_Type.TYPE_BYTES; + case 13: + case "TYPE_UINT32": + return FieldDescriptorProto_Type.TYPE_UINT32; + case 14: + case "TYPE_ENUM": + return FieldDescriptorProto_Type.TYPE_ENUM; + case 15: + case "TYPE_SFIXED32": + return FieldDescriptorProto_Type.TYPE_SFIXED32; + case 16: + case "TYPE_SFIXED64": + return FieldDescriptorProto_Type.TYPE_SFIXED64; + case 17: + case "TYPE_SINT32": + return FieldDescriptorProto_Type.TYPE_SINT32; + case 18: + case "TYPE_SINT64": + return FieldDescriptorProto_Type.TYPE_SINT64; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Type.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_TypeToJSON(object: FieldDescriptorProto_Type): string { + switch (object) { + case FieldDescriptorProto_Type.TYPE_DOUBLE: + return "TYPE_DOUBLE"; + case FieldDescriptorProto_Type.TYPE_FLOAT: + return "TYPE_FLOAT"; + case FieldDescriptorProto_Type.TYPE_INT64: + return "TYPE_INT64"; + case FieldDescriptorProto_Type.TYPE_UINT64: + return "TYPE_UINT64"; + case FieldDescriptorProto_Type.TYPE_INT32: + return "TYPE_INT32"; + case FieldDescriptorProto_Type.TYPE_FIXED64: + return "TYPE_FIXED64"; + case FieldDescriptorProto_Type.TYPE_FIXED32: + return "TYPE_FIXED32"; + case FieldDescriptorProto_Type.TYPE_BOOL: + return "TYPE_BOOL"; + case FieldDescriptorProto_Type.TYPE_STRING: + return "TYPE_STRING"; + case FieldDescriptorProto_Type.TYPE_GROUP: + return "TYPE_GROUP"; + case FieldDescriptorProto_Type.TYPE_MESSAGE: + return "TYPE_MESSAGE"; + case FieldDescriptorProto_Type.TYPE_BYTES: + return "TYPE_BYTES"; + case FieldDescriptorProto_Type.TYPE_UINT32: + return "TYPE_UINT32"; + case FieldDescriptorProto_Type.TYPE_ENUM: + return "TYPE_ENUM"; + case FieldDescriptorProto_Type.TYPE_SFIXED32: + return "TYPE_SFIXED32"; + case FieldDescriptorProto_Type.TYPE_SFIXED64: + return "TYPE_SFIXED64"; + case FieldDescriptorProto_Type.TYPE_SINT32: + return "TYPE_SINT32"; + case FieldDescriptorProto_Type.TYPE_SINT64: + return "TYPE_SINT64"; + case FieldDescriptorProto_Type.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldDescriptorProto_Label { + /** LABEL_OPTIONAL - 0 is reserved for errors */ + LABEL_OPTIONAL = 1, + LABEL_REQUIRED = 2, + LABEL_REPEATED = 3, + UNRECOGNIZED = -1, +} +export const FieldDescriptorProto_LabelSDKType = FieldDescriptorProto_Label; +export function fieldDescriptorProto_LabelFromJSON(object: any): FieldDescriptorProto_Label { + switch (object) { + case 1: + case "LABEL_OPTIONAL": + return FieldDescriptorProto_Label.LABEL_OPTIONAL; + case 2: + case "LABEL_REQUIRED": + return FieldDescriptorProto_Label.LABEL_REQUIRED; + case 3: + case "LABEL_REPEATED": + return FieldDescriptorProto_Label.LABEL_REPEATED; + case -1: + case "UNRECOGNIZED": + default: + return FieldDescriptorProto_Label.UNRECOGNIZED; + } +} +export function fieldDescriptorProto_LabelToJSON(object: FieldDescriptorProto_Label): string { + switch (object) { + case FieldDescriptorProto_Label.LABEL_OPTIONAL: + return "LABEL_OPTIONAL"; + case FieldDescriptorProto_Label.LABEL_REQUIRED: + return "LABEL_REQUIRED"; + case FieldDescriptorProto_Label.LABEL_REPEATED: + return "LABEL_REPEATED"; + case FieldDescriptorProto_Label.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** Generated classes can be optimized for speed or code size. */ +export enum FileOptions_OptimizeMode { + /** + * SPEED - Generate complete code for parsing, serialization, + * etc. + */ + SPEED = 1, + /** CODE_SIZE - Use ReflectionOps to implement these methods. */ + CODE_SIZE = 2, + /** LITE_RUNTIME - Generate code using MessageLite and the lite runtime. */ + LITE_RUNTIME = 3, + UNRECOGNIZED = -1, +} +export const FileOptions_OptimizeModeSDKType = FileOptions_OptimizeMode; +export function fileOptions_OptimizeModeFromJSON(object: any): FileOptions_OptimizeMode { + switch (object) { + case 1: + case "SPEED": + return FileOptions_OptimizeMode.SPEED; + case 2: + case "CODE_SIZE": + return FileOptions_OptimizeMode.CODE_SIZE; + case 3: + case "LITE_RUNTIME": + return FileOptions_OptimizeMode.LITE_RUNTIME; + case -1: + case "UNRECOGNIZED": + default: + return FileOptions_OptimizeMode.UNRECOGNIZED; + } +} +export function fileOptions_OptimizeModeToJSON(object: FileOptions_OptimizeMode): string { + switch (object) { + case FileOptions_OptimizeMode.SPEED: + return "SPEED"; + case FileOptions_OptimizeMode.CODE_SIZE: + return "CODE_SIZE"; + case FileOptions_OptimizeMode.LITE_RUNTIME: + return "LITE_RUNTIME"; + case FileOptions_OptimizeMode.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldOptions_CType { + /** STRING - Default mode. */ + STRING = 0, + CORD = 1, + STRING_PIECE = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_CTypeSDKType = FieldOptions_CType; +export function fieldOptions_CTypeFromJSON(object: any): FieldOptions_CType { + switch (object) { + case 0: + case "STRING": + return FieldOptions_CType.STRING; + case 1: + case "CORD": + return FieldOptions_CType.CORD; + case 2: + case "STRING_PIECE": + return FieldOptions_CType.STRING_PIECE; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_CType.UNRECOGNIZED; + } +} +export function fieldOptions_CTypeToJSON(object: FieldOptions_CType): string { + switch (object) { + case FieldOptions_CType.STRING: + return "STRING"; + case FieldOptions_CType.CORD: + return "CORD"; + case FieldOptions_CType.STRING_PIECE: + return "STRING_PIECE"; + case FieldOptions_CType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export enum FieldOptions_JSType { + /** JS_NORMAL - Use the default type. */ + JS_NORMAL = 0, + /** JS_STRING - Use JavaScript strings. */ + JS_STRING = 1, + /** JS_NUMBER - Use JavaScript numbers. */ + JS_NUMBER = 2, + UNRECOGNIZED = -1, +} +export const FieldOptions_JSTypeSDKType = FieldOptions_JSType; +export function fieldOptions_JSTypeFromJSON(object: any): FieldOptions_JSType { + switch (object) { + case 0: + case "JS_NORMAL": + return FieldOptions_JSType.JS_NORMAL; + case 1: + case "JS_STRING": + return FieldOptions_JSType.JS_STRING; + case 2: + case "JS_NUMBER": + return FieldOptions_JSType.JS_NUMBER; + case -1: + case "UNRECOGNIZED": + default: + return FieldOptions_JSType.UNRECOGNIZED; + } +} +export function fieldOptions_JSTypeToJSON(object: FieldOptions_JSType): string { + switch (object) { + case FieldOptions_JSType.JS_NORMAL: + return "JS_NORMAL"; + case FieldOptions_JSType.JS_STRING: + return "JS_STRING"; + case FieldOptions_JSType.JS_NUMBER: + return "JS_NUMBER"; + case FieldOptions_JSType.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * Is this method side-effect-free (or safe in HTTP parlance), or idempotent, + * or neither? HTTP based RPC implementation may choose GET verb for safe + * methods, and PUT verb for idempotent methods instead of the default POST. + */ +export enum MethodOptions_IdempotencyLevel { + IDEMPOTENCY_UNKNOWN = 0, + /** NO_SIDE_EFFECTS - implies idempotent */ + NO_SIDE_EFFECTS = 1, + /** IDEMPOTENT - idempotent, but may have side effects */ + IDEMPOTENT = 2, + UNRECOGNIZED = -1, +} +export const MethodOptions_IdempotencyLevelSDKType = MethodOptions_IdempotencyLevel; +export function methodOptions_IdempotencyLevelFromJSON(object: any): MethodOptions_IdempotencyLevel { + switch (object) { + case 0: + case "IDEMPOTENCY_UNKNOWN": + return MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN; + case 1: + case "NO_SIDE_EFFECTS": + return MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS; + case 2: + case "IDEMPOTENT": + return MethodOptions_IdempotencyLevel.IDEMPOTENT; + case -1: + case "UNRECOGNIZED": + default: + return MethodOptions_IdempotencyLevel.UNRECOGNIZED; + } +} +export function methodOptions_IdempotencyLevelToJSON(object: MethodOptions_IdempotencyLevel): string { + switch (object) { + case MethodOptions_IdempotencyLevel.IDEMPOTENCY_UNKNOWN: + return "IDEMPOTENCY_UNKNOWN"; + case MethodOptions_IdempotencyLevel.NO_SIDE_EFFECTS: + return "NO_SIDE_EFFECTS"; + case MethodOptions_IdempotencyLevel.IDEMPOTENT: + return "IDEMPOTENT"; + case MethodOptions_IdempotencyLevel.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSet { + file: FileDescriptorProto[]; +} +export interface FileDescriptorSetProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorSet"; + value: Uint8Array; +} +/** + * The protocol compiler can output a FileDescriptorSet containing the .proto + * files it parses. + */ +export interface FileDescriptorSetSDKType { + file: FileDescriptorProtoSDKType[]; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProto { + /** file name, relative to root of source tree */ + name: string; + package: string; + /** Names of files imported by this file. */ + dependency: string[]; + /** Indexes of the public imported files in the dependency list above. */ + publicDependency: number[]; + /** + * Indexes of the weak imported files in the dependency list. + * For Google-internal migration only. Do not use. + */ + weakDependency: number[]; + /** All top-level definitions in this file. */ + messageType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + service: ServiceDescriptorProto[]; + extension: FieldDescriptorProto[]; + options?: FileOptions; + /** + * This field contains optional information about the original source code. + * You may safely remove this entire field without harming runtime + * functionality of the descriptors -- the information is needed only by + * development tools. + */ + sourceCodeInfo?: SourceCodeInfo; + /** + * The syntax of the proto file. + * The supported values are "proto2" and "proto3". + */ + syntax: string; +} +export interface FileDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FileDescriptorProto"; + value: Uint8Array; +} +/** Describes a complete .proto file. */ +export interface FileDescriptorProtoSDKType { + name: string; + package: string; + dependency: string[]; + public_dependency: number[]; + weak_dependency: number[]; + message_type: DescriptorProtoSDKType[]; + enum_type: EnumDescriptorProtoSDKType[]; + service: ServiceDescriptorProtoSDKType[]; + extension: FieldDescriptorProtoSDKType[]; + options?: FileOptionsSDKType; + source_code_info?: SourceCodeInfoSDKType; + syntax: string; +} +/** Describes a message type. */ +export interface DescriptorProto { + name: string; + field: FieldDescriptorProto[]; + extension: FieldDescriptorProto[]; + nestedType: DescriptorProto[]; + enumType: EnumDescriptorProto[]; + extensionRange: DescriptorProto_ExtensionRange[]; + oneofDecl: OneofDescriptorProto[]; + options?: MessageOptions; + reservedRange: DescriptorProto_ReservedRange[]; + /** + * Reserved field names, which may not be used by fields in the same message. + * A given name may only be reserved once. + */ + reservedName: string[]; +} +export interface DescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.DescriptorProto"; + value: Uint8Array; +} +/** Describes a message type. */ +export interface DescriptorProtoSDKType { + name: string; + field: FieldDescriptorProtoSDKType[]; + extension: FieldDescriptorProtoSDKType[]; + nested_type: DescriptorProtoSDKType[]; + enum_type: EnumDescriptorProtoSDKType[]; + extension_range: DescriptorProto_ExtensionRangeSDKType[]; + oneof_decl: OneofDescriptorProtoSDKType[]; + options?: MessageOptionsSDKType; + reserved_range: DescriptorProto_ReservedRangeSDKType[]; + reserved_name: string[]; +} +export interface DescriptorProto_ExtensionRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; + options?: ExtensionRangeOptions; +} +export interface DescriptorProto_ExtensionRangeProtoMsg { + typeUrl: "/google.protobuf.ExtensionRange"; + value: Uint8Array; +} +export interface DescriptorProto_ExtensionRangeSDKType { + start: number; + end: number; + options?: ExtensionRangeOptionsSDKType; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRange { + /** Inclusive. */ + start: number; + /** Exclusive. */ + end: number; +} +export interface DescriptorProto_ReservedRangeProtoMsg { + typeUrl: "/google.protobuf.ReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved tag numbers. Reserved tag numbers may not be used by + * fields or extension ranges in the same message. Reserved ranges may + * not overlap. + */ +export interface DescriptorProto_ReservedRangeSDKType { + start: number; + end: number; +} +export interface ExtensionRangeOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ExtensionRangeOptionsProtoMsg { + typeUrl: "/google.protobuf.ExtensionRangeOptions"; + value: Uint8Array; +} +export interface ExtensionRangeOptionsSDKType { + uninterpreted_option: UninterpretedOptionSDKType[]; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProto { + name: string; + number: number; + label: FieldDescriptorProto_Label; + /** + * If type_name is set, this need not be set. If both this and type_name + * are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + */ + type: FieldDescriptorProto_Type; + /** + * For message and enum types, this is the name of the type. If the name + * starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + * rules are used to find the type (i.e. first the nested types within this + * message are searched, then within the parent, on up to the root + * namespace). + */ + typeName: string; + /** + * For extensions, this is the name of the type being extended. It is + * resolved in the same manner as type_name. + */ + extendee: string; + /** + * For numeric types, contains the original text representation of the value. + * For booleans, "true" or "false". + * For strings, contains the default text contents (not escaped in any way). + * For bytes, contains the C escaped value. All bytes >= 128 are escaped. + * TODO(kenton): Base-64 encode? + */ + defaultValue: string; + /** + * If set, gives the index of a oneof in the containing type's oneof_decl + * list. This field is a member of that oneof. + */ + oneofIndex: number; + /** + * JSON name of this field. The value is set by protocol compiler. If the + * user has set a "json_name" option on this field, that option's value + * will be used. Otherwise, it's deduced from the field's name by converting + * it to camelCase. + */ + jsonName: string; + options?: FieldOptions; +} +export interface FieldDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.FieldDescriptorProto"; + value: Uint8Array; +} +/** Describes a field within a message. */ +export interface FieldDescriptorProtoSDKType { + name: string; + number: number; + label: FieldDescriptorProto_Label; + type: FieldDescriptorProto_Type; + type_name: string; + extendee: string; + default_value: string; + oneof_index: number; + json_name: string; + options?: FieldOptionsSDKType; +} +/** Describes a oneof. */ +export interface OneofDescriptorProto { + name: string; + options?: OneofOptions; +} +export interface OneofDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.OneofDescriptorProto"; + value: Uint8Array; +} +/** Describes a oneof. */ +export interface OneofDescriptorProtoSDKType { + name: string; + options?: OneofOptionsSDKType; +} +/** Describes an enum type. */ +export interface EnumDescriptorProto { + name: string; + value: EnumValueDescriptorProto[]; + options?: EnumOptions; + /** + * Range of reserved numeric values. Reserved numeric values may not be used + * by enum values in the same enum declaration. Reserved ranges may not + * overlap. + */ + reservedRange: EnumDescriptorProto_EnumReservedRange[]; + /** + * Reserved enum value names, which may not be reused. A given name may only + * be reserved once. + */ + reservedName: string[]; +} +export interface EnumDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumDescriptorProto"; + value: Uint8Array; +} +/** Describes an enum type. */ +export interface EnumDescriptorProtoSDKType { + name: string; + value: EnumValueDescriptorProtoSDKType[]; + options?: EnumOptionsSDKType; + reserved_range: EnumDescriptorProto_EnumReservedRangeSDKType[]; + reserved_name: string[]; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRange { + /** Inclusive. */ + start: number; + /** Inclusive. */ + end: number; +} +export interface EnumDescriptorProto_EnumReservedRangeProtoMsg { + typeUrl: "/google.protobuf.EnumReservedRange"; + value: Uint8Array; +} +/** + * Range of reserved numeric values. Reserved values may not be used by + * entries in the same enum. Reserved ranges may not overlap. + * + * Note that this is distinct from DescriptorProto.ReservedRange in that it + * is inclusive such that it can appropriately represent the entire int32 + * domain. + */ +export interface EnumDescriptorProto_EnumReservedRangeSDKType { + start: number; + end: number; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProto { + name: string; + number: number; + options?: EnumValueOptions; +} +export interface EnumValueDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.EnumValueDescriptorProto"; + value: Uint8Array; +} +/** Describes a value within an enum. */ +export interface EnumValueDescriptorProtoSDKType { + name: string; + number: number; + options?: EnumValueOptionsSDKType; +} +/** Describes a service. */ +export interface ServiceDescriptorProto { + name: string; + method: MethodDescriptorProto[]; + options?: ServiceOptions; +} +export interface ServiceDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.ServiceDescriptorProto"; + value: Uint8Array; +} +/** Describes a service. */ +export interface ServiceDescriptorProtoSDKType { + name: string; + method: MethodDescriptorProtoSDKType[]; + options?: ServiceOptionsSDKType; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProto { + name: string; + /** + * Input and output type names. These are resolved in the same way as + * FieldDescriptorProto.type_name, but must refer to a message type. + */ + inputType: string; + outputType: string; + options?: MethodOptions; + /** Identifies if client streams multiple client messages */ + clientStreaming: boolean; + /** Identifies if server streams multiple server messages */ + serverStreaming: boolean; +} +export interface MethodDescriptorProtoProtoMsg { + typeUrl: "/google.protobuf.MethodDescriptorProto"; + value: Uint8Array; +} +/** Describes a method of a service. */ +export interface MethodDescriptorProtoSDKType { + name: string; + input_type: string; + output_type: string; + options?: MethodOptionsSDKType; + client_streaming: boolean; + server_streaming: boolean; +} +export interface FileOptions { + /** + * Sets the Java package where classes generated from this .proto will be + * placed. By default, the proto package is used, but this is often + * inappropriate because proto packages do not normally start with backwards + * domain names. + */ + javaPackage: string; + /** + * If set, all the classes from the .proto file are wrapped in a single + * outer class with the given name. This applies to both Proto1 + * (equivalent to the old "--one_java_file" option) and Proto2 (where + * a .proto always translates to a single class, but you may want to + * explicitly choose the class name). + */ + javaOuterClassname: string; + /** + * If set true, then the Java code generator will generate a separate .java + * file for each top-level message, enum, and service defined in the .proto + * file. Thus, these types will *not* be nested inside the outer class + * named by java_outer_classname. However, the outer class will still be + * generated to contain the file's getDescriptor() method as well as any + * top-level extensions defined in the file. + */ + javaMultipleFiles: boolean; + /** This option does nothing. */ + /** @deprecated */ + javaGenerateEqualsAndHash: boolean; + /** + * If set true, then the Java2 code generator will generate code that + * throws an exception whenever an attempt is made to assign a non-UTF-8 + * byte sequence to a string field. + * Message reflection will do the same. + * However, an extension field still accepts non-UTF-8 byte sequences. + * This option has no effect on when used with the lite runtime. + */ + javaStringCheckUtf8: boolean; + optimizeFor: FileOptions_OptimizeMode; + /** + * Sets the Go package where structs generated from this .proto will be + * placed. If omitted, the Go package will be derived from the following: + * - The basename of the package import path, if provided. + * - Otherwise, the package statement in the .proto file, if present. + * - Otherwise, the basename of the .proto file, without extension. + */ + goPackage: string; + /** + * Should generic services be generated in each language? "Generic" services + * are not specific to any particular RPC system. They are generated by the + * main code generators in each language (without additional plugins). + * Generic services were the only kind of service generation supported by + * early versions of google.protobuf. + * + * Generic services are now considered deprecated in favor of using plugins + * that generate code specific to your particular RPC system. Therefore, + * these default to false. Old code which depends on generic services should + * explicitly set them to true. + */ + ccGenericServices: boolean; + javaGenericServices: boolean; + pyGenericServices: boolean; + phpGenericServices: boolean; + /** + * Is this file deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for everything in the file, or it will be completely ignored; in the very + * least, this is a formalization for deprecating files. + */ + deprecated: boolean; + /** + * Enables the use of arenas for the proto messages in this file. This applies + * only to generated classes for C++. + */ + ccEnableArenas: boolean; + /** + * Sets the objective c class prefix which is prepended to all objective c + * generated classes from this .proto. There is no default. + */ + objcClassPrefix: string; + /** Namespace for generated classes; defaults to the package. */ + csharpNamespace: string; + /** + * By default Swift generators will take the proto package and CamelCase it + * replacing '.' with underscore and use that to prefix the types/symbols + * defined. When this options is provided, they will use this value instead + * to prefix the types/symbols defined. + */ + swiftPrefix: string; + /** + * Sets the php class prefix which is prepended to all php generated classes + * from this .proto. Default is empty. + */ + phpClassPrefix: string; + /** + * Use this option to change the namespace of php generated classes. Default + * is empty. When this option is empty, the package name will be used for + * determining the namespace. + */ + phpNamespace: string; + /** + * Use this option to change the namespace of php generated metadata classes. + * Default is empty. When this option is empty, the proto file name will be + * used for determining the namespace. + */ + phpMetadataNamespace: string; + /** + * Use this option to change the package of ruby generated classes. Default + * is empty. When this option is not set, the package name will be used for + * determining the ruby package. + */ + rubyPackage: string; + /** + * The parser stores options it doesn't recognize here. + * See the documentation for the "Options" section above. + */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FileOptionsProtoMsg { + typeUrl: "/google.protobuf.FileOptions"; + value: Uint8Array; +} +export interface FileOptionsSDKType { + java_package: string; + java_outer_classname: string; + java_multiple_files: boolean; + /** @deprecated */ + java_generate_equals_and_hash: boolean; + java_string_check_utf8: boolean; + optimize_for: FileOptions_OptimizeMode; + go_package: string; + cc_generic_services: boolean; + java_generic_services: boolean; + py_generic_services: boolean; + php_generic_services: boolean; + deprecated: boolean; + cc_enable_arenas: boolean; + objc_class_prefix: string; + csharp_namespace: string; + swift_prefix: string; + php_class_prefix: string; + php_namespace: string; + php_metadata_namespace: string; + ruby_package: string; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface MessageOptions { + /** + * Set true to use the old proto1 MessageSet wire format for extensions. + * This is provided for backwards-compatibility with the MessageSet wire + * format. You should not use this for any other reason: It's less + * efficient, has fewer features, and is more complicated. + * + * The message must be defined exactly as follows: + * message Foo { + * option message_set_wire_format = true; + * extensions 4 to max; + * } + * Note that the message cannot have any defined fields; MessageSets only + * have extensions. + * + * All extensions of your type must be singular messages; e.g. they cannot + * be int32s, enums, or repeated messages. + * + * Because this is an option, the above two restrictions are not enforced by + * the protocol compiler. + */ + messageSetWireFormat: boolean; + /** + * Disables the generation of the standard "descriptor()" accessor, which can + * conflict with a field of the same name. This is meant to make migration + * from proto1 easier; new code should avoid fields named "descriptor". + */ + noStandardDescriptorAccessor: boolean; + /** + * Is this message deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the message, or it will be completely ignored; in the very least, + * this is a formalization for deprecating messages. + */ + deprecated: boolean; + /** + * Whether the message is an automatically generated map entry type for the + * maps field. + * + * For maps fields: + * map map_field = 1; + * The parsed descriptor looks like: + * message MapFieldEntry { + * option map_entry = true; + * optional KeyType key = 1; + * optional ValueType value = 2; + * } + * repeated MapFieldEntry map_field = 1; + * + * Implementations may choose not to generate the map_entry=true message, but + * use a native map in the target language to hold the keys and values. + * The reflection APIs in such implementations still need to work as + * if the field is a repeated message field. + * + * NOTE: Do not set the option in .proto files. Always use the maps syntax + * instead. The option should only be implicitly set by the proto compiler + * parser. + */ + mapEntry: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface MessageOptionsProtoMsg { + typeUrl: "/google.protobuf.MessageOptions"; + value: Uint8Array; +} +export interface MessageOptionsSDKType { + message_set_wire_format: boolean; + no_standard_descriptor_accessor: boolean; + deprecated: boolean; + map_entry: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface FieldOptions { + /** + * The ctype option instructs the C++ code generator to use a different + * representation of the field than it normally would. See the specific + * options below. This option is not yet implemented in the open source + * release -- sorry, we'll try to include it in a future version! + */ + ctype: FieldOptions_CType; + /** + * The packed option can be enabled for repeated primitive fields to enable + * a more efficient representation on the wire. Rather than repeatedly + * writing the tag and type for each element, the entire array is encoded as + * a single length-delimited blob. In proto3, only explicit setting it to + * false will avoid using packed encoding. + */ + packed: boolean; + /** + * The jstype option determines the JavaScript type used for values of the + * field. The option is permitted only for 64 bit integral and fixed types + * (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + * is represented as JavaScript string, which avoids loss of precision that + * can happen when a large value is converted to a floating point JavaScript. + * Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + * use the JavaScript "number" type. The behavior of the default option + * JS_NORMAL is implementation dependent. + * + * This option is an enum to permit additional types to be added, e.g. + * goog.math.Integer. + */ + jstype: FieldOptions_JSType; + /** + * Should this field be parsed lazily? Lazy applies only to message-type + * fields. It means that when the outer message is initially parsed, the + * inner message's contents will not be parsed but instead stored in encoded + * form. The inner message will actually be parsed when it is first accessed. + * + * This is only a hint. Implementations are free to choose whether to use + * eager or lazy parsing regardless of the value of this option. However, + * setting this option true suggests that the protocol author believes that + * using lazy parsing on this field is worth the additional bookkeeping + * overhead typically needed to implement it. + * + * This option does not affect the public interface of any generated code; + * all method signatures remain the same. Furthermore, thread-safety of the + * interface is not affected by this option; const methods remain safe to + * call from multiple threads concurrently, while non-const methods continue + * to require exclusive access. + * + * + * Note that implementations may choose not to check required fields within + * a lazy sub-message. That is, calling IsInitialized() on the outer message + * may return true even if the inner message has missing required fields. + * This is necessary because otherwise the inner message would have to be + * parsed in order to perform the check, defeating the purpose of lazy + * parsing. An implementation which chooses not to check required fields + * must be consistent about it. That is, for any particular sub-message, the + * implementation must either *always* check its required fields, or *never* + * check its required fields, regardless of whether or not the message has + * been parsed. + */ + lazy: boolean; + /** + * Is this field deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for accessors, or it will be completely ignored; in the very least, this + * is a formalization for deprecating fields. + */ + deprecated: boolean; + /** For Google-internal migration only. Do not use. */ + weak: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface FieldOptionsProtoMsg { + typeUrl: "/google.protobuf.FieldOptions"; + value: Uint8Array; +} +export interface FieldOptionsSDKType { + ctype: FieldOptions_CType; + packed: boolean; + jstype: FieldOptions_JSType; + lazy: boolean; + deprecated: boolean; + weak: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface OneofOptions { + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface OneofOptionsProtoMsg { + typeUrl: "/google.protobuf.OneofOptions"; + value: Uint8Array; +} +export interface OneofOptionsSDKType { + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface EnumOptions { + /** + * Set this option to true to allow mapping different tag names to the same + * value. + */ + allowAlias: boolean; + /** + * Is this enum deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum, or it will be completely ignored; in the very least, this + * is a formalization for deprecating enums. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumOptions"; + value: Uint8Array; +} +export interface EnumOptionsSDKType { + allow_alias: boolean; + deprecated: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface EnumValueOptions { + /** + * Is this enum value deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the enum value, or it will be completely ignored; in the very least, + * this is a formalization for deprecating enum values. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface EnumValueOptionsProtoMsg { + typeUrl: "/google.protobuf.EnumValueOptions"; + value: Uint8Array; +} +export interface EnumValueOptionsSDKType { + deprecated: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface ServiceOptions { + /** + * Is this service deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the service, or it will be completely ignored; in the very least, + * this is a formalization for deprecating services. + */ + deprecated: boolean; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface ServiceOptionsProtoMsg { + typeUrl: "/google.protobuf.ServiceOptions"; + value: Uint8Array; +} +export interface ServiceOptionsSDKType { + deprecated: boolean; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +export interface MethodOptions { + /** + * Is this method deprecated? + * Depending on the target platform, this can emit Deprecated annotations + * for the method, or it will be completely ignored; in the very least, + * this is a formalization for deprecating methods. + */ + deprecated: boolean; + idempotencyLevel: MethodOptions_IdempotencyLevel; + /** The parser stores options it doesn't recognize here. See above. */ + uninterpretedOption: UninterpretedOption[]; +} +export interface MethodOptionsProtoMsg { + typeUrl: "/google.protobuf.MethodOptions"; + value: Uint8Array; +} +export interface MethodOptionsSDKType { + deprecated: boolean; + idempotency_level: MethodOptions_IdempotencyLevel; + uninterpreted_option: UninterpretedOptionSDKType[]; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOption { + name: UninterpretedOption_NamePart[]; + /** + * The value of the uninterpreted option, in whatever type the tokenizer + * identified it as during parsing. Exactly one of these should be set. + */ + identifierValue: string; + positiveIntValue: bigint; + negativeIntValue: bigint; + doubleValue: number; + stringValue: Uint8Array; + aggregateValue: string; +} +export interface UninterpretedOptionProtoMsg { + typeUrl: "/google.protobuf.UninterpretedOption"; + value: Uint8Array; +} +/** + * A message representing a option the parser does not recognize. This only + * appears in options protos created by the compiler::Parser class. + * DescriptorPool resolves these when building Descriptor objects. Therefore, + * options protos in descriptor objects (e.g. returned by Descriptor::options(), + * or produced by Descriptor::CopyTo()) will never have UninterpretedOptions + * in them. + */ +export interface UninterpretedOptionSDKType { + name: UninterpretedOption_NamePartSDKType[]; + identifier_value: string; + positive_int_value: bigint; + negative_int_value: bigint; + double_value: number; + string_value: Uint8Array; + aggregate_value: string; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePart { + namePart: string; + isExtension: boolean; +} +export interface UninterpretedOption_NamePartProtoMsg { + typeUrl: "/google.protobuf.NamePart"; + value: Uint8Array; +} +/** + * The name of the uninterpreted option. Each string represents a segment in + * a dot-separated name. is_extension is true iff a segment represents an + * extension (denoted with parentheses in options specs in .proto files). + * E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents + * "foo.(bar.baz).qux". + */ +export interface UninterpretedOption_NamePartSDKType { + name_part: string; + is_extension: boolean; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfo { + /** + * A Location identifies a piece of source code in a .proto file which + * corresponds to a particular definition. This information is intended + * to be useful to IDEs, code indexers, documentation generators, and similar + * tools. + * + * For example, say we have a file like: + * message Foo { + * optional string foo = 1; + * } + * Let's look at just the field definition: + * optional string foo = 1; + * ^ ^^ ^^ ^ ^^^ + * a bc de f ghi + * We have the following locations: + * span path represents + * [a,i) [ 4, 0, 2, 0 ] The whole field definition. + * [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + * [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + * [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + * [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + * + * Notes: + * - A location may refer to a repeated field itself (i.e. not to any + * particular index within it). This is used whenever a set of elements are + * logically enclosed in a single code segment. For example, an entire + * extend block (possibly containing multiple extension definitions) will + * have an outer location whose path refers to the "extensions" repeated + * field without an index. + * - Multiple locations may have the same path. This happens when a single + * logical declaration is spread out across multiple places. The most + * obvious example is the "extend" block again -- there may be multiple + * extend blocks in the same scope, each of which will have the same path. + * - A location's span is not always a subset of its parent's span. For + * example, the "extendee" of an extension declaration appears at the + * beginning of the "extend" block and is shared by all extensions within + * the block. + * - Just because a location's span is a subset of some other location's span + * does not mean that it is a descendant. For example, a "group" defines + * both a type and a field in a single declaration. Thus, the locations + * corresponding to the type and field and their components will overlap. + * - Code which tries to interpret locations should probably be designed to + * ignore those that it doesn't understand, as more types of locations could + * be recorded in the future. + */ + location: SourceCodeInfo_Location[]; +} +export interface SourceCodeInfoProtoMsg { + typeUrl: "/google.protobuf.SourceCodeInfo"; + value: Uint8Array; +} +/** + * Encapsulates information about the original source file from which a + * FileDescriptorProto was generated. + */ +export interface SourceCodeInfoSDKType { + location: SourceCodeInfo_LocationSDKType[]; +} +export interface SourceCodeInfo_Location { + /** + * Identifies which part of the FileDescriptorProto was defined at this + * location. + * + * Each element is a field number or an index. They form a path from + * the root FileDescriptorProto to the place where the definition. For + * example, this path: + * [ 4, 3, 2, 7, 1 ] + * refers to: + * file.message_type(3) // 4, 3 + * .field(7) // 2, 7 + * .name() // 1 + * This is because FileDescriptorProto.message_type has field number 4: + * repeated DescriptorProto message_type = 4; + * and DescriptorProto.field has field number 2: + * repeated FieldDescriptorProto field = 2; + * and FieldDescriptorProto.name has field number 1: + * optional string name = 1; + * + * Thus, the above path gives the location of a field name. If we removed + * the last element: + * [ 4, 3, 2, 7 ] + * this path refers to the whole field declaration (from the beginning + * of the label to the terminating semicolon). + */ + path: number[]; + /** + * Always has exactly three or four elements: start line, start column, + * end line (optional, otherwise assumed same as start line), end column. + * These are packed into a single field for efficiency. Note that line + * and column numbers are zero-based -- typically you will want to add + * 1 to each before displaying to a user. + */ + span: number[]; + /** + * If this SourceCodeInfo represents a complete declaration, these are any + * comments appearing before and after the declaration which appear to be + * attached to the declaration. + * + * A series of line comments appearing on consecutive lines, with no other + * tokens appearing on those lines, will be treated as a single comment. + * + * leading_detached_comments will keep paragraphs of comments that appear + * before (but not connected to) the current element. Each paragraph, + * separated by empty lines, will be one comment element in the repeated + * field. + * + * Only the comment content is provided; comment markers (e.g. //) are + * stripped out. For block comments, leading whitespace and an asterisk + * will be stripped from the beginning of each line other than the first. + * Newlines are included in the output. + * + * Examples: + * + * optional int32 foo = 1; // Comment attached to foo. + * // Comment attached to bar. + * optional int32 bar = 2; + * + * optional string baz = 3; + * // Comment attached to baz. + * // Another line attached to baz. + * + * // Comment attached to qux. + * // + * // Another line attached to qux. + * optional double qux = 4; + * + * // Detached comment for corge. This is not leading or trailing comments + * // to qux or corge because there are blank lines separating it from + * // both. + * + * // Detached comment for corge paragraph 2. + * + * optional string corge = 5; + * /* Block comment attached + * * to corge. Leading asterisks + * * will be removed. *\/ + * /* Block comment attached to + * * grault. *\/ + * optional int32 grault = 6; + * + * // ignored detached comments. + */ + leadingComments: string; + trailingComments: string; + leadingDetachedComments: string[]; +} +export interface SourceCodeInfo_LocationProtoMsg { + typeUrl: "/google.protobuf.Location"; + value: Uint8Array; +} +export interface SourceCodeInfo_LocationSDKType { + path: number[]; + span: number[]; + leading_comments: string; + trailing_comments: string; + leading_detached_comments: string[]; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfo { + /** + * An Annotation connects some span of text in generated code to an element + * of its generating .proto file. + */ + annotation: GeneratedCodeInfo_Annotation[]; +} +export interface GeneratedCodeInfoProtoMsg { + typeUrl: "/google.protobuf.GeneratedCodeInfo"; + value: Uint8Array; +} +/** + * Describes the relationship between generated code and its original source + * file. A GeneratedCodeInfo message is associated with only one generated + * source file, but may contain references to different source .proto files. + */ +export interface GeneratedCodeInfoSDKType { + annotation: GeneratedCodeInfo_AnnotationSDKType[]; +} +export interface GeneratedCodeInfo_Annotation { + /** + * Identifies the element in the original source .proto file. This field + * is formatted the same as SourceCodeInfo.Location.path. + */ + path: number[]; + /** Identifies the filesystem path to the original source .proto. */ + sourceFile: string; + /** + * Identifies the starting offset in bytes in the generated code + * that relates to the identified object. + */ + begin: number; + /** + * Identifies the ending offset in bytes in the generated code that + * relates to the identified offset. The end offset should be one past + * the last relevant byte (so the length of the text = end - begin). + */ + end: number; +} +export interface GeneratedCodeInfo_AnnotationProtoMsg { + typeUrl: "/google.protobuf.Annotation"; + value: Uint8Array; +} +export interface GeneratedCodeInfo_AnnotationSDKType { + path: number[]; + source_file: string; + begin: number; + end: number; +} +function createBaseFileDescriptorSet(): FileDescriptorSet { + return { + file: [] + }; +} +export const FileDescriptorSet = { + typeUrl: "/google.protobuf.FileDescriptorSet", + encode(message: FileDescriptorSet, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.file) { + FileDescriptorProto.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorSet { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorSet(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.file.push(FileDescriptorProto.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): FileDescriptorSet { + const obj = createBaseFileDescriptorSet(); + if (Array.isArray(object?.file)) obj.file = object.file.map((e: any) => FileDescriptorProto.fromJSON(e)); + return obj; + }, + toJSON(message: FileDescriptorSet): unknown { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map(e => e ? FileDescriptorProto.toJSON(e) : undefined); + } else { + obj.file = []; + } + return obj; + }, + fromPartial(object: DeepPartial): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromPartial(e)) || []; + return message; + }, + fromSDK(object: FileDescriptorSetSDKType): FileDescriptorSet { + return { + file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): FileDescriptorSetSDKType { + return { + file: Array.isArray(object?.file) ? object.file.map((e: any) => FileDescriptorProto.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: FileDescriptorSet): FileDescriptorSetSDKType { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map(e => e ? FileDescriptorProto.toSDK(e) : undefined); + } else { + obj.file = []; + } + return obj; + }, + fromAmino(object: FileDescriptorSetAmino): FileDescriptorSet { + const message = createBaseFileDescriptorSet(); + message.file = object.file?.map(e => FileDescriptorProto.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileDescriptorSet): FileDescriptorSetAmino { + const obj: any = {}; + if (message.file) { + obj.file = message.file.map(e => e ? FileDescriptorProto.toAmino(e) : undefined); + } else { + obj.file = message.file; + } + return obj; + }, + fromAminoMsg(object: FileDescriptorSetAminoMsg): FileDescriptorSet { + return FileDescriptorSet.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorSetProtoMsg): FileDescriptorSet { + return FileDescriptorSet.decode(message.value); + }, + toProto(message: FileDescriptorSet): Uint8Array { + return FileDescriptorSet.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorSet): FileDescriptorSetProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorSet", + value: FileDescriptorSet.encode(message).finish() + }; + } +}; +function createBaseFileDescriptorProto(): FileDescriptorProto { + return { + name: "", + package: "", + dependency: [], + publicDependency: [], + weakDependency: [], + messageType: [], + enumType: [], + service: [], + extension: [], + options: undefined, + sourceCodeInfo: undefined, + syntax: "" + }; +} +export const FileDescriptorProto = { + typeUrl: "/google.protobuf.FileDescriptorProto", + encode(message: FileDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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!); + } + writer.uint32(82).fork(); + for (const v of message.publicDependency) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(90).fork(); + for (const v of message.weakDependency) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.messageType) { + DescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.service) { + ServiceDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(58).fork()).ldelim(); + } + if (message.options !== undefined) { + FileOptions.encode(message.options, writer.uint32(66).fork()).ldelim(); + } + if (message.sourceCodeInfo !== undefined) { + SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(74).fork()).ldelim(); + } + if (message.syntax !== "") { + writer.uint32(98).string(message.syntax); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.package = reader.string(); + break; + case 3: + message.dependency.push(reader.string()); + break; + case 10: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.publicDependency.push(reader.int32()); + } + } else { + message.publicDependency.push(reader.int32()); + } + break; + case 11: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.weakDependency.push(reader.int32()); + } + } else { + message.weakDependency.push(reader.int32()); + } + break; + case 4: + message.messageType.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + message.service.push(ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 8: + message.options = FileOptions.decode(reader, reader.uint32()); + break; + case 9: + message.sourceCodeInfo = SourceCodeInfo.decode(reader, reader.uint32()); + break; + case 12: + message.syntax = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): FileDescriptorProto { + const obj = createBaseFileDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.package)) obj.package = String(object.package); + if (Array.isArray(object?.dependency)) obj.dependency = object.dependency.map((e: any) => String(e)); + if (Array.isArray(object?.publicDependency)) obj.publicDependency = object.publicDependency.map((e: any) => Number(e)); + if (Array.isArray(object?.weakDependency)) obj.weakDependency = object.weakDependency.map((e: any) => Number(e)); + if (Array.isArray(object?.messageType)) obj.messageType = object.messageType.map((e: any) => DescriptorProto.fromJSON(e)); + if (Array.isArray(object?.enumType)) obj.enumType = object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)); + if (Array.isArray(object?.service)) obj.service = object.service.map((e: any) => ServiceDescriptorProto.fromJSON(e)); + if (Array.isArray(object?.extension)) obj.extension = object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)); + if (isSet(object.options)) obj.options = FileOptions.fromJSON(object.options); + if (isSet(object.sourceCodeInfo)) obj.sourceCodeInfo = SourceCodeInfo.fromJSON(object.sourceCodeInfo); + if (isSet(object.syntax)) obj.syntax = String(object.syntax); + return obj; + }, + 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 => Math.round(e)); + } else { + obj.publicDependency = []; + } + if (message.weakDependency) { + obj.weakDependency = message.weakDependency.map(e => Math.round(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 = createBaseFileDescriptorProto(); + message.name = object.name ?? ""; + message.package = object.package ?? ""; + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.publicDependency?.map(e => e) || []; + message.weakDependency = object.weakDependency?.map(e => e) || []; + message.messageType = object.messageType?.map(e => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map(e => EnumDescriptorProto.fromPartial(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromPartial(object.options); + } + if (object.sourceCodeInfo !== undefined && object.sourceCodeInfo !== null) { + message.sourceCodeInfo = SourceCodeInfo.fromPartial(object.sourceCodeInfo); + } + message.syntax = object.syntax ?? ""; + return message; + }, + fromSDK(object: FileDescriptorProtoSDKType): FileDescriptorProto { + return { + name: object?.name, + package: object?.package, + dependency: Array.isArray(object?.dependency) ? object.dependency.map((e: any) => e) : [], + publicDependency: Array.isArray(object?.public_dependency) ? object.public_dependency.map((e: any) => e) : [], + weakDependency: Array.isArray(object?.weak_dependency) ? object.weak_dependency.map((e: any) => e) : [], + messageType: Array.isArray(object?.message_type) ? object.message_type.map((e: any) => DescriptorProto.fromSDK(e)) : [], + enumType: Array.isArray(object?.enum_type) ? object.enum_type.map((e: any) => EnumDescriptorProto.fromSDK(e)) : [], + service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromSDK(e)) : [], + extension: Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromSDK(e)) : [], + options: object.options ? FileOptions.fromSDK(object.options) : undefined, + sourceCodeInfo: object.source_code_info ? SourceCodeInfo.fromSDK(object.source_code_info) : undefined, + syntax: object?.syntax + }; + }, + fromSDKJSON(object: any): FileDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + package: isSet(object.package) ? String(object.package) : "", + dependency: Array.isArray(object?.dependency) ? object.dependency.map((e: any) => String(e)) : [], + public_dependency: Array.isArray(object?.public_dependency) ? object.public_dependency.map((e: any) => Number(e)) : [], + weak_dependency: Array.isArray(object?.weak_dependency) ? object.weak_dependency.map((e: any) => Number(e)) : [], + message_type: Array.isArray(object?.message_type) ? object.message_type.map((e: any) => DescriptorProto.fromSDKJSON(e)) : [], + enum_type: Array.isArray(object?.enum_type) ? object.enum_type.map((e: any) => EnumDescriptorProto.fromSDKJSON(e)) : [], + service: Array.isArray(object?.service) ? object.service.map((e: any) => ServiceDescriptorProto.fromSDKJSON(e)) : [], + extension: Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromSDKJSON(e)) : [], + options: isSet(object.options) ? FileOptions.fromSDKJSON(object.options) : undefined, + source_code_info: isSet(object.source_code_info) ? SourceCodeInfo.fromSDKJSON(object.source_code_info) : undefined, + syntax: isSet(object.syntax) ? String(object.syntax) : "" + }; + }, + toSDK(message: FileDescriptorProto): FileDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + obj.package = message.package; + if (message.dependency) { + obj.dependency = message.dependency.map(e => e); + } else { + obj.dependency = []; + } + if (message.publicDependency) { + obj.public_dependency = message.publicDependency.map(e => e); + } else { + obj.public_dependency = []; + } + if (message.weakDependency) { + obj.weak_dependency = message.weakDependency.map(e => e); + } else { + obj.weak_dependency = []; + } + if (message.messageType) { + obj.message_type = message.messageType.map(e => e ? DescriptorProto.toSDK(e) : undefined); + } else { + obj.message_type = []; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toSDK(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.service) { + obj.service = message.service.map(e => e ? ServiceDescriptorProto.toSDK(e) : undefined); + } else { + obj.service = []; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toSDK(e) : undefined); + } else { + obj.extension = []; + } + message.options !== undefined && (obj.options = message.options ? FileOptions.toSDK(message.options) : undefined); + message.sourceCodeInfo !== undefined && (obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toSDK(message.sourceCodeInfo) : undefined); + obj.syntax = message.syntax; + return obj; + }, + fromAmino(object: FileDescriptorProtoAmino): FileDescriptorProto { + const message = createBaseFileDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.package !== undefined && object.package !== null) { + message.package = object.package; + } + message.dependency = object.dependency?.map(e => e) || []; + message.publicDependency = object.public_dependency?.map(e => e) || []; + message.weakDependency = object.weak_dependency?.map(e => e) || []; + message.messageType = object.message_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.service = object.service?.map(e => ServiceDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = FileOptions.fromAmino(object.options); + } + if (object.source_code_info !== undefined && object.source_code_info !== null) { + message.sourceCodeInfo = SourceCodeInfo.fromAmino(object.source_code_info); + } + if (object.syntax !== undefined && object.syntax !== null) { + message.syntax = object.syntax; + } + return message; + }, + toAmino(message: FileDescriptorProto): FileDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.package = message.package === "" ? undefined : message.package; + if (message.dependency) { + obj.dependency = message.dependency.map(e => e); + } else { + obj.dependency = message.dependency; + } + if (message.publicDependency) { + obj.public_dependency = message.publicDependency.map(e => e); + } else { + obj.public_dependency = message.publicDependency; + } + if (message.weakDependency) { + obj.weak_dependency = message.weakDependency.map(e => e); + } else { + obj.weak_dependency = message.weakDependency; + } + if (message.messageType) { + obj.message_type = message.messageType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.message_type = message.messageType; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = message.enumType; + } + if (message.service) { + obj.service = message.service.map(e => e ? ServiceDescriptorProto.toAmino(e) : undefined); + } else { + obj.service = message.service; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = message.extension; + } + obj.options = message.options ? FileOptions.toAmino(message.options) : undefined; + obj.source_code_info = message.sourceCodeInfo ? SourceCodeInfo.toAmino(message.sourceCodeInfo) : undefined; + obj.syntax = message.syntax === "" ? undefined : message.syntax; + return obj; + }, + fromAminoMsg(object: FileDescriptorProtoAminoMsg): FileDescriptorProto { + return FileDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FileDescriptorProtoProtoMsg): FileDescriptorProto { + return FileDescriptorProto.decode(message.value); + }, + toProto(message: FileDescriptorProto): Uint8Array { + return FileDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FileDescriptorProto): FileDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FileDescriptorProto", + value: FileDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseDescriptorProto(): DescriptorProto { + return { + name: "", + field: [], + extension: [], + nestedType: [], + enumType: [], + extensionRange: [], + oneofDecl: [], + options: undefined, + reservedRange: [], + reservedName: [] + }; +} +export const DescriptorProto = { + typeUrl: "/google.protobuf.DescriptorProto", + encode(message: DescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.field) { + FieldDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + for (const v of message.extension) { + FieldDescriptorProto.encode(v!, writer.uint32(50).fork()).ldelim(); + } + for (const v of message.nestedType) { + DescriptorProto.encode(v!, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.enumType) { + EnumDescriptorProto.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.extensionRange) { + DescriptorProto_ExtensionRange.encode(v!, writer.uint32(42).fork()).ldelim(); + } + for (const v of message.oneofDecl) { + OneofDescriptorProto.encode(v!, writer.uint32(66).fork()).ldelim(); + } + if (message.options !== undefined) { + MessageOptions.encode(message.options, writer.uint32(58).fork()).ldelim(); + } + for (const v of message.reservedRange) { + DescriptorProto_ReservedRange.encode(v!, writer.uint32(74).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(82).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.field.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 6: + message.extension.push(FieldDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.nestedType.push(DescriptorProto.decode(reader, reader.uint32())); + break; + case 4: + message.enumType.push(EnumDescriptorProto.decode(reader, reader.uint32())); + break; + case 5: + message.extensionRange.push(DescriptorProto_ExtensionRange.decode(reader, reader.uint32())); + break; + case 8: + message.oneofDecl.push(OneofDescriptorProto.decode(reader, reader.uint32())); + break; + case 7: + message.options = MessageOptions.decode(reader, reader.uint32()); + break; + case 9: + message.reservedRange.push(DescriptorProto_ReservedRange.decode(reader, reader.uint32())); + break; + case 10: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): DescriptorProto { + const obj = createBaseDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.field)) obj.field = object.field.map((e: any) => FieldDescriptorProto.fromJSON(e)); + if (Array.isArray(object?.extension)) obj.extension = object.extension.map((e: any) => FieldDescriptorProto.fromJSON(e)); + if (Array.isArray(object?.nestedType)) obj.nestedType = object.nestedType.map((e: any) => DescriptorProto.fromJSON(e)); + if (Array.isArray(object?.enumType)) obj.enumType = object.enumType.map((e: any) => EnumDescriptorProto.fromJSON(e)); + if (Array.isArray(object?.extensionRange)) obj.extensionRange = object.extensionRange.map((e: any) => DescriptorProto_ExtensionRange.fromJSON(e)); + if (Array.isArray(object?.oneofDecl)) obj.oneofDecl = object.oneofDecl.map((e: any) => OneofDescriptorProto.fromJSON(e)); + if (isSet(object.options)) obj.options = MessageOptions.fromJSON(object.options); + if (Array.isArray(object?.reservedRange)) obj.reservedRange = object.reservedRange.map((e: any) => DescriptorProto_ReservedRange.fromJSON(e)); + if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); + return obj; + }, + 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 = createBaseDescriptorProto(); + message.name = object.name ?? ""; + message.field = object.field?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromPartial(e)) || []; + message.nestedType = object.nestedType?.map(e => DescriptorProto.fromPartial(e)) || []; + message.enumType = object.enumType?.map(e => EnumDescriptorProto.fromPartial(e)) || []; + message.extensionRange = object.extensionRange?.map(e => DescriptorProto_ExtensionRange.fromPartial(e)) || []; + message.oneofDecl = object.oneofDecl?.map(e => OneofDescriptorProto.fromPartial(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromPartial(object.options); + } + message.reservedRange = object.reservedRange?.map(e => DescriptorProto_ReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map(e => e) || []; + return message; + }, + fromSDK(object: DescriptorProtoSDKType): DescriptorProto { + return { + name: object?.name, + field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromSDK(e)) : [], + extension: Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromSDK(e)) : [], + nestedType: Array.isArray(object?.nested_type) ? object.nested_type.map((e: any) => DescriptorProto.fromSDK(e)) : [], + enumType: Array.isArray(object?.enum_type) ? object.enum_type.map((e: any) => EnumDescriptorProto.fromSDK(e)) : [], + extensionRange: Array.isArray(object?.extension_range) ? object.extension_range.map((e: any) => DescriptorProto_ExtensionRange.fromSDK(e)) : [], + oneofDecl: Array.isArray(object?.oneof_decl) ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromSDK(e)) : [], + options: object.options ? MessageOptions.fromSDK(object.options) : undefined, + reservedRange: Array.isArray(object?.reserved_range) ? object.reserved_range.map((e: any) => DescriptorProto_ReservedRange.fromSDK(e)) : [], + reservedName: Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => e) : [] + }; + }, + fromSDKJSON(object: any): DescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + field: Array.isArray(object?.field) ? object.field.map((e: any) => FieldDescriptorProto.fromSDKJSON(e)) : [], + extension: Array.isArray(object?.extension) ? object.extension.map((e: any) => FieldDescriptorProto.fromSDKJSON(e)) : [], + nested_type: Array.isArray(object?.nested_type) ? object.nested_type.map((e: any) => DescriptorProto.fromSDKJSON(e)) : [], + enum_type: Array.isArray(object?.enum_type) ? object.enum_type.map((e: any) => EnumDescriptorProto.fromSDKJSON(e)) : [], + extension_range: Array.isArray(object?.extension_range) ? object.extension_range.map((e: any) => DescriptorProto_ExtensionRange.fromSDKJSON(e)) : [], + oneof_decl: Array.isArray(object?.oneof_decl) ? object.oneof_decl.map((e: any) => OneofDescriptorProto.fromSDKJSON(e)) : [], + options: isSet(object.options) ? MessageOptions.fromSDKJSON(object.options) : undefined, + reserved_range: Array.isArray(object?.reserved_range) ? object.reserved_range.map((e: any) => DescriptorProto_ReservedRange.fromSDKJSON(e)) : [], + reserved_name: Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => String(e)) : [] + }; + }, + toSDK(message: DescriptorProto): DescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + if (message.field) { + obj.field = message.field.map(e => e ? FieldDescriptorProto.toSDK(e) : undefined); + } else { + obj.field = []; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toSDK(e) : undefined); + } else { + obj.extension = []; + } + if (message.nestedType) { + obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toSDK(e) : undefined); + } else { + obj.nested_type = []; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toSDK(e) : undefined); + } else { + obj.enum_type = []; + } + if (message.extensionRange) { + obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toSDK(e) : undefined); + } else { + obj.extension_range = []; + } + if (message.oneofDecl) { + obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toSDK(e) : undefined); + } else { + obj.oneof_decl = []; + } + message.options !== undefined && (obj.options = message.options ? MessageOptions.toSDK(message.options) : undefined); + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toSDK(e) : undefined); + } else { + obj.reserved_range = []; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + fromAmino(object: DescriptorProtoAmino): DescriptorProto { + const message = createBaseDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.field = object.field?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.extension = object.extension?.map(e => FieldDescriptorProto.fromAmino(e)) || []; + message.nestedType = object.nested_type?.map(e => DescriptorProto.fromAmino(e)) || []; + message.enumType = object.enum_type?.map(e => EnumDescriptorProto.fromAmino(e)) || []; + message.extensionRange = object.extension_range?.map(e => DescriptorProto_ExtensionRange.fromAmino(e)) || []; + message.oneofDecl = object.oneof_decl?.map(e => OneofDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = MessageOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => DescriptorProto_ReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: DescriptorProto): DescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.field) { + obj.field = message.field.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.field = message.field; + } + if (message.extension) { + obj.extension = message.extension.map(e => e ? FieldDescriptorProto.toAmino(e) : undefined); + } else { + obj.extension = message.extension; + } + if (message.nestedType) { + obj.nested_type = message.nestedType.map(e => e ? DescriptorProto.toAmino(e) : undefined); + } else { + obj.nested_type = message.nestedType; + } + if (message.enumType) { + obj.enum_type = message.enumType.map(e => e ? EnumDescriptorProto.toAmino(e) : undefined); + } else { + obj.enum_type = message.enumType; + } + if (message.extensionRange) { + obj.extension_range = message.extensionRange.map(e => e ? DescriptorProto_ExtensionRange.toAmino(e) : undefined); + } else { + obj.extension_range = message.extensionRange; + } + if (message.oneofDecl) { + obj.oneof_decl = message.oneofDecl.map(e => e ? OneofDescriptorProto.toAmino(e) : undefined); + } else { + obj.oneof_decl = message.oneofDecl; + } + obj.options = message.options ? MessageOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? DescriptorProto_ReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = message.reservedRange; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = message.reservedName; + } + return obj; + }, + fromAminoMsg(object: DescriptorProtoAminoMsg): DescriptorProto { + return DescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProtoProtoMsg): DescriptorProto { + return DescriptorProto.decode(message.value); + }, + toProto(message: DescriptorProto): Uint8Array { + return DescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto): DescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.DescriptorProto", + value: DescriptorProto.encode(message).finish() + }; + } +}; +function createBaseDescriptorProto_ExtensionRange(): DescriptorProto_ExtensionRange { + return { + start: 0, + end: 0, + options: undefined + }; +} +export const DescriptorProto_ExtensionRange = { + typeUrl: "/google.protobuf.ExtensionRange", + encode(message: DescriptorProto_ExtensionRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ExtensionRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ExtensionRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + case 3: + message.options = ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): DescriptorProto_ExtensionRange { + const obj = createBaseDescriptorProto_ExtensionRange(); + if (isSet(object.start)) obj.start = Number(object.start); + if (isSet(object.end)) obj.end = Number(object.end); + if (isSet(object.options)) obj.options = ExtensionRangeOptions.fromJSON(object.options); + return obj; + }, + toJSON(message: DescriptorProto_ExtensionRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + message.options !== undefined && (obj.options = message.options ? ExtensionRangeOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromPartial(object.options); + } + return message; + }, + fromSDK(object: DescriptorProto_ExtensionRangeSDKType): DescriptorProto_ExtensionRange { + return { + start: object?.start, + end: object?.end, + options: object.options ? ExtensionRangeOptions.fromSDK(object.options) : undefined + }; + }, + fromSDKJSON(object: any): DescriptorProto_ExtensionRangeSDKType { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0, + options: isSet(object.options) ? ExtensionRangeOptions.fromSDKJSON(object.options) : undefined + }; + }, + toSDK(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeSDKType { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + message.options !== undefined && (obj.options = message.options ? ExtensionRangeOptions.toSDK(message.options) : undefined); + return obj; + }, + fromAmino(object: DescriptorProto_ExtensionRangeAmino): DescriptorProto_ExtensionRange { + const message = createBaseDescriptorProto_ExtensionRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + if (object.options !== undefined && object.options !== null) { + message.options = ExtensionRangeOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + obj.options = message.options ? ExtensionRangeOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ExtensionRangeAminoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ExtensionRangeProtoMsg): DescriptorProto_ExtensionRange { + return DescriptorProto_ExtensionRange.decode(message.value); + }, + toProto(message: DescriptorProto_ExtensionRange): Uint8Array { + return DescriptorProto_ExtensionRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ExtensionRange): DescriptorProto_ExtensionRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRange", + value: DescriptorProto_ExtensionRange.encode(message).finish() + }; + } +}; +function createBaseDescriptorProto_ReservedRange(): DescriptorProto_ReservedRange { + return { + start: 0, + end: 0 + }; +} +export const DescriptorProto_ReservedRange = { + typeUrl: "/google.protobuf.ReservedRange", + encode(message: DescriptorProto_ReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): DescriptorProto_ReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDescriptorProto_ReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): DescriptorProto_ReservedRange { + const obj = createBaseDescriptorProto_ReservedRange(); + if (isSet(object.start)) obj.start = Number(object.start); + if (isSet(object.end)) obj.end = Number(object.end); + return obj; + }, + toJSON(message: DescriptorProto_ReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + fromPartial(object: DeepPartial): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromSDK(object: DescriptorProto_ReservedRangeSDKType): DescriptorProto_ReservedRange { + return { + start: object?.start, + end: object?.end + }; + }, + fromSDKJSON(object: any): DescriptorProto_ReservedRangeSDKType { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0 + }; + }, + toSDK(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeSDKType { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + return obj; + }, + fromAmino(object: DescriptorProto_ReservedRangeAmino): DescriptorProto_ReservedRange { + const message = createBaseDescriptorProto_ReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: DescriptorProto_ReservedRangeAminoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: DescriptorProto_ReservedRangeProtoMsg): DescriptorProto_ReservedRange { + return DescriptorProto_ReservedRange.decode(message.value); + }, + toProto(message: DescriptorProto_ReservedRange): Uint8Array { + return DescriptorProto_ReservedRange.encode(message).finish(); + }, + toProtoMsg(message: DescriptorProto_ReservedRange): DescriptorProto_ReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.ReservedRange", + value: DescriptorProto_ReservedRange.encode(message).finish() + }; + } +}; +function createBaseExtensionRangeOptions(): ExtensionRangeOptions { + return { + uninterpretedOption: [] + }; +} +export const ExtensionRangeOptions = { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + encode(message: ExtensionRangeOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ExtensionRangeOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseExtensionRangeOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ExtensionRangeOptions { + const obj = createBaseExtensionRangeOptions(); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + toJSON(message: ExtensionRangeOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: ExtensionRangeOptionsSDKType): ExtensionRangeOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): ExtensionRangeOptionsSDKType { + return { + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: ExtensionRangeOptions): ExtensionRangeOptionsSDKType { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: ExtensionRangeOptionsAmino): ExtensionRangeOptions { + const message = createBaseExtensionRangeOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ExtensionRangeOptions): ExtensionRangeOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: ExtensionRangeOptionsAminoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ExtensionRangeOptionsProtoMsg): ExtensionRangeOptions { + return ExtensionRangeOptions.decode(message.value); + }, + toProto(message: ExtensionRangeOptions): Uint8Array { + return ExtensionRangeOptions.encode(message).finish(); + }, + toProtoMsg(message: ExtensionRangeOptions): ExtensionRangeOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ExtensionRangeOptions", + value: ExtensionRangeOptions.encode(message).finish() + }; + } +}; +function createBaseFieldDescriptorProto(): FieldDescriptorProto { + return { + name: "", + number: 0, + label: 1, + type: 1, + typeName: "", + extendee: "", + defaultValue: "", + oneofIndex: 0, + jsonName: "", + options: undefined + }; +} +export const FieldDescriptorProto = { + typeUrl: "/google.protobuf.FieldDescriptorProto", + encode(message: FieldDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 3: + message.number = reader.int32(); + break; + case 4: + message.label = (reader.int32() as any); + break; + case 5: + message.type = (reader.int32() as any); + break; + case 6: + message.typeName = reader.string(); + break; + case 2: + message.extendee = reader.string(); + break; + case 7: + message.defaultValue = reader.string(); + break; + case 9: + message.oneofIndex = reader.int32(); + break; + case 10: + message.jsonName = reader.string(); + break; + case 8: + message.options = FieldOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): FieldDescriptorProto { + const obj = createBaseFieldDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.number)) obj.number = Number(object.number); + if (isSet(object.label)) obj.label = fieldDescriptorProto_LabelFromJSON(object.label); + if (isSet(object.type)) obj.type = fieldDescriptorProto_TypeFromJSON(object.type); + if (isSet(object.typeName)) obj.typeName = String(object.typeName); + if (isSet(object.extendee)) obj.extendee = String(object.extendee); + if (isSet(object.defaultValue)) obj.defaultValue = String(object.defaultValue); + if (isSet(object.oneofIndex)) obj.oneofIndex = Number(object.oneofIndex); + if (isSet(object.jsonName)) obj.jsonName = String(object.jsonName); + if (isSet(object.options)) obj.options = FieldOptions.fromJSON(object.options); + return obj; + }, + toJSON(message: FieldDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(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 = Math.round(message.oneofIndex)); + message.jsonName !== undefined && (obj.jsonName = message.jsonName); + message.options !== undefined && (obj.options = message.options ? FieldOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + message.label = object.label ?? 1; + message.type = object.type ?? 1; + message.typeName = object.typeName ?? ""; + message.extendee = object.extendee ?? ""; + message.defaultValue = object.defaultValue ?? ""; + message.oneofIndex = object.oneofIndex ?? 0; + message.jsonName = object.jsonName ?? ""; + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromPartial(object.options); + } + return message; + }, + fromSDK(object: FieldDescriptorProtoSDKType): FieldDescriptorProto { + return { + name: object?.name, + number: object?.number, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, + typeName: object?.type_name, + extendee: object?.extendee, + defaultValue: object?.default_value, + oneofIndex: object?.oneof_index, + jsonName: object?.json_name, + options: object.options ? FieldOptions.fromSDK(object.options) : undefined + }; + }, + fromSDKJSON(object: any): FieldDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + label: isSet(object.label) ? fieldDescriptorProto_LabelFromJSON(object.label) : -1, + type: isSet(object.type) ? fieldDescriptorProto_TypeFromJSON(object.type) : -1, + type_name: isSet(object.type_name) ? String(object.type_name) : "", + extendee: isSet(object.extendee) ? String(object.extendee) : "", + default_value: isSet(object.default_value) ? String(object.default_value) : "", + oneof_index: isSet(object.oneof_index) ? Number(object.oneof_index) : 0, + json_name: isSet(object.json_name) ? String(object.json_name) : "", + options: isSet(object.options) ? FieldOptions.fromSDKJSON(object.options) : undefined + }; + }, + toSDK(message: FieldDescriptorProto): FieldDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + message.label !== undefined && (obj.label = fieldDescriptorProto_LabelToJSON(message.label)); + message.type !== undefined && (obj.type = fieldDescriptorProto_TypeToJSON(message.type)); + obj.type_name = message.typeName; + obj.extendee = message.extendee; + obj.default_value = message.defaultValue; + obj.oneof_index = message.oneofIndex; + obj.json_name = message.jsonName; + message.options !== undefined && (obj.options = message.options ? FieldOptions.toSDK(message.options) : undefined); + return obj; + }, + fromAmino(object: FieldDescriptorProtoAmino): FieldDescriptorProto { + const message = createBaseFieldDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.label !== undefined && object.label !== null) { + message.label = object.label; + } + if (object.type !== undefined && object.type !== null) { + message.type = object.type; + } + if (object.type_name !== undefined && object.type_name !== null) { + message.typeName = object.type_name; + } + if (object.extendee !== undefined && object.extendee !== null) { + message.extendee = object.extendee; + } + if (object.default_value !== undefined && object.default_value !== null) { + message.defaultValue = object.default_value; + } + if (object.oneof_index !== undefined && object.oneof_index !== null) { + message.oneofIndex = object.oneof_index; + } + if (object.json_name !== undefined && object.json_name !== null) { + message.jsonName = object.json_name; + } + if (object.options !== undefined && object.options !== null) { + message.options = FieldOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: FieldDescriptorProto): FieldDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.label = message.label === 1 ? undefined : message.label; + obj.type = message.type === 1 ? undefined : message.type; + obj.type_name = message.typeName === "" ? undefined : message.typeName; + obj.extendee = message.extendee === "" ? undefined : message.extendee; + obj.default_value = message.defaultValue === "" ? undefined : message.defaultValue; + obj.oneof_index = message.oneofIndex === 0 ? undefined : message.oneofIndex; + obj.json_name = message.jsonName === "" ? undefined : message.jsonName; + obj.options = message.options ? FieldOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: FieldDescriptorProtoAminoMsg): FieldDescriptorProto { + return FieldDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: FieldDescriptorProtoProtoMsg): FieldDescriptorProto { + return FieldDescriptorProto.decode(message.value); + }, + toProto(message: FieldDescriptorProto): Uint8Array { + return FieldDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: FieldDescriptorProto): FieldDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.FieldDescriptorProto", + value: FieldDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseOneofDescriptorProto(): OneofDescriptorProto { + return { + name: "", + options: undefined + }; +} +export const OneofDescriptorProto = { + typeUrl: "/google.protobuf.OneofDescriptorProto", + encode(message: OneofDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + if (message.options !== undefined) { + OneofOptions.encode(message.options, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OneofDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.options = OneofOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): OneofDescriptorProto { + const obj = createBaseOneofDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.options)) obj.options = OneofOptions.fromJSON(object.options); + return obj; + }, + 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 = createBaseOneofDescriptorProto(); + message.name = object.name ?? ""; + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromPartial(object.options); + } + return message; + }, + fromSDK(object: OneofDescriptorProtoSDKType): OneofDescriptorProto { + return { + name: object?.name, + options: object.options ? OneofOptions.fromSDK(object.options) : undefined + }; + }, + fromSDKJSON(object: any): OneofDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + options: isSet(object.options) ? OneofOptions.fromSDKJSON(object.options) : undefined + }; + }, + toSDK(message: OneofDescriptorProto): OneofDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + message.options !== undefined && (obj.options = message.options ? OneofOptions.toSDK(message.options) : undefined); + return obj; + }, + fromAmino(object: OneofDescriptorProtoAmino): OneofDescriptorProto { + const message = createBaseOneofDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.options !== undefined && object.options !== null) { + message.options = OneofOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: OneofDescriptorProto): OneofDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.options = message.options ? OneofOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: OneofDescriptorProtoAminoMsg): OneofDescriptorProto { + return OneofDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: OneofDescriptorProtoProtoMsg): OneofDescriptorProto { + return OneofDescriptorProto.decode(message.value); + }, + toProto(message: OneofDescriptorProto): Uint8Array { + return OneofDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: OneofDescriptorProto): OneofDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.OneofDescriptorProto", + value: OneofDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseEnumDescriptorProto(): EnumDescriptorProto { + return { + name: "", + value: [], + options: undefined, + reservedRange: [], + reservedName: [] + }; +} +export const EnumDescriptorProto = { + typeUrl: "/google.protobuf.EnumDescriptorProto", + encode(message: EnumDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.value) { + EnumValueDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + EnumOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + for (const v of message.reservedRange) { + EnumDescriptorProto_EnumReservedRange.encode(v!, writer.uint32(34).fork()).ldelim(); + } + for (const v of message.reservedName) { + writer.uint32(42).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.value.push(EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = EnumOptions.decode(reader, reader.uint32()); + break; + case 4: + message.reservedRange.push(EnumDescriptorProto_EnumReservedRange.decode(reader, reader.uint32())); + break; + case 5: + message.reservedName.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EnumDescriptorProto { + const obj = createBaseEnumDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.value)) obj.value = object.value.map((e: any) => EnumValueDescriptorProto.fromJSON(e)); + if (isSet(object.options)) obj.options = EnumOptions.fromJSON(object.options); + if (Array.isArray(object?.reservedRange)) obj.reservedRange = object.reservedRange.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromJSON(e)); + if (Array.isArray(object?.reservedName)) obj.reservedName = object.reservedName.map((e: any) => String(e)); + return obj; + }, + 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 = createBaseEnumDescriptorProto(); + message.name = object.name ?? ""; + message.value = object.value?.map(e => EnumValueDescriptorProto.fromPartial(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromPartial(object.options); + } + message.reservedRange = object.reservedRange?.map(e => EnumDescriptorProto_EnumReservedRange.fromPartial(e)) || []; + message.reservedName = object.reservedName?.map(e => e) || []; + return message; + }, + fromSDK(object: EnumDescriptorProtoSDKType): EnumDescriptorProto { + return { + name: object?.name, + value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromSDK(e)) : [], + options: object.options ? EnumOptions.fromSDK(object.options) : undefined, + reservedRange: Array.isArray(object?.reserved_range) ? object.reserved_range.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromSDK(e)) : [], + reservedName: Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => e) : [] + }; + }, + fromSDKJSON(object: any): EnumDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + value: Array.isArray(object?.value) ? object.value.map((e: any) => EnumValueDescriptorProto.fromSDKJSON(e)) : [], + options: isSet(object.options) ? EnumOptions.fromSDKJSON(object.options) : undefined, + reserved_range: Array.isArray(object?.reserved_range) ? object.reserved_range.map((e: any) => EnumDescriptorProto_EnumReservedRange.fromSDKJSON(e)) : [], + reserved_name: Array.isArray(object?.reserved_name) ? object.reserved_name.map((e: any) => String(e)) : [] + }; + }, + toSDK(message: EnumDescriptorProto): EnumDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + if (message.value) { + obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toSDK(e) : undefined); + } else { + obj.value = []; + } + message.options !== undefined && (obj.options = message.options ? EnumOptions.toSDK(message.options) : undefined); + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toSDK(e) : undefined); + } else { + obj.reserved_range = []; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = []; + } + return obj; + }, + fromAmino(object: EnumDescriptorProtoAmino): EnumDescriptorProto { + const message = createBaseEnumDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.value = object.value?.map(e => EnumValueDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = EnumOptions.fromAmino(object.options); + } + message.reservedRange = object.reserved_range?.map(e => EnumDescriptorProto_EnumReservedRange.fromAmino(e)) || []; + message.reservedName = object.reserved_name?.map(e => e) || []; + return message; + }, + toAmino(message: EnumDescriptorProto): EnumDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.value) { + obj.value = message.value.map(e => e ? EnumValueDescriptorProto.toAmino(e) : undefined); + } else { + obj.value = message.value; + } + obj.options = message.options ? EnumOptions.toAmino(message.options) : undefined; + if (message.reservedRange) { + obj.reserved_range = message.reservedRange.map(e => e ? EnumDescriptorProto_EnumReservedRange.toAmino(e) : undefined); + } else { + obj.reserved_range = message.reservedRange; + } + if (message.reservedName) { + obj.reserved_name = message.reservedName.map(e => e); + } else { + obj.reserved_name = message.reservedName; + } + return obj; + }, + fromAminoMsg(object: EnumDescriptorProtoAminoMsg): EnumDescriptorProto { + return EnumDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProtoProtoMsg): EnumDescriptorProto { + return EnumDescriptorProto.decode(message.value); + }, + toProto(message: EnumDescriptorProto): Uint8Array { + return EnumDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto): EnumDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumDescriptorProto", + value: EnumDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseEnumDescriptorProto_EnumReservedRange(): EnumDescriptorProto_EnumReservedRange { + return { + start: 0, + end: 0 + }; +} +export const EnumDescriptorProto_EnumReservedRange = { + typeUrl: "/google.protobuf.EnumReservedRange", + encode(message: EnumDescriptorProto_EnumReservedRange, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.start !== 0) { + writer.uint32(8).int32(message.start); + } + if (message.end !== 0) { + writer.uint32(16).int32(message.end); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumDescriptorProto_EnumReservedRange { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.start = reader.int32(); + break; + case 2: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EnumDescriptorProto_EnumReservedRange { + const obj = createBaseEnumDescriptorProto_EnumReservedRange(); + if (isSet(object.start)) obj.start = Number(object.start); + if (isSet(object.end)) obj.end = Number(object.end); + return obj; + }, + toJSON(message: EnumDescriptorProto_EnumReservedRange): unknown { + const obj: any = {}; + message.start !== undefined && (obj.start = Math.round(message.start)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + fromPartial(object: DeepPartial): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + message.start = object.start ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromSDK(object: EnumDescriptorProto_EnumReservedRangeSDKType): EnumDescriptorProto_EnumReservedRange { + return { + start: object?.start, + end: object?.end + }; + }, + fromSDKJSON(object: any): EnumDescriptorProto_EnumReservedRangeSDKType { + return { + start: isSet(object.start) ? Number(object.start) : 0, + end: isSet(object.end) ? Number(object.end) : 0 + }; + }, + toSDK(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeSDKType { + const obj: any = {}; + obj.start = message.start; + obj.end = message.end; + return obj; + }, + fromAmino(object: EnumDescriptorProto_EnumReservedRangeAmino): EnumDescriptorProto_EnumReservedRange { + const message = createBaseEnumDescriptorProto_EnumReservedRange(); + if (object.start !== undefined && object.start !== null) { + message.start = object.start; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeAmino { + const obj: any = {}; + obj.start = message.start === 0 ? undefined : message.start; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: EnumDescriptorProto_EnumReservedRangeAminoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.fromAmino(object.value); + }, + fromProtoMsg(message: EnumDescriptorProto_EnumReservedRangeProtoMsg): EnumDescriptorProto_EnumReservedRange { + return EnumDescriptorProto_EnumReservedRange.decode(message.value); + }, + toProto(message: EnumDescriptorProto_EnumReservedRange): Uint8Array { + return EnumDescriptorProto_EnumReservedRange.encode(message).finish(); + }, + toProtoMsg(message: EnumDescriptorProto_EnumReservedRange): EnumDescriptorProto_EnumReservedRangeProtoMsg { + return { + typeUrl: "/google.protobuf.EnumReservedRange", + value: EnumDescriptorProto_EnumReservedRange.encode(message).finish() + }; + } +}; +function createBaseEnumValueDescriptorProto(): EnumValueDescriptorProto { + return { + name: "", + number: 0, + options: undefined + }; +} +export const EnumValueDescriptorProto = { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + encode(message: EnumValueDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.number = reader.int32(); + break; + case 3: + message.options = EnumValueOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EnumValueDescriptorProto { + const obj = createBaseEnumValueDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.number)) obj.number = Number(object.number); + if (isSet(object.options)) obj.options = EnumValueOptions.fromJSON(object.options); + return obj; + }, + toJSON(message: EnumValueDescriptorProto): unknown { + const obj: any = {}; + message.name !== undefined && (obj.name = message.name); + message.number !== undefined && (obj.number = Math.round(message.number)); + message.options !== undefined && (obj.options = message.options ? EnumValueOptions.toJSON(message.options) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + message.name = object.name ?? ""; + message.number = object.number ?? 0; + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromPartial(object.options); + } + return message; + }, + fromSDK(object: EnumValueDescriptorProtoSDKType): EnumValueDescriptorProto { + return { + name: object?.name, + number: object?.number, + options: object.options ? EnumValueOptions.fromSDK(object.options) : undefined + }; + }, + fromSDKJSON(object: any): EnumValueDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + number: isSet(object.number) ? Number(object.number) : 0, + options: isSet(object.options) ? EnumValueOptions.fromSDKJSON(object.options) : undefined + }; + }, + toSDK(message: EnumValueDescriptorProto): EnumValueDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + obj.number = message.number; + message.options !== undefined && (obj.options = message.options ? EnumValueOptions.toSDK(message.options) : undefined); + return obj; + }, + fromAmino(object: EnumValueDescriptorProtoAmino): EnumValueDescriptorProto { + const message = createBaseEnumValueDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.number !== undefined && object.number !== null) { + message.number = object.number; + } + if (object.options !== undefined && object.options !== null) { + message.options = EnumValueOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: EnumValueDescriptorProto): EnumValueDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.number = message.number === 0 ? undefined : message.number; + obj.options = message.options ? EnumValueOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: EnumValueDescriptorProtoAminoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueDescriptorProtoProtoMsg): EnumValueDescriptorProto { + return EnumValueDescriptorProto.decode(message.value); + }, + toProto(message: EnumValueDescriptorProto): Uint8Array { + return EnumValueDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: EnumValueDescriptorProto): EnumValueDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueDescriptorProto", + value: EnumValueDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseServiceDescriptorProto(): ServiceDescriptorProto { + return { + name: "", + method: [], + options: undefined + }; +} +export const ServiceDescriptorProto = { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + encode(message: ServiceDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.name !== "") { + writer.uint32(10).string(message.name); + } + for (const v of message.method) { + MethodDescriptorProto.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.options !== undefined) { + ServiceOptions.encode(message.options, writer.uint32(26).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ServiceDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.method.push(MethodDescriptorProto.decode(reader, reader.uint32())); + break; + case 3: + message.options = ServiceOptions.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ServiceDescriptorProto { + const obj = createBaseServiceDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.method)) obj.method = object.method.map((e: any) => MethodDescriptorProto.fromJSON(e)); + if (isSet(object.options)) obj.options = ServiceOptions.fromJSON(object.options); + return obj; + }, + 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 = createBaseServiceDescriptorProto(); + message.name = object.name ?? ""; + message.method = object.method?.map(e => MethodDescriptorProto.fromPartial(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromPartial(object.options); + } + return message; + }, + fromSDK(object: ServiceDescriptorProtoSDKType): ServiceDescriptorProto { + return { + name: object?.name, + method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromSDK(e)) : [], + options: object.options ? ServiceOptions.fromSDK(object.options) : undefined + }; + }, + fromSDKJSON(object: any): ServiceDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + method: Array.isArray(object?.method) ? object.method.map((e: any) => MethodDescriptorProto.fromSDKJSON(e)) : [], + options: isSet(object.options) ? ServiceOptions.fromSDKJSON(object.options) : undefined + }; + }, + toSDK(message: ServiceDescriptorProto): ServiceDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + if (message.method) { + obj.method = message.method.map(e => e ? MethodDescriptorProto.toSDK(e) : undefined); + } else { + obj.method = []; + } + message.options !== undefined && (obj.options = message.options ? ServiceOptions.toSDK(message.options) : undefined); + return obj; + }, + fromAmino(object: ServiceDescriptorProtoAmino): ServiceDescriptorProto { + const message = createBaseServiceDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.method = object.method?.map(e => MethodDescriptorProto.fromAmino(e)) || []; + if (object.options !== undefined && object.options !== null) { + message.options = ServiceOptions.fromAmino(object.options); + } + return message; + }, + toAmino(message: ServiceDescriptorProto): ServiceDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + if (message.method) { + obj.method = message.method.map(e => e ? MethodDescriptorProto.toAmino(e) : undefined); + } else { + obj.method = message.method; + } + obj.options = message.options ? ServiceOptions.toAmino(message.options) : undefined; + return obj; + }, + fromAminoMsg(object: ServiceDescriptorProtoAminoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceDescriptorProtoProtoMsg): ServiceDescriptorProto { + return ServiceDescriptorProto.decode(message.value); + }, + toProto(message: ServiceDescriptorProto): Uint8Array { + return ServiceDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: ServiceDescriptorProto): ServiceDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceDescriptorProto", + value: ServiceDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseMethodDescriptorProto(): MethodDescriptorProto { + return { + name: "", + inputType: "", + outputType: "", + options: undefined, + clientStreaming: false, + serverStreaming: false + }; +} +export const MethodDescriptorProto = { + typeUrl: "/google.protobuf.MethodDescriptorProto", + encode(message: MethodDescriptorProto, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + if (message.clientStreaming === true) { + writer.uint32(40).bool(message.clientStreaming); + } + if (message.serverStreaming === true) { + writer.uint32(48).bool(message.serverStreaming); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MethodDescriptorProto { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodDescriptorProto(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.name = reader.string(); + break; + case 2: + message.inputType = reader.string(); + break; + case 3: + message.outputType = reader.string(); + break; + case 4: + message.options = MethodOptions.decode(reader, reader.uint32()); + break; + case 5: + message.clientStreaming = reader.bool(); + break; + case 6: + message.serverStreaming = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MethodDescriptorProto { + const obj = createBaseMethodDescriptorProto(); + if (isSet(object.name)) obj.name = String(object.name); + if (isSet(object.inputType)) obj.inputType = String(object.inputType); + if (isSet(object.outputType)) obj.outputType = String(object.outputType); + if (isSet(object.options)) obj.options = MethodOptions.fromJSON(object.options); + if (isSet(object.clientStreaming)) obj.clientStreaming = Boolean(object.clientStreaming); + if (isSet(object.serverStreaming)) obj.serverStreaming = Boolean(object.serverStreaming); + return obj; + }, + 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 = createBaseMethodDescriptorProto(); + message.name = object.name ?? ""; + message.inputType = object.inputType ?? ""; + message.outputType = object.outputType ?? ""; + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromPartial(object.options); + } + message.clientStreaming = object.clientStreaming ?? false; + message.serverStreaming = object.serverStreaming ?? false; + return message; + }, + fromSDK(object: MethodDescriptorProtoSDKType): MethodDescriptorProto { + return { + name: object?.name, + inputType: object?.input_type, + outputType: object?.output_type, + options: object.options ? MethodOptions.fromSDK(object.options) : undefined, + clientStreaming: object?.client_streaming, + serverStreaming: object?.server_streaming + }; + }, + fromSDKJSON(object: any): MethodDescriptorProtoSDKType { + return { + name: isSet(object.name) ? String(object.name) : "", + input_type: isSet(object.input_type) ? String(object.input_type) : "", + output_type: isSet(object.output_type) ? String(object.output_type) : "", + options: isSet(object.options) ? MethodOptions.fromSDKJSON(object.options) : undefined, + client_streaming: isSet(object.client_streaming) ? Boolean(object.client_streaming) : false, + server_streaming: isSet(object.server_streaming) ? Boolean(object.server_streaming) : false + }; + }, + toSDK(message: MethodDescriptorProto): MethodDescriptorProtoSDKType { + const obj: any = {}; + obj.name = message.name; + obj.input_type = message.inputType; + obj.output_type = message.outputType; + message.options !== undefined && (obj.options = message.options ? MethodOptions.toSDK(message.options) : undefined); + obj.client_streaming = message.clientStreaming; + obj.server_streaming = message.serverStreaming; + return obj; + }, + fromAmino(object: MethodDescriptorProtoAmino): MethodDescriptorProto { + const message = createBaseMethodDescriptorProto(); + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + if (object.input_type !== undefined && object.input_type !== null) { + message.inputType = object.input_type; + } + if (object.output_type !== undefined && object.output_type !== null) { + message.outputType = object.output_type; + } + if (object.options !== undefined && object.options !== null) { + message.options = MethodOptions.fromAmino(object.options); + } + if (object.client_streaming !== undefined && object.client_streaming !== null) { + message.clientStreaming = object.client_streaming; + } + if (object.server_streaming !== undefined && object.server_streaming !== null) { + message.serverStreaming = object.server_streaming; + } + return message; + }, + toAmino(message: MethodDescriptorProto): MethodDescriptorProtoAmino { + const obj: any = {}; + obj.name = message.name === "" ? undefined : message.name; + obj.input_type = message.inputType === "" ? undefined : message.inputType; + obj.output_type = message.outputType === "" ? undefined : message.outputType; + obj.options = message.options ? MethodOptions.toAmino(message.options) : undefined; + obj.client_streaming = message.clientStreaming === false ? undefined : message.clientStreaming; + obj.server_streaming = message.serverStreaming === false ? undefined : message.serverStreaming; + return obj; + }, + fromAminoMsg(object: MethodDescriptorProtoAminoMsg): MethodDescriptorProto { + return MethodDescriptorProto.fromAmino(object.value); + }, + fromProtoMsg(message: MethodDescriptorProtoProtoMsg): MethodDescriptorProto { + return MethodDescriptorProto.decode(message.value); + }, + toProto(message: MethodDescriptorProto): Uint8Array { + return MethodDescriptorProto.encode(message).finish(); + }, + toProtoMsg(message: MethodDescriptorProto): MethodDescriptorProtoProtoMsg { + return { + typeUrl: "/google.protobuf.MethodDescriptorProto", + value: MethodDescriptorProto.encode(message).finish() + }; + } +}; +function createBaseFileOptions(): FileOptions { + return { + javaPackage: "", + javaOuterClassname: "", + javaMultipleFiles: false, + javaGenerateEqualsAndHash: false, + javaStringCheckUtf8: false, + optimizeFor: 1, + goPackage: "", + ccGenericServices: false, + javaGenericServices: false, + pyGenericServices: false, + phpGenericServices: false, + deprecated: false, + ccEnableArenas: false, + objcClassPrefix: "", + csharpNamespace: "", + swiftPrefix: "", + phpClassPrefix: "", + phpNamespace: "", + phpMetadataNamespace: "", + rubyPackage: "", + uninterpretedOption: [] + }; +} +export const FileOptions = { + typeUrl: "/google.protobuf.FileOptions", + encode(message: FileOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FileOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFileOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.javaPackage = reader.string(); + break; + case 8: + message.javaOuterClassname = reader.string(); + break; + case 10: + message.javaMultipleFiles = reader.bool(); + break; + case 20: + message.javaGenerateEqualsAndHash = reader.bool(); + break; + case 27: + message.javaStringCheckUtf8 = reader.bool(); + break; + case 9: + message.optimizeFor = (reader.int32() as any); + break; + case 11: + message.goPackage = reader.string(); + break; + case 16: + message.ccGenericServices = reader.bool(); + break; + case 17: + message.javaGenericServices = reader.bool(); + break; + case 18: + message.pyGenericServices = reader.bool(); + break; + case 42: + message.phpGenericServices = reader.bool(); + break; + case 23: + message.deprecated = reader.bool(); + break; + case 31: + message.ccEnableArenas = reader.bool(); + break; + case 36: + message.objcClassPrefix = reader.string(); + break; + case 37: + message.csharpNamespace = reader.string(); + break; + case 39: + message.swiftPrefix = reader.string(); + break; + case 40: + message.phpClassPrefix = reader.string(); + break; + case 41: + message.phpNamespace = reader.string(); + break; + case 44: + message.phpMetadataNamespace = reader.string(); + break; + case 45: + message.rubyPackage = reader.string(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): FileOptions { + const obj = createBaseFileOptions(); + if (isSet(object.javaPackage)) obj.javaPackage = String(object.javaPackage); + if (isSet(object.javaOuterClassname)) obj.javaOuterClassname = String(object.javaOuterClassname); + if (isSet(object.javaMultipleFiles)) obj.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (isSet(object.javaGenerateEqualsAndHash)) obj.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (isSet(object.javaStringCheckUtf8)) obj.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + if (isSet(object.optimizeFor)) obj.optimizeFor = fileOptions_OptimizeModeFromJSON(object.optimizeFor); + if (isSet(object.goPackage)) obj.goPackage = String(object.goPackage); + if (isSet(object.ccGenericServices)) obj.ccGenericServices = Boolean(object.ccGenericServices); + if (isSet(object.javaGenericServices)) obj.javaGenericServices = Boolean(object.javaGenericServices); + if (isSet(object.pyGenericServices)) obj.pyGenericServices = Boolean(object.pyGenericServices); + if (isSet(object.phpGenericServices)) obj.phpGenericServices = Boolean(object.phpGenericServices); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (isSet(object.ccEnableArenas)) obj.ccEnableArenas = Boolean(object.ccEnableArenas); + if (isSet(object.objcClassPrefix)) obj.objcClassPrefix = String(object.objcClassPrefix); + if (isSet(object.csharpNamespace)) obj.csharpNamespace = String(object.csharpNamespace); + if (isSet(object.swiftPrefix)) obj.swiftPrefix = String(object.swiftPrefix); + if (isSet(object.phpClassPrefix)) obj.phpClassPrefix = String(object.phpClassPrefix); + if (isSet(object.phpNamespace)) obj.phpNamespace = String(object.phpNamespace); + if (isSet(object.phpMetadataNamespace)) obj.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (isSet(object.rubyPackage)) obj.rubyPackage = String(object.rubyPackage); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + 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 = createBaseFileOptions(); + message.javaPackage = object.javaPackage ?? ""; + message.javaOuterClassname = object.javaOuterClassname ?? ""; + message.javaMultipleFiles = object.javaMultipleFiles ?? false; + message.javaGenerateEqualsAndHash = object.javaGenerateEqualsAndHash ?? false; + message.javaStringCheckUtf8 = object.javaStringCheckUtf8 ?? false; + message.optimizeFor = object.optimizeFor ?? 1; + message.goPackage = object.goPackage ?? ""; + message.ccGenericServices = object.ccGenericServices ?? false; + message.javaGenericServices = object.javaGenericServices ?? false; + message.pyGenericServices = object.pyGenericServices ?? false; + message.phpGenericServices = object.phpGenericServices ?? false; + message.deprecated = object.deprecated ?? false; + message.ccEnableArenas = object.ccEnableArenas ?? false; + message.objcClassPrefix = object.objcClassPrefix ?? ""; + message.csharpNamespace = object.csharpNamespace ?? ""; + message.swiftPrefix = object.swiftPrefix ?? ""; + message.phpClassPrefix = object.phpClassPrefix ?? ""; + message.phpNamespace = object.phpNamespace ?? ""; + message.phpMetadataNamespace = object.phpMetadataNamespace ?? ""; + message.rubyPackage = object.rubyPackage ?? ""; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: FileOptionsSDKType): FileOptions { + return { + javaPackage: object?.java_package, + javaOuterClassname: object?.java_outer_classname, + javaMultipleFiles: object?.java_multiple_files, + javaGenerateEqualsAndHash: object?.java_generate_equals_and_hash, + javaStringCheckUtf8: object?.java_string_check_utf8, + optimizeFor: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : -1, + goPackage: object?.go_package, + ccGenericServices: object?.cc_generic_services, + javaGenericServices: object?.java_generic_services, + pyGenericServices: object?.py_generic_services, + phpGenericServices: object?.php_generic_services, + deprecated: object?.deprecated, + ccEnableArenas: object?.cc_enable_arenas, + objcClassPrefix: object?.objc_class_prefix, + csharpNamespace: object?.csharp_namespace, + swiftPrefix: object?.swift_prefix, + phpClassPrefix: object?.php_class_prefix, + phpNamespace: object?.php_namespace, + phpMetadataNamespace: object?.php_metadata_namespace, + rubyPackage: object?.ruby_package, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): FileOptionsSDKType { + return { + java_package: isSet(object.java_package) ? String(object.java_package) : "", + java_outer_classname: isSet(object.java_outer_classname) ? String(object.java_outer_classname) : "", + java_multiple_files: isSet(object.java_multiple_files) ? Boolean(object.java_multiple_files) : false, + java_generate_equals_and_hash: isSet(object.java_generate_equals_and_hash) ? Boolean(object.java_generate_equals_and_hash) : false, + java_string_check_utf8: isSet(object.java_string_check_utf8) ? Boolean(object.java_string_check_utf8) : false, + optimize_for: isSet(object.optimize_for) ? fileOptions_OptimizeModeFromJSON(object.optimize_for) : -1, + go_package: isSet(object.go_package) ? String(object.go_package) : "", + cc_generic_services: isSet(object.cc_generic_services) ? Boolean(object.cc_generic_services) : false, + java_generic_services: isSet(object.java_generic_services) ? Boolean(object.java_generic_services) : false, + py_generic_services: isSet(object.py_generic_services) ? Boolean(object.py_generic_services) : false, + php_generic_services: isSet(object.php_generic_services) ? Boolean(object.php_generic_services) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + cc_enable_arenas: isSet(object.cc_enable_arenas) ? Boolean(object.cc_enable_arenas) : false, + objc_class_prefix: isSet(object.objc_class_prefix) ? String(object.objc_class_prefix) : "", + csharp_namespace: isSet(object.csharp_namespace) ? String(object.csharp_namespace) : "", + swift_prefix: isSet(object.swift_prefix) ? String(object.swift_prefix) : "", + php_class_prefix: isSet(object.php_class_prefix) ? String(object.php_class_prefix) : "", + php_namespace: isSet(object.php_namespace) ? String(object.php_namespace) : "", + php_metadata_namespace: isSet(object.php_metadata_namespace) ? String(object.php_metadata_namespace) : "", + ruby_package: isSet(object.ruby_package) ? String(object.ruby_package) : "", + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: FileOptions): FileOptionsSDKType { + const obj: any = {}; + obj.java_package = message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8; + message.optimizeFor !== undefined && (obj.optimize_for = fileOptions_OptimizeModeToJSON(message.optimizeFor)); + obj.go_package = message.goPackage; + obj.cc_generic_services = message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices; + obj.deprecated = message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix; + obj.php_namespace = message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: FileOptionsAmino): FileOptions { + const message = createBaseFileOptions(); + if (object.java_package !== undefined && object.java_package !== null) { + message.javaPackage = object.java_package; + } + if (object.java_outer_classname !== undefined && object.java_outer_classname !== null) { + message.javaOuterClassname = object.java_outer_classname; + } + if (object.java_multiple_files !== undefined && object.java_multiple_files !== null) { + message.javaMultipleFiles = object.java_multiple_files; + } + if (object.java_generate_equals_and_hash !== undefined && object.java_generate_equals_and_hash !== null) { + message.javaGenerateEqualsAndHash = object.java_generate_equals_and_hash; + } + if (object.java_string_check_utf8 !== undefined && object.java_string_check_utf8 !== null) { + message.javaStringCheckUtf8 = object.java_string_check_utf8; + } + if (object.optimize_for !== undefined && object.optimize_for !== null) { + message.optimizeFor = object.optimize_for; + } + if (object.go_package !== undefined && object.go_package !== null) { + message.goPackage = object.go_package; + } + if (object.cc_generic_services !== undefined && object.cc_generic_services !== null) { + message.ccGenericServices = object.cc_generic_services; + } + if (object.java_generic_services !== undefined && object.java_generic_services !== null) { + message.javaGenericServices = object.java_generic_services; + } + if (object.py_generic_services !== undefined && object.py_generic_services !== null) { + message.pyGenericServices = object.py_generic_services; + } + if (object.php_generic_services !== undefined && object.php_generic_services !== null) { + message.phpGenericServices = object.php_generic_services; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.cc_enable_arenas !== undefined && object.cc_enable_arenas !== null) { + message.ccEnableArenas = object.cc_enable_arenas; + } + if (object.objc_class_prefix !== undefined && object.objc_class_prefix !== null) { + message.objcClassPrefix = object.objc_class_prefix; + } + if (object.csharp_namespace !== undefined && object.csharp_namespace !== null) { + message.csharpNamespace = object.csharp_namespace; + } + if (object.swift_prefix !== undefined && object.swift_prefix !== null) { + message.swiftPrefix = object.swift_prefix; + } + if (object.php_class_prefix !== undefined && object.php_class_prefix !== null) { + message.phpClassPrefix = object.php_class_prefix; + } + if (object.php_namespace !== undefined && object.php_namespace !== null) { + message.phpNamespace = object.php_namespace; + } + if (object.php_metadata_namespace !== undefined && object.php_metadata_namespace !== null) { + message.phpMetadataNamespace = object.php_metadata_namespace; + } + if (object.ruby_package !== undefined && object.ruby_package !== null) { + message.rubyPackage = object.ruby_package; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FileOptions): FileOptionsAmino { + const obj: any = {}; + obj.java_package = message.javaPackage === "" ? undefined : message.javaPackage; + obj.java_outer_classname = message.javaOuterClassname === "" ? undefined : message.javaOuterClassname; + obj.java_multiple_files = message.javaMultipleFiles === false ? undefined : message.javaMultipleFiles; + obj.java_generate_equals_and_hash = message.javaGenerateEqualsAndHash === false ? undefined : message.javaGenerateEqualsAndHash; + obj.java_string_check_utf8 = message.javaStringCheckUtf8 === false ? undefined : message.javaStringCheckUtf8; + obj.optimize_for = message.optimizeFor === 1 ? undefined : message.optimizeFor; + obj.go_package = message.goPackage === "" ? undefined : message.goPackage; + obj.cc_generic_services = message.ccGenericServices === false ? undefined : message.ccGenericServices; + obj.java_generic_services = message.javaGenericServices === false ? undefined : message.javaGenericServices; + obj.py_generic_services = message.pyGenericServices === false ? undefined : message.pyGenericServices; + obj.php_generic_services = message.phpGenericServices === false ? undefined : message.phpGenericServices; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.cc_enable_arenas = message.ccEnableArenas === false ? undefined : message.ccEnableArenas; + obj.objc_class_prefix = message.objcClassPrefix === "" ? undefined : message.objcClassPrefix; + obj.csharp_namespace = message.csharpNamespace === "" ? undefined : message.csharpNamespace; + obj.swift_prefix = message.swiftPrefix === "" ? undefined : message.swiftPrefix; + obj.php_class_prefix = message.phpClassPrefix === "" ? undefined : message.phpClassPrefix; + obj.php_namespace = message.phpNamespace === "" ? undefined : message.phpNamespace; + obj.php_metadata_namespace = message.phpMetadataNamespace === "" ? undefined : message.phpMetadataNamespace; + obj.ruby_package = message.rubyPackage === "" ? undefined : message.rubyPackage; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: FileOptionsAminoMsg): FileOptions { + return FileOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FileOptionsProtoMsg): FileOptions { + return FileOptions.decode(message.value); + }, + toProto(message: FileOptions): Uint8Array { + return FileOptions.encode(message).finish(); + }, + toProtoMsg(message: FileOptions): FileOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FileOptions", + value: FileOptions.encode(message).finish() + }; + } +}; +function createBaseMessageOptions(): MessageOptions { + return { + messageSetWireFormat: false, + noStandardDescriptorAccessor: false, + deprecated: false, + mapEntry: false, + uninterpretedOption: [] + }; +} +export const MessageOptions = { + typeUrl: "/google.protobuf.MessageOptions", + encode(message: MessageOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MessageOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMessageOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.messageSetWireFormat = reader.bool(); + break; + case 2: + message.noStandardDescriptorAccessor = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 7: + message.mapEntry = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MessageOptions { + const obj = createBaseMessageOptions(); + if (isSet(object.messageSetWireFormat)) obj.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (isSet(object.noStandardDescriptorAccessor)) obj.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (isSet(object.mapEntry)) obj.mapEntry = Boolean(object.mapEntry); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + 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 = createBaseMessageOptions(); + message.messageSetWireFormat = object.messageSetWireFormat ?? false; + message.noStandardDescriptorAccessor = object.noStandardDescriptorAccessor ?? false; + message.deprecated = object.deprecated ?? false; + message.mapEntry = object.mapEntry ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: MessageOptionsSDKType): MessageOptions { + return { + messageSetWireFormat: object?.message_set_wire_format, + noStandardDescriptorAccessor: object?.no_standard_descriptor_accessor, + deprecated: object?.deprecated, + mapEntry: object?.map_entry, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): MessageOptionsSDKType { + return { + message_set_wire_format: isSet(object.message_set_wire_format) ? Boolean(object.message_set_wire_format) : false, + no_standard_descriptor_accessor: isSet(object.no_standard_descriptor_accessor) ? Boolean(object.no_standard_descriptor_accessor) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + map_entry: isSet(object.map_entry) ? Boolean(object.map_entry) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: MessageOptions): MessageOptionsSDKType { + const obj: any = {}; + obj.message_set_wire_format = message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated; + obj.map_entry = message.mapEntry; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: MessageOptionsAmino): MessageOptions { + const message = createBaseMessageOptions(); + if (object.message_set_wire_format !== undefined && object.message_set_wire_format !== null) { + message.messageSetWireFormat = object.message_set_wire_format; + } + if (object.no_standard_descriptor_accessor !== undefined && object.no_standard_descriptor_accessor !== null) { + message.noStandardDescriptorAccessor = object.no_standard_descriptor_accessor; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.map_entry !== undefined && object.map_entry !== null) { + message.mapEntry = object.map_entry; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MessageOptions): MessageOptionsAmino { + const obj: any = {}; + obj.message_set_wire_format = message.messageSetWireFormat === false ? undefined : message.messageSetWireFormat; + obj.no_standard_descriptor_accessor = message.noStandardDescriptorAccessor === false ? undefined : message.noStandardDescriptorAccessor; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.map_entry = message.mapEntry === false ? undefined : message.mapEntry; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: MessageOptionsAminoMsg): MessageOptions { + return MessageOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MessageOptionsProtoMsg): MessageOptions { + return MessageOptions.decode(message.value); + }, + toProto(message: MessageOptions): Uint8Array { + return MessageOptions.encode(message).finish(); + }, + toProtoMsg(message: MessageOptions): MessageOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MessageOptions", + value: MessageOptions.encode(message).finish() + }; + } +}; +function createBaseFieldOptions(): FieldOptions { + return { + ctype: 1, + packed: false, + jstype: 1, + lazy: false, + deprecated: false, + weak: false, + uninterpretedOption: [] + }; +} +export const FieldOptions = { + typeUrl: "/google.protobuf.FieldOptions", + encode(message: FieldOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.ctype !== 1) { + writer.uint32(8).int32(message.ctype); + } + if (message.packed === true) { + writer.uint32(16).bool(message.packed); + } + if (message.jstype !== 1) { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): FieldOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseFieldOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.ctype = (reader.int32() as any); + break; + case 2: + message.packed = reader.bool(); + break; + case 6: + message.jstype = (reader.int32() as any); + break; + case 5: + message.lazy = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 10: + message.weak = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): FieldOptions { + const obj = createBaseFieldOptions(); + if (isSet(object.ctype)) obj.ctype = fieldOptions_CTypeFromJSON(object.ctype); + if (isSet(object.packed)) obj.packed = Boolean(object.packed); + if (isSet(object.jstype)) obj.jstype = fieldOptions_JSTypeFromJSON(object.jstype); + if (isSet(object.lazy)) obj.lazy = Boolean(object.lazy); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (isSet(object.weak)) obj.weak = Boolean(object.weak); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + 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 = createBaseFieldOptions(); + message.ctype = object.ctype ?? 1; + message.packed = object.packed ?? false; + message.jstype = object.jstype ?? 1; + message.lazy = object.lazy ?? false; + message.deprecated = object.deprecated ?? false; + message.weak = object.weak ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: FieldOptionsSDKType): FieldOptions { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, + packed: object?.packed, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, + lazy: object?.lazy, + deprecated: object?.deprecated, + weak: object?.weak, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): FieldOptionsSDKType { + return { + ctype: isSet(object.ctype) ? fieldOptions_CTypeFromJSON(object.ctype) : -1, + packed: isSet(object.packed) ? Boolean(object.packed) : false, + jstype: isSet(object.jstype) ? fieldOptions_JSTypeFromJSON(object.jstype) : -1, + lazy: isSet(object.lazy) ? Boolean(object.lazy) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + weak: isSet(object.weak) ? Boolean(object.weak) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: FieldOptions): FieldOptionsSDKType { + const obj: any = {}; + message.ctype !== undefined && (obj.ctype = fieldOptions_CTypeToJSON(message.ctype)); + obj.packed = message.packed; + message.jstype !== undefined && (obj.jstype = fieldOptions_JSTypeToJSON(message.jstype)); + obj.lazy = message.lazy; + obj.deprecated = message.deprecated; + obj.weak = message.weak; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: FieldOptionsAmino): FieldOptions { + const message = createBaseFieldOptions(); + if (object.ctype !== undefined && object.ctype !== null) { + message.ctype = object.ctype; + } + if (object.packed !== undefined && object.packed !== null) { + message.packed = object.packed; + } + if (object.jstype !== undefined && object.jstype !== null) { + message.jstype = object.jstype; + } + if (object.lazy !== undefined && object.lazy !== null) { + message.lazy = object.lazy; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.weak !== undefined && object.weak !== null) { + message.weak = object.weak; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: FieldOptions): FieldOptionsAmino { + const obj: any = {}; + obj.ctype = message.ctype === 1 ? undefined : message.ctype; + obj.packed = message.packed === false ? undefined : message.packed; + obj.jstype = message.jstype === 1 ? undefined : message.jstype; + obj.lazy = message.lazy === false ? undefined : message.lazy; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.weak = message.weak === false ? undefined : message.weak; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: FieldOptionsAminoMsg): FieldOptions { + return FieldOptions.fromAmino(object.value); + }, + fromProtoMsg(message: FieldOptionsProtoMsg): FieldOptions { + return FieldOptions.decode(message.value); + }, + toProto(message: FieldOptions): Uint8Array { + return FieldOptions.encode(message).finish(); + }, + toProtoMsg(message: FieldOptions): FieldOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.FieldOptions", + value: FieldOptions.encode(message).finish() + }; + } +}; +function createBaseOneofOptions(): OneofOptions { + return { + uninterpretedOption: [] + }; +} +export const OneofOptions = { + typeUrl: "/google.protobuf.OneofOptions", + encode(message: OneofOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): OneofOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseOneofOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): OneofOptions { + const obj = createBaseOneofOptions(); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + toJSON(message: OneofOptions): unknown { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpretedOption = message.uninterpretedOption.map(e => e ? UninterpretedOption.toJSON(e) : undefined); + } else { + obj.uninterpretedOption = []; + } + return obj; + }, + fromPartial(object: DeepPartial): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: OneofOptionsSDKType): OneofOptions { + return { + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): OneofOptionsSDKType { + return { + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: OneofOptions): OneofOptionsSDKType { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: OneofOptionsAmino): OneofOptions { + const message = createBaseOneofOptions(); + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: OneofOptions): OneofOptionsAmino { + const obj: any = {}; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: OneofOptionsAminoMsg): OneofOptions { + return OneofOptions.fromAmino(object.value); + }, + fromProtoMsg(message: OneofOptionsProtoMsg): OneofOptions { + return OneofOptions.decode(message.value); + }, + toProto(message: OneofOptions): Uint8Array { + return OneofOptions.encode(message).finish(); + }, + toProtoMsg(message: OneofOptions): OneofOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.OneofOptions", + value: OneofOptions.encode(message).finish() + }; + } +}; +function createBaseEnumOptions(): EnumOptions { + return { + allowAlias: false, + deprecated: false, + uninterpretedOption: [] + }; +} +export const EnumOptions = { + typeUrl: "/google.protobuf.EnumOptions", + encode(message: EnumOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + 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(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.allowAlias = reader.bool(); + break; + case 3: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EnumOptions { + const obj = createBaseEnumOptions(); + if (isSet(object.allowAlias)) obj.allowAlias = Boolean(object.allowAlias); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + 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 = createBaseEnumOptions(); + message.allowAlias = object.allowAlias ?? false; + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: EnumOptionsSDKType): EnumOptions { + return { + allowAlias: object?.allow_alias, + deprecated: object?.deprecated, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): EnumOptionsSDKType { + return { + allow_alias: isSet(object.allow_alias) ? Boolean(object.allow_alias) : false, + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: EnumOptions): EnumOptionsSDKType { + const obj: any = {}; + obj.allow_alias = message.allowAlias; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: EnumOptionsAmino): EnumOptions { + const message = createBaseEnumOptions(); + if (object.allow_alias !== undefined && object.allow_alias !== null) { + message.allowAlias = object.allow_alias; + } + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumOptions): EnumOptionsAmino { + const obj: any = {}; + obj.allow_alias = message.allowAlias === false ? undefined : message.allowAlias; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: EnumOptionsAminoMsg): EnumOptions { + return EnumOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumOptionsProtoMsg): EnumOptions { + return EnumOptions.decode(message.value); + }, + toProto(message: EnumOptions): Uint8Array { + return EnumOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumOptions): EnumOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumOptions", + value: EnumOptions.encode(message).finish() + }; + } +}; +function createBaseEnumValueOptions(): EnumValueOptions { + return { + deprecated: false, + uninterpretedOption: [] + }; +} +export const EnumValueOptions = { + typeUrl: "/google.protobuf.EnumValueOptions", + encode(message: EnumValueOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(8).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EnumValueOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEnumValueOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EnumValueOptions { + const obj = createBaseEnumValueOptions(); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + toJSON(message: EnumValueOptions): unknown { + const obj: any = {}; + 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): EnumValueOptions { + const message = createBaseEnumValueOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: EnumValueOptionsSDKType): EnumValueOptions { + return { + deprecated: object?.deprecated, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): EnumValueOptionsSDKType { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: EnumValueOptions): EnumValueOptionsSDKType { + const obj: any = {}; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: EnumValueOptionsAmino): EnumValueOptions { + const message = createBaseEnumValueOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: EnumValueOptions): EnumValueOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: EnumValueOptionsAminoMsg): EnumValueOptions { + return EnumValueOptions.fromAmino(object.value); + }, + fromProtoMsg(message: EnumValueOptionsProtoMsg): EnumValueOptions { + return EnumValueOptions.decode(message.value); + }, + toProto(message: EnumValueOptions): Uint8Array { + return EnumValueOptions.encode(message).finish(); + }, + toProtoMsg(message: EnumValueOptions): EnumValueOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.EnumValueOptions", + value: EnumValueOptions.encode(message).finish() + }; + } +}; +function createBaseServiceOptions(): ServiceOptions { + return { + deprecated: false, + uninterpretedOption: [] + }; +} +export const ServiceOptions = { + typeUrl: "/google.protobuf.ServiceOptions", + encode(message: ServiceOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): ServiceOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseServiceOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): ServiceOptions { + const obj = createBaseServiceOptions(); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + toJSON(message: ServiceOptions): unknown { + const obj: any = {}; + 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): ServiceOptions { + const message = createBaseServiceOptions(); + message.deprecated = object.deprecated ?? false; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: ServiceOptionsSDKType): ServiceOptions { + return { + deprecated: object?.deprecated, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): ServiceOptionsSDKType { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: ServiceOptions): ServiceOptionsSDKType { + const obj: any = {}; + obj.deprecated = message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: ServiceOptionsAmino): ServiceOptions { + const message = createBaseServiceOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: ServiceOptions): ServiceOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: ServiceOptionsAminoMsg): ServiceOptions { + return ServiceOptions.fromAmino(object.value); + }, + fromProtoMsg(message: ServiceOptionsProtoMsg): ServiceOptions { + return ServiceOptions.decode(message.value); + }, + toProto(message: ServiceOptions): Uint8Array { + return ServiceOptions.encode(message).finish(); + }, + toProtoMsg(message: ServiceOptions): ServiceOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.ServiceOptions", + value: ServiceOptions.encode(message).finish() + }; + } +}; +function createBaseMethodOptions(): MethodOptions { + return { + deprecated: false, + idempotencyLevel: 1, + uninterpretedOption: [] + }; +} +export const MethodOptions = { + typeUrl: "/google.protobuf.MethodOptions", + encode(message: MethodOptions, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.deprecated === true) { + writer.uint32(264).bool(message.deprecated); + } + if (message.idempotencyLevel !== 1) { + writer.uint32(272).int32(message.idempotencyLevel); + } + for (const v of message.uninterpretedOption) { + UninterpretedOption.encode(v!, writer.uint32(7994).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MethodOptions { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMethodOptions(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 33: + message.deprecated = reader.bool(); + break; + case 34: + message.idempotencyLevel = (reader.int32() as any); + break; + case 999: + message.uninterpretedOption.push(UninterpretedOption.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): MethodOptions { + const obj = createBaseMethodOptions(); + if (isSet(object.deprecated)) obj.deprecated = Boolean(object.deprecated); + if (isSet(object.idempotencyLevel)) obj.idempotencyLevel = methodOptions_IdempotencyLevelFromJSON(object.idempotencyLevel); + if (Array.isArray(object?.uninterpretedOption)) obj.uninterpretedOption = object.uninterpretedOption.map((e: any) => UninterpretedOption.fromJSON(e)); + return obj; + }, + 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 = createBaseMethodOptions(); + message.deprecated = object.deprecated ?? false; + message.idempotencyLevel = object.idempotencyLevel ?? 1; + message.uninterpretedOption = object.uninterpretedOption?.map(e => UninterpretedOption.fromPartial(e)) || []; + return message; + }, + fromSDK(object: MethodOptionsSDKType): MethodOptions { + return { + deprecated: object?.deprecated, + idempotencyLevel: isSet(object.idempotency_level) ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) : -1, + uninterpretedOption: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): MethodOptionsSDKType { + return { + deprecated: isSet(object.deprecated) ? Boolean(object.deprecated) : false, + idempotency_level: isSet(object.idempotency_level) ? methodOptions_IdempotencyLevelFromJSON(object.idempotency_level) : -1, + uninterpreted_option: Array.isArray(object?.uninterpreted_option) ? object.uninterpreted_option.map((e: any) => UninterpretedOption.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: MethodOptions): MethodOptionsSDKType { + const obj: any = {}; + obj.deprecated = message.deprecated; + message.idempotencyLevel !== undefined && (obj.idempotency_level = methodOptions_IdempotencyLevelToJSON(message.idempotencyLevel)); + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toSDK(e) : undefined); + } else { + obj.uninterpreted_option = []; + } + return obj; + }, + fromAmino(object: MethodOptionsAmino): MethodOptions { + const message = createBaseMethodOptions(); + if (object.deprecated !== undefined && object.deprecated !== null) { + message.deprecated = object.deprecated; + } + if (object.idempotency_level !== undefined && object.idempotency_level !== null) { + message.idempotencyLevel = object.idempotency_level; + } + message.uninterpretedOption = object.uninterpreted_option?.map(e => UninterpretedOption.fromAmino(e)) || []; + return message; + }, + toAmino(message: MethodOptions): MethodOptionsAmino { + const obj: any = {}; + obj.deprecated = message.deprecated === false ? undefined : message.deprecated; + obj.idempotency_level = message.idempotencyLevel === 1 ? undefined : message.idempotencyLevel; + if (message.uninterpretedOption) { + obj.uninterpreted_option = message.uninterpretedOption.map(e => e ? UninterpretedOption.toAmino(e) : undefined); + } else { + obj.uninterpreted_option = message.uninterpretedOption; + } + return obj; + }, + fromAminoMsg(object: MethodOptionsAminoMsg): MethodOptions { + return MethodOptions.fromAmino(object.value); + }, + fromProtoMsg(message: MethodOptionsProtoMsg): MethodOptions { + return MethodOptions.decode(message.value); + }, + toProto(message: MethodOptions): Uint8Array { + return MethodOptions.encode(message).finish(); + }, + toProtoMsg(message: MethodOptions): MethodOptionsProtoMsg { + return { + typeUrl: "/google.protobuf.MethodOptions", + value: MethodOptions.encode(message).finish() + }; + } +}; +function createBaseUninterpretedOption(): UninterpretedOption { + return { + name: [], + identifierValue: "", + positiveIntValue: BigInt(0), + negativeIntValue: BigInt(0), + doubleValue: 0, + stringValue: new Uint8Array(), + aggregateValue: "" + }; +} +export const UninterpretedOption = { + typeUrl: "/google.protobuf.UninterpretedOption", + encode(message: UninterpretedOption, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.name) { + UninterpretedOption_NamePart.encode(v!, writer.uint32(18).fork()).ldelim(); + } + if (message.identifierValue !== "") { + writer.uint32(26).string(message.identifierValue); + } + if (message.positiveIntValue !== BigInt(0)) { + writer.uint32(32).uint64(message.positiveIntValue); + } + if (message.negativeIntValue !== BigInt(0)) { + 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: BinaryReader | Uint8Array, length?: number): UninterpretedOption { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 2: + message.name.push(UninterpretedOption_NamePart.decode(reader, reader.uint32())); + break; + case 3: + message.identifierValue = reader.string(); + break; + case 4: + message.positiveIntValue = reader.uint64(); + break; + case 5: + message.negativeIntValue = reader.int64(); + break; + case 6: + message.doubleValue = reader.double(); + break; + case 7: + message.stringValue = reader.bytes(); + break; + case 8: + message.aggregateValue = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): UninterpretedOption { + const obj = createBaseUninterpretedOption(); + if (Array.isArray(object?.name)) obj.name = object.name.map((e: any) => UninterpretedOption_NamePart.fromJSON(e)); + if (isSet(object.identifierValue)) obj.identifierValue = String(object.identifierValue); + if (isSet(object.positiveIntValue)) obj.positiveIntValue = BigInt(object.positiveIntValue.toString()); + if (isSet(object.negativeIntValue)) obj.negativeIntValue = BigInt(object.negativeIntValue.toString()); + if (isSet(object.doubleValue)) obj.doubleValue = Number(object.doubleValue); + if (isSet(object.stringValue)) obj.stringValue = bytesFromBase64(object.stringValue); + if (isSet(object.aggregateValue)) obj.aggregateValue = String(object.aggregateValue); + return obj; + }, + 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 || BigInt(0)).toString()); + message.negativeIntValue !== undefined && (obj.negativeIntValue = (message.negativeIntValue || BigInt(0)).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 = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromPartial(e)) || []; + message.identifierValue = object.identifierValue ?? ""; + if (object.positiveIntValue !== undefined && object.positiveIntValue !== null) { + message.positiveIntValue = BigInt(object.positiveIntValue.toString()); + } + if (object.negativeIntValue !== undefined && object.negativeIntValue !== null) { + message.negativeIntValue = BigInt(object.negativeIntValue.toString()); + } + message.doubleValue = object.doubleValue ?? 0; + message.stringValue = object.stringValue ?? new Uint8Array(); + message.aggregateValue = object.aggregateValue ?? ""; + return message; + }, + fromSDK(object: UninterpretedOptionSDKType): UninterpretedOption { + return { + name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromSDK(e)) : [], + identifierValue: object?.identifier_value, + positiveIntValue: object?.positive_int_value, + negativeIntValue: object?.negative_int_value, + doubleValue: object?.double_value, + stringValue: object?.string_value, + aggregateValue: object?.aggregate_value + }; + }, + fromSDKJSON(object: any): UninterpretedOptionSDKType { + return { + name: Array.isArray(object?.name) ? object.name.map((e: any) => UninterpretedOption_NamePart.fromSDKJSON(e)) : [], + identifier_value: isSet(object.identifier_value) ? String(object.identifier_value) : "", + positive_int_value: isSet(object.positive_int_value) ? BigInt(object.positive_int_value.toString()) : BigInt(0), + negative_int_value: isSet(object.negative_int_value) ? BigInt(object.negative_int_value.toString()) : BigInt(0), + double_value: isSet(object.double_value) ? Number(object.double_value) : 0, + string_value: isSet(object.string_value) ? bytesFromBase64(object.string_value) : new Uint8Array(), + aggregate_value: isSet(object.aggregate_value) ? String(object.aggregate_value) : "" + }; + }, + toSDK(message: UninterpretedOption): UninterpretedOptionSDKType { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toSDK(e) : undefined); + } else { + obj.name = []; + } + obj.identifier_value = message.identifierValue; + obj.positive_int_value = message.positiveIntValue; + obj.negative_int_value = message.negativeIntValue; + obj.double_value = message.doubleValue; + obj.string_value = message.stringValue; + obj.aggregate_value = message.aggregateValue; + return obj; + }, + fromAmino(object: UninterpretedOptionAmino): UninterpretedOption { + const message = createBaseUninterpretedOption(); + message.name = object.name?.map(e => UninterpretedOption_NamePart.fromAmino(e)) || []; + if (object.identifier_value !== undefined && object.identifier_value !== null) { + message.identifierValue = object.identifier_value; + } + if (object.positive_int_value !== undefined && object.positive_int_value !== null) { + message.positiveIntValue = BigInt(object.positive_int_value); + } + if (object.negative_int_value !== undefined && object.negative_int_value !== null) { + message.negativeIntValue = BigInt(object.negative_int_value); + } + if (object.double_value !== undefined && object.double_value !== null) { + message.doubleValue = object.double_value; + } + if (object.string_value !== undefined && object.string_value !== null) { + message.stringValue = bytesFromBase64(object.string_value); + } + if (object.aggregate_value !== undefined && object.aggregate_value !== null) { + message.aggregateValue = object.aggregate_value; + } + return message; + }, + toAmino(message: UninterpretedOption): UninterpretedOptionAmino { + const obj: any = {}; + if (message.name) { + obj.name = message.name.map(e => e ? UninterpretedOption_NamePart.toAmino(e) : undefined); + } else { + obj.name = message.name; + } + obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; + obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; + obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; + obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; + return obj; + }, + fromAminoMsg(object: UninterpretedOptionAminoMsg): UninterpretedOption { + return UninterpretedOption.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOptionProtoMsg): UninterpretedOption { + return UninterpretedOption.decode(message.value); + }, + toProto(message: UninterpretedOption): Uint8Array { + return UninterpretedOption.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption): UninterpretedOptionProtoMsg { + return { + typeUrl: "/google.protobuf.UninterpretedOption", + value: UninterpretedOption.encode(message).finish() + }; + } +}; +function createBaseUninterpretedOption_NamePart(): UninterpretedOption_NamePart { + return { + namePart: "", + isExtension: false + }; +} +export const UninterpretedOption_NamePart = { + typeUrl: "/google.protobuf.NamePart", + encode(message: UninterpretedOption_NamePart, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.namePart !== "") { + writer.uint32(10).string(message.namePart); + } + if (message.isExtension === true) { + writer.uint32(16).bool(message.isExtension); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): UninterpretedOption_NamePart { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseUninterpretedOption_NamePart(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.namePart = reader.string(); + break; + case 2: + message.isExtension = reader.bool(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): UninterpretedOption_NamePart { + const obj = createBaseUninterpretedOption_NamePart(); + if (isSet(object.namePart)) obj.namePart = String(object.namePart); + if (isSet(object.isExtension)) obj.isExtension = Boolean(object.isExtension); + return obj; + }, + 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 = createBaseUninterpretedOption_NamePart(); + message.namePart = object.namePart ?? ""; + message.isExtension = object.isExtension ?? false; + return message; + }, + fromSDK(object: UninterpretedOption_NamePartSDKType): UninterpretedOption_NamePart { + return { + namePart: object?.name_part, + isExtension: object?.is_extension + }; + }, + fromSDKJSON(object: any): UninterpretedOption_NamePartSDKType { + return { + name_part: isSet(object.name_part) ? String(object.name_part) : "", + is_extension: isSet(object.is_extension) ? Boolean(object.is_extension) : false + }; + }, + toSDK(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartSDKType { + const obj: any = {}; + obj.name_part = message.namePart; + obj.is_extension = message.isExtension; + return obj; + }, + fromAmino(object: UninterpretedOption_NamePartAmino): UninterpretedOption_NamePart { + const message = createBaseUninterpretedOption_NamePart(); + if (object.name_part !== undefined && object.name_part !== null) { + message.namePart = object.name_part; + } + if (object.is_extension !== undefined && object.is_extension !== null) { + message.isExtension = object.is_extension; + } + return message; + }, + toAmino(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartAmino { + const obj: any = {}; + obj.name_part = message.namePart === "" ? undefined : message.namePart; + obj.is_extension = message.isExtension === false ? undefined : message.isExtension; + return obj; + }, + fromAminoMsg(object: UninterpretedOption_NamePartAminoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.fromAmino(object.value); + }, + fromProtoMsg(message: UninterpretedOption_NamePartProtoMsg): UninterpretedOption_NamePart { + return UninterpretedOption_NamePart.decode(message.value); + }, + toProto(message: UninterpretedOption_NamePart): Uint8Array { + return UninterpretedOption_NamePart.encode(message).finish(); + }, + toProtoMsg(message: UninterpretedOption_NamePart): UninterpretedOption_NamePartProtoMsg { + return { + typeUrl: "/google.protobuf.NamePart", + value: UninterpretedOption_NamePart.encode(message).finish() + }; + } +}; +function createBaseSourceCodeInfo(): SourceCodeInfo { + return { + location: [] + }; +} +export const SourceCodeInfo = { + typeUrl: "/google.protobuf.SourceCodeInfo", + encode(message: SourceCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.location) { + SourceCodeInfo_Location.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.location.push(SourceCodeInfo_Location.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): SourceCodeInfo { + const obj = createBaseSourceCodeInfo(); + if (Array.isArray(object?.location)) obj.location = object.location.map((e: any) => SourceCodeInfo_Location.fromJSON(e)); + return obj; + }, + toJSON(message: SourceCodeInfo): unknown { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toJSON(e) : undefined); + } else { + obj.location = []; + } + return obj; + }, + fromPartial(object: DeepPartial): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromPartial(e)) || []; + return message; + }, + fromSDK(object: SourceCodeInfoSDKType): SourceCodeInfo { + return { + location: Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): SourceCodeInfoSDKType { + return { + location: Array.isArray(object?.location) ? object.location.map((e: any) => SourceCodeInfo_Location.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: SourceCodeInfo): SourceCodeInfoSDKType { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toSDK(e) : undefined); + } else { + obj.location = []; + } + return obj; + }, + fromAmino(object: SourceCodeInfoAmino): SourceCodeInfo { + const message = createBaseSourceCodeInfo(); + message.location = object.location?.map(e => SourceCodeInfo_Location.fromAmino(e)) || []; + return message; + }, + toAmino(message: SourceCodeInfo): SourceCodeInfoAmino { + const obj: any = {}; + if (message.location) { + obj.location = message.location.map(e => e ? SourceCodeInfo_Location.toAmino(e) : undefined); + } else { + obj.location = message.location; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfoAminoMsg): SourceCodeInfo { + return SourceCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfoProtoMsg): SourceCodeInfo { + return SourceCodeInfo.decode(message.value); + }, + toProto(message: SourceCodeInfo): Uint8Array { + return SourceCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo): SourceCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.SourceCodeInfo", + value: SourceCodeInfo.encode(message).finish() + }; + } +}; +function createBaseSourceCodeInfo_Location(): SourceCodeInfo_Location { + return { + path: [], + span: [], + leadingComments: "", + trailingComments: "", + leadingDetachedComments: [] + }; +} +export const SourceCodeInfo_Location = { + typeUrl: "/google.protobuf.Location", + encode(message: SourceCodeInfo_Location, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(18).fork(); + for (const v of message.span) { + writer.int32(v); + } + writer.ldelim(); + 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!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): SourceCodeInfo_Location { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseSourceCodeInfo_Location(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.span.push(reader.int32()); + } + } else { + message.span.push(reader.int32()); + } + break; + case 3: + message.leadingComments = reader.string(); + break; + case 4: + message.trailingComments = reader.string(); + break; + case 6: + message.leadingDetachedComments.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): SourceCodeInfo_Location { + const obj = createBaseSourceCodeInfo_Location(); + if (Array.isArray(object?.path)) obj.path = object.path.map((e: any) => Number(e)); + if (Array.isArray(object?.span)) obj.span = object.span.map((e: any) => Number(e)); + if (isSet(object.leadingComments)) obj.leadingComments = String(object.leadingComments); + if (isSet(object.trailingComments)) obj.trailingComments = String(object.trailingComments); + if (Array.isArray(object?.leadingDetachedComments)) obj.leadingDetachedComments = object.leadingDetachedComments.map((e: any) => String(e)); + return obj; + }, + toJSON(message: SourceCodeInfo_Location): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => Math.round(e)); + } else { + obj.path = []; + } + if (message.span) { + obj.span = message.span.map(e => Math.round(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 = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + message.leadingComments = object.leadingComments ?? ""; + message.trailingComments = object.trailingComments ?? ""; + message.leadingDetachedComments = object.leadingDetachedComments?.map(e => e) || []; + return message; + }, + fromSDK(object: SourceCodeInfo_LocationSDKType): SourceCodeInfo_Location { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => e) : [], + span: Array.isArray(object?.span) ? object.span.map((e: any) => e) : [], + leadingComments: object?.leading_comments, + trailingComments: object?.trailing_comments, + leadingDetachedComments: Array.isArray(object?.leading_detached_comments) ? object.leading_detached_comments.map((e: any) => e) : [] + }; + }, + fromSDKJSON(object: any): SourceCodeInfo_LocationSDKType { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + span: Array.isArray(object?.span) ? object.span.map((e: any) => Number(e)) : [], + leading_comments: isSet(object.leading_comments) ? String(object.leading_comments) : "", + trailing_comments: isSet(object.trailing_comments) ? String(object.trailing_comments) : "", + leading_detached_comments: Array.isArray(object?.leading_detached_comments) ? object.leading_detached_comments.map((e: any) => String(e)) : [] + }; + }, + toSDK(message: SourceCodeInfo_Location): SourceCodeInfo_LocationSDKType { + 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 = []; + } + obj.leading_comments = message.leadingComments; + obj.trailing_comments = message.trailingComments; + if (message.leadingDetachedComments) { + obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); + } else { + obj.leading_detached_comments = []; + } + return obj; + }, + fromAmino(object: SourceCodeInfo_LocationAmino): SourceCodeInfo_Location { + const message = createBaseSourceCodeInfo_Location(); + message.path = object.path?.map(e => e) || []; + message.span = object.span?.map(e => e) || []; + if (object.leading_comments !== undefined && object.leading_comments !== null) { + message.leadingComments = object.leading_comments; + } + if (object.trailing_comments !== undefined && object.trailing_comments !== null) { + message.trailingComments = object.trailing_comments; + } + message.leadingDetachedComments = object.leading_detached_comments?.map(e => e) || []; + return message; + }, + toAmino(message: SourceCodeInfo_Location): SourceCodeInfo_LocationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + if (message.span) { + obj.span = message.span.map(e => e); + } else { + obj.span = message.span; + } + obj.leading_comments = message.leadingComments === "" ? undefined : message.leadingComments; + obj.trailing_comments = message.trailingComments === "" ? undefined : message.trailingComments; + if (message.leadingDetachedComments) { + obj.leading_detached_comments = message.leadingDetachedComments.map(e => e); + } else { + obj.leading_detached_comments = message.leadingDetachedComments; + } + return obj; + }, + fromAminoMsg(object: SourceCodeInfo_LocationAminoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.fromAmino(object.value); + }, + fromProtoMsg(message: SourceCodeInfo_LocationProtoMsg): SourceCodeInfo_Location { + return SourceCodeInfo_Location.decode(message.value); + }, + toProto(message: SourceCodeInfo_Location): Uint8Array { + return SourceCodeInfo_Location.encode(message).finish(); + }, + toProtoMsg(message: SourceCodeInfo_Location): SourceCodeInfo_LocationProtoMsg { + return { + typeUrl: "/google.protobuf.Location", + value: SourceCodeInfo_Location.encode(message).finish() + }; + } +}; +function createBaseGeneratedCodeInfo(): GeneratedCodeInfo { + return { + annotation: [] + }; +} +export const GeneratedCodeInfo = { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + encode(message: GeneratedCodeInfo, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + for (const v of message.annotation) { + GeneratedCodeInfo_Annotation.encode(v!, writer.uint32(10).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.annotation.push(GeneratedCodeInfo_Annotation.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GeneratedCodeInfo { + const obj = createBaseGeneratedCodeInfo(); + if (Array.isArray(object?.annotation)) obj.annotation = object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromJSON(e)); + return obj; + }, + toJSON(message: GeneratedCodeInfo): unknown { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toJSON(e) : undefined); + } else { + obj.annotation = []; + } + return obj; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromPartial(e)) || []; + return message; + }, + fromSDK(object: GeneratedCodeInfoSDKType): GeneratedCodeInfo { + return { + annotation: Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): GeneratedCodeInfoSDKType { + return { + annotation: Array.isArray(object?.annotation) ? object.annotation.map((e: any) => GeneratedCodeInfo_Annotation.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: GeneratedCodeInfo): GeneratedCodeInfoSDKType { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toSDK(e) : undefined); + } else { + obj.annotation = []; + } + return obj; + }, + fromAmino(object: GeneratedCodeInfoAmino): GeneratedCodeInfo { + const message = createBaseGeneratedCodeInfo(); + message.annotation = object.annotation?.map(e => GeneratedCodeInfo_Annotation.fromAmino(e)) || []; + return message; + }, + toAmino(message: GeneratedCodeInfo): GeneratedCodeInfoAmino { + const obj: any = {}; + if (message.annotation) { + obj.annotation = message.annotation.map(e => e ? GeneratedCodeInfo_Annotation.toAmino(e) : undefined); + } else { + obj.annotation = message.annotation; + } + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfoAminoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfoProtoMsg): GeneratedCodeInfo { + return GeneratedCodeInfo.decode(message.value); + }, + toProto(message: GeneratedCodeInfo): Uint8Array { + return GeneratedCodeInfo.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo): GeneratedCodeInfoProtoMsg { + return { + typeUrl: "/google.protobuf.GeneratedCodeInfo", + value: GeneratedCodeInfo.encode(message).finish() + }; + } +}; +function createBaseGeneratedCodeInfo_Annotation(): GeneratedCodeInfo_Annotation { + return { + path: [], + sourceFile: "", + begin: 0, + end: 0 + }; +} +export const GeneratedCodeInfo_Annotation = { + typeUrl: "/google.protobuf.Annotation", + encode(message: GeneratedCodeInfo_Annotation, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + writer.uint32(10).fork(); + for (const v of message.path) { + writer.int32(v); + } + writer.ldelim(); + 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: BinaryReader | Uint8Array, length?: number): GeneratedCodeInfo_Annotation { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGeneratedCodeInfo_Annotation(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.path.push(reader.int32()); + } + } else { + message.path.push(reader.int32()); + } + break; + case 2: + message.sourceFile = reader.string(); + break; + case 3: + message.begin = reader.int32(); + break; + case 4: + message.end = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GeneratedCodeInfo_Annotation { + const obj = createBaseGeneratedCodeInfo_Annotation(); + if (Array.isArray(object?.path)) obj.path = object.path.map((e: any) => Number(e)); + if (isSet(object.sourceFile)) obj.sourceFile = String(object.sourceFile); + if (isSet(object.begin)) obj.begin = Number(object.begin); + if (isSet(object.end)) obj.end = Number(object.end); + return obj; + }, + toJSON(message: GeneratedCodeInfo_Annotation): unknown { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => Math.round(e)); + } else { + obj.path = []; + } + message.sourceFile !== undefined && (obj.sourceFile = message.sourceFile); + message.begin !== undefined && (obj.begin = Math.round(message.begin)); + message.end !== undefined && (obj.end = Math.round(message.end)); + return obj; + }, + fromPartial(object: DeepPartial): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + message.sourceFile = object.sourceFile ?? ""; + message.begin = object.begin ?? 0; + message.end = object.end ?? 0; + return message; + }, + fromSDK(object: GeneratedCodeInfo_AnnotationSDKType): GeneratedCodeInfo_Annotation { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => e) : [], + sourceFile: object?.source_file, + begin: object?.begin, + end: object?.end + }; + }, + fromSDKJSON(object: any): GeneratedCodeInfo_AnnotationSDKType { + return { + path: Array.isArray(object?.path) ? object.path.map((e: any) => Number(e)) : [], + source_file: isSet(object.source_file) ? String(object.source_file) : "", + begin: isSet(object.begin) ? Number(object.begin) : 0, + end: isSet(object.end) ? Number(object.end) : 0 + }; + }, + toSDK(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationSDKType { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = []; + } + obj.source_file = message.sourceFile; + obj.begin = message.begin; + obj.end = message.end; + return obj; + }, + fromAmino(object: GeneratedCodeInfo_AnnotationAmino): GeneratedCodeInfo_Annotation { + const message = createBaseGeneratedCodeInfo_Annotation(); + message.path = object.path?.map(e => e) || []; + if (object.source_file !== undefined && object.source_file !== null) { + message.sourceFile = object.source_file; + } + if (object.begin !== undefined && object.begin !== null) { + message.begin = object.begin; + } + if (object.end !== undefined && object.end !== null) { + message.end = object.end; + } + return message; + }, + toAmino(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationAmino { + const obj: any = {}; + if (message.path) { + obj.path = message.path.map(e => e); + } else { + obj.path = message.path; + } + obj.source_file = message.sourceFile === "" ? undefined : message.sourceFile; + obj.begin = message.begin === 0 ? undefined : message.begin; + obj.end = message.end === 0 ? undefined : message.end; + return obj; + }, + fromAminoMsg(object: GeneratedCodeInfo_AnnotationAminoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.fromAmino(object.value); + }, + fromProtoMsg(message: GeneratedCodeInfo_AnnotationProtoMsg): GeneratedCodeInfo_Annotation { + return GeneratedCodeInfo_Annotation.decode(message.value); + }, + toProto(message: GeneratedCodeInfo_Annotation): Uint8Array { + return GeneratedCodeInfo_Annotation.encode(message).finish(); + }, + toProtoMsg(message: GeneratedCodeInfo_Annotation): GeneratedCodeInfo_AnnotationProtoMsg { + return { + typeUrl: "/google.protobuf.Annotation", + value: GeneratedCodeInfo_Annotation.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts new file mode 100644 index 0000000000..532fd9db20 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/duration.ts @@ -0,0 +1,249 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial } from "../../helpers"; +export const protobufPackage = "google.protobuf"; +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + nanos: number; +} +export interface DurationProtoMsg { + typeUrl: "/google.protobuf.Duration"; + value: Uint8Array; +} +/** + * A Duration represents a signed, fixed-length span of time represented + * as a count of seconds and fractions of seconds at nanosecond + * resolution. It is independent of any calendar and concepts like "day" + * or "month". It is related to Timestamp in that the difference between + * two Timestamp values is a Duration and it can be added or subtracted + * from a Timestamp. Range is approximately +-10,000 years. + * + * # Examples + * + * Example 1: Compute Duration from two Timestamps in pseudo code. + * + * Timestamp start = ...; + * Timestamp end = ...; + * Duration duration = ...; + * + * duration.seconds = end.seconds - start.seconds; + * duration.nanos = end.nanos - start.nanos; + * + * if (duration.seconds < 0 && duration.nanos > 0) { + * duration.seconds += 1; + * duration.nanos -= 1000000000; + * } else if (durations.seconds > 0 && duration.nanos < 0) { + * duration.seconds -= 1; + * duration.nanos += 1000000000; + * } + * + * Example 2: Compute Timestamp from Timestamp + Duration in pseudo code. + * + * Timestamp start = ...; + * Duration duration = ...; + * Timestamp end = ...; + * + * end.seconds = start.seconds + duration.seconds; + * end.nanos = start.nanos + duration.nanos; + * + * if (end.nanos < 0) { + * end.seconds -= 1; + * end.nanos += 1000000000; + * } else if (end.nanos >= 1000000000) { + * end.seconds += 1; + * end.nanos -= 1000000000; + * } + * + * Example 3: Compute Duration from datetime.timedelta in Python. + * + * td = datetime.timedelta(days=3, minutes=10) + * duration = Duration() + * duration.FromTimedelta(td) + * + * # JSON Mapping + * + * In JSON format, the Duration type is encoded as a string rather than an + * object, where the string ends in the suffix "s" (indicating seconds) and + * is preceded by the number of seconds, with nanoseconds expressed as + * fractional seconds. For example, 3 seconds with 0 nanoseconds should be + * encoded in JSON format as "3s", while 3 seconds and 1 nanosecond should + * be expressed in JSON format as "3.000000001s", and 3 seconds and 1 + * microsecond should be expressed in JSON format as "3.000001s". + */ +export interface DurationSDKType { + seconds: bigint; + nanos: number; +} +function createBaseDuration(): Duration { + return { + seconds: BigInt(0), + nanos: 0 + }; +} +export const Duration = { + typeUrl: "/google.protobuf.Duration", + encode(message: Duration, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Duration { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseDuration(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Duration { + const obj = createBaseDuration(); + if (isSet(object.seconds)) obj.seconds = BigInt(object.seconds.toString()); + if (isSet(object.nanos)) obj.nanos = Number(object.nanos); + return obj; + }, + toJSON(message: Duration): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + fromPartial(object: DeepPartial): Duration { + const message = createBaseDuration(); + if (object.seconds !== undefined && object.seconds !== null) { + message.seconds = BigInt(object.seconds.toString()); + } + message.nanos = object.nanos ?? 0; + return message; + }, + fromSDK(object: DurationSDKType): Duration { + return { + seconds: object?.seconds, + nanos: object?.nanos + }; + }, + fromSDKJSON(object: any): DurationSDKType { + return { + seconds: isSet(object.seconds) ? BigInt(object.seconds.toString()) : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; + }, + toSDK(message: Duration): DurationSDKType { + const obj: any = {}; + obj.seconds = message.seconds; + obj.nanos = message.nanos; + return obj; + }, + fromAmino(object: DurationAmino): Duration { + const value = BigInt(object); + return { + seconds: value / BigInt("1000000000"), + nanos: Number(value % BigInt("1000000000")) + }; + }, + toAmino(message: Duration): DurationAmino { + return (message.seconds * BigInt("1000000000") + BigInt(message.nanos)).toString(); + }, + fromAminoMsg(object: DurationAminoMsg): Duration { + return Duration.fromAmino(object.value); + }, + fromProtoMsg(message: DurationProtoMsg): Duration { + return Duration.decode(message.value); + }, + toProto(message: Duration): Uint8Array { + return Duration.encode(message).finish(); + }, + toProtoMsg(message: Duration): DurationProtoMsg { + return { + typeUrl: "/google.protobuf.Duration", + value: Duration.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts new file mode 100644 index 0000000000..497d725979 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/timestamp.ts @@ -0,0 +1,291 @@ +import { BinaryReader, BinaryWriter } from "../../binary"; +import { isSet, DeepPartial, fromJsonTimestamp, fromTimestamp } from "../../helpers"; +export const protobufPackage = "google.protobuf"; +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + nanos: number; +} +export interface TimestampProtoMsg { + typeUrl: "/google.protobuf.Timestamp"; + value: Uint8Array; +} +/** + * A Timestamp represents a point in time independent of any time zone or local + * calendar, encoded as a count of seconds and fractions of seconds at + * nanosecond resolution. The count is relative to an epoch at UTC midnight on + * January 1, 1970, in the proleptic Gregorian calendar which extends the + * Gregorian calendar backwards to year one. + * + * All minutes are 60 seconds long. Leap seconds are "smeared" so that no leap + * second table is needed for interpretation, using a [24-hour linear + * smear](https://developers.google.com/time/smear). + * + * The range is from 0001-01-01T00:00:00Z to 9999-12-31T23:59:59.999999999Z. By + * restricting to that range, we ensure that we can convert to and from [RFC + * 3339](https://www.ietf.org/rfc/rfc3339.txt) date strings. + * + * # Examples + * + * Example 1: Compute Timestamp from POSIX `time()`. + * + * Timestamp timestamp; + * timestamp.set_seconds(time(NULL)); + * timestamp.set_nanos(0); + * + * Example 2: Compute Timestamp from POSIX `gettimeofday()`. + * + * struct timeval tv; + * gettimeofday(&tv, NULL); + * + * Timestamp timestamp; + * timestamp.set_seconds(tv.tv_sec); + * timestamp.set_nanos(tv.tv_usec * 1000); + * + * Example 3: Compute Timestamp from Win32 `GetSystemTimeAsFileTime()`. + * + * FILETIME ft; + * GetSystemTimeAsFileTime(&ft); + * UINT64 ticks = (((UINT64)ft.dwHighDateTime) << 32) | ft.dwLowDateTime; + * + * // A Windows tick is 100 nanoseconds. Windows epoch 1601-01-01T00:00:00Z + * // is 11644473600 seconds before Unix epoch 1970-01-01T00:00:00Z. + * Timestamp timestamp; + * timestamp.set_seconds((INT64) ((ticks / 10000000) - 11644473600LL)); + * timestamp.set_nanos((INT32) ((ticks % 10000000) * 100)); + * + * Example 4: Compute Timestamp from Java `System.currentTimeMillis()`. + * + * long millis = System.currentTimeMillis(); + * + * Timestamp timestamp = Timestamp.newBuilder().setSeconds(millis / 1000) + * .setNanos((int) ((millis % 1000) * 1000000)).build(); + * + * + * Example 5: Compute Timestamp from current time in Python. + * + * timestamp = Timestamp() + * timestamp.GetCurrentTime() + * + * # JSON Mapping + * + * In JSON format, the Timestamp type is encoded as a string in the + * [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) format. That is, the + * format is "{year}-{month}-{day}T{hour}:{min}:{sec}[.{frac_sec}]Z" + * where {year} is always expressed using four digits while {month}, {day}, + * {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional + * seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), + * are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone + * is required. A proto3 JSON serializer should always use UTC (as indicated by + * "Z") when printing the Timestamp type and a proto3 JSON parser should be + * able to accept both UTC and other timezones (as indicated by an offset). + * + * For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past + * 01:30 UTC on January 15, 2017. + * + * In JavaScript, one can convert a Date object to this format using the + * standard + * [toISOString()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString) + * method. In Python, a standard `datetime.datetime` object can be converted + * to this format using + * [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) with + * the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one can use + * the Joda Time's [`ISODateTimeFormat.dateTime()`]( + * http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime%2D%2D + * ) to obtain a formatter capable of generating timestamps in this format. + */ +export interface TimestampSDKType { + seconds: bigint; + nanos: number; +} +function createBaseTimestamp(): Timestamp { + return { + seconds: BigInt(0), + nanos: 0 + }; +} +export const Timestamp = { + typeUrl: "/google.protobuf.Timestamp", + encode(message: Timestamp, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.seconds !== BigInt(0)) { + writer.uint32(8).int64(message.seconds); + } + if (message.nanos !== 0) { + writer.uint32(16).int32(message.nanos); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): Timestamp { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseTimestamp(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.seconds = reader.int64(); + break; + case 2: + message.nanos = reader.int32(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): Timestamp { + const obj = createBaseTimestamp(); + if (isSet(object.seconds)) obj.seconds = BigInt(object.seconds.toString()); + if (isSet(object.nanos)) obj.nanos = Number(object.nanos); + return obj; + }, + toJSON(message: Timestamp): unknown { + const obj: any = {}; + message.seconds !== undefined && (obj.seconds = (message.seconds || BigInt(0)).toString()); + message.nanos !== undefined && (obj.nanos = Math.round(message.nanos)); + return obj; + }, + fromPartial(object: DeepPartial): Timestamp { + const message = createBaseTimestamp(); + if (object.seconds !== undefined && object.seconds !== null) { + message.seconds = BigInt(object.seconds.toString()); + } + message.nanos = object.nanos ?? 0; + return message; + }, + fromSDK(object: TimestampSDKType): Timestamp { + return { + seconds: object?.seconds, + nanos: object?.nanos + }; + }, + fromSDKJSON(object: any): TimestampSDKType { + return { + seconds: isSet(object.seconds) ? BigInt(object.seconds.toString()) : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; + }, + toSDK(message: Timestamp): TimestampSDKType { + const obj: any = {}; + obj.seconds = message.seconds; + obj.nanos = message.nanos; + return obj; + }, + fromAmino(object: TimestampAmino): Timestamp { + return fromJsonTimestamp(object); + }, + toAmino(message: Timestamp): TimestampAmino { + return fromTimestamp(message).toISOString().replace(/\.\d+Z$/, "Z"); + }, + fromAminoMsg(object: TimestampAminoMsg): Timestamp { + return Timestamp.fromAmino(object.value); + }, + fromProtoMsg(message: TimestampProtoMsg): Timestamp { + return Timestamp.decode(message.value); + }, + toProto(message: Timestamp): Uint8Array { + return Timestamp.encode(message).finish(); + }, + toProtoMsg(message: Timestamp): TimestampProtoMsg { + return { + typeUrl: "/google.protobuf.Timestamp", + value: Timestamp.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts new file mode 100644 index 0000000000..ca8bc2ac0f --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/helpers.ts @@ -0,0 +1,260 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +import { Dec } from "@keplr-wallet/unit"; + +declare var self: any | undefined; +declare var window: any | undefined; +declare var global: any | undefined; +var globalThis: any = (() => { + if (typeof globalThis !== 'undefined') return globalThis; + if (typeof self !== 'undefined') return self; + if (typeof window !== 'undefined') return window; + if (typeof global !== 'undefined') return global; + throw 'Unable to locate global object'; +})(); + +const atob: (b64: string) => string = + globalThis.atob || + ((b64) => globalThis.Buffer.from(b64, 'base64').toString('binary')); + +export function bytesFromBase64(b64: string): Uint8Array { + const bin = atob(b64); + const arr = new Uint8Array(bin.length); + for (let i = 0; i < bin.length; ++i) { + arr[i] = bin.charCodeAt(i); + } + return arr; +} + +const btoa: (bin: string) => string = + globalThis.btoa || + ((bin) => globalThis.Buffer.from(bin, 'binary').toString('base64')); + +export function base64FromBytes(arr: Uint8Array): string { + const bin: string[] = []; + arr.forEach((byte) => { + bin.push(String.fromCharCode(byte)); + }); + return btoa(bin.join('')); +} + +export interface AminoHeight { + readonly revision_number?: string; + readonly revision_height?: string; +} + +export function omitDefault( + input: T +): T | undefined { + if (typeof input === 'string') { + return input === '' ? undefined : input; + } + + if (typeof input === 'number') { + return input === 0 ? undefined : input; + } + + if (typeof input === "boolean"){ + return input === false ? undefined : input; + } + + if (typeof input === 'bigint') { + return input === BigInt(0) ? undefined : input; + } + + throw new Error(`Got unsupported type ${typeof input}`); +} + +interface Duration { + /** + * Signed seconds of the span of time. Must be from -315,576,000,000 + * to +315,576,000,000 inclusive. Note: these bounds are computed from: + * 60 sec/min * 60 min/hr * 24 hr/day * 365.25 days/year * 10000 years + */ + seconds: bigint; + /** + * Signed fractions of a second at nanosecond resolution of the span + * of time. Durations less than one second are represented with a 0 + * `seconds` field and a positive or negative `nanos` field. For durations + * of one second or more, a non-zero value for the `nanos` field must be + * of the same sign as the `seconds` field. Must be from -999,999,999 + * to +999,999,999 inclusive. + */ + + nanos: number; +} + +export function toDuration(duration: string): Duration { + return { + seconds: BigInt(Math.floor(parseInt(duration) / 1000000000)), + nanos: parseInt(duration) % 1000000000 + }; +} + +export function fromDuration(duration: Duration): string { + return ( + parseInt(duration.seconds.toString()) * 1000000000 + + duration.nanos + ).toString(); +} + +export function isSet(value: any): boolean { + return value !== null && value !== undefined; +} + +export function isObject(value: any): boolean { + return typeof value === 'object' && value !== null; +} + +export interface PageRequest { + key: Uint8Array; + offset: bigint; + limit: bigint; + countTotal: boolean; + reverse: boolean; +} + +export interface PageRequestParams { + 'pagination.key'?: string; + 'pagination.offset'?: string; + 'pagination.limit'?: string; + 'pagination.count_total'?: boolean; + 'pagination.reverse'?: boolean; +} + +export interface Params { + params: PageRequestParams; +} + +export const setPaginationParams = ( + options: Params, + pagination?: PageRequest +) => { + if (!pagination) { + return options; + } + + if (typeof pagination?.countTotal !== 'undefined') { + options.params['pagination.count_total'] = pagination.countTotal; + } + if (typeof pagination?.key !== 'undefined') { + // String to Uint8Array + // let uint8arr = new Uint8Array(Buffer.from(data,'base64')); + + // Uint8Array to String + options.params['pagination.key'] = Buffer.from(pagination.key).toString( + 'base64' + ); + } + if (typeof pagination?.limit !== 'undefined') { + options.params['pagination.limit'] = pagination.limit.toString(); + } + if (typeof pagination?.offset !== 'undefined') { + options.params['pagination.offset'] = pagination.offset.toString(); + } + if (typeof pagination?.reverse !== 'undefined') { + options.params['pagination.reverse'] = pagination.reverse; + } + + return options; +}; + +type Builtin = + | Date + | Function + | Uint8Array + | string + | number + | bigint + | boolean + | undefined; + +export type DeepPartial = T extends Builtin + ? T + : T extends Array + ? Array> + : T extends ReadonlyArray + ? ReadonlyArray> + : T extends {} + ? { [K in keyof T]?: DeepPartial } + : Partial; + +type KeysOfUnion = T extends T ? keyof T : never; +export type Exact = P extends Builtin + ? P + : P & { [K in keyof P]: Exact } & Record< + Exclude>, + never + >; + +export interface Rpc { + request( + service: string, + method: string, + data: Uint8Array + ): Promise; +} + +interface Timestamp { + /** + * Represents seconds of UTC time since Unix epoch + * 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to + * 9999-12-31T23:59:59Z inclusive. + */ + seconds: bigint; + /** + * Non-negative fractions of a second at nanosecond resolution. Negative + * second values with fractions must still have non-negative nanos values + * that count forward in time. Must be from 0 to 999,999,999 + * inclusive. + */ + + nanos: number; +} + +export function toTimestamp(date: Date): Timestamp { + const seconds = numberToLong(date.getTime() / 1_000); + const nanos = (date.getTime() % 1000) * 1000000; + return { + seconds, + nanos + }; +} + +export function fromTimestamp(t: Timestamp): Date { + let millis = Number(t.seconds) * 1000; + millis += t.nanos / 1000000; + return new Date(millis); +} + +const timestampFromJSON = (object: any): Timestamp => { + return { + seconds: isSet(object.seconds) + ? BigInt(object.seconds.toString()) + : BigInt(0), + nanos: isSet(object.nanos) ? Number(object.nanos) : 0 + }; +}; + +export function fromJsonTimestamp(o: any): Timestamp { + if (o instanceof Date) { + return toTimestamp(o); + } else if (typeof o === 'string') { + return toTimestamp(new Date(o)); + } else { + return timestampFromJSON(o); + } +} + +function numberToLong(number: number) { + return BigInt(Math.trunc(number)); +} + +export function padDecimal(decStr: string): string{ + return decStr ? new Dec(decStr).toString() : decStr; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts new file mode 100644 index 0000000000..d219f262cb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/index.ts @@ -0,0 +1,17 @@ +/** + * This file and any referenced files were automatically generated by @cosmology/telescope@latest + * DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain + * and run the transpile command or yarn proto command to regenerate this bundle. + */ + +export * from "./gogoproto/bundle"; +export * from "./google/bundle"; +export * from "./misc/bundle"; +export * from "./misc/client"; +export * from "./extern"; +export * from "./react-query"; +export * from "./mobx"; +export * from "./pinia-endpoint"; +export * from "./varint"; +export * from "./utf8"; +export * from "./binary"; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts new file mode 100644 index 0000000000..4a5b8c662a --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts @@ -0,0 +1,2387 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts new file mode 100644 index 0000000000..55a33896be --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts @@ -0,0 +1,18 @@ +import * as _41 from "./amino_fields"; +import * as _42 from "./eval_request"; +import * as _43 from "./tx"; +import * as _44 from "./tx.amino"; +import * as _45 from "./tx.registry"; +import * as _46 from "./tx.rpc.msg"; +import * as _47 from "./rpc.tx"; +export const misc = { + ..._41, + ..._42, + ..._43, + ..._44, + ..._45, + ..._46, + ClientFactory: { + ..._47 + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/client.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts new file mode 100644 index 0000000000..e75506a8a2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/eval_request.ts @@ -0,0 +1,851 @@ +import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial, isObject } from "../helpers"; +export const protobufPackage = "misc"; +/** VoteOption enumerates the valid vote options for a given governance proposal. */ +export enum VoteOption { + /** VOTE_OPTION_UNSPECIFIED - VOTE_OPTION_UNSPECIFIED defines a no-op vote option. */ + VOTE_OPTION_UNSPECIFIED = 0, + /** VOTE_OPTION_YES - VOTE_OPTION_YES defines a yes vote option. */ + VOTE_OPTION_YES = 1, + /** VOTE_OPTION_ABSTAIN - VOTE_OPTION_ABSTAIN defines an abstain vote option. */ + VOTE_OPTION_ABSTAIN = 2, + /** VOTE_OPTION_NO - VOTE_OPTION_NO defines a no vote option. */ + VOTE_OPTION_NO = 3, + /** VOTE_OPTION_NO_WITH_VETO - VOTE_OPTION_NO_WITH_VETO defines a no with veto vote option. */ + VOTE_OPTION_NO_WITH_VETO = 4, + UNRECOGNIZED = -1, +} +export const VoteOptionSDKType = VoteOption; +export function voteOptionFromJSON(object: any): VoteOption { + switch (object) { + case 0: + case "VOTE_OPTION_UNSPECIFIED": + return VoteOption.VOTE_OPTION_UNSPECIFIED; + case 1: + case "VOTE_OPTION_YES": + return VoteOption.VOTE_OPTION_YES; + case 2: + case "VOTE_OPTION_ABSTAIN": + return VoteOption.VOTE_OPTION_ABSTAIN; + case 3: + case "VOTE_OPTION_NO": + return VoteOption.VOTE_OPTION_NO; + case 4: + case "VOTE_OPTION_NO_WITH_VETO": + return VoteOption.VOTE_OPTION_NO_WITH_VETO; + case -1: + case "UNRECOGNIZED": + default: + return VoteOption.UNRECOGNIZED; + } +} +export function voteOptionToJSON(object: VoteOption): string { + switch (object) { + case VoteOption.VOTE_OPTION_UNSPECIFIED: + return "VOTE_OPTION_UNSPECIFIED"; + case VoteOption.VOTE_OPTION_YES: + return "VOTE_OPTION_YES"; + case VoteOption.VOTE_OPTION_ABSTAIN: + return "VOTE_OPTION_ABSTAIN"; + case VoteOption.VOTE_OPTION_NO: + return "VOTE_OPTION_NO"; + case VoteOption.VOTE_OPTION_NO_WITH_VETO: + return "VOTE_OPTION_NO_WITH_VETO"; + case VoteOption.UNRECOGNIZED: + default: + return "UNRECOGNIZED"; + } +} +export interface EvalRequest_BindingsEntry { + key: string; + value?: ExprValue; +} +export interface EvalRequest_BindingsEntryProtoMsg { + typeUrl: string; + value: Uint8Array; +} +export interface EvalRequest_BindingsEntrySDKType { + key: string; + value?: ExprValueSDKType; +} +export interface EvalRequest_RefsEntry { + key: string; + value?: IdRef; +} +export interface EvalRequest_RefsEntryProtoMsg { + typeUrl: string; + value: Uint8Array; +} +export interface EvalRequest_RefsEntrySDKType { + key: string; + value?: IdRefSDKType; +} +export interface EvalRequest { + /** + * Bindings for the external variables. The types SHOULD be compatible + * with the type environment in [CheckRequest][google.api.expr.conformance.v1alpha1.CheckRequest], if checked. + */ + bindings: { + [key: string]: ExprValue; + }; + refs: { + [key: string]: IdRef; + }; + testNum: number; + testString: string; + testBool: boolean; + instantiatePermission?: AccessConfig; + /** [(gogoproto.nullable) = false] wouldn't work in this case */ + id?: string; + name?: string; + testArray: string[]; +} +export interface EvalRequestProtoMsg { + typeUrl: "/misc.EvalRequest"; + value: Uint8Array; +} +export interface EvalRequestSDKType { + bindings: { + [key: string]: ExprValueSDKType; + }; + refs: { + [key: string]: IdRefSDKType; + }; + test_num: number; + test_string: string; + test_bool: boolean; + instantiate_permission?: AccessConfigSDKType; + id?: string; + name?: string; + test_array: string[]; +} +export interface AccessConfig { + sender: string; +} +export interface AccessConfigProtoMsg { + typeUrl: "/misc.AccessConfig"; + value: Uint8Array; +} +export interface AccessConfigSDKType { + sender: string; +} +export interface GenericAuthorization { + /** Msg, identified by it's type URL, to grant unrestricted permissions to execute */ + msg: string; +} +export interface GenericAuthorizationProtoMsg { + typeUrl: "/misc.GenericAuthorization"; + value: Uint8Array; +} +export interface GenericAuthorizationSDKType { + msg: string; +} +function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { + return { + key: "", + value: undefined + }; +} +export const EvalRequest_BindingsEntry = { + encode(message: EvalRequest_BindingsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + ExprValue.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvalRequest_BindingsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvalRequest_BindingsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = ExprValue.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EvalRequest_BindingsEntry { + const obj = createBaseEvalRequest_BindingsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = ExprValue.fromJSON(object.value); + return obj; + }, + toJSON(message: EvalRequest_BindingsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value ? ExprValue.toJSON(message.value) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): EvalRequest_BindingsEntry { + const message = createBaseEvalRequest_BindingsEntry(); + message.key = object.key ?? ""; + if (object.value !== undefined && object.value !== null) { + message.value = ExprValue.fromPartial(object.value); + } + return message; + }, + fromSDK(object: EvalRequest_BindingsEntrySDKType): EvalRequest_BindingsEntry { + return { + key: object?.key, + value: object.value ? ExprValue.fromSDK(object.value) : undefined + }; + }, + fromSDKJSON(object: any): EvalRequest_BindingsEntrySDKType { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? ExprValue.fromSDKJSON(object.value) : undefined + }; + }, + toSDK(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntrySDKType { + const obj: any = {}; + obj.key = message.key; + message.value !== undefined && (obj.value = message.value ? ExprValue.toSDK(message.value) : undefined); + return obj; + }, + fromAmino(object: EvalRequest_BindingsEntryAmino): EvalRequest_BindingsEntry { + const message = createBaseEvalRequest_BindingsEntry(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = ExprValue.fromAmino(object.value); + } + return message; + }, + toAmino(message: EvalRequest_BindingsEntry): EvalRequest_BindingsEntryAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? ExprValue.toAmino(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: EvalRequest_BindingsEntryAminoMsg): EvalRequest_BindingsEntry { + return EvalRequest_BindingsEntry.fromAmino(object.value); + }, + fromProtoMsg(message: EvalRequest_BindingsEntryProtoMsg): EvalRequest_BindingsEntry { + return EvalRequest_BindingsEntry.decode(message.value); + }, + toProto(message: EvalRequest_BindingsEntry): Uint8Array { + return EvalRequest_BindingsEntry.encode(message).finish(); + } +}; +function createBaseEvalRequest_RefsEntry(): EvalRequest_RefsEntry { + return { + key: "", + value: undefined + }; +} +export const EvalRequest_RefsEntry = { + encode(message: EvalRequest_RefsEntry, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.key !== "") { + writer.uint32(10).string(message.key); + } + if (message.value !== undefined) { + IdRef.encode(message.value, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvalRequest_RefsEntry { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvalRequest_RefsEntry(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.key = reader.string(); + break; + case 2: + message.value = IdRef.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EvalRequest_RefsEntry { + const obj = createBaseEvalRequest_RefsEntry(); + if (isSet(object.key)) obj.key = String(object.key); + if (isSet(object.value)) obj.value = IdRef.fromJSON(object.value); + return obj; + }, + toJSON(message: EvalRequest_RefsEntry): unknown { + const obj: any = {}; + message.key !== undefined && (obj.key = message.key); + message.value !== undefined && (obj.value = message.value ? IdRef.toJSON(message.value) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): EvalRequest_RefsEntry { + const message = createBaseEvalRequest_RefsEntry(); + message.key = object.key ?? ""; + if (object.value !== undefined && object.value !== null) { + message.value = IdRef.fromPartial(object.value); + } + return message; + }, + fromSDK(object: EvalRequest_RefsEntrySDKType): EvalRequest_RefsEntry { + return { + key: object?.key, + value: object.value ? IdRef.fromSDK(object.value) : undefined + }; + }, + fromSDKJSON(object: any): EvalRequest_RefsEntrySDKType { + return { + key: isSet(object.key) ? String(object.key) : "", + value: isSet(object.value) ? IdRef.fromSDKJSON(object.value) : undefined + }; + }, + toSDK(message: EvalRequest_RefsEntry): EvalRequest_RefsEntrySDKType { + const obj: any = {}; + obj.key = message.key; + message.value !== undefined && (obj.value = message.value ? IdRef.toSDK(message.value) : undefined); + return obj; + }, + fromAmino(object: EvalRequest_RefsEntryAmino): EvalRequest_RefsEntry { + const message = createBaseEvalRequest_RefsEntry(); + if (object.key !== undefined && object.key !== null) { + message.key = object.key; + } + if (object.value !== undefined && object.value !== null) { + message.value = IdRef.fromAmino(object.value); + } + return message; + }, + toAmino(message: EvalRequest_RefsEntry): EvalRequest_RefsEntryAmino { + const obj: any = {}; + obj.key = message.key === "" ? undefined : message.key; + obj.value = message.value ? IdRef.toAmino(message.value) : undefined; + return obj; + }, + fromAminoMsg(object: EvalRequest_RefsEntryAminoMsg): EvalRequest_RefsEntry { + return EvalRequest_RefsEntry.fromAmino(object.value); + }, + fromProtoMsg(message: EvalRequest_RefsEntryProtoMsg): EvalRequest_RefsEntry { + return EvalRequest_RefsEntry.decode(message.value); + }, + toProto(message: EvalRequest_RefsEntry): Uint8Array { + return EvalRequest_RefsEntry.encode(message).finish(); + } +}; +function createBaseEvalRequest(): EvalRequest { + return { + bindings: {}, + refs: {}, + testNum: 0, + testString: "", + testBool: false, + instantiatePermission: undefined, + id: undefined, + name: undefined, + testArray: [] + }; +} +export const EvalRequest = { + typeUrl: "/misc.EvalRequest", + encode(message: EvalRequest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + Object.entries(message.bindings).forEach(([key, value]) => { + EvalRequest_BindingsEntry.encode({ + key: (key as any), + value + }, writer.uint32(10).fork()).ldelim(); + }); + Object.entries(message.refs).forEach(([key, value]) => { + EvalRequest_RefsEntry.encode({ + key: (key as any), + value + }, writer.uint32(18).fork()).ldelim(); + }); + if (message.testNum !== 0) { + writer.uint32(24).uint32(message.testNum); + } + if (message.testString !== "") { + writer.uint32(34).string(message.testString); + } + if (message.testBool === true) { + writer.uint32(40).bool(message.testBool); + } + if (message.instantiatePermission !== undefined) { + AccessConfig.encode(message.instantiatePermission, writer.uint32(66).fork()).ldelim(); + } + if (message.id !== undefined) { + writer.uint32(98).string(message.id); + } + if (message.name !== undefined) { + writer.uint32(106).string(message.name); + } + for (const v of message.testArray) { + writer.uint32(114).string(v!); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): EvalRequest { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseEvalRequest(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + const entry1 = EvalRequest_BindingsEntry.decode(reader, reader.uint32()); + if (entry1.value !== undefined) { + message.bindings[entry1.key] = entry1.value; + } + break; + case 2: + const entry2 = EvalRequest_RefsEntry.decode(reader, reader.uint32()); + if (entry2.value !== undefined) { + message.refs[entry2.key] = entry2.value; + } + break; + case 3: + message.testNum = reader.uint32(); + break; + case 4: + message.testString = reader.string(); + break; + case 5: + message.testBool = reader.bool(); + break; + case 8: + message.instantiatePermission = AccessConfig.decode(reader, reader.uint32()); + break; + case 12: + message.id = reader.string(); + break; + case 13: + message.name = reader.string(); + break; + case 14: + message.testArray.push(reader.string()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): EvalRequest { + const obj = createBaseEvalRequest(); + if (isObject(object.bindings)) obj.bindings = Object.entries(object.bindings).reduce<{ + [key: string]: ExprValue; + }>((acc, [key, value]) => { + acc[key] = ExprValue.fromJSON(value); + return acc; + }, {}); + if (isObject(object.refs)) obj.refs = Object.entries(object.refs).reduce<{ + [key: string]: IdRef; + }>((acc, [key, value]) => { + acc[key] = IdRef.fromJSON(value); + return acc; + }, {}); + if (isSet(object.testNum)) obj.testNum = Number(object.testNum); + if (isSet(object.testString)) obj.testString = String(object.testString); + if (isSet(object.testBool)) obj.testBool = Boolean(object.testBool); + if (isSet(object.instantiatePermission)) obj.instantiatePermission = AccessConfig.fromJSON(object.instantiatePermission); + if (isSet(object.id)) obj.id = String(object.id); + if (isSet(object.name)) obj.name = String(object.name); + if (Array.isArray(object?.testArray)) obj.testArray = object.testArray.map((e: any) => String(e)); + return obj; + }, + toJSON(message: EvalRequest): unknown { + const obj: any = {}; + obj.bindings = {}; + if (message.bindings) { + Object.entries(message.bindings).forEach(([k, v]) => { + obj.bindings[k] = ExprValue.toJSON(v); + }); + } + obj.refs = {}; + if (message.refs) { + Object.entries(message.refs).forEach(([k, v]) => { + obj.refs[k] = IdRef.toJSON(v); + }); + } + message.testNum !== undefined && (obj.testNum = Math.round(message.testNum)); + message.testString !== undefined && (obj.testString = message.testString); + message.testBool !== undefined && (obj.testBool = message.testBool); + message.instantiatePermission !== undefined && (obj.instantiatePermission = message.instantiatePermission ? AccessConfig.toJSON(message.instantiatePermission) : undefined); + message.id !== undefined && (obj.id = message.id); + message.name !== undefined && (obj.name = message.name); + if (message.testArray) { + obj.testArray = message.testArray.map(e => e); + } else { + obj.testArray = []; + } + return obj; + }, + fromPartial(object: DeepPartial): EvalRequest { + const message = createBaseEvalRequest(); + message.bindings = Object.entries(object.bindings ?? {}).reduce<{ + [key: string]: ExprValue; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ExprValue.fromPartial(value); + } + return acc; + }, {}); + message.refs = Object.entries(object.refs ?? {}).reduce<{ + [key: string]: IdRef; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = IdRef.fromPartial(value); + } + return acc; + }, {}); + message.testNum = object.testNum ?? 0; + message.testString = object.testString ?? ""; + message.testBool = object.testBool ?? false; + if (object.instantiatePermission !== undefined && object.instantiatePermission !== null) { + message.instantiatePermission = AccessConfig.fromPartial(object.instantiatePermission); + } + message.id = object.id ?? undefined; + message.name = object.name ?? undefined; + message.testArray = object.testArray?.map(e => e) || []; + return message; + }, + fromSDK(object: EvalRequestSDKType): EvalRequest { + return { + bindings: isObject(object.bindings) ? Object.entries(object.bindings).reduce<{ + [key: string]: ExprValue; + }>((acc, [key, value]) => { + acc[key] = ExprValue.fromSDK(value); + return acc; + }, {}) : {}, + refs: isObject(object.refs) ? Object.entries(object.refs).reduce<{ + [key: string]: IdRef; + }>((acc, [key, value]) => { + acc[key] = IdRef.fromSDK(value); + return acc; + }, {}) : {}, + testNum: object?.test_num, + testString: object?.test_string, + testBool: object?.test_bool, + instantiatePermission: object.instantiate_permission ? AccessConfig.fromSDK(object.instantiate_permission) : undefined, + id: object?.id, + name: object?.name, + testArray: Array.isArray(object?.test_array) ? object.test_array.map((e: any) => e) : [] + }; + }, + fromSDKJSON(object: any): EvalRequestSDKType { + return { + bindings: isObject(object.bindings) ? Object.entries(object.bindings).reduce<{ + [key: string]: ExprValue; + }>((acc, [key, value]) => { + acc[key] = ExprValue.fromSDKJSON(value); + return acc; + }, {}) : {}, + refs: isObject(object.refs) ? Object.entries(object.refs).reduce<{ + [key: string]: IdRef; + }>((acc, [key, value]) => { + acc[key] = IdRef.fromSDKJSON(value); + return acc; + }, {}) : {}, + test_num: isSet(object.test_num) ? Number(object.test_num) : 0, + test_string: isSet(object.test_string) ? String(object.test_string) : "", + test_bool: isSet(object.test_bool) ? Boolean(object.test_bool) : false, + instantiate_permission: isSet(object.instantiate_permission) ? AccessConfig.fromSDKJSON(object.instantiate_permission) : undefined, + id: isSet(object.id) ? String(object.id) : undefined, + name: isSet(object.name) ? String(object.name) : undefined, + test_array: Array.isArray(object?.test_array) ? object.test_array.map((e: any) => String(e)) : [] + }; + }, + toSDK(message: EvalRequest): EvalRequestSDKType { + const obj: any = {}; + obj.bindings = {}; + if (message.bindings) { + Object.entries(message.bindings).forEach(([k, v]) => { + obj.bindings[k] = ExprValue.toSDK(v); + }); + } + obj.refs = {}; + if (message.refs) { + Object.entries(message.refs).forEach(([k, v]) => { + obj.refs[k] = IdRef.toSDK(v); + }); + } + obj.test_num = message.testNum; + obj.test_string = message.testString; + obj.test_bool = message.testBool; + message.instantiatePermission !== undefined && (obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toSDK(message.instantiatePermission) : undefined); + obj.id = message.id; + obj.name = message.name; + if (message.testArray) { + obj.test_array = message.testArray.map(e => e); + } else { + obj.test_array = []; + } + return obj; + }, + fromAmino(object: EvalRequestAmino): EvalRequest { + const message = createBaseEvalRequest(); + message.bindings = Object.entries(object.bindings ?? {}).reduce<{ + [key: string]: ExprValue; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = ExprValue.fromAmino(value); + } + return acc; + }, {}); + message.refs = Object.entries(object.refs ?? {}).reduce<{ + [key: string]: IdRef; + }>((acc, [key, value]) => { + if (value !== undefined) { + acc[key] = IdRef.fromAmino(value); + } + return acc; + }, {}); + if (object.test_num !== undefined && object.test_num !== null) { + message.testNum = object.test_num; + } + if (object.test_string !== undefined && object.test_string !== null) { + message.testString = object.test_string; + } + if (object.test_bool !== undefined && object.test_bool !== null) { + message.testBool = object.test_bool; + } + if (object.instantiate_permission !== undefined && object.instantiate_permission !== null) { + message.instantiatePermission = AccessConfig.fromAmino(object.instantiate_permission); + } + if (object.id !== undefined && object.id !== null) { + message.id = object.id; + } + if (object.name !== undefined && object.name !== null) { + message.name = object.name; + } + message.testArray = object.test_array?.map(e => e) || []; + return message; + }, + toAmino(message: EvalRequest): EvalRequestAmino { + const obj: any = {}; + obj.bindings = {}; + if (message.bindings) { + Object.entries(message.bindings).forEach(([k, v]) => { + obj.bindings[k] = ExprValue.toAmino(v); + }); + } + obj.refs = {}; + if (message.refs) { + Object.entries(message.refs).forEach(([k, v]) => { + obj.refs[k] = IdRef.toAmino(v); + }); + } + obj.test_num = message.testNum === 0 ? undefined : message.testNum; + obj.test_string = message.testString === "" ? undefined : message.testString; + obj.test_bool = message.testBool === false ? undefined : message.testBool; + obj.instantiate_permission = message.instantiatePermission ? AccessConfig.toAmino(message.instantiatePermission) : undefined; + obj.id = message.id === null ? undefined : message.id; + obj.name = message.name === null ? undefined : message.name; + if (message.testArray) { + obj.test_array = message.testArray.map(e => e); + } else { + obj.test_array = message.testArray; + } + return obj; + }, + fromAminoMsg(object: EvalRequestAminoMsg): EvalRequest { + return EvalRequest.fromAmino(object.value); + }, + fromProtoMsg(message: EvalRequestProtoMsg): EvalRequest { + return EvalRequest.decode(message.value); + }, + toProto(message: EvalRequest): Uint8Array { + return EvalRequest.encode(message).finish(); + }, + toProtoMsg(message: EvalRequest): EvalRequestProtoMsg { + return { + typeUrl: "/misc.EvalRequest", + value: EvalRequest.encode(message).finish() + }; + } +}; +function createBaseAccessConfig(): AccessConfig { + return { + sender: "" + }; +} +export const AccessConfig = { + typeUrl: "/misc.AccessConfig", + encode(message: AccessConfig, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.sender !== "") { + writer.uint32(10).string(message.sender); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AccessConfig { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAccessConfig(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.sender = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AccessConfig { + const obj = createBaseAccessConfig(); + if (isSet(object.sender)) obj.sender = String(object.sender); + return obj; + }, + toJSON(message: AccessConfig): unknown { + const obj: any = {}; + message.sender !== undefined && (obj.sender = message.sender); + return obj; + }, + fromPartial(object: DeepPartial): AccessConfig { + const message = createBaseAccessConfig(); + message.sender = object.sender ?? ""; + return message; + }, + fromSDK(object: AccessConfigSDKType): AccessConfig { + return { + sender: object?.sender + }; + }, + fromSDKJSON(object: any): AccessConfigSDKType { + return { + sender: isSet(object.sender) ? String(object.sender) : "" + }; + }, + toSDK(message: AccessConfig): AccessConfigSDKType { + const obj: any = {}; + obj.sender = message.sender; + return obj; + }, + fromAmino(object: AccessConfigAmino): AccessConfig { + const message = createBaseAccessConfig(); + if (object.sender !== undefined && object.sender !== null) { + message.sender = object.sender; + } + return message; + }, + toAmino(message: AccessConfig): AccessConfigAmino { + const obj: any = {}; + obj.sender = message.sender === "" ? undefined : message.sender; + return obj; + }, + fromAminoMsg(object: AccessConfigAminoMsg): AccessConfig { + return AccessConfig.fromAmino(object.value); + }, + fromProtoMsg(message: AccessConfigProtoMsg): AccessConfig { + return AccessConfig.decode(message.value); + }, + toProto(message: AccessConfig): Uint8Array { + return AccessConfig.encode(message).finish(); + }, + toProtoMsg(message: AccessConfig): AccessConfigProtoMsg { + return { + typeUrl: "/misc.AccessConfig", + value: AccessConfig.encode(message).finish() + }; + } +}; +function createBaseGenericAuthorization(): GenericAuthorization { + return { + msg: "" + }; +} +export const GenericAuthorization = { + typeUrl: "/misc.GenericAuthorization", + encode(message: GenericAuthorization, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.msg !== "") { + writer.uint32(10).string(message.msg); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): GenericAuthorization { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseGenericAuthorization(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.msg = reader.string(); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): GenericAuthorization { + const obj = createBaseGenericAuthorization(); + if (isSet(object.msg)) obj.msg = String(object.msg); + return obj; + }, + toJSON(message: GenericAuthorization): unknown { + const obj: any = {}; + message.msg !== undefined && (obj.msg = message.msg); + return obj; + }, + fromPartial(object: DeepPartial): GenericAuthorization { + const message = createBaseGenericAuthorization(); + message.msg = object.msg ?? ""; + return message; + }, + fromSDK(object: GenericAuthorizationSDKType): GenericAuthorization { + return { + msg: object?.msg + }; + }, + fromSDKJSON(object: any): GenericAuthorizationSDKType { + return { + msg: isSet(object.msg) ? String(object.msg) : "" + }; + }, + toSDK(message: GenericAuthorization): GenericAuthorizationSDKType { + const obj: any = {}; + obj.msg = message.msg; + return obj; + }, + fromAmino(object: GenericAuthorizationAmino): GenericAuthorization { + const message = createBaseGenericAuthorization(); + if (object.msg !== undefined && object.msg !== null) { + message.msg = object.msg; + } + return message; + }, + toAmino(message: GenericAuthorization): GenericAuthorizationAmino { + const obj: any = {}; + obj.msg = message.msg === "" ? undefined : message.msg; + return obj; + }, + fromAminoMsg(object: GenericAuthorizationAminoMsg): GenericAuthorization { + return GenericAuthorization.fromAmino(object.value); + }, + fromProtoMsg(message: GenericAuthorizationProtoMsg): GenericAuthorization { + return GenericAuthorization.decode(message.value); + }, + toProto(message: GenericAuthorization): Uint8Array { + return GenericAuthorization.encode(message).finish(); + }, + toProtoMsg(message: GenericAuthorization): GenericAuthorizationProtoMsg { + return { + typeUrl: "/misc.GenericAuthorization", + value: GenericAuthorization.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts new file mode 100644 index 0000000000..1b00a68ed2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -0,0 +1,489 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { AminoMsg, Pubkey } from "@cosmjs/amino"; +import { omitDefault } from "../helpers"; +import { fromUtf8, toBase64, toUtf8, fromBase64 } from "@cosmjs/encoding"; +import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; +import { AccessConfig, AccessConfigSDKType, voteOptionFromJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export interface InputMsgAminoType extends AminoMsg { + type: "/misc.InputMsg"; + value: { + d_o_tests: { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: string; + d_o_big: string; + proto: { + sender: string; + }; + d_o_proto: { + sender: string; + }; + auth: { + type_url: string; + value: Uint8Array; + }; + d_o_auth: { + type_url: string; + value: Uint8Array; + }; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: string; + d_o_wasm: string; + opt: number; + d_o_opt: number; + period: { + seconds: string; + nanos: number; + }; + d_o_period: { + seconds: string; + nanos: number; + }; + date: string; + d_o_date: string; + pubkey: Pubkey; + d_o_pubkey: Pubkey; + nums: number[]; + d_o_nums: number[]; + bigs: string[]; + d_o_bigs: string[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: string[]; + d_o_wasms: string[]; + opts: number[]; + d_o_opts: number[]; + periods: { + seconds: string; + nanos: number; + }[]; + d_o_periods: { + seconds: string; + nanos: number; + }[]; + protos: { + sender: string; + }[]; + d_o_protos: { + sender: string; + }[]; + auths: { + type_url: string; + value: Uint8Array; + }[]; + d_o_auths: { + type_url: string; + value: Uint8Array; + }[]; + }; + o_tests: { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: string; + o_big: string; + proto: { + sender: string; + }; + o_proto: { + sender: string; + }; + auth: { + type_url: string; + value: Uint8Array; + }; + o_auth: { + type_url: string; + value: Uint8Array; + }; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: string; + o_wasm: string; + opt: number; + o_opt: number; + period: { + seconds: string; + nanos: number; + }; + o_period: { + seconds: string; + nanos: number; + }; + date: string; + o_date: string; + pubkey: Pubkey; + o_pubkey: Pubkey; + nums: number[]; + o_nums: number[]; + bigs: string[]; + o_bigs: string[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: string[]; + o_wasms: string[]; + opts: number[]; + o_opts: number[]; + periods: { + seconds: string; + nanos: number; + }[]; + o_periods: { + seconds: string; + nanos: number; + }[]; + protos: { + sender: string; + }[]; + o_protos: { + sender: string; + }[]; + auths: { + type_url: string; + value: Uint8Array; + }[]; + o_auths: { + type_url: string; + value: Uint8Array; + }[]; + }; + }; +} +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: ({ + dOTests, + oTests + }: InputMsg): InputMsgAminoType["value"] => { + return { + d_o_tests: { + str: omitDefault(dOTests.str), + d_o_str: omitDefault(dOTests.dOStr), + b: omitDefault(dOTests.b), + d_o_b: omitDefault(dOTests.dOB), + num: omitDefault(dOTests.num), + d_o_num: omitDefault(dOTests.dONum), + big: omitDefault(dOTests.big)?.toString?.(), + d_o_big: omitDefault(dOTests.dOBig)?.toString?.(), + proto: { + sender: omitDefault(dOTests.proto.sender) + }, + d_o_proto: { + sender: omitDefault(dOTests.dOProto.sender) + }, + auth: { + type_url: omitDefault(dOTests.auth.typeUrl), + value: dOTests.auth.value + }, + d_o_auth: { + type_url: omitDefault(dOTests.dOAuth.typeUrl), + value: dOTests.dOAuth.value + }, + salt: dOTests.salt, + d_o_salt: dOTests.dOSalt, + raw: JSON.parse(fromUtf8(dOTests.raw)), + d_o_raw: JSON.parse(fromUtf8(dOTests.dORaw)), + wasm: toBase64(dOTests.wasm), + d_o_wasm: toBase64(dOTests.dOWasm), + opt: dOTests.opt, + d_o_opt: dOTests.dOOpt, + period: (dOTests.period * 1_000_000_000).toString(), + d_o_period: (dOTests.dOPeriod * 1_000_000_000).toString(), + date: dOTests.date, + d_o_date: dOTests.dODate, + pubkey: decodePubkey(pubkey)!, + dOPubkey: decodePubkey(dOPubkey)!, + nums: dOTests.nums, + d_o_nums: dOTests.dONums, + bigs: dOTests.bigs.map(el0 => el0.toString()), + d_o_bigs: dOTests.dOBigs.map(el0 => el0.toString()), + salts: dOTests.salts, + d_o_salts: dOTests.dOSalts, + raws: dOTests.raws, + d_o_raws: dOTests.dORaws, + wasms: dOTests.wasms, + d_o_wasms: dOTests.dOWasms, + opts: dOTests.opts, + d_o_opts: dOTests.dOOpts, + periods: dOTests.periods.map(el0 => ({ + seconds: omitDefault(el0.seconds)?.toString?.(), + nanos: omitDefault(el0.nanos) + })), + d_o_periods: dOTests.dOPeriods.map(el0 => ({ + seconds: omitDefault(el0.seconds)?.toString?.(), + nanos: omitDefault(el0.nanos) + })), + protos: dOTests.protos.map(el0 => ({ + sender: omitDefault(el0.sender) + })), + d_o_protos: dOTests.dOProtos.map(el0 => ({ + sender: omitDefault(el0.sender) + })), + auths: dOTests.auths.map(el0 => ({ + type_url: omitDefault(el0.typeUrl), + value: el0.value + })), + d_o_auths: dOTests.dOAuths.map(el0 => ({ + type_url: omitDefault(el0.typeUrl), + value: el0.value + })) + }, + o_tests: { + str: omitDefault(oTests.str), + o_str: omitDefault(oTests.oStr), + b: omitDefault(oTests.b), + o_b: omitDefault(oTests.oB), + num: omitDefault(oTests.num), + o_num: omitDefault(oTests.oNum), + big: omitDefault(oTests.big)?.toString?.(), + o_big: omitDefault(oTests.oBig)?.toString?.(), + proto: { + sender: omitDefault(oTests.proto.sender) + }, + o_proto: { + sender: omitDefault(oTests.oProto.sender) + }, + auth: { + type_url: omitDefault(oTests.auth.typeUrl), + value: oTests.auth.value + }, + o_auth: { + type_url: omitDefault(oTests.oAuth.typeUrl), + value: oTests.oAuth.value + }, + salt: oTests.salt, + o_salt: oTests.oSalt, + raw: JSON.parse(fromUtf8(oTests.raw)), + o_raw: JSON.parse(fromUtf8(oTests.oRaw)), + wasm: toBase64(oTests.wasm), + o_wasm: toBase64(oTests.oWasm), + opt: oTests.opt, + o_opt: oTests.oOpt, + period: (oTests.period * 1_000_000_000).toString(), + o_period: (oTests.oPeriod * 1_000_000_000).toString(), + date: oTests.date, + o_date: oTests.oDate, + pubkey: decodePubkey(pubkey)!, + oPubkey: decodePubkey(oPubkey)!, + nums: oTests.nums, + o_nums: oTests.oNums, + bigs: oTests.bigs.map(el0 => el0.toString()), + o_bigs: oTests.oBigs.map(el0 => el0.toString()), + salts: oTests.salts, + o_salts: oTests.oSalts, + raws: oTests.raws, + o_raws: oTests.oRaws, + wasms: oTests.wasms, + o_wasms: oTests.oWasms, + opts: oTests.opts, + o_opts: oTests.oOpts, + periods: oTests.periods.map(el0 => ({ + seconds: omitDefault(el0.seconds)?.toString?.(), + nanos: omitDefault(el0.nanos) + })), + o_periods: oTests.oPeriods.map(el0 => ({ + seconds: omitDefault(el0.seconds)?.toString?.(), + nanos: omitDefault(el0.nanos) + })), + protos: oTests.protos.map(el0 => ({ + sender: omitDefault(el0.sender) + })), + o_protos: oTests.oProtos.map(el0 => ({ + sender: omitDefault(el0.sender) + })), + auths: oTests.auths.map(el0 => ({ + type_url: omitDefault(el0.typeUrl), + value: el0.value + })), + o_auths: oTests.oAuths.map(el0 => ({ + type_url: omitDefault(el0.typeUrl), + value: el0.value + })) + } + }; + }, + fromAmino: ({ + d_o_tests, + o_tests + }: InputMsgAminoType["value"]): InputMsg => { + return { + dOTests: d_o_tests == null ? d_o_tests : { + str: d_o_tests.str, + dOStr: d_o_tests.d_o_str, + b: d_o_tests.b, + dOB: d_o_tests.d_o_b, + num: d_o_tests.num, + dONum: d_o_tests.d_o_num, + big: d_o_tests.big == null ? d_o_tests.big : BigInt(d_o_tests.big), + dOBig: d_o_tests.d_o_big == null ? d_o_tests.d_o_big : BigInt(d_o_tests.d_o_big), + proto: d_o_tests.proto == null ? d_o_tests.proto : { + sender: d_o_tests.proto.sender + }, + dOProto: d_o_tests.d_o_proto == null ? d_o_tests.d_o_proto : { + sender: d_o_tests.d_o_proto.sender + }, + auth: d_o_tests.auth == null ? d_o_tests.auth : { + typeUrl: d_o_tests.auth.type_url, + value: d_o_tests.auth.value + }, + dOAuth: d_o_tests.d_o_auth == null ? d_o_tests.d_o_auth : { + typeUrl: d_o_tests.d_o_auth.type_url, + value: d_o_tests.d_o_auth.value + }, + salt: d_o_tests.salt, + dOSalt: d_o_tests.d_o_salt, + raw: d_o_tests.raw == null ? d_o_tests.raw : toUtf8(JSON.stringify(d_o_tests.raw)), + dORaw: d_o_tests.d_o_raw == null ? d_o_tests.d_o_raw : toUtf8(JSON.stringify(d_o_tests.d_o_raw)), + wasm: d_o_tests.wasm == null ? d_o_tests.wasm : fromBase64(d_o_tests.wasm), + dOWasm: d_o_tests.d_o_wasm == null ? d_o_tests.d_o_wasm : fromBase64(d_o_tests.d_o_wasm), + opt: d_o_tests.opt == null ? d_o_tests.opt : voteOptionFromJSON(d_o_tests.opt), + dOOpt: d_o_tests.d_o_opt == null ? d_o_tests.d_o_opt : voteOptionFromJSON(d_o_tests.d_o_opt), + period: d_o_tests.period == null ? d_o_tests.period : { + seconds: BigInt(Math.floor(parseInt(d_o_tests.period) / 1_000_000_000)), + nanos: parseInt(d_o_tests.period) % 1_000_000_000 + }, + dOPeriod: d_o_tests.d_o_period == null ? d_o_tests.d_o_period : { + seconds: BigInt(Math.floor(parseInt(d_o_tests.d_o_period) / 1_000_000_000)), + nanos: parseInt(d_o_tests.d_o_period) % 1_000_000_000 + }, + date: d_o_tests.date, + dODate: d_o_tests.d_o_date, + pubkey: encodePubkey(pubkey), + dOPubkey: encodePubkey(pubkey), + nums: d_o_tests.nums, + dONums: d_o_tests.d_o_nums, + bigs: d_o_tests.bigs.map?.(el1 => BigInt(el1)), + dOBigs: d_o_tests.d_o_bigs.map?.(el1 => BigInt(el1)), + salts: d_o_tests.salts, + dOSalts: d_o_tests.d_o_salts, + raws: d_o_tests.raws, + dORaws: d_o_tests.d_o_raws, + wasms: d_o_tests.wasms, + dOWasms: d_o_tests.d_o_wasms, + opts: d_o_tests.opts.map?.(el => voteOptionFromJSON(el)), + dOOpts: d_o_tests.d_o_opts.map?.(el => voteOptionFromJSON(el)), + periods: d_o_tests.periods.map?.(el1 => ({ + seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + nanos: el1.nanos + })), + dOPeriods: d_o_tests.d_o_periods.map?.(el1 => ({ + seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + nanos: el1.nanos + })), + protos: d_o_tests.protos.map?.(el1 => ({ + sender: el1.sender + })), + dOProtos: d_o_tests.d_o_protos.map?.(el1 => ({ + sender: el1.sender + })), + auths: d_o_tests.auths.map?.(el1 => ({ + typeUrl: el1.type_url, + value: el1.value + })), + dOAuths: d_o_tests.d_o_auths.map?.(el1 => ({ + typeUrl: el1.type_url, + value: el1.value + })) + }, + oTests: o_tests == null ? o_tests : { + str: o_tests.str, + oStr: o_tests.o_str, + b: o_tests.b, + oB: o_tests.o_b, + num: o_tests.num, + oNum: o_tests.o_num, + big: o_tests.big == null ? o_tests.big : BigInt(o_tests.big), + oBig: o_tests.o_big == null ? o_tests.o_big : BigInt(o_tests.o_big), + proto: o_tests.proto == null ? o_tests.proto : { + sender: o_tests.proto.sender + }, + oProto: o_tests.o_proto == null ? o_tests.o_proto : { + sender: o_tests.o_proto.sender + }, + auth: o_tests.auth == null ? o_tests.auth : { + typeUrl: o_tests.auth.type_url, + value: o_tests.auth.value + }, + oAuth: o_tests.o_auth == null ? o_tests.o_auth : { + typeUrl: o_tests.o_auth.type_url, + value: o_tests.o_auth.value + }, + salt: o_tests.salt, + oSalt: o_tests.o_salt, + raw: o_tests.raw == null ? o_tests.raw : toUtf8(JSON.stringify(o_tests.raw)), + oRaw: o_tests.o_raw == null ? o_tests.o_raw : toUtf8(JSON.stringify(o_tests.o_raw)), + wasm: o_tests.wasm == null ? o_tests.wasm : fromBase64(o_tests.wasm), + oWasm: o_tests.o_wasm == null ? o_tests.o_wasm : fromBase64(o_tests.o_wasm), + opt: o_tests.opt == null ? o_tests.opt : voteOptionFromJSON(o_tests.opt), + oOpt: o_tests.o_opt == null ? o_tests.o_opt : voteOptionFromJSON(o_tests.o_opt), + period: o_tests.period == null ? o_tests.period : { + seconds: BigInt(Math.floor(parseInt(o_tests.period) / 1_000_000_000)), + nanos: parseInt(o_tests.period) % 1_000_000_000 + }, + oPeriod: o_tests.o_period == null ? o_tests.o_period : { + seconds: BigInt(Math.floor(parseInt(o_tests.o_period) / 1_000_000_000)), + nanos: parseInt(o_tests.o_period) % 1_000_000_000 + }, + date: o_tests.date, + oDate: o_tests.o_date, + pubkey: encodePubkey(pubkey), + oPubkey: encodePubkey(pubkey), + nums: o_tests.nums, + oNums: o_tests.o_nums, + bigs: o_tests.bigs.map?.(el1 => BigInt(el1)), + oBigs: o_tests.o_bigs.map?.(el1 => BigInt(el1)), + salts: o_tests.salts, + oSalts: o_tests.o_salts, + raws: o_tests.raws, + oRaws: o_tests.o_raws, + wasms: o_tests.wasms, + oWasms: o_tests.o_wasms, + opts: o_tests.opts.map?.(el => voteOptionFromJSON(el)), + oOpts: o_tests.o_opts.map?.(el => voteOptionFromJSON(el)), + periods: o_tests.periods.map?.(el1 => ({ + seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + nanos: el1.nanos + })), + oPeriods: o_tests.o_periods.map?.(el1 => ({ + seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + nanos: el1.nanos + })), + protos: o_tests.protos.map?.(el1 => ({ + sender: el1.sender + })), + oProtos: o_tests.o_protos.map?.(el1 => ({ + sender: el1.sender + })), + auths: o_tests.auths.map?.(el1 => ({ + typeUrl: el1.type_url, + value: el1.value + })), + oAuths: o_tests.o_auths.map?.(el1 => ({ + typeUrl: el1.type_url, + value: el1.value + })) + } + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts new file mode 100644 index 0000000000..1e7aeb0e5a --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.ts @@ -0,0 +1,209 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/mobx.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/mobx.ts new file mode 100644 index 0000000000..9e66db0620 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/mobx.ts @@ -0,0 +1,82 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +import { + makeAutoObservable, + runInAction +} from 'mobx'; + +import { QueryStatus } from '@tanstack/react-query'; + +export interface MobxResponse { + data: T | undefined; + isSuccess: boolean; + isLoading: boolean; + refetch: () => Promise; +} + +export class QueryStore { + state?: QueryStatus; + request?: Request; + response?: Response; + fetchFunc?: (request: Request) => Promise; + + constructor(fetchFunc?: (request: Request) => Promise) { + this.fetchFunc = fetchFunc; + makeAutoObservable(this) + } + + get isLoading() { + return this.state === 'loading'; + } + + get isSuccess() { + return this.state === 'success'; + } + + refetch = async (): Promise => { + runInAction(() => { + this.response = void 0; + this.state = 'loading'; + }); + try { + if (!this.fetchFunc) + throw new Error( + 'Query Service not initialized or request function not implemented' + ); + if (!this.request) throw new Error('Request not provided'); + const response = await this.fetchFunc(this.request); + runInAction(() => { + this.response = response; + this.state = 'success'; + }); + console.log( + '%cquery.rpc.Query.ts line:572 this.state', + 'color: #007acc;', + this.state, + this.response + ); + } catch (e) { + console.error(e); + runInAction(() => { + this.state = 'error'; + }); + } + } + + getData(request?: Request): MobxResponse { + runInAction(() => { + this.request = request; + }); + return { + data: this.response, + isSuccess: this.isSuccess, + isLoading: this.isLoading, + refetch: this.refetch, + }; + } +} diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/pinia-endpoint.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/pinia-endpoint.ts new file mode 100644 index 0000000000..94788f3e3d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/pinia-endpoint.ts @@ -0,0 +1,22 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +import { defineStore } from "pinia"; +import type { LCDClient } from '@cosmology/lcd'; + +export const useEndpoint = defineStore('pinia.endpoint', { + state: () => { + return { + restClient: {} as LCDClient, + } + }, + actions: { + setRestClient(client: LCDClient) { + this.restClient = client + } + } +}) diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/react-query.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/react-query.ts new file mode 100644 index 0000000000..6f5178b23b --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/react-query.ts @@ -0,0 +1,71 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + +import { getRpcClient } from './extern' +import { + useQuery, + UseQueryOptions, +} from '@tanstack/react-query'; + +import { HttpEndpoint, ProtobufRpcClient } from '@cosmjs/stargate'; +import { Tendermint34Client } from '@cosmjs/tendermint-rpc'; + +export interface ReactQueryParams { + options?: UseQueryOptions; +} + +export interface UseRpcClientQuery extends ReactQueryParams { + rpcEndpoint: string | HttpEndpoint; +} + +export interface UseRpcEndpointQuery extends ReactQueryParams { + getter: () => Promise; + extraKey?: string +} + +export const useRpcEndpoint = ({ + getter, + options, + extraKey +}: UseRpcEndpointQuery) => { + return useQuery(['rpcEndpoint', extraKey], async () => { + return await getter(); + }, options); +}; + +export const useRpcClient = ({ + rpcEndpoint, + options, +}: UseRpcClientQuery) => { + return useQuery(['rpcClient', rpcEndpoint], async () => { + return await getRpcClient(rpcEndpoint); + }, options); +}; + +interface UseTendermintClient extends ReactQueryParams { + rpcEndpoint: string | HttpEndpoint; +} + +/** + * Hook that uses react-query to cache a connected tendermint client. + */ +export const useTendermintClient = ({ + rpcEndpoint, + options, +}: UseTendermintClient) => { + const { data: client } = useQuery( + ['client', 'tendermint', rpcEndpoint], + () => Tendermint34Client.connect(rpcEndpoint), + { + // allow overriding + onError: (e) => { + throw new Error(`Failed to connect to ${rpcEndpoint}` + '\n' + e) + }, + ...options, + } + ) + return { client } +}; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/utf8.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/utf8.ts new file mode 100644 index 0000000000..ec09644425 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/utf8.ts @@ -0,0 +1,148 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright (c) 2016, Daniel Wirtz All rights reserved. + +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: + +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above copyright +// notice, this list of conditions and the following disclaimer in the +// documentation and/or other materials provided with the distribution. +// * Neither the name of its author, nor the names of its contributors +// may be used to endorse or promote products derived from this software +// without specific prior written permission. + +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +"use strict"; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +export function utf8Length(str: string) { + let len = 0, + c = 0; + for (let i = 0; i < str.length; ++i) { + c = str.charCodeAt(i); + if (c < 128) len += 1; + else if (c < 2048) len += 2; + else if ( + (c & 0xfc00) === 0xd800 && + (str.charCodeAt(i + 1) & 0xfc00) === 0xdc00 + ) { + ++i; + len += 4; + } else len += 3; + } + return len; +} + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +export function utf8Read( + buffer: ArrayLike, + start: number, + end: number +) { + const len = end - start; + if (len < 1) return ""; + const chunk = []; + let parts: string[] = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = ((t & 31) << 6) | (buffer[start++] & 63); + else if (t > 239 && t < 365) { + t = + (((t & 7) << 18) | + ((buffer[start++] & 63) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63)) - + 0x10000; + chunk[i++] = 0xd800 + (t >> 10); + chunk[i++] = 0xdc00 + (t & 1023); + } else + chunk[i++] = + ((t & 15) << 12) | + ((buffer[start++] & 63) << 6) | + (buffer[start++] & 63); + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode(...chunk)); + i = 0; + } + } + if (parts) { + if (i) parts.push(String.fromCharCode(...chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode(...chunk.slice(0, i)); +} + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +export function utf8Write( + str: string, + buffer: Uint8Array | Array, + offset: number +) { + const start = offset; + let c1, // character 1 + c2; // character 2 + for (let i = 0; i < str.length; ++i) { + c1 = str.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = (c1 >> 6) | 192; + buffer[offset++] = (c1 & 63) | 128; + } else if ( + (c1 & 0xfc00) === 0xd800 && + ((c2 = str.charCodeAt(i + 1)) & 0xfc00) === 0xdc00 + ) { + c1 = 0x10000 + ((c1 & 0x03ff) << 10) + (c2 & 0x03ff); + ++i; + buffer[offset++] = (c1 >> 18) | 240; + buffer[offset++] = ((c1 >> 12) & 63) | 128; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } else { + buffer[offset++] = (c1 >> 12) | 224; + buffer[offset++] = ((c1 >> 6) & 63) | 128; + buffer[offset++] = (c1 & 63) | 128; + } + } + return offset - start; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/varint.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/varint.ts new file mode 100644 index 0000000000..a83418dbc0 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/varint.ts @@ -0,0 +1,488 @@ +/** +* This file and any referenced files were automatically generated by @cosmology/telescope@latest +* DO NOT MODIFY BY HAND. Instead, download the latest proto files for your chain +* and run the transpile command or yarn proto command to regenerate this bundle. +*/ + + +// Copyright 2008 Google Inc. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +// +// Code generated by the Protocol Buffer compiler is owned by the owner +// of the input file used when generating it. This code is not +// standalone and requires a support library to be linked with it. This +// support library is itself covered by the above license. + +/* eslint-disable prefer-const,@typescript-eslint/restrict-plus-operands */ + +/** + * Read a 64 bit varint as two JS numbers. + * + * Returns tuple: + * [0]: low bits + * [1]: high bits + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L175 + */ +export function varint64read(this: ReaderLike): [number, number] { + let lowBits = 0; + let highBits = 0; + + for (let shift = 0; shift < 28; shift += 7) { + let b = this.buf[this.pos++]; + lowBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + let middleByte = this.buf[this.pos++]; + + // last four bits of the first 32 bit number + lowBits |= (middleByte & 0x0f) << 28; + + // 3 upper bits are part of the next 32 bit number + highBits = (middleByte & 0x70) >> 4; + + if ((middleByte & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + + for (let shift = 3; shift <= 31; shift += 7) { + let b = this.buf[this.pos++]; + highBits |= (b & 0x7f) << shift; + if ((b & 0x80) == 0) { + this.assertBounds(); + return [lowBits, highBits]; + } + } + + throw new Error("invalid varint"); +} + +/** + * Write a 64 bit varint, given as two JS numbers, to the given bytes array. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/writer.js#L344 + */ +export function varint64write(lo: number, hi: number, bytes: number[]): void { + for (let i = 0; i < 28; i = i + 7) { + const shift = lo >>> i; + const hasNext = !(shift >>> 7 == 0 && hi == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + const splitBits = ((lo >>> 28) & 0x0f) | ((hi & 0x07) << 4); + const hasMoreBits = !(hi >> 3 == 0); + bytes.push((hasMoreBits ? splitBits | 0x80 : splitBits) & 0xff); + + if (!hasMoreBits) { + return; + } + + for (let i = 3; i < 31; i = i + 7) { + const shift = hi >>> i; + const hasNext = !(shift >>> 7 == 0); + const byte = (hasNext ? shift | 0x80 : shift) & 0xff; + bytes.push(byte); + if (!hasNext) { + return; + } + } + + bytes.push((hi >>> 31) & 0x01); +} + +// constants for binary math +const TWO_PWR_32_DBL = 0x100000000; + +/** + * Parse decimal string of 64 bit integer value as two JS numbers. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64FromString(dec: string): { lo: number; hi: number } { + // Check for minus sign. + const minus = dec[0] === "-"; + if (minus) { + dec = dec.slice(1); + } + + // Work 6 decimal digits at a time, acting like we're converting base 1e6 + // digits to binary. This is safe to do with floating point math because + // Number.isSafeInteger(ALL_32_BITS * 1e6) == true. + const base = 1e6; + let lowBits = 0; + let highBits = 0; + + function add1e6digit(begin: number, end?: number) { + // Note: Number('') is 0. + const digit1e6 = Number(dec.slice(begin, end)); + highBits *= base; + lowBits = lowBits * base + digit1e6; + // Carry bits from lowBits to + if (lowBits >= TWO_PWR_32_DBL) { + highBits = highBits + ((lowBits / TWO_PWR_32_DBL) | 0); + lowBits = lowBits % TWO_PWR_32_DBL; + } + } + + add1e6digit(-24, -18); + add1e6digit(-18, -12); + add1e6digit(-12, -6); + add1e6digit(-6); + return minus ? negate(lowBits, highBits) : newBits(lowBits, highBits); +} + +/** + * Losslessly converts a 64-bit signed integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function int64ToString(lo: number, hi: number): string { + let bits = newBits(lo, hi); + // If we're treating the input as a signed value and the high bit is set, do + // a manual two's complement conversion before the decimal conversion. + const negative = bits.hi & 0x80000000; + if (negative) { + bits = negate(bits.lo, bits.hi); + } + const result = uInt64ToString(bits.lo, bits.hi); + return negative ? "-" + result : result; +} + +/** + * Losslessly converts a 64-bit unsigned integer in 32:32 split representation + * into a decimal string. + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf-javascript/blob/a428c58273abad07c66071d9753bc4d1289de426/experimental/runtime/int64.js#L10 + */ +export function uInt64ToString(lo: number, hi: number): string { + ({ lo, hi } = toUnsigned(lo, hi)); + // Skip the expensive conversion if the number is small enough to use the + // built-in conversions. + // Number.MAX_SAFE_INTEGER = 0x001FFFFF FFFFFFFF, thus any number with + // highBits <= 0x1FFFFF can be safely expressed with a double and retain + // integer precision. + // Proven by: Number.isSafeInteger(0x1FFFFF * 2**32 + 0xFFFFFFFF) == true. + if (hi <= 0x1fffff) { + return String(TWO_PWR_32_DBL * hi + lo); + } + + // What this code is doing is essentially converting the input number from + // base-2 to base-1e7, which allows us to represent the 64-bit range with + // only 3 (very large) digits. Those digits are then trivial to convert to + // a base-10 string. + + // The magic numbers used here are - + // 2^24 = 16777216 = (1,6777216) in base-1e7. + // 2^48 = 281474976710656 = (2,8147497,6710656) in base-1e7. + + // Split 32:32 representation into 16:24:24 representation so our + // intermediate digits don't overflow. + const low = lo & 0xffffff; + const mid = ((lo >>> 24) | (hi << 8)) & 0xffffff; + const high = (hi >> 16) & 0xffff; + + // Assemble our three base-1e7 digits, ignoring carries. The maximum + // value in a digit at this step is representable as a 48-bit integer, which + // can be stored in a 64-bit floating point number. + let digitA = low + mid * 6777216 + high * 6710656; + let digitB = mid + high * 8147497; + let digitC = high * 2; + + // Apply carries from A to B and from B to C. + const base = 10000000; + if (digitA >= base) { + digitB += Math.floor(digitA / base); + digitA %= base; + } + + if (digitB >= base) { + digitC += Math.floor(digitB / base); + digitB %= base; + } + + // If digitC is 0, then we should have returned in the trivial code path + // at the top for non-safe integers. Given this, we can assume both digitB + // and digitA need leading zeros. + return ( + digitC.toString() + + decimalFrom1e7WithLeadingZeros(digitB) + + decimalFrom1e7WithLeadingZeros(digitA) + ); +} + +function toUnsigned(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo >>> 0, hi: hi >>> 0 }; +} + +function newBits(lo: number, hi: number): { lo: number; hi: number } { + return { lo: lo | 0, hi: hi | 0 }; +} + +/** + * Returns two's compliment negation of input. + * @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Signed_32-bit_integers + */ +function negate(lowBits: number, highBits: number) { + highBits = ~highBits; + if (lowBits) { + lowBits = ~lowBits + 1; + } else { + // If lowBits is 0, then bitwise-not is 0xFFFFFFFF, + // adding 1 to that, results in 0x100000000, which leaves + // the low bits 0x0 and simply adds one to the high bits. + highBits += 1; + } + return newBits(lowBits, highBits); +} + +/** + * Returns decimal representation of digit1e7 with leading zeros. + */ +const decimalFrom1e7WithLeadingZeros = (digit1e7: number) => { + const partial = String(digit1e7); + return "0000000".slice(partial.length) + partial; +}; + +/** + * Write a 32 bit varint, signed or unsigned. Same as `varint64write(0, value, bytes)` + * + * Copyright 2008 Google Inc. All rights reserved. + * + * See https://github.com/protocolbuffers/protobuf/blob/1b18833f4f2a2f681f4e4a25cdf3b0a43115ec26/js/binary/encoder.js#L144 + */ +export function varint32write(value: number, bytes: number[]): void { + if (value >= 0) { + // write value as varint 32 + while (value > 0x7f) { + bytes.push((value & 0x7f) | 0x80); + value = value >>> 7; + } + bytes.push(value); + } else { + for (let i = 0; i < 9; i++) { + bytes.push((value & 127) | 128); + value = value >> 7; + } + bytes.push(1); + } +} + +/** + * Read an unsigned 32 bit varint. + * + * See https://github.com/protocolbuffers/protobuf/blob/8a71927d74a4ce34efe2d8769fda198f52d20d12/js/experimental/runtime/kernel/buffer_decoder.js#L220 + */ +export function varint32read(this: ReaderLike): number { + let b = this.buf[this.pos++]; + let result = b & 0x7f; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 7; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 14; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + b = this.buf[this.pos++]; + result |= (b & 0x7f) << 21; + if ((b & 0x80) == 0) { + this.assertBounds(); + return result; + } + + // Extract only last 4 bits + b = this.buf[this.pos++]; + result |= (b & 0x0f) << 28; + + for (let readBytes = 5; (b & 0x80) !== 0 && readBytes < 10; readBytes++) + b = this.buf[this.pos++]; + + if ((b & 0x80) != 0) throw new Error("invalid varint"); + + this.assertBounds(); + + // Result can have 32 bits, convert it to unsigned + return result >>> 0; +} + +type ReaderLike = { + buf: Uint8Array; + pos: number; + len: number; + assertBounds(): void; +}; + +/** + * encode zig zag + */ +export function zzEncode(lo: number, hi: number) { + let mask = hi >> 31; + hi = (((hi << 1) | (lo >>> 31)) ^ mask) >>> 0; + lo = ((lo << 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * decode zig zag + */ +export function zzDecode(lo: number, hi: number) { + let mask = -(lo & 1); + lo = (((lo >>> 1) | (hi << 31)) ^ mask) >>> 0; + hi = ((hi >>> 1) ^ mask) >>> 0; + return [lo, hi]; +} + +/** + * unsigned int32 without moving pos. + */ +export function readUInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + buf[pos + 3] * 0x1000000 + ); +} + +/** + * signed int32 without moving pos. + */ +export function readInt32(buf: Uint8Array, pos: number) { + return ( + (buf[pos] | (buf[pos + 1] << 8) | (buf[pos + 2] << 16)) + + (buf[pos + 3] << 24) + ); +} + +/** + * writing varint32 to pos + */ +export function writeVarint32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + while (val > 127) { + buf[pos++] = (val & 127) | 128; + val >>>= 7; + } + buf[pos] = val; +} + +/** + * writing varint64 to pos + */ +export function writeVarint64( + val: { lo: number; hi: number }, + buf: Uint8Array | number[], + pos: number +) { + while (val.hi) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = ((val.lo >>> 7) | (val.hi << 25)) >>> 0; + val.hi >>>= 7; + } + while (val.lo > 127) { + buf[pos++] = (val.lo & 127) | 128; + val.lo = val.lo >>> 7; + } + buf[pos++] = val.lo; +} + +export function int64Length(lo: number, hi: number) { + let part0 = lo, + part1 = ((lo >>> 28) | (hi << 4)) >>> 0, + part2 = hi >>> 24; + return part2 === 0 + ? part1 === 0 + ? part0 < 16384 + ? part0 < 128 + ? 1 + : 2 + : part0 < 2097152 + ? 3 + : 4 + : part1 < 16384 + ? part1 < 128 + ? 5 + : 6 + : part1 < 2097152 + ? 7 + : 8 + : part2 < 128 + ? 9 + : 10; +} + +export function writeFixed32( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; + buf[pos + 1] = (val >>> 8) & 255; + buf[pos + 2] = (val >>> 16) & 255; + buf[pos + 3] = val >>> 24; +} + +export function writeByte( + val: number, + buf: Uint8Array | number[], + pos: number +) { + buf[pos] = val & 255; +} diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts index cf51f6dcde..3025fa61bf 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _56 from "./gogo"; +import * as _105 from "./gogo"; export const gogoproto = { - ..._56 + ..._105 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts index 6636b68221..5f3575035b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _57 from "./api/expr/v1alpha1/eval"; -import * as _58 from "./protobuf/any"; -import * as _59 from "./protobuf/duration"; -import * as _60 from "./protobuf/timestamp"; -import * as _61 from "./protobuf/descriptor"; +import * as _106 from "./api/expr/v1alpha1/eval"; +import * as _107 from "./protobuf/any"; +import * as _108 from "./protobuf/duration"; +import * as _109 from "./protobuf/timestamp"; +import * as _110 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._57 + ..._106 }; } } export const protobuf = { - ..._58, - ..._59, - ..._60, - ..._61 + ..._107, + ..._108, + ..._109, + ..._110 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts index 775295ffb7..d219f262cb 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/index.ts @@ -7,6 +7,7 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; +export * from "./misc/client"; export * from "./extern"; export * from "./react-query"; export * from "./mobx"; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts new file mode 100644 index 0000000000..ad128f88ec --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts @@ -0,0 +1,2527 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitAmino { + /** scalar */ + str?: string; + d_o_str: string; + b?: boolean; + d_o_b: boolean; + num?: number; + d_o_num: number; + /** bigint */ + big?: string; + d_o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + d_o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + d_o_auth: AnyAmino; + /** bytes */ + salt?: string; + d_o_salt: string; + /** raw bytes */ + raw?: any; + d_o_raw: any; + /** wasm bytes */ + wasm?: string; + d_o_wasm: string; + /** enum */ + opt?: VoteOption; + d_o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + d_o_period: DurationAmino; + /** timestamp */ + date?: string; + d_o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + d_o_pubkey: AnyAmino; + /** array scalar */ + nums?: number[]; + d_o_nums: number[]; + /** array bigint */ + bigs?: string[]; + d_o_bigs: string[]; + /** array bytes */ + salts?: string[]; + d_o_salts: string[]; + /** array raw bytes */ + raws?: any[]; + d_o_raws: any[]; + /** array wasm bytes */ + wasms?: string[]; + d_o_wasms: string[]; + /** array enum */ + opts?: VoteOption[]; + d_o_opts: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + d_o_periods: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + d_o_protos: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + d_o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForDontOmitAminoMsg { + type: "/misc.AminoEncodingTestForDontOmit"; + value: AminoEncodingTestForDontOmitAmino; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitAmino { + /** scalar */ + str?: string; + o_str?: string; + b?: boolean; + o_b?: boolean; + num?: number; + o_num?: number; + /** bigint */ + big?: string; + o_big?: string; + /** protoType */ + proto?: AccessConfigAmino; + o_proto?: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + o_auth?: AnyAmino; + /** bytes */ + salt?: string; + o_salt?: string; + /** raw bytes */ + raw?: any; + o_raw?: any; + /** wasm bytes */ + wasm?: string; + o_wasm?: string; + /** enum */ + opt?: VoteOption; + o_opt?: VoteOption; + /** duration */ + period?: DurationAmino; + o_period?: DurationAmino; + /** timestamp */ + date?: string; + o_date?: string; + /** pubkey */ + pubkey?: AnyAmino; + o_pubkey?: AnyAmino; + /** array scalar */ + nums?: number[]; + o_nums?: number[]; + /** array bigint */ + bigs?: string[]; + o_bigs?: string[]; + /** array bytes */ + salts?: string[]; + o_salts?: string[]; + /** array raw bytes */ + raws?: any[]; + o_raws?: any[]; + /** array wasm bytes */ + wasms?: string[]; + o_wasms?: string[]; + /** array enum */ + opts?: VoteOption[]; + o_opts?: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + o_periods?: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + o_protos?: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + o_auths?: AnyAmino[]; +} +export interface AminoEncodingTestForOmitAminoMsg { + type: "/misc.AminoEncodingTestForOmit"; + value: AminoEncodingTestForOmitAmino; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts index 79974e5775..118dfaa606 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts @@ -1,4 +1,18 @@ -import * as _62 from "./eval_request"; +import * as _111 from "./amino_fields"; +import * as _112 from "./eval_request"; +import * as _113 from "./tx"; +import * as _114 from "./tx.amino"; +import * as _115 from "./tx.registry"; +import * as _116 from "./tx.rpc.msg"; +import * as _117 from "./rpc.tx"; export const misc = { - ..._62 + ..._111, + ..._112, + ..._113, + ..._114, + ..._115, + ..._116, + ClientFactory: { + ..._117 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/client.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts index ff2ca6fed1..41599d60fc 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/eval_request.ts @@ -1,11 +1,6 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -202,192 +197,6 @@ export interface GenericAuthorizationAminoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestAminoMsg { - type: "/misc.AminoEncodingTest"; - value: AminoEncodingTestAmino; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -1095,1077 +904,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.amino.ts new file mode 100644 index 0000000000..0d46c9a916 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.amino.ts @@ -0,0 +1,9 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: InputMsg.toAmino, + fromAmino: InputMsg.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts new file mode 100644 index 0000000000..4611dbb80b --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/tx.ts @@ -0,0 +1,227 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitAmino, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitAmino, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgAmino { + d_o_tests?: AminoEncodingTestForDontOmitAmino; + o_tests?: AminoEncodingTestForOmitAmino; +} +export interface InputMsgAminoMsg { + type: "/misc.InputMsg"; + value: InputMsgAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseAmino {} +export interface MsgResponseAminoMsg { + type: "/misc.MsgResponse"; + value: MsgResponseAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts index 71ad42a61b..f0a946b17a 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _49 from "./gogo"; +import * as _92 from "./gogo"; export const gogoproto = { - ..._49 + ..._92 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts index 994af959df..821d114d55 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _50 from "./api/expr/v1alpha1/eval"; -import * as _51 from "./protobuf/any"; -import * as _52 from "./protobuf/duration"; -import * as _53 from "./protobuf/timestamp"; -import * as _54 from "./protobuf/descriptor"; +import * as _93 from "./api/expr/v1alpha1/eval"; +import * as _94 from "./protobuf/any"; +import * as _95 from "./protobuf/duration"; +import * as _96 from "./protobuf/timestamp"; +import * as _97 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._50 + ..._93 }; } } export const protobuf = { - ..._51, - ..._52, - ..._53, - ..._54 + ..._94, + ..._95, + ..._96, + ..._97 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts index 775295ffb7..d219f262cb 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/index.ts @@ -7,6 +7,7 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; +export * from "./misc/client"; export * from "./extern"; export * from "./react-query"; export * from "./mobx"; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts new file mode 100644 index 0000000000..ad128f88ec --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts @@ -0,0 +1,2527 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitAmino { + /** scalar */ + str?: string; + d_o_str: string; + b?: boolean; + d_o_b: boolean; + num?: number; + d_o_num: number; + /** bigint */ + big?: string; + d_o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + d_o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + d_o_auth: AnyAmino; + /** bytes */ + salt?: string; + d_o_salt: string; + /** raw bytes */ + raw?: any; + d_o_raw: any; + /** wasm bytes */ + wasm?: string; + d_o_wasm: string; + /** enum */ + opt?: VoteOption; + d_o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + d_o_period: DurationAmino; + /** timestamp */ + date?: string; + d_o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + d_o_pubkey: AnyAmino; + /** array scalar */ + nums?: number[]; + d_o_nums: number[]; + /** array bigint */ + bigs?: string[]; + d_o_bigs: string[]; + /** array bytes */ + salts?: string[]; + d_o_salts: string[]; + /** array raw bytes */ + raws?: any[]; + d_o_raws: any[]; + /** array wasm bytes */ + wasms?: string[]; + d_o_wasms: string[]; + /** array enum */ + opts?: VoteOption[]; + d_o_opts: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + d_o_periods: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + d_o_protos: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + d_o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForDontOmitAminoMsg { + type: "/misc.AminoEncodingTestForDontOmit"; + value: AminoEncodingTestForDontOmitAmino; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitAmino { + /** scalar */ + str?: string; + o_str?: string; + b?: boolean; + o_b?: boolean; + num?: number; + o_num?: number; + /** bigint */ + big?: string; + o_big?: string; + /** protoType */ + proto?: AccessConfigAmino; + o_proto?: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + o_auth?: AnyAmino; + /** bytes */ + salt?: string; + o_salt?: string; + /** raw bytes */ + raw?: any; + o_raw?: any; + /** wasm bytes */ + wasm?: string; + o_wasm?: string; + /** enum */ + opt?: VoteOption; + o_opt?: VoteOption; + /** duration */ + period?: DurationAmino; + o_period?: DurationAmino; + /** timestamp */ + date?: string; + o_date?: string; + /** pubkey */ + pubkey?: AnyAmino; + o_pubkey?: AnyAmino; + /** array scalar */ + nums?: number[]; + o_nums?: number[]; + /** array bigint */ + bigs?: string[]; + o_bigs?: string[]; + /** array bytes */ + salts?: string[]; + o_salts?: string[]; + /** array raw bytes */ + raws?: any[]; + o_raws?: any[]; + /** array wasm bytes */ + wasms?: string[]; + o_wasms?: string[]; + /** array enum */ + opts?: VoteOption[]; + o_opts?: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + o_periods?: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + o_protos?: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + o_auths?: AnyAmino[]; +} +export interface AminoEncodingTestForOmitAminoMsg { + type: "/misc.AminoEncodingTestForOmit"; + value: AminoEncodingTestForOmitAmino; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts index 82160487ff..9887810bf8 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts @@ -1,4 +1,18 @@ -import * as _55 from "./eval_request"; +import * as _98 from "./amino_fields"; +import * as _99 from "./eval_request"; +import * as _100 from "./tx"; +import * as _101 from "./tx.amino"; +import * as _102 from "./tx.registry"; +import * as _103 from "./tx.rpc.msg"; +import * as _104 from "./rpc.tx"; export const misc = { - ..._55 + ..._98, + ..._99, + ..._100, + ..._101, + ..._102, + ..._103, + ClientFactory: { + ..._104 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/client.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts index ff2ca6fed1..41599d60fc 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/eval_request.ts @@ -1,11 +1,6 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -202,192 +197,6 @@ export interface GenericAuthorizationAminoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestAminoMsg { - type: "/misc.AminoEncodingTest"; - value: AminoEncodingTestAmino; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -1095,1077 +904,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.amino.ts new file mode 100644 index 0000000000..0d46c9a916 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.amino.ts @@ -0,0 +1,9 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: InputMsg.toAmino, + fromAmino: InputMsg.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts new file mode 100644 index 0000000000..4611dbb80b --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/tx.ts @@ -0,0 +1,227 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitAmino, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitAmino, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgAmino { + d_o_tests?: AminoEncodingTestForDontOmitAmino; + o_tests?: AminoEncodingTestForOmitAmino; +} +export interface InputMsgAminoMsg { + type: "/misc.InputMsg"; + value: InputMsgAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseAmino {} +export interface MsgResponseAminoMsg { + type: "/misc.MsgResponse"; + value: MsgResponseAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts index 4402767df3..0dfabdc9b7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _63 from "./gogo"; +import * as _118 from "./gogo"; export const gogoproto = { - ..._63 + ..._118 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts index f48c6dbadf..3c7862a96a 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _64 from "./api/expr/v1alpha1/eval"; -import * as _65 from "./protobuf/any"; -import * as _66 from "./protobuf/duration"; -import * as _67 from "./protobuf/timestamp"; -import * as _68 from "./protobuf/descriptor"; +import * as _119 from "./api/expr/v1alpha1/eval"; +import * as _120 from "./protobuf/any"; +import * as _121 from "./protobuf/duration"; +import * as _122 from "./protobuf/timestamp"; +import * as _123 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._64 + ..._119 }; } } export const protobuf = { - ..._65, - ..._66, - ..._67, - ..._68 + ..._120, + ..._121, + ..._122, + ..._123 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts index 775295ffb7..d219f262cb 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/index.ts @@ -7,6 +7,7 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; +export * from "./misc/client"; export * from "./extern"; export * from "./react-query"; export * from "./mobx"; diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts new file mode 100644 index 0000000000..71de359eb2 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts @@ -0,0 +1,2513 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitAmino { + /** scalar */ + str?: string; + d_o_str: string; + b?: boolean; + d_o_b: boolean; + num?: number; + d_o_num: number; + /** bigint */ + big?: string; + d_o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + d_o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + d_o_auth: AnyAmino; + /** bytes */ + salt?: string; + d_o_salt: string; + /** raw bytes */ + raw?: any; + d_o_raw: any; + /** wasm bytes */ + wasm?: string; + d_o_wasm: string; + /** enum */ + opt?: VoteOption; + d_o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + d_o_period: DurationAmino; + /** timestamp */ + date?: string; + d_o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + d_o_pubkey: AnyAmino; + /** array scalar */ + nums?: number[]; + d_o_nums: number[]; + /** array bigint */ + bigs?: string[]; + d_o_bigs: string[]; + /** array bytes */ + salts?: string[]; + d_o_salts: string[]; + /** array raw bytes */ + raws?: any[]; + d_o_raws: any[]; + /** array wasm bytes */ + wasms?: string[]; + d_o_wasms: string[]; + /** array enum */ + opts?: VoteOption[]; + d_o_opts: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + d_o_periods: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + d_o_protos: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + d_o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitAmino { + /** scalar */ + str?: string; + o_str?: string; + b?: boolean; + o_b?: boolean; + num?: number; + o_num?: number; + /** bigint */ + big?: string; + o_big?: string; + /** protoType */ + proto?: AccessConfigAmino; + o_proto?: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + o_auth?: AnyAmino; + /** bytes */ + salt?: string; + o_salt?: string; + /** raw bytes */ + raw?: any; + o_raw?: any; + /** wasm bytes */ + wasm?: string; + o_wasm?: string; + /** enum */ + opt?: VoteOption; + o_opt?: VoteOption; + /** duration */ + period?: DurationAmino; + o_period?: DurationAmino; + /** timestamp */ + date?: string; + o_date?: string; + /** pubkey */ + pubkey?: AnyAmino; + o_pubkey?: AnyAmino; + /** array scalar */ + nums?: number[]; + o_nums?: number[]; + /** array bigint */ + bigs?: string[]; + o_bigs?: string[]; + /** array bytes */ + salts?: string[]; + o_salts?: string[]; + /** array raw bytes */ + raws?: any[]; + o_raws?: any[]; + /** array wasm bytes */ + wasms?: string[]; + o_wasms?: string[]; + /** array enum */ + opts?: VoteOption[]; + o_opts?: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + o_periods?: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + o_protos?: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + o_auths?: AnyAmino[]; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts index d3c7d41a1b..a446b4fc5b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts @@ -1,4 +1,18 @@ -import * as _69 from "./eval_request"; +import * as _124 from "./amino_fields"; +import * as _125 from "./eval_request"; +import * as _126 from "./tx"; +import * as _127 from "./tx.amino"; +import * as _128 from "./tx.registry"; +import * as _129 from "./tx.rpc.msg"; +import * as _130 from "./rpc.tx"; export const misc = { - ..._69 + ..._124, + ..._125, + ..._126, + ..._127, + ..._128, + ..._129, + ClientFactory: { + ..._130 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/client.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts index 2ccc57254c..b321f10547 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/eval_request.ts @@ -1,11 +1,6 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -182,188 +177,6 @@ export interface GenericAuthorizationAmino { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -1056,1074 +869,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.amino.ts new file mode 100644 index 0000000000..0d46c9a916 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.amino.ts @@ -0,0 +1,9 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: InputMsg.toAmino, + fromAmino: InputMsg.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts new file mode 100644 index 0000000000..0ff4e3540c --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/tx.ts @@ -0,0 +1,213 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitAmino, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitAmino, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgAmino { + d_o_tests?: AminoEncodingTestForDontOmitAmino; + o_tests?: AminoEncodingTestForOmitAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseAmino {} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts index 4b48ade873..cb53ce409c 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _28 from "./gogo"; +import * as _59 from "./gogo"; export const gogoproto = { - ..._28 + ..._59 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts index e159ab5791..fd5144dcd9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _29 from "./api/expr/v1alpha1/eval"; -import * as _30 from "./protobuf/any"; -import * as _31 from "./protobuf/duration"; -import * as _32 from "./protobuf/timestamp"; -import * as _33 from "./protobuf/descriptor"; +import * as _60 from "./api/expr/v1alpha1/eval"; +import * as _61 from "./protobuf/any"; +import * as _62 from "./protobuf/duration"; +import * as _63 from "./protobuf/timestamp"; +import * as _64 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._29 + ..._60 }; } } export const protobuf = { - ..._30, - ..._31, - ..._32, - ..._33 + ..._61, + ..._62, + ..._63, + ..._64 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts new file mode 100644 index 0000000000..70ea955b33 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts @@ -0,0 +1,1907 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts index ce65a43b11..d05cc1c7ec 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts @@ -1,4 +1,14 @@ -import * as _34 from "./eval_request"; +import * as _65 from "./amino_fields"; +import * as _66 from "./eval_request"; +import * as _67 from "./tx"; +import * as _68 from "./tx.rpc.msg"; +import * as _69 from "./rpc.tx"; export const misc = { - ..._34 + ..._65, + ..._66, + ..._67, + ..._68, + ClientFactory: { + ..._69 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts index b4bade42d9..cb5a5b027e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/eval_request.ts @@ -1,9 +1,6 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -124,118 +121,6 @@ export interface GenericAuthorization { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -758,842 +643,4 @@ export const GenericAuthorization = { obj.msg = message.msg; return obj; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts new file mode 100644 index 0000000000..b48845c6d6 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/tx.ts @@ -0,0 +1,147 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts index 5c6938e573..5cfa81caa6 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _21 from "./gogo"; +import * as _48 from "./gogo"; export const gogoproto = { - ..._21 + ..._48 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts index 678daf650a..099f7e617f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _22 from "./api/expr/v1alpha1/eval"; -import * as _23 from "./protobuf/any"; -import * as _24 from "./protobuf/duration"; -import * as _25 from "./protobuf/timestamp"; -import * as _26 from "./protobuf/descriptor"; +import * as _49 from "./api/expr/v1alpha1/eval"; +import * as _50 from "./protobuf/any"; +import * as _51 from "./protobuf/duration"; +import * as _52 from "./protobuf/timestamp"; +import * as _53 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._22 + ..._49 }; } } export const protobuf = { - ..._23, - ..._24, - ..._25, - ..._26 + ..._50, + ..._51, + ..._52, + ..._53 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts new file mode 100644 index 0000000000..4a5b8c662a --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts @@ -0,0 +1,2387 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts index 006280c77c..b32a02dca1 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts @@ -1,4 +1,14 @@ -import * as _27 from "./eval_request"; +import * as _54 from "./amino_fields"; +import * as _55 from "./eval_request"; +import * as _56 from "./tx"; +import * as _57 from "./tx.rpc.msg"; +import * as _58 from "./rpc.tx"; export const misc = { - ..._27 + ..._54, + ..._55, + ..._56, + ..._57, + ClientFactory: { + ..._58 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts index a65efe04e9..e75506a8a2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/eval_request.ts @@ -1,11 +1,6 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -146,122 +141,6 @@ export interface GenericAuthorizationProtoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -969,1077 +848,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts new file mode 100644 index 0000000000..1e7aeb0e5a --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/tx.ts @@ -0,0 +1,209 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts index 35aacd21ad..d2e9312f2e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _14 from "./gogo"; +import * as _24 from "./gogo"; export const gogoproto = { - ..._14 + ..._24 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts index 9bc838d884..b29367d0ff 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _15 from "./api/expr/v1alpha1/eval"; -import * as _16 from "./protobuf/any"; -import * as _17 from "./protobuf/duration"; -import * as _18 from "./protobuf/timestamp"; -import * as _19 from "./protobuf/descriptor"; +import * as _25 from "./api/expr/v1alpha1/eval"; +import * as _26 from "./protobuf/any"; +import * as _27 from "./protobuf/duration"; +import * as _28 from "./protobuf/timestamp"; +import * as _29 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._15 + ..._25 }; } } export const protobuf = { - ..._16, - ..._17, - ..._18, - ..._19 + ..._26, + ..._27, + ..._28, + ..._29 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts new file mode 100644 index 0000000000..70ea955b33 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts @@ -0,0 +1,1907 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts index 070f700b7e..08a786bb04 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts @@ -1,4 +1,14 @@ -import * as _20 from "./eval_request"; +import * as _30 from "./amino_fields"; +import * as _31 from "./eval_request"; +import * as _32 from "./tx"; +import * as _33 from "./tx.rpc.msg"; +import * as _34 from "./rpc.tx"; export const misc = { - ..._20 + ..._30, + ..._31, + ..._32, + ..._33, + ClientFactory: { + ..._34 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts index b4bade42d9..cb5a5b027e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/eval_request.ts @@ -1,9 +1,6 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -124,118 +121,6 @@ export interface GenericAuthorization { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -758,842 +643,4 @@ export const GenericAuthorization = { obj.msg = message.msg; return obj; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts new file mode 100644 index 0000000000..b48845c6d6 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/tx.ts @@ -0,0 +1,147 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts index 3a745a9194..6a167339ea 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _7 from "./gogo"; +import * as _13 from "./gogo"; export const gogoproto = { - ..._7 + ..._13 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts index 9c5946e6af..7d94284e1c 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _8 from "./api/expr/v1alpha1/eval"; -import * as _9 from "./protobuf/any"; -import * as _10 from "./protobuf/duration"; -import * as _11 from "./protobuf/timestamp"; -import * as _12 from "./protobuf/descriptor"; +import * as _14 from "./api/expr/v1alpha1/eval"; +import * as _15 from "./protobuf/any"; +import * as _16 from "./protobuf/duration"; +import * as _17 from "./protobuf/timestamp"; +import * as _18 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._8 + ..._14 }; } } export const protobuf = { - ..._9, - ..._10, - ..._11, - ..._12 + ..._15, + ..._16, + ..._17, + ..._18 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts new file mode 100644 index 0000000000..4a5b8c662a --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts @@ -0,0 +1,2387 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts index 9fe7cf8657..9c173466a5 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts @@ -1,4 +1,14 @@ -import * as _13 from "./eval_request"; +import * as _19 from "./amino_fields"; +import * as _20 from "./eval_request"; +import * as _21 from "./tx"; +import * as _22 from "./tx.rpc.msg"; +import * as _23 from "./rpc.tx"; export const misc = { - ..._13 + ..._19, + ..._20, + ..._21, + ..._22, + ClientFactory: { + ..._23 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts index a65efe04e9..e75506a8a2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/eval_request.ts @@ -1,11 +1,6 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -146,122 +141,6 @@ export interface GenericAuthorizationProtoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -969,1077 +848,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts new file mode 100644 index 0000000000..1e7aeb0e5a --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/tx.ts @@ -0,0 +1,209 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts index fcb7615ef6..2d45725f12 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _42 from "./gogo"; +import * as _81 from "./gogo"; export const gogoproto = { - ..._42 + ..._81 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts index b9c42cb237..ec7d7ceb55 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _43 from "./api/expr/v1alpha1/eval"; -import * as _44 from "./protobuf/any"; -import * as _45 from "./protobuf/duration"; -import * as _46 from "./protobuf/timestamp"; -import * as _47 from "./protobuf/descriptor"; +import * as _82 from "./api/expr/v1alpha1/eval"; +import * as _83 from "./protobuf/any"; +import * as _84 from "./protobuf/duration"; +import * as _85 from "./protobuf/timestamp"; +import * as _86 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._43 + ..._82 }; } } export const protobuf = { - ..._44, - ..._45, - ..._46, - ..._47 + ..._83, + ..._84, + ..._85, + ..._86 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts new file mode 100644 index 0000000000..d961ddf7ad --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts @@ -0,0 +1,1939 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts index 767816b5eb..20249cfd02 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts @@ -1,4 +1,14 @@ -import * as _48 from "./eval_request"; +import * as _87 from "./amino_fields"; +import * as _88 from "./eval_request"; +import * as _89 from "./tx"; +import * as _90 from "./tx.rpc.msg"; +import * as _91 from "./rpc.tx"; export const misc = { - ..._48 + ..._87, + ..._88, + ..._89, + ..._90, + ClientFactory: { + ..._91 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts index 11444cdf8d..2d7916cb1d 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/eval_request.ts @@ -1,9 +1,6 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -144,122 +141,6 @@ export interface GenericAuthorizationProtoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -830,854 +711,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts new file mode 100644 index 0000000000..540a98a4f8 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/tx.ts @@ -0,0 +1,179 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts index 9b9fc6d670..0a786ca9fc 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _35 from "./gogo"; +import * as _70 from "./gogo"; export const gogoproto = { - ..._35 + ..._70 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts index 39ebd5c73e..8800ad45c8 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _36 from "./api/expr/v1alpha1/eval"; -import * as _37 from "./protobuf/any"; -import * as _38 from "./protobuf/duration"; -import * as _39 from "./protobuf/timestamp"; -import * as _40 from "./protobuf/descriptor"; +import * as _71 from "./api/expr/v1alpha1/eval"; +import * as _72 from "./protobuf/any"; +import * as _73 from "./protobuf/duration"; +import * as _74 from "./protobuf/timestamp"; +import * as _75 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._36 + ..._71 }; } } export const protobuf = { - ..._37, - ..._38, - ..._39, - ..._40 + ..._72, + ..._73, + ..._74, + ..._75 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts new file mode 100644 index 0000000000..d961ddf7ad --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts @@ -0,0 +1,1939 @@ +import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts index 40d524ca4c..7927f70a98 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts @@ -1,4 +1,14 @@ -import * as _41 from "./eval_request"; +import * as _76 from "./amino_fields"; +import * as _77 from "./eval_request"; +import * as _78 from "./tx"; +import * as _79 from "./tx.rpc.msg"; +import * as _80 from "./rpc.tx"; export const misc = { - ..._41 + ..._76, + ..._77, + ..._78, + ..._79, + ClientFactory: { + ..._80 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts index 11444cdf8d..2d7916cb1d 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/eval_request.ts @@ -1,9 +1,6 @@ import { ExprValue, ExprValueSDKType, IdRef, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -144,122 +141,6 @@ export interface GenericAuthorizationProtoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -830,854 +711,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/rpc.tx.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts new file mode 100644 index 0000000000..540a98a4f8 --- /dev/null +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/tx.ts @@ -0,0 +1,179 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output/index.ts b/__fixtures__/misc/output/index.ts index 775295ffb7..d219f262cb 100644 --- a/__fixtures__/misc/output/index.ts +++ b/__fixtures__/misc/output/index.ts @@ -7,6 +7,7 @@ export * from "./gogoproto/bundle"; export * from "./google/bundle"; export * from "./misc/bundle"; +export * from "./misc/client"; export * from "./extern"; export * from "./react-query"; export * from "./mobx"; diff --git a/__fixtures__/misc/output/misc/amino_fields.ts b/__fixtures__/misc/output/misc/amino_fields.ts new file mode 100644 index 0000000000..ad128f88ec --- /dev/null +++ b/__fixtures__/misc/output/misc/amino_fields.ts @@ -0,0 +1,2527 @@ +import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; +import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; +import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; +import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; +import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; +import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +export const protobufPackage = "misc"; +export interface AminoEncodingTestForDontOmit { + /** scalar */ + str: string; + dOStr: string; + b: boolean; + dOB: boolean; + num: number; + dONum: number; + /** bigint */ + big: bigint; + dOBig: bigint; + /** protoType */ + proto?: AccessConfig; + dOProto: AccessConfig; + /** anyType */ + auth?: Any; + dOAuth: Any; + /** bytes */ + salt: Uint8Array; + dOSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + dORaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + dOWasm: Uint8Array; + /** enum */ + opt: VoteOption; + dOOpt: VoteOption; + /** duration */ + period?: Duration; + dOPeriod: Duration; + /** timestamp */ + date?: Date; + dODate: Date; + /** pubkey */ + pubkey?: Any; + dOPubkey: Any; + /** array scalar */ + nums: number[]; + dONums: number[]; + /** array bigint */ + bigs: bigint[]; + dOBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + dOSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + dORaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + dOWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + dOOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + dOPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + dOProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + dOAuths: Any[]; +} +export interface AminoEncodingTestForDontOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForDontOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForDontOmitAmino { + /** scalar */ + str?: string; + d_o_str: string; + b?: boolean; + d_o_b: boolean; + num?: number; + d_o_num: number; + /** bigint */ + big?: string; + d_o_big: string; + /** protoType */ + proto?: AccessConfigAmino; + d_o_proto: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + d_o_auth: AnyAmino; + /** bytes */ + salt?: string; + d_o_salt: string; + /** raw bytes */ + raw?: any; + d_o_raw: any; + /** wasm bytes */ + wasm?: string; + d_o_wasm: string; + /** enum */ + opt?: VoteOption; + d_o_opt: VoteOption; + /** duration */ + period?: DurationAmino; + d_o_period: DurationAmino; + /** timestamp */ + date?: string; + d_o_date: string; + /** pubkey */ + pubkey?: AnyAmino; + d_o_pubkey: AnyAmino; + /** array scalar */ + nums?: number[]; + d_o_nums: number[]; + /** array bigint */ + bigs?: string[]; + d_o_bigs: string[]; + /** array bytes */ + salts?: string[]; + d_o_salts: string[]; + /** array raw bytes */ + raws?: any[]; + d_o_raws: any[]; + /** array wasm bytes */ + wasms?: string[]; + d_o_wasms: string[]; + /** array enum */ + opts?: VoteOption[]; + d_o_opts: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + d_o_periods: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + d_o_protos: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + d_o_auths: AnyAmino[]; +} +export interface AminoEncodingTestForDontOmitAminoMsg { + type: "/misc.AminoEncodingTestForDontOmit"; + value: AminoEncodingTestForDontOmitAmino; +} +export interface AminoEncodingTestForDontOmitSDKType { + str: string; + d_o_str: string; + b: boolean; + d_o_b: boolean; + num: number; + d_o_num: number; + big: bigint; + d_o_big: bigint; + proto?: AccessConfigSDKType; + d_o_proto: AccessConfigSDKType; + auth?: AnySDKType; + d_o_auth: AnySDKType; + salt: Uint8Array; + d_o_salt: Uint8Array; + raw: Uint8Array; + d_o_raw: Uint8Array; + wasm: Uint8Array; + d_o_wasm: Uint8Array; + opt: VoteOption; + d_o_opt: VoteOption; + period?: DurationSDKType; + d_o_period: DurationSDKType; + date?: Date; + d_o_date: Date; + pubkey?: AnySDKType; + d_o_pubkey: AnySDKType; + nums: number[]; + d_o_nums: number[]; + bigs: bigint[]; + d_o_bigs: bigint[]; + salts: Uint8Array[]; + d_o_salts: Uint8Array[]; + raws: Uint8Array[]; + d_o_raws: Uint8Array[]; + wasms: Uint8Array[]; + d_o_wasms: Uint8Array[]; + opts: VoteOption[]; + d_o_opts: VoteOption[]; + periods: DurationSDKType[]; + d_o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + d_o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + d_o_auths: AnySDKType[]; +} +export interface AminoEncodingTestForOmit { + /** scalar */ + str: string; + oStr: string; + b: boolean; + oB: boolean; + num: number; + oNum: number; + /** bigint */ + big: bigint; + oBig: bigint; + /** protoType */ + proto?: AccessConfig; + oProto: AccessConfig; + /** anyType */ + auth?: Any; + oAuth: Any; + /** bytes */ + salt: Uint8Array; + oSalt: Uint8Array; + /** raw bytes */ + raw: Uint8Array; + oRaw: Uint8Array; + /** wasm bytes */ + wasm: Uint8Array; + oWasm: Uint8Array; + /** enum */ + opt: VoteOption; + oOpt: VoteOption; + /** duration */ + period?: Duration; + oPeriod: Duration; + /** timestamp */ + date?: Date; + oDate: Date; + /** pubkey */ + pubkey?: Any; + oPubkey: Any; + /** array scalar */ + nums: number[]; + oNums: number[]; + /** array bigint */ + bigs: bigint[]; + oBigs: bigint[]; + /** array bytes */ + salts: Uint8Array[]; + oSalts: Uint8Array[]; + /** array raw bytes */ + raws: Uint8Array[]; + oRaws: Uint8Array[]; + /** array wasm bytes */ + wasms: Uint8Array[]; + oWasms: Uint8Array[]; + /** array enum */ + opts: VoteOption[]; + oOpts: VoteOption[]; + /** array duration */ + periods: Duration[]; + oPeriods: Duration[]; + /** array protoType */ + protos: AccessConfig[]; + oProtos: AccessConfig[]; + /** array anyType */ + auths: Any[]; + oAuths: Any[]; +} +export interface AminoEncodingTestForOmitProtoMsg { + typeUrl: "/misc.AminoEncodingTestForOmit"; + value: Uint8Array; +} +export interface AminoEncodingTestForOmitAmino { + /** scalar */ + str?: string; + o_str?: string; + b?: boolean; + o_b?: boolean; + num?: number; + o_num?: number; + /** bigint */ + big?: string; + o_big?: string; + /** protoType */ + proto?: AccessConfigAmino; + o_proto?: AccessConfigAmino; + /** anyType */ + auth?: AnyAmino; + o_auth?: AnyAmino; + /** bytes */ + salt?: string; + o_salt?: string; + /** raw bytes */ + raw?: any; + o_raw?: any; + /** wasm bytes */ + wasm?: string; + o_wasm?: string; + /** enum */ + opt?: VoteOption; + o_opt?: VoteOption; + /** duration */ + period?: DurationAmino; + o_period?: DurationAmino; + /** timestamp */ + date?: string; + o_date?: string; + /** pubkey */ + pubkey?: AnyAmino; + o_pubkey?: AnyAmino; + /** array scalar */ + nums?: number[]; + o_nums?: number[]; + /** array bigint */ + bigs?: string[]; + o_bigs?: string[]; + /** array bytes */ + salts?: string[]; + o_salts?: string[]; + /** array raw bytes */ + raws?: any[]; + o_raws?: any[]; + /** array wasm bytes */ + wasms?: string[]; + o_wasms?: string[]; + /** array enum */ + opts?: VoteOption[]; + o_opts?: VoteOption[]; + /** array duration */ + periods?: DurationAmino[]; + o_periods?: DurationAmino[]; + /** array protoType */ + protos?: AccessConfigAmino[]; + o_protos?: AccessConfigAmino[]; + /** array anyType */ + auths?: AnyAmino[]; + o_auths?: AnyAmino[]; +} +export interface AminoEncodingTestForOmitAminoMsg { + type: "/misc.AminoEncodingTestForOmit"; + value: AminoEncodingTestForOmitAmino; +} +export interface AminoEncodingTestForOmitSDKType { + str: string; + o_str: string; + b: boolean; + o_b: boolean; + num: number; + o_num: number; + big: bigint; + o_big: bigint; + proto?: AccessConfigSDKType; + o_proto: AccessConfigSDKType; + auth?: AnySDKType; + o_auth: AnySDKType; + salt: Uint8Array; + o_salt: Uint8Array; + raw: Uint8Array; + o_raw: Uint8Array; + wasm: Uint8Array; + o_wasm: Uint8Array; + opt: VoteOption; + o_opt: VoteOption; + period?: DurationSDKType; + o_period: DurationSDKType; + date?: Date; + o_date: Date; + pubkey?: AnySDKType; + o_pubkey: AnySDKType; + nums: number[]; + o_nums: number[]; + bigs: bigint[]; + o_bigs: bigint[]; + salts: Uint8Array[]; + o_salts: Uint8Array[]; + raws: Uint8Array[]; + o_raws: Uint8Array[]; + wasms: Uint8Array[]; + o_wasms: Uint8Array[]; + opts: VoteOption[]; + o_opts: VoteOption[]; + periods: DurationSDKType[]; + o_periods: DurationSDKType[]; + protos: AccessConfigSDKType[]; + o_protos: AccessConfigSDKType[]; + auths: AnySDKType[]; + o_auths: AnySDKType[]; +} +function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { + return { + str: "", + dOStr: "", + b: false, + dOB: false, + num: 0, + dONum: 0, + big: BigInt(0), + dOBig: BigInt(0), + proto: undefined, + dOProto: AccessConfig.fromPartial({}), + auth: undefined, + dOAuth: Any.fromPartial({}), + salt: new Uint8Array(), + dOSalt: new Uint8Array(), + raw: new Uint8Array(), + dORaw: new Uint8Array(), + wasm: new Uint8Array(), + dOWasm: new Uint8Array(), + opt: 0, + dOOpt: 0, + period: undefined, + dOPeriod: Duration.fromPartial({}), + date: undefined, + dODate: new Date(), + pubkey: undefined, + dOPubkey: Any.fromPartial({}), + nums: [], + dONums: [], + bigs: [], + dOBigs: [], + salts: [], + dOSalts: [], + raws: [], + dORaws: [], + wasms: [], + dOWasms: [], + opts: [], + dOOpts: [], + periods: [], + dOPeriods: [], + protos: [], + dOProtos: [], + auths: [], + dOAuths: [] + }; +} +export const AminoEncodingTestForDontOmit = { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.dOStr !== "") { + writer.uint32(18).string(message.dOStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.dOB === true) { + writer.uint32(32).bool(message.dOB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.dONum !== 0) { + writer.uint32(48).int32(message.dONum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.dOBig !== BigInt(0)) { + writer.uint32(64).int64(message.dOBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.dOProto !== undefined) { + AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.dOAuth !== undefined) { + Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.dOSalt.length !== 0) { + writer.uint32(114).bytes(message.dOSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.dORaw.length !== 0) { + writer.uint32(130).bytes(message.dORaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.dOWasm.length !== 0) { + writer.uint32(146).bytes(message.dOWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.dOOpt !== 0) { + writer.uint32(160).int32(message.dOOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.dOPeriod !== undefined) { + Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.dODate !== undefined) { + Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.dOPubkey !== undefined) { + Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.dONums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.dOBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.dOSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.dORaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.dOWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.dOOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.dOPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.dOProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.dOAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForDontOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.dOStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.dOB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.dONum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.dOBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.dOProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.dOAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.dOSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.dORaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.dOWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.dOOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.dOPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.dOPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dONums.push(reader.int32()); + } + } else { + message.dONums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOBigs.push(reader.int64()); + } + } else { + message.dOBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.dOSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.dORaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.dOWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.dOOpts.push((reader.int32() as any)); + } + } else { + message.dOOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.dOPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.dOAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForDontOmit { + const obj = createBaseAminoEncodingTestForDontOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.dONum)) obj.dONum = Number(object.dONum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForDontOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.dOStr !== undefined && (obj.dOStr = message.dOStr); + message.b !== undefined && (obj.b = message.b); + message.dOB !== undefined && (obj.dOB = message.dOB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.dONums = message.dONums.map(e => Math.round(e)); + } else { + obj.dONums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.dOBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dORaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.dOWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.dOOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.dOPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.dOProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.dOAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + message.str = object.str ?? ""; + message.dOStr = object.dOStr ?? ""; + message.b = object.b ?? false; + message.dOB = object.dOB ?? false; + message.num = object.num ?? 0; + message.dONum = object.dONum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.dOBig !== undefined && object.dOBig !== null) { + message.dOBig = BigInt(object.dOBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.dOProto !== undefined && object.dOProto !== null) { + message.dOProto = AccessConfig.fromPartial(object.dOProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.dOAuth !== undefined && object.dOAuth !== null) { + message.dOAuth = Any.fromPartial(object.dOAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.dOSalt = object.dOSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.dORaw = object.dORaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.dOWasm = object.dOWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.dOOpt = object.dOOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.dOPeriod !== undefined && object.dOPeriod !== null) { + message.dOPeriod = Duration.fromPartial(object.dOPeriod); + } + message.date = object.date ?? undefined; + message.dODate = object.dODate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.dOPubkey !== undefined && object.dOPubkey !== null) { + message.dOPubkey = Any.fromPartial(object.dOPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.dONums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.dOSalts = object.dOSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.dORaws = object.dORaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.dOWasms = object.dOWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.dOOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { + return { + str: object?.str, + dOStr: object?.d_o_str, + b: object?.b, + dOB: object?.d_o_b, + num: object?.num, + dONum: object?.d_o_num, + big: object?.big, + dOBig: object?.d_o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, + salt: object?.salt, + dOSalt: object?.d_o_salt, + raw: object?.raw, + dORaw: object?.d_o_raw, + wasm: object?.wasm, + dOWasm: object?.d_o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, + date: object.date ?? undefined, + dODate: object.d_o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.d_o_str = message.dOStr; + obj.b = message.b; + obj.d_o_b = message.dOB; + obj.num = message.num; + obj.d_o_num = message.dONum; + obj.big = message.big; + obj.d_o_big = message.dOBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); + obj.salt = message.salt; + obj.d_o_salt = message.dOSalt; + obj.raw = message.raw; + obj.d_o_raw = message.dORaw; + obj.wasm = message.wasm; + obj.d_o_wasm = message.dOWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e); + } else { + obj.d_o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => e); + } else { + obj.d_o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => e); + } else { + obj.d_o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => e); + } else { + obj.d_o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); + } else { + obj.d_o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.d_o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.d_o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.d_o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { + const message = createBaseAminoEncodingTestForDontOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.d_o_str !== undefined && object.d_o_str !== null) { + message.dOStr = object.d_o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.d_o_b !== undefined && object.d_o_b !== null) { + message.dOB = object.d_o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.d_o_num !== undefined && object.d_o_num !== null) { + message.dONum = object.d_o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.d_o_big !== undefined && object.d_o_big !== null) { + message.dOBig = BigInt(object.d_o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.d_o_proto !== undefined && object.d_o_proto !== null) { + message.dOProto = AccessConfig.fromAmino(object.d_o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.d_o_auth !== undefined && object.d_o_auth !== null) { + message.dOAuth = Any.fromAmino(object.d_o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.d_o_salt !== undefined && object.d_o_salt !== null) { + message.dOSalt = bytesFromBase64(object.d_o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.d_o_raw !== undefined && object.d_o_raw !== null) { + message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { + message.dOWasm = fromBase64(object.d_o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.d_o_opt !== undefined && object.d_o_opt !== null) { + message.dOOpt = object.d_o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.d_o_period !== undefined && object.d_o_period !== null) { + message.dOPeriod = Duration.fromAmino(object.d_o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.d_o_date !== undefined && object.d_o_date !== null) { + message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { + message.dOPubkey = encodePubkey(object.d_o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.dONums = object.d_o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.dOOpts = object.d_o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.b = message.b === false ? undefined : message.b; + obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.num = message.num === 0 ? undefined : message.num; + obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; + obj.big = message.big ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.dONums) { + obj.d_o_nums = message.dONums.map(e => e); + } else { + obj.d_o_nums = message.dONums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.dOBigs) { + obj.d_o_bigs = message.dOBigs.map(e => e.toString()); + } else { + obj.d_o_bigs = message.dOBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.dOSalts) { + obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); + } else { + obj.d_o_salts = message.dOSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.dORaws) { + obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.d_o_raws = message.dORaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.dOWasms) { + obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); + } else { + obj.d_o_wasms = message.dOWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.dOOpts) { + obj.d_o_opts = message.dOOpts.map(e => e); + } else { + obj.d_o_opts = message.dOOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.dOPeriods) { + obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.d_o_periods = message.dOPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.dOProtos) { + obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.d_o_protos = message.dOProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.dOAuths) { + obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.d_o_auths = message.dOAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { + return AminoEncodingTestForDontOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForDontOmit): Uint8Array { + return AminoEncodingTestForDontOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForDontOmit", + value: AminoEncodingTestForDontOmit.encode(message).finish() + }; + } +}; +function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { + return { + str: "", + oStr: "", + b: false, + oB: false, + num: 0, + oNum: 0, + big: BigInt(0), + oBig: BigInt(0), + proto: undefined, + oProto: AccessConfig.fromPartial({}), + auth: undefined, + oAuth: Any.fromPartial({}), + salt: new Uint8Array(), + oSalt: new Uint8Array(), + raw: new Uint8Array(), + oRaw: new Uint8Array(), + wasm: new Uint8Array(), + oWasm: new Uint8Array(), + opt: 0, + oOpt: 0, + period: undefined, + oPeriod: Duration.fromPartial({}), + date: undefined, + oDate: new Date(), + pubkey: undefined, + oPubkey: Any.fromPartial({}), + nums: [], + oNums: [], + bigs: [], + oBigs: [], + salts: [], + oSalts: [], + raws: [], + oRaws: [], + wasms: [], + oWasms: [], + opts: [], + oOpts: [], + periods: [], + oPeriods: [], + protos: [], + oProtos: [], + auths: [], + oAuths: [] + }; +} +export const AminoEncodingTestForOmit = { + typeUrl: "/misc.AminoEncodingTestForOmit", + encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.str !== "") { + writer.uint32(10).string(message.str); + } + if (message.oStr !== "") { + writer.uint32(18).string(message.oStr); + } + if (message.b === true) { + writer.uint32(24).bool(message.b); + } + if (message.oB === true) { + writer.uint32(32).bool(message.oB); + } + if (message.num !== 0) { + writer.uint32(40).int32(message.num); + } + if (message.oNum !== 0) { + writer.uint32(48).int32(message.oNum); + } + if (message.big !== BigInt(0)) { + writer.uint32(56).int64(message.big); + } + if (message.oBig !== BigInt(0)) { + writer.uint32(64).int64(message.oBig); + } + if (message.proto !== undefined) { + AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); + } + if (message.oProto !== undefined) { + AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); + } + if (message.auth !== undefined) { + Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); + } + if (message.oAuth !== undefined) { + Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); + } + if (message.salt.length !== 0) { + writer.uint32(106).bytes(message.salt); + } + if (message.oSalt.length !== 0) { + writer.uint32(114).bytes(message.oSalt); + } + if (message.raw.length !== 0) { + writer.uint32(122).bytes(message.raw); + } + if (message.oRaw.length !== 0) { + writer.uint32(130).bytes(message.oRaw); + } + if (message.wasm.length !== 0) { + writer.uint32(138).bytes(message.wasm); + } + if (message.oWasm.length !== 0) { + writer.uint32(146).bytes(message.oWasm); + } + if (message.opt !== 0) { + writer.uint32(152).int32(message.opt); + } + if (message.oOpt !== 0) { + writer.uint32(160).int32(message.oOpt); + } + if (message.period !== undefined) { + Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); + } + if (message.oPeriod !== undefined) { + Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); + } + if (message.date !== undefined) { + Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); + } + if (message.oDate !== undefined) { + Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); + } + if (message.pubkey !== undefined) { + Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); + } + if (message.oPubkey !== undefined) { + Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); + } + writer.uint32(218).fork(); + for (const v of message.nums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(226).fork(); + for (const v of message.oNums) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(234).fork(); + for (const v of message.bigs) { + writer.int64(v); + } + writer.ldelim(); + writer.uint32(242).fork(); + for (const v of message.oBigs) { + writer.int64(v); + } + writer.ldelim(); + for (const v of message.salts) { + writer.uint32(250).bytes(v!); + } + for (const v of message.oSalts) { + writer.uint32(258).bytes(v!); + } + for (const v of message.raws) { + writer.uint32(266).bytes(v!); + } + for (const v of message.oRaws) { + writer.uint32(274).bytes(v!); + } + for (const v of message.wasms) { + writer.uint32(282).bytes(v!); + } + for (const v of message.oWasms) { + writer.uint32(290).bytes(v!); + } + writer.uint32(298).fork(); + for (const v of message.opts) { + writer.int32(v); + } + writer.ldelim(); + writer.uint32(306).fork(); + for (const v of message.oOpts) { + writer.int32(v); + } + writer.ldelim(); + for (const v of message.periods) { + Duration.encode(v!, writer.uint32(314).fork()).ldelim(); + } + for (const v of message.oPeriods) { + Duration.encode(v!, writer.uint32(322).fork()).ldelim(); + } + for (const v of message.protos) { + AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); + } + for (const v of message.oProtos) { + AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); + } + for (const v of message.auths) { + Any.encode(v!, writer.uint32(362).fork()).ldelim(); + } + for (const v of message.oAuths) { + Any.encode(v!, writer.uint32(370).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseAminoEncodingTestForOmit(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.str = reader.string(); + break; + case 2: + message.oStr = reader.string(); + break; + case 3: + message.b = reader.bool(); + break; + case 4: + message.oB = reader.bool(); + break; + case 5: + message.num = reader.int32(); + break; + case 6: + message.oNum = reader.int32(); + break; + case 7: + message.big = reader.int64(); + break; + case 8: + message.oBig = reader.int64(); + break; + case 9: + message.proto = AccessConfig.decode(reader, reader.uint32()); + break; + case 10: + message.oProto = AccessConfig.decode(reader, reader.uint32()); + break; + case 11: + message.auth = Any.decode(reader, reader.uint32()); + break; + case 12: + message.oAuth = Any.decode(reader, reader.uint32()); + break; + case 13: + message.salt = reader.bytes(); + break; + case 14: + message.oSalt = reader.bytes(); + break; + case 15: + message.raw = reader.bytes(); + break; + case 16: + message.oRaw = reader.bytes(); + break; + case 17: + message.wasm = reader.bytes(); + break; + case 18: + message.oWasm = reader.bytes(); + break; + case 19: + message.opt = (reader.int32() as any); + break; + case 20: + message.oOpt = (reader.int32() as any); + break; + case 21: + message.period = Duration.decode(reader, reader.uint32()); + break; + case 22: + message.oPeriod = Duration.decode(reader, reader.uint32()); + break; + case 23: + message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 24: + message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); + break; + case 25: + message.pubkey = Any.decode(reader, reader.uint32()); + break; + case 26: + message.oPubkey = Any.decode(reader, reader.uint32()); + break; + case 27: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.nums.push(reader.int32()); + } + } else { + message.nums.push(reader.int32()); + } + break; + case 28: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oNums.push(reader.int32()); + } + } else { + message.oNums.push(reader.int32()); + } + break; + case 29: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.bigs.push(reader.int64()); + } + } else { + message.bigs.push(reader.int64()); + } + break; + case 30: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oBigs.push(reader.int64()); + } + } else { + message.oBigs.push(reader.int64()); + } + break; + case 31: + message.salts.push(reader.bytes()); + break; + case 32: + message.oSalts.push(reader.bytes()); + break; + case 33: + message.raws.push(reader.bytes()); + break; + case 34: + message.oRaws.push(reader.bytes()); + break; + case 35: + message.wasms.push(reader.bytes()); + break; + case 36: + message.oWasms.push(reader.bytes()); + break; + case 37: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.opts.push((reader.int32() as any)); + } + } else { + message.opts.push((reader.int32() as any)); + } + break; + case 38: + if ((tag & 7) === 2) { + const end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) { + message.oOpts.push((reader.int32() as any)); + } + } else { + message.oOpts.push((reader.int32() as any)); + } + break; + case 39: + message.periods.push(Duration.decode(reader, reader.uint32())); + break; + case 40: + message.oPeriods.push(Duration.decode(reader, reader.uint32())); + break; + case 43: + message.protos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 44: + message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); + break; + case 45: + message.auths.push(Any.decode(reader, reader.uint32())); + break; + case 46: + message.oAuths.push(Any.decode(reader, reader.uint32())); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): AminoEncodingTestForOmit { + const obj = createBaseAminoEncodingTestForOmit(); + if (isSet(object.str)) obj.str = String(object.str); + if (isSet(object.oStr)) obj.oStr = String(object.oStr); + if (isSet(object.b)) obj.b = Boolean(object.b); + if (isSet(object.oB)) obj.oB = Boolean(object.oB); + if (isSet(object.num)) obj.num = Number(object.num); + if (isSet(object.oNum)) obj.oNum = Number(object.oNum); + if (isSet(object.big)) obj.big = BigInt(object.big.toString()); + if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); + if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); + if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); + if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); + if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); + if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); + if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); + if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); + if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); + if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); + if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); + if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); + if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); + if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); + if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); + if (isSet(object.date)) obj.date = new Date(object.date); + if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); + if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); + if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); + if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); + if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); + if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); + if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); + if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); + if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); + if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); + if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); + if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); + return obj; + }, + toJSON(message: AminoEncodingTestForOmit): unknown { + const obj: any = {}; + message.str !== undefined && (obj.str = message.str); + message.oStr !== undefined && (obj.oStr = message.oStr); + message.b !== undefined && (obj.b = message.b); + message.oB !== undefined && (obj.oB = message.oB); + message.num !== undefined && (obj.num = Math.round(message.num)); + message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); + message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); + message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); + message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); + message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); + message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); + message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); + message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); + message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); + message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); + message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); + message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date.toISOString()); + message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => Math.round(e)); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.oNums = message.oNums.map(e => Math.round(e)); + } else { + obj.oNums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); + } else { + obj.oBigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oSalts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oRaws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); + } else { + obj.oWasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.oOpts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); + } else { + obj.oPeriods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); + } else { + obj.oProtos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); + } else { + obj.oAuths = []; + } + return obj; + }, + fromPartial(object: DeepPartial): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + message.str = object.str ?? ""; + message.oStr = object.oStr ?? ""; + message.b = object.b ?? false; + message.oB = object.oB ?? false; + message.num = object.num ?? 0; + message.oNum = object.oNum ?? 0; + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big.toString()); + } + if (object.oBig !== undefined && object.oBig !== null) { + message.oBig = BigInt(object.oBig.toString()); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromPartial(object.proto); + } + if (object.oProto !== undefined && object.oProto !== null) { + message.oProto = AccessConfig.fromPartial(object.oProto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromPartial(object.auth); + } + if (object.oAuth !== undefined && object.oAuth !== null) { + message.oAuth = Any.fromPartial(object.oAuth); + } + message.salt = object.salt ?? new Uint8Array(); + message.oSalt = object.oSalt ?? new Uint8Array(); + message.raw = object.raw ?? new Uint8Array(); + message.oRaw = object.oRaw ?? new Uint8Array(); + message.wasm = object.wasm ?? new Uint8Array(); + message.oWasm = object.oWasm ?? new Uint8Array(); + message.opt = object.opt ?? 0; + message.oOpt = object.oOpt ?? 0; + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromPartial(object.period); + } + if (object.oPeriod !== undefined && object.oPeriod !== null) { + message.oPeriod = Duration.fromPartial(object.oPeriod); + } + message.date = object.date ?? undefined; + message.oDate = object.oDate ?? undefined; + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = Any.fromPartial(object.pubkey); + } + if (object.oPubkey !== undefined && object.oPubkey !== null) { + message.oPubkey = Any.fromPartial(object.oPubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.oNums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; + message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; + message.salts = object.salts?.map(e => e) || []; + message.oSalts = object.oSalts?.map(e => e) || []; + message.raws = object.raws?.map(e => e) || []; + message.oRaws = object.oRaws?.map(e => e) || []; + message.wasms = object.wasms?.map(e => e) || []; + message.oWasms = object.oWasms?.map(e => e) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.oOpts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; + message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; + message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; + message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; + message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; + return message; + }, + fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { + return { + str: object?.str, + oStr: object?.o_str, + b: object?.b, + oB: object?.o_b, + num: object?.num, + oNum: object?.o_num, + big: object?.big, + oBig: object?.o_big, + proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, + oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, + auth: object.auth ? Any.fromSDK(object.auth) : undefined, + oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, + salt: object?.salt, + oSalt: object?.o_salt, + raw: object?.raw, + oRaw: object?.o_raw, + wasm: object?.wasm, + oWasm: object?.o_wasm, + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: object.period ? Duration.fromSDK(object.period) : undefined, + oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, + date: object.date ?? undefined, + oDate: object.o_date ?? undefined, + pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, + oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], + oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], + oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], + oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], + oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], + oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], + oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], + oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] + }; + }, + fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { + return { + str: isSet(object.str) ? String(object.str) : "", + o_str: isSet(object.o_str) ? String(object.o_str) : "", + b: isSet(object.b) ? Boolean(object.b) : false, + o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, + num: isSet(object.num) ? Number(object.num) : 0, + o_num: isSet(object.o_num) ? Number(object.o_num) : 0, + big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), + o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), + proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, + o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, + auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, + o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, + salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), + o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), + raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), + o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), + wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), + o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), + opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, + o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, + period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, + o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, + date: isSet(object.date) ? new Date(object.date) : undefined, + o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, + pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, + o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, + nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], + o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], + bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], + o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], + salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], + o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], + raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], + o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], + wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], + o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], + opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], + o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], + periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], + protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], + auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], + o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] + }; + }, + toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { + const obj: any = {}; + obj.str = message.str; + obj.o_str = message.oStr; + obj.b = message.b; + obj.o_b = message.oB; + obj.num = message.num; + obj.o_num = message.oNum; + obj.big = message.big; + obj.o_big = message.oBig; + message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); + message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); + message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); + message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); + obj.salt = message.salt; + obj.o_salt = message.oSalt; + obj.raw = message.raw; + obj.o_raw = message.oRaw; + obj.wasm = message.wasm; + obj.o_wasm = message.oWasm; + message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); + message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); + message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); + message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); + message.date !== undefined && (obj.date = message.date ?? undefined); + message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); + message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); + message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = []; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = []; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e); + } else { + obj.bigs = []; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e); + } else { + obj.o_bigs = []; + } + if (message.salts) { + obj.salts = message.salts.map(e => e); + } else { + obj.salts = []; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => e); + } else { + obj.o_salts = []; + } + if (message.raws) { + obj.raws = message.raws.map(e => e); + } else { + obj.raws = []; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => e); + } else { + obj.o_raws = []; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => e); + } else { + obj.wasms = []; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => e); + } else { + obj.o_wasms = []; + } + if (message.opts) { + obj.opts = message.opts.map(e => voteOptionToJSON(e)); + } else { + obj.opts = []; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); + } else { + obj.o_opts = []; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.periods = []; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); + } else { + obj.o_periods = []; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.protos = []; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); + } else { + obj.o_protos = []; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.auths = []; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); + } else { + obj.o_auths = []; + } + return obj; + }, + fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { + const message = createBaseAminoEncodingTestForOmit(); + if (object.str !== undefined && object.str !== null) { + message.str = object.str; + } + if (object.o_str !== undefined && object.o_str !== null) { + message.oStr = object.o_str; + } + if (object.b !== undefined && object.b !== null) { + message.b = object.b; + } + if (object.o_b !== undefined && object.o_b !== null) { + message.oB = object.o_b; + } + if (object.num !== undefined && object.num !== null) { + message.num = object.num; + } + if (object.o_num !== undefined && object.o_num !== null) { + message.oNum = object.o_num; + } + if (object.big !== undefined && object.big !== null) { + message.big = BigInt(object.big); + } + if (object.o_big !== undefined && object.o_big !== null) { + message.oBig = BigInt(object.o_big); + } + if (object.proto !== undefined && object.proto !== null) { + message.proto = AccessConfig.fromAmino(object.proto); + } + if (object.o_proto !== undefined && object.o_proto !== null) { + message.oProto = AccessConfig.fromAmino(object.o_proto); + } + if (object.auth !== undefined && object.auth !== null) { + message.auth = Any.fromAmino(object.auth); + } + if (object.o_auth !== undefined && object.o_auth !== null) { + message.oAuth = Any.fromAmino(object.o_auth); + } + if (object.salt !== undefined && object.salt !== null) { + message.salt = bytesFromBase64(object.salt); + } + if (object.o_salt !== undefined && object.o_salt !== null) { + message.oSalt = bytesFromBase64(object.o_salt); + } + if (object.raw !== undefined && object.raw !== null) { + message.raw = toUtf8(JSON.stringify(object.raw)); + } + if (object.o_raw !== undefined && object.o_raw !== null) { + message.oRaw = toUtf8(JSON.stringify(object.o_raw)); + } + if (object.wasm !== undefined && object.wasm !== null) { + message.wasm = fromBase64(object.wasm); + } + if (object.o_wasm !== undefined && object.o_wasm !== null) { + message.oWasm = fromBase64(object.o_wasm); + } + if (object.opt !== undefined && object.opt !== null) { + message.opt = object.opt; + } + if (object.o_opt !== undefined && object.o_opt !== null) { + message.oOpt = object.o_opt; + } + if (object.period !== undefined && object.period !== null) { + message.period = Duration.fromAmino(object.period); + } + if (object.o_period !== undefined && object.o_period !== null) { + message.oPeriod = Duration.fromAmino(object.o_period); + } + if (object.date !== undefined && object.date !== null) { + message.date = fromTimestamp(Timestamp.fromAmino(object.date)); + } + if (object.o_date !== undefined && object.o_date !== null) { + message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); + } + if (object.pubkey !== undefined && object.pubkey !== null) { + message.pubkey = encodePubkey(object.pubkey); + } + if (object.o_pubkey !== undefined && object.o_pubkey !== null) { + message.oPubkey = encodePubkey(object.o_pubkey); + } + message.nums = object.nums?.map(e => e) || []; + message.oNums = object.o_nums?.map(e => e) || []; + message.bigs = object.bigs?.map(e => BigInt(e)) || []; + message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; + message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; + message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; + message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; + message.wasms = object.wasms?.map(e => fromBase64(e)) || []; + message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; + message.opts = object.opts?.map(e => e) || []; + message.oOpts = object.o_opts?.map(e => e) || []; + message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; + message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; + message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; + message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; + message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; + return message; + }, + toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { + const obj: any = {}; + obj.str = message.str === "" ? undefined : message.str; + obj.o_str = message.oStr === "" ? undefined : message.oStr; + obj.b = message.b === false ? undefined : message.b; + obj.o_b = message.oB === false ? undefined : message.oB; + obj.num = message.num === 0 ? undefined : message.num; + obj.o_num = message.oNum === 0 ? undefined : message.oNum; + obj.big = message.big ? message.big.toString() : undefined; + obj.o_big = message.oBig ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; + obj.opt = message.opt === 0 ? undefined : message.opt; + obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; + obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; + if (message.nums) { + obj.nums = message.nums.map(e => e); + } else { + obj.nums = message.nums; + } + if (message.oNums) { + obj.o_nums = message.oNums.map(e => e); + } else { + obj.o_nums = message.oNums; + } + if (message.bigs) { + obj.bigs = message.bigs.map(e => e.toString()); + } else { + obj.bigs = message.bigs; + } + if (message.oBigs) { + obj.o_bigs = message.oBigs.map(e => e.toString()); + } else { + obj.o_bigs = message.oBigs; + } + if (message.salts) { + obj.salts = message.salts.map(e => base64FromBytes(e)); + } else { + obj.salts = message.salts; + } + if (message.oSalts) { + obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); + } else { + obj.o_salts = message.oSalts; + } + if (message.raws) { + obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.raws = message.raws; + } + if (message.oRaws) { + obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); + } else { + obj.o_raws = message.oRaws; + } + if (message.wasms) { + obj.wasms = message.wasms.map(e => toBase64(e)); + } else { + obj.wasms = message.wasms; + } + if (message.oWasms) { + obj.o_wasms = message.oWasms.map(e => toBase64(e)); + } else { + obj.o_wasms = message.oWasms; + } + if (message.opts) { + obj.opts = message.opts.map(e => e); + } else { + obj.opts = message.opts; + } + if (message.oOpts) { + obj.o_opts = message.oOpts.map(e => e); + } else { + obj.o_opts = message.oOpts; + } + if (message.periods) { + obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.periods = message.periods; + } + if (message.oPeriods) { + obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); + } else { + obj.o_periods = message.oPeriods; + } + if (message.protos) { + obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.protos = message.protos; + } + if (message.oProtos) { + obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); + } else { + obj.o_protos = message.oProtos; + } + if (message.auths) { + obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.auths = message.auths; + } + if (message.oAuths) { + obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); + } else { + obj.o_auths = message.oAuths; + } + return obj; + }, + fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.fromAmino(object.value); + }, + fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { + return AminoEncodingTestForOmit.decode(message.value); + }, + toProto(message: AminoEncodingTestForOmit): Uint8Array { + return AminoEncodingTestForOmit.encode(message).finish(); + }, + toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { + return { + typeUrl: "/misc.AminoEncodingTestForOmit", + value: AminoEncodingTestForOmit.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/bundle.ts b/__fixtures__/misc/output/misc/bundle.ts index 73f1024527..428c665b00 100644 --- a/__fixtures__/misc/output/misc/bundle.ts +++ b/__fixtures__/misc/output/misc/bundle.ts @@ -1,4 +1,18 @@ -import * as _6 from "./eval_request"; +import * as _6 from "./amino_fields"; +import * as _7 from "./eval_request"; +import * as _8 from "./tx"; +import * as _9 from "./tx.amino"; +import * as _10 from "./tx.registry"; +import * as _11 from "./tx.rpc.msg"; +import * as _12 from "./rpc.tx"; export const misc = { - ..._6 + ..._6, + ..._7, + ..._8, + ..._9, + ..._10, + ..._11, + ClientFactory: { + ..._12 + } }; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/client.ts b/__fixtures__/misc/output/misc/client.ts new file mode 100644 index 0000000000..ee9a8bda9d --- /dev/null +++ b/__fixtures__/misc/output/misc/client.ts @@ -0,0 +1,47 @@ +import { GeneratedType, Registry, OfflineSigner } from "@cosmjs/proto-signing"; +import { defaultRegistryTypes, AminoTypes, SigningStargateClient } from "@cosmjs/stargate"; +import { HttpEndpoint } from "@cosmjs/tendermint-rpc"; +import * as miscTxRegistry from "./tx.registry"; +import * as miscTxAmino from "./tx.amino"; +export const miscAminoConverters = { + ...miscTxAmino.AminoConverter +}; +export const miscProtoRegistry: ReadonlyArray<[string, GeneratedType]> = [...miscTxRegistry.registry]; +export const getSigningMiscClientOptions = ({ + defaultTypes = defaultRegistryTypes +}: { + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +} = {}): { + registry: Registry; + aminoTypes: AminoTypes; +} => { + const registry = new Registry([...defaultTypes, ...miscProtoRegistry]); + const aminoTypes = new AminoTypes({ + ...miscAminoConverters + }); + return { + registry, + aminoTypes + }; +}; +export const getSigningMiscClient = async ({ + rpcEndpoint, + signer, + defaultTypes = defaultRegistryTypes +}: { + rpcEndpoint: string | HttpEndpoint; + signer: OfflineSigner; + defaultTypes?: ReadonlyArray<[string, GeneratedType]>; +}) => { + const { + registry, + aminoTypes + } = getSigningMiscClientOptions({ + defaultTypes + }); + const client = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, { + registry: (registry as any), + aminoTypes + }); + return client; +}; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/eval_request.ts b/__fixtures__/misc/output/misc/eval_request.ts index ff2ca6fed1..41599d60fc 100644 --- a/__fixtures__/misc/output/misc/eval_request.ts +++ b/__fixtures__/misc/output/misc/eval_request.ts @@ -1,11 +1,6 @@ import { ExprValue, ExprValueAmino, ExprValueSDKType, IdRef, IdRefAmino, IdRefSDKType } from "../google/api/expr/v1alpha1/eval"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; import { BinaryReader, BinaryWriter } from "../binary"; -import { isSet, DeepPartial, isObject, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; +import { isSet, DeepPartial, isObject } from "../helpers"; export const protobufPackage = "misc"; /** VoteOption enumerates the valid vote options for a given governance proposal. */ export enum VoteOption { @@ -202,192 +197,6 @@ export interface GenericAuthorizationAminoMsg { export interface GenericAuthorizationSDKType { msg: string; } -export interface AminoEncodingTest { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestProtoMsg { - typeUrl: "/misc.AminoEncodingTest"; - value: Uint8Array; -} -export interface AminoEncodingTestAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestAminoMsg { - type: "/misc.AminoEncodingTest"; - value: AminoEncodingTestAmino; -} -export interface AminoEncodingTestSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} function createBaseEvalRequest_BindingsEntry(): EvalRequest_BindingsEntry { return { key: "", @@ -1095,1077 +904,4 @@ export const GenericAuthorization = { value: GenericAuthorization.encode(message).finish() }; } -}; -function createBaseAminoEncodingTest(): AminoEncodingTest { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTest = { - typeUrl: "/misc.AminoEncodingTest", - encode(message: AminoEncodingTest, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTest { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTest(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTest { - const obj = createBaseAminoEncodingTest(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTest): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestSDKType): AminoEncodingTest { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTest): AminoEncodingTestSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestAmino): AminoEncodingTest { - const message = createBaseAminoEncodingTest(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTest): AminoEncodingTestAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestAminoMsg): AminoEncodingTest { - return AminoEncodingTest.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestProtoMsg): AminoEncodingTest { - return AminoEncodingTest.decode(message.value); - }, - toProto(message: AminoEncodingTest): Uint8Array { - return AminoEncodingTest.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTest): AminoEncodingTestProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTest", - value: AminoEncodingTest.encode(message).finish() - }; - } }; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/rpc.tx.ts b/__fixtures__/misc/output/misc/rpc.tx.ts new file mode 100644 index 0000000000..95f48c2dfe --- /dev/null +++ b/__fixtures__/misc/output/misc/rpc.tx.ts @@ -0,0 +1,8 @@ +import { Rpc } from "../helpers"; +export const createRPCMsgClient = async ({ + rpc +}: { + rpc: Rpc; +}) => ({ + misc: new (await import("./tx.rpc.msg")).MsgClientImpl(rpc) +}); \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/tx.amino.ts b/__fixtures__/misc/output/misc/tx.amino.ts new file mode 100644 index 0000000000..0d46c9a916 --- /dev/null +++ b/__fixtures__/misc/output/misc/tx.amino.ts @@ -0,0 +1,9 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const AminoConverter = { + "/misc.InputMsg": { + aminoType: "/misc.InputMsg", + toAmino: InputMsg.toAmino, + fromAmino: InputMsg.fromAmino + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/tx.registry.ts b/__fixtures__/misc/output/misc/tx.registry.ts new file mode 100644 index 0000000000..b7cdd5cf05 --- /dev/null +++ b/__fixtures__/misc/output/misc/tx.registry.ts @@ -0,0 +1,51 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { GeneratedType, Registry } from "@cosmjs/proto-signing"; +import { InputMsg, InputMsgSDKType } from "./tx"; +export const registry: ReadonlyArray<[string, GeneratedType]> = [["/misc.InputMsg", InputMsg]]; +export const load = (protoRegistry: Registry) => { + registry.forEach(([typeUrl, mod]) => { + protoRegistry.register(typeUrl, mod); + }); +}; +export const MessageComposer = { + encoded: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(value).finish() + }; + } + }, + withTypeUrl: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value + }; + } + }, + toJSON: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.toJSON(value) + }; + } + }, + fromJSON: { + sendMsg(value: any) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromJSON(value) + }; + } + }, + fromPartial: { + sendMsg(value: InputMsg) { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.fromPartial(value) + }; + } + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/tx.rpc.msg.ts b/__fixtures__/misc/output/misc/tx.rpc.msg.ts new file mode 100644 index 0000000000..f8b8b22fdb --- /dev/null +++ b/__fixtures__/misc/output/misc/tx.rpc.msg.ts @@ -0,0 +1,23 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { Rpc } from "../helpers"; +import { BinaryReader } from "../binary"; +import { InputMsg, InputMsgSDKType, MsgResponse, MsgResponseSDKType } from "./tx"; +export interface Msg { + /** test tx */ + sendMsg(request: InputMsg): Promise; +} +export class MsgClientImpl implements Msg { + private readonly rpc: Rpc; + constructor(rpc: Rpc) { + this.rpc = rpc; + this.sendMsg = this.sendMsg.bind(this); + } + sendMsg(request: InputMsg): Promise { + const data = InputMsg.encode(request).finish(); + const promise = this.rpc.request("misc.Msg", "SendMsg", data); + return promise.then(data => MsgResponse.decode(new BinaryReader(data))); + } +} +export const createClientImpl = (rpc: Rpc) => { + return new MsgClientImpl(rpc); +}; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/tx.ts b/__fixtures__/misc/output/misc/tx.ts new file mode 100644 index 0000000000..4611dbb80b --- /dev/null +++ b/__fixtures__/misc/output/misc/tx.ts @@ -0,0 +1,227 @@ +import { AminoEncodingTestForDontOmit, AminoEncodingTestForDontOmitAmino, AminoEncodingTestForDontOmitSDKType, AminoEncodingTestForOmit, AminoEncodingTestForOmitAmino, AminoEncodingTestForOmitSDKType } from "./amino_fields"; +import { BinaryReader, BinaryWriter } from "../binary"; +import { isSet, DeepPartial } from "../helpers"; +export const protobufPackage = "misc"; +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsg { + dOTests: AminoEncodingTestForDontOmit; + oTests: AminoEncodingTestForOmit; +} +export interface InputMsgProtoMsg { + typeUrl: "/misc.InputMsg"; + value: Uint8Array; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgAmino { + d_o_tests?: AminoEncodingTestForDontOmitAmino; + o_tests?: AminoEncodingTestForOmitAmino; +} +export interface InputMsgAminoMsg { + type: "/misc.InputMsg"; + value: InputMsgAmino; +} +/** + * MsgGrant is a request type for Grant method. It declares authorization to the grantee + * on behalf of the granter with the provided expiration time. + */ +export interface InputMsgSDKType { + d_o_tests: AminoEncodingTestForDontOmitSDKType; + o_tests: AminoEncodingTestForOmitSDKType; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponse {} +export interface MsgResponseProtoMsg { + typeUrl: "/misc.MsgResponse"; + value: Uint8Array; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseAmino {} +export interface MsgResponseAminoMsg { + type: "/misc.MsgResponse"; + value: MsgResponseAmino; +} +/** MsgGrantResponse defines the Msg/MsgGrant response type. */ +export interface MsgResponseSDKType {} +function createBaseInputMsg(): InputMsg { + return { + dOTests: AminoEncodingTestForDontOmit.fromPartial({}), + oTests: AminoEncodingTestForOmit.fromPartial({}) + }; +} +export const InputMsg = { + typeUrl: "/misc.InputMsg", + encode(message: InputMsg, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + if (message.dOTests !== undefined) { + AminoEncodingTestForDontOmit.encode(message.dOTests, writer.uint32(10).fork()).ldelim(); + } + if (message.oTests !== undefined) { + AminoEncodingTestForOmit.encode(message.oTests, writer.uint32(18).fork()).ldelim(); + } + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): InputMsg { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseInputMsg(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + case 1: + message.dOTests = AminoEncodingTestForDontOmit.decode(reader, reader.uint32()); + break; + case 2: + message.oTests = AminoEncodingTestForOmit.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(object: any): InputMsg { + const obj = createBaseInputMsg(); + if (isSet(object.dOTests)) obj.dOTests = AminoEncodingTestForDontOmit.fromJSON(object.dOTests); + if (isSet(object.oTests)) obj.oTests = AminoEncodingTestForOmit.fromJSON(object.oTests); + return obj; + }, + toJSON(message: InputMsg): unknown { + const obj: any = {}; + message.dOTests !== undefined && (obj.dOTests = message.dOTests ? AminoEncodingTestForDontOmit.toJSON(message.dOTests) : undefined); + message.oTests !== undefined && (obj.oTests = message.oTests ? AminoEncodingTestForOmit.toJSON(message.oTests) : undefined); + return obj; + }, + fromPartial(object: DeepPartial): InputMsg { + const message = createBaseInputMsg(); + if (object.dOTests !== undefined && object.dOTests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromPartial(object.dOTests); + } + if (object.oTests !== undefined && object.oTests !== null) { + message.oTests = AminoEncodingTestForOmit.fromPartial(object.oTests); + } + return message; + }, + fromSDK(object: InputMsgSDKType): InputMsg { + return { + dOTests: object.d_o_tests ? AminoEncodingTestForDontOmit.fromSDK(object.d_o_tests) : undefined, + oTests: object.o_tests ? AminoEncodingTestForOmit.fromSDK(object.o_tests) : undefined + }; + }, + fromSDKJSON(object: any): InputMsgSDKType { + return { + d_o_tests: isSet(object.d_o_tests) ? AminoEncodingTestForDontOmit.fromSDKJSON(object.d_o_tests) : undefined, + o_tests: isSet(object.o_tests) ? AminoEncodingTestForOmit.fromSDKJSON(object.o_tests) : undefined + }; + }, + toSDK(message: InputMsg): InputMsgSDKType { + const obj: any = {}; + message.dOTests !== undefined && (obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toSDK(message.dOTests) : undefined); + message.oTests !== undefined && (obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toSDK(message.oTests) : undefined); + return obj; + }, + fromAmino(object: InputMsgAmino): InputMsg { + const message = createBaseInputMsg(); + if (object.d_o_tests !== undefined && object.d_o_tests !== null) { + message.dOTests = AminoEncodingTestForDontOmit.fromAmino(object.d_o_tests); + } + if (object.o_tests !== undefined && object.o_tests !== null) { + message.oTests = AminoEncodingTestForOmit.fromAmino(object.o_tests); + } + return message; + }, + toAmino(message: InputMsg): InputMsgAmino { + const obj: any = {}; + obj.d_o_tests = message.dOTests ? AminoEncodingTestForDontOmit.toAmino(message.dOTests) : undefined; + obj.o_tests = message.oTests ? AminoEncodingTestForOmit.toAmino(message.oTests) : undefined; + return obj; + }, + fromAminoMsg(object: InputMsgAminoMsg): InputMsg { + return InputMsg.fromAmino(object.value); + }, + fromProtoMsg(message: InputMsgProtoMsg): InputMsg { + return InputMsg.decode(message.value); + }, + toProto(message: InputMsg): Uint8Array { + return InputMsg.encode(message).finish(); + }, + toProtoMsg(message: InputMsg): InputMsgProtoMsg { + return { + typeUrl: "/misc.InputMsg", + value: InputMsg.encode(message).finish() + }; + } +}; +function createBaseMsgResponse(): MsgResponse { + return {}; +} +export const MsgResponse = { + typeUrl: "/misc.MsgResponse", + encode(_: MsgResponse, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { + return writer; + }, + decode(input: BinaryReader | Uint8Array, length?: number): MsgResponse { + const reader = input instanceof BinaryReader ? input : new BinaryReader(input); + let end = length === undefined ? reader.len : reader.pos + length; + const message = createBaseMsgResponse(); + while (reader.pos < end) { + const tag = reader.uint32(); + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }, + fromJSON(_: any): MsgResponse { + const obj = createBaseMsgResponse(); + return obj; + }, + toJSON(_: MsgResponse): unknown { + const obj: any = {}; + return obj; + }, + fromPartial(_: DeepPartial): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + fromSDK(_: MsgResponseSDKType): MsgResponse { + return {}; + }, + fromSDKJSON(_: any): MsgResponseSDKType { + return {}; + }, + toSDK(_: MsgResponse): MsgResponseSDKType { + const obj: any = {}; + return obj; + }, + fromAmino(_: MsgResponseAmino): MsgResponse { + const message = createBaseMsgResponse(); + return message; + }, + toAmino(_: MsgResponse): MsgResponseAmino { + const obj: any = {}; + return obj; + }, + fromAminoMsg(object: MsgResponseAminoMsg): MsgResponse { + return MsgResponse.fromAmino(object.value); + }, + fromProtoMsg(message: MsgResponseProtoMsg): MsgResponse { + return MsgResponse.decode(message.value); + }, + toProto(message: MsgResponse): Uint8Array { + return MsgResponse.encode(message).finish(); + }, + toProtoMsg(message: MsgResponse): MsgResponseProtoMsg { + return { + typeUrl: "/misc.MsgResponse", + value: MsgResponse.encode(message).finish() + }; + } +}; \ No newline at end of file diff --git a/__fixtures__/misc/proto-impl-interfaces/cosmos/authz/v1beta1/tx.proto b/__fixtures__/misc/proto-impl-interfaces/cosmos/authz/v1beta1/tx.proto new file mode 100644 index 0000000000..93980161f8 --- /dev/null +++ b/__fixtures__/misc/proto-impl-interfaces/cosmos/authz/v1beta1/tx.proto @@ -0,0 +1,71 @@ +// Since: cosmos-sdk 0.43 +syntax = "proto3"; +package cosmos.authz.v1beta1; + +import "cosmos_proto/cosmos.proto"; +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "cosmos/authz/v1beta1/authz.proto"; + +option go_package = "github.com/cosmos/cosmos-sdk/x/authz"; +option (gogoproto.goproto_getters_all) = false; + +// Msg defines the authz Msg service. +service Msg { + // Grant grants the provided authorization to the grantee on the granter's + // account with the provided expiration time. If there is already a grant + // for the given (granter, grantee, Authorization) triple, then the grant + // will be overwritten. + rpc Grant(MsgGrant) returns (MsgGrantResponse); + + // Exec attempts to execute the provided messages using + // authorizations granted to the grantee. Each message should have only + // one signer corresponding to the granter of the authorization. + rpc Exec(MsgExec) returns (MsgExecResponse); + + // Revoke revokes any authorization corresponding to the provided method name on the + // granter's account that has been granted to the grantee. + rpc Revoke(MsgRevoke) returns (MsgRevokeResponse); +} + +// MsgGrant is a request type for Grant method. It declares authorization to the grantee +// on behalf of the granter with the provided expiration time. +message MsgGrant { + + string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + cosmos.authz.v1beta1.Grant grant = 3 [(gogoproto.nullable) = false]; +} + +// MsgExecResponse defines the Msg/MsgExecResponse response type. +message MsgExecResponse { + repeated bytes results = 1; +} + +// MsgExec attempts to execute the provided messages using +// authorizations granted to the grantee. Each message should have only +// one signer corresponding to the granter of the authorization. +message MsgExec { + + string grantee = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // Authorization Msg requests to execute. Each msg must implement Authorization interface + // The x/authz will try to find a grant matching (msg.signers[0], grantee, MsgTypeURL(msg)) + // triple and validate it. + repeated google.protobuf.Any msgs = 2 [(cosmos_proto.accepts_interface) = "sdk.Msg, authz.Authorization"]; +} + +// MsgGrantResponse defines the Msg/MsgGrant response type. +message MsgGrantResponse {} + +// MsgRevoke revokes any authorization with the provided sdk.Msg type on the +// granter's account with that has been granted to the grantee. +message MsgRevoke { + + string granter = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string grantee = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string msg_type_url = 3; +} + +// MsgRevokeResponse defines the Msg/MsgRevokeResponse response type. +message MsgRevokeResponse {} diff --git a/__fixtures__/misc/proto/misc/amino_fields.proto b/__fixtures__/misc/proto/misc/amino_fields.proto new file mode 100644 index 0000000000..e7230a4947 --- /dev/null +++ b/__fixtures__/misc/proto/misc/amino_fields.proto @@ -0,0 +1,362 @@ +syntax = "proto3"; + +package misc; + +import "google/protobuf/any.proto"; +import "google/protobuf/timestamp.proto"; +import "google/protobuf/duration.proto"; +import "misc/eval_request.proto"; + +message AminoEncodingTestForDontOmit { + // scalar + string str = 1; + string d_o_str = 2 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + bool b = 3; + bool d_o_b = 4 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + int32 num = 5; + int32 d_o_num = 6 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // bigint + int64 big = 7; + int64 d_o_big = 8 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // protoType + AccessConfig proto = 9; + AccessConfig d_o_proto = 10 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // anyType + google.protobuf.Any auth = 11 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Any d_o_auth = 12 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (cosmos_proto.accepts_interface) = "Authorization" + ]; + + // bytes + bytes salt = 13; + bytes d_o_salt = 14 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // raw bytes + bytes raw = 15 [ + (gogoproto.casttype) = "RawContractMessage" + ]; + bytes d_o_raw = 16 [ + (gogoproto.casttype) = "RawContractMessage", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // wasm bytes + bytes wasm = 17 [ + (gogoproto.customname) = "WASMByteCode" + ]; + bytes d_o_wasm = 18 [ + (gogoproto.customname) = "WASMByteCode", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // enum + VoteOption opt = 19; + VoteOption d_o_opt = 20 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // duration + google.protobuf.Duration period = 21; + google.protobuf.Duration d_o_period = 22 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // timestamp + google.protobuf.Timestamp date = 23; + google.protobuf.Timestamp d_o_date = 24 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // pubkey + google.protobuf.Any pubkey = 25 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; + google.protobuf.Any d_o_pubkey = 26 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" + ]; + + // array scalar + repeated int32 nums = 27; + repeated int32 d_o_nums = 28 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array bigint + repeated int64 bigs = 29; + repeated int64 d_o_bigs = 30 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array bytes + repeated bytes salts = 31; + repeated bytes d_o_salts = 32 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array raw bytes + repeated bytes raws = 33 [ + (gogoproto.casttype) = "RawContractMessage" + ]; + repeated bytes d_o_raws = 34 [ + (gogoproto.casttype) = "RawContractMessage", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array wasm bytes + repeated bytes wasms = 35 [ + (gogoproto.customname) = "WASMByteCode" + ]; + repeated bytes d_o_wasms = 36 [ + (gogoproto.customname) = "WASMByteCode", + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array enum + repeated VoteOption opts = 37; + repeated VoteOption d_o_opts = 38 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array duration + repeated google.protobuf.Duration periods = 39; + repeated google.protobuf.Duration d_o_periods = 40 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array timestamp + // TODO:: need to debug + // repeated google.protobuf.Timestamp dates = 41; + // repeated google.protobuf.Timestamp d_o_dates = 42 [ + // (gogoproto.nullable) = false, + // (amino.dont_omitempty) = true + // ]; + + // array protoType + repeated AccessConfig protos = 43; + repeated AccessConfig d_o_protos = 44 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true + ]; + + // array anyType + repeated google.protobuf.Any auths = 45 [(cosmos_proto.accepts_interface) = "Authorization"]; + repeated google.protobuf.Any d_o_auths = 46 [ + (gogoproto.nullable) = false, + (amino.dont_omitempty) = true, + (cosmos_proto.accepts_interface) = "Authorization" + ]; +} + +message AminoEncodingTestForOmit { + // scalar + string str = 1; + string o_str = 2 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_str,omitempty" + ]; + + bool b = 3; + bool o_b = 4 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_b,omitempty" + ]; + + int32 num = 5; + int32 o_num = 6 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_num,omitempty" + ]; + + // bigint + int64 big = 7; + int64 o_big = 8 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_big,omitempty" + ]; + + // protoType + AccessConfig proto = 9; + AccessConfig o_proto = 10 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_proto,omitempty" + ]; + + // anyType + google.protobuf.Any auth = 11 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Any o_auth = 12 [ + (cosmos_proto.accepts_interface) = "Authorization", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_auth,omitempty" + ]; + + // bytes + bytes salt = 13; + bytes o_salt = 14 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_salt,omitempty" + ]; + + // raw bytes + bytes raw = 15 [ + (gogoproto.casttype) = "RawContractMessage" + ]; + bytes o_raw = 16 [ + (gogoproto.casttype) = "RawContractMessage", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_raw,omitempty" + ]; + + // wasm bytes + bytes wasm = 17 [ + (gogoproto.customname) = "WASMByteCode" + ]; + bytes o_wasm = 18 [ + (gogoproto.customname) = "WASMByteCode", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_wasm,omitempty" + ]; + + // enum + VoteOption opt = 19; + VoteOption o_opt = 20 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_opt,omitempty" + ]; + + // duration + google.protobuf.Duration period = 21; + google.protobuf.Duration o_period = 22 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_period,omitempty" + ]; + + // timestamp + google.protobuf.Timestamp date = 23; + google.protobuf.Timestamp o_date = 24 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_date,omitempty" + ]; + + // pubkey + google.protobuf.Any pubkey = 25 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; + google.protobuf.Any o_pubkey = 26 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_pubkey,omitempty" + ]; + + // array scalar + repeated int32 nums = 27; + repeated int32 o_nums = 28 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_nums,omitempty" + ]; + + // array bigint + repeated int64 bigs = 29; + repeated int64 o_bigs = 30 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_bigs,omitempty" + ]; + + // array bytes + repeated bytes salts = 31; + repeated bytes o_salts = 32 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_salts,omitempty" + ]; + + // array raw bytes + repeated bytes raws = 33 [ + (gogoproto.casttype) = "RawContractMessage" + ]; + repeated bytes o_raws = 34 [ + (gogoproto.casttype) = "RawContractMessage", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_raws,omitempty" + ]; + + // array wasm bytes + repeated bytes wasms = 35 [ + (gogoproto.customname) = "WASMByteCode" + ]; + repeated bytes o_wasms = 36 [ + (gogoproto.customname) = "WASMByteCode", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_wasms,omitempty" + ]; + + // array enum + repeated VoteOption opts = 37; + repeated VoteOption o_opts = 38 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_opts,omitempty" + ]; + + // array duration + repeated google.protobuf.Duration periods = 39; + repeated google.protobuf.Duration o_periods = 40 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_periods,omitempty" + ]; + + // array timestamp + // TODO:: need to debug + // repeated google.protobuf.Timestamp dates = 41; + // repeated google.protobuf.Timestamp o_dates = 42 [ + // (gogoproto.nullable) = false, + // (gogoproto.jsontag) = "o_dates,omitempty" + // ]; + + // array protoType + repeated AccessConfig protos = 43; + repeated AccessConfig o_protos = 44 [ + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_protos,omitempty" + ]; + + // array anyType + repeated google.protobuf.Any auths = 45 [(cosmos_proto.accepts_interface) = "Authorization"]; + repeated google.protobuf.Any o_auths = 46 [ + (cosmos_proto.accepts_interface) = "Authorization", + (gogoproto.nullable) = false, + (gogoproto.jsontag) = "o_auths,omitempty" + ]; +} \ No newline at end of file diff --git a/__fixtures__/misc/proto/misc/eval_request.proto b/__fixtures__/misc/proto/misc/eval_request.proto index 5007115d18..cdc2205c21 100644 --- a/__fixtures__/misc/proto/misc/eval_request.proto +++ b/__fixtures__/misc/proto/misc/eval_request.proto @@ -55,181 +55,4 @@ message GenericAuthorization { // Msg, identified by it's type URL, to grant unrestricted permissions to execute string msg = 1; -} - -message AminoEncodingTest { - // scalar - string str = 1; - string d_o_str = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - bool b = 3; - bool d_o_b = 4 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - int32 num = 5; - int32 d_o_num = 6 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // bigint - int64 big = 7; - int64 d_o_big = 8 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // protoType - AccessConfig proto = 9; - AccessConfig d_o_proto = 10 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // anyType - google.protobuf.Any auth = 11 [(cosmos_proto.accepts_interface) = "Authorization"]; - google.protobuf.Any d_o_auth = 12 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (cosmos_proto.accepts_interface) = "Authorization" - ]; - - // bytes - bytes salt = 13; - bytes d_o_salt = 14 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // raw bytes - bytes raw = 15 [ - (gogoproto.casttype) = "RawContractMessage" - ]; - bytes d_o_raw = 16 [ - (gogoproto.casttype) = "RawContractMessage", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // wasm bytes - bytes wasm = 17 [ - (gogoproto.customname) = "WASMByteCode" - ]; - bytes d_o_wasm = 18 [ - (gogoproto.customname) = "WASMByteCode", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // enum - VoteOption opt = 19; - VoteOption d_o_opt = 20 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // duration - google.protobuf.Duration period = 21; - google.protobuf.Duration d_o_period = 22 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // timestamp - google.protobuf.Timestamp date = 23; - google.protobuf.Timestamp d_o_date = 24 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // pubkey - google.protobuf.Any pubkey = 25 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; - google.protobuf.Any d_o_pubkey = 26 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" - ]; - - // array scalar - repeated int32 nums = 27; - repeated int32 d_o_nums = 28 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array bigint - repeated int64 bigs = 29; - repeated int64 d_o_bigs = 30 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array bytes - repeated bytes salts = 31; - repeated bytes d_o_salts = 32 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array raw bytes - repeated bytes raws = 33 [ - (gogoproto.casttype) = "RawContractMessage" - ]; - repeated bytes d_o_raws = 34 [ - (gogoproto.casttype) = "RawContractMessage", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array wasm bytes - repeated bytes wasms = 35 [ - (gogoproto.customname) = "WASMByteCode" - ]; - repeated bytes d_o_wasms = 36 [ - (gogoproto.customname) = "WASMByteCode", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array enum - repeated VoteOption opts = 37; - repeated VoteOption d_o_opts = 38 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array duration - repeated google.protobuf.Duration periods = 39; - repeated google.protobuf.Duration d_o_periods = 40 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array timestamp - // TODO:: need to debug - // repeated google.protobuf.Timestamp dates = 41; - // repeated google.protobuf.Timestamp d_o_dates = 42 [ - // (gogoproto.nullable) = false, - // (amino.dont_omitempty) = true - // ]; - - // array protoType - repeated AccessConfig protos = 43; - repeated AccessConfig d_o_protos = 44 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array anyType - repeated google.protobuf.Any auths = 45 [(cosmos_proto.accepts_interface) = "Authorization"]; - repeated google.protobuf.Any d_o_auths = 46 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (cosmos_proto.accepts_interface) = "Authorization" - ]; } \ No newline at end of file diff --git a/__fixtures__/misc/proto/misc/tx.proto b/__fixtures__/misc/proto/misc/tx.proto new file mode 100644 index 0000000000..ab60286c06 --- /dev/null +++ b/__fixtures__/misc/proto/misc/tx.proto @@ -0,0 +1,25 @@ +// Since: cosmos-sdk 0.43 +syntax = "proto3"; +package misc; + +import "gogoproto/gogo.proto"; +import "google/protobuf/any.proto"; +import "misc/amino_fields.proto"; + +option go_package = "github.com/misc/amino/fields/test"; +option (gogoproto.goproto_getters_all) = false; + +service Msg { + // test tx + rpc SendMsg(InputMsg) returns (MsgResponse); +} + +// MsgGrant is a request type for Grant method. It declares authorization to the grantee +// on behalf of the granter with the provided expiration time. +message InputMsg { + misc.AminoEncodingTestForDontOmit d_o_tests = 1 [(gogoproto.nullable) = false]; + misc.AminoEncodingTestForOmit o_tests = 2 [(gogoproto.nullable) = false]; +} + +// MsgGrantResponse defines the Msg/MsgGrant response type. +message MsgResponse {} \ No newline at end of file diff --git a/packages/ast/src/encoding/amino/to-amino-json/index.ts b/packages/ast/src/encoding/amino/to-amino-json/index.ts index 548da2dfaa..d3493b67b7 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/index.ts @@ -73,6 +73,8 @@ export const toAminoParseField = ({ } switch (field.parsedType.type) { + case 'Enum': + return toAmino.defaultType(args); case 'Type': return toAmino.typeArray(args); } diff --git a/packages/telescope/__tests__/__snapshots__/impl-interfaces.test.ts.snap b/packages/telescope/__tests__/__snapshots__/impl-interfaces.test.ts.snap index ab16cee866..39195bb049 100644 --- a/packages/telescope/__tests__/__snapshots__/impl-interfaces.test.ts.snap +++ b/packages/telescope/__tests__/__snapshots__/impl-interfaces.test.ts.snap @@ -45,7 +45,7 @@ exports[`implements interface works toAmino for interface 1`] = ` "value": Uint8Array [], }, ], - "opt": "VOTE_OPTION_UNSPECIFIED", + "opt": undefined, "single_msg": { "type": "", "value": Uint8Array [], @@ -73,7 +73,7 @@ exports[`implements interface works toAmino for interface with Any 1`] = ` "value": Uint8Array [], }, ], - "opt": "VOTE_OPTION_UNSPECIFIED", + "opt": undefined, "single_msg": { "type": "", "value": Uint8Array [], diff --git a/packages/telescope/__tests__/misc.test.ts b/packages/telescope/__tests__/misc.test.ts index 967ac35420..fda5fdb115 100644 --- a/packages/telescope/__tests__/misc.test.ts +++ b/packages/telescope/__tests__/misc.test.ts @@ -166,6 +166,31 @@ describe("misc", () => { await telescope.build(); }); + it("generates amino legacy", async () => { + const testFolder = "/output-proto-amino/amino-legacy"; + + const telescope = new TelescopeBuilder({ + outPath: __dirname + "/../../../__fixtures__/misc" + testFolder, + protoDirs: [__dirname + "/../../../__fixtures__/misc/proto"], + options: deepmerge(options, { + prototypes: { + methods: { + toAmino: true, + fromAmino: true, + toProto: true, + fromProto: true, + }, + }, + aminoEncoding: { + enabled: true, + useLegacyInlineEncoding: true, + }, + }), + }); + + await telescope.build(); + }); + it("generates without amino but legacy", async () => { const testFolder = "/output-proto-amino/no-amino-legacy"; From f5a6e12c65683e2ac3be0be005c93f613f300bb9 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Tue, 12 Mar 2024 18:59:02 +0800 Subject: [PATCH 17/24] added shouldOmitEmpty and tests --- packages/ast/src/utils/amino.ts | 3 - packages/types/src/telescope.ts | 3 + packages/types/types/telescope.d.ts | 1 + packages/utils/src/__tests__/amino.test.ts | 301 +++++++++++++++++++++ packages/utils/src/amino.ts | 41 +++ packages/utils/types/amino.d.ts | 10 +- 6 files changed, 355 insertions(+), 4 deletions(-) create mode 100644 packages/utils/src/__tests__/amino.test.ts diff --git a/packages/ast/src/utils/amino.ts b/packages/ast/src/utils/amino.ts index 8e02a05d69..24462763bc 100644 --- a/packages/ast/src/utils/amino.ts +++ b/packages/ast/src/utils/amino.ts @@ -5,9 +5,6 @@ export const AminoUtils = { }; }): boolean { - // if (field?.options?.['(gogoproto.nullable)']) { - // return false; - // } let jsonTag = field.options?.['(gogoproto.jsontag)'] ?? field.options?.['(cosmos_proto.json_tag)']; return jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); } diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index 94707b7687..c6f29bad93 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -87,6 +87,7 @@ interface TelescopeOpts { customTypes?: { useCosmosSDKDec?: boolean; }, + num64?: 'long' | 'bigint'; useDeepPartial?: boolean; useExact?: boolean; @@ -140,6 +141,7 @@ interface TelescopeOpts { customTypes?: { useCosmosSDKDec?: boolean; }, + omitEmptyTags: ( "omitempty" | "dont_omitempty" )[]; useProtoOptionality?: boolean; disableMsgTypes?: boolean; casingFn?: Function; @@ -372,6 +374,7 @@ export const defaultTelescopeOptions: TelescopeOptions = { customTypes: { useCosmosSDKDec: false }, + omitEmptyTags: ["omitempty", "dont_omitempty"], casingFn: snake, exceptions: { ...DEFAULT_AMINO_EXCEPTIONS diff --git a/packages/types/types/telescope.d.ts b/packages/types/types/telescope.d.ts index 5ec64d20c5..d26a681419 100644 --- a/packages/types/types/telescope.d.ts +++ b/packages/types/types/telescope.d.ts @@ -115,6 +115,7 @@ interface TelescopeOpts { customTypes?: { useCosmosSDKDec?: boolean; }; + omitEmptyTags: ("omitempty" | "dont_omitempty")[]; useProtoOptionality?: boolean; disableMsgTypes?: boolean; casingFn?: Function; diff --git a/packages/utils/src/__tests__/amino.test.ts b/packages/utils/src/__tests__/amino.test.ts new file mode 100644 index 0000000000..b80522ff72 --- /dev/null +++ b/packages/utils/src/__tests__/amino.test.ts @@ -0,0 +1,301 @@ +import { shouldOmitEmpty } from "../amino"; +import { ProtoField } from "@cosmology/types"; +import cases from "jest-in-case"; + +describe("shouldOmitEmpty", () => { + cases( + `shouldOmitEmpty`, + (opts) => { + const ctx: any = { + pluginValue: jest.fn().mockReturnValue(opts.pluginValue), + }; + const field: ProtoField = { + id: 0, + options: opts.options, + }; + expect(shouldOmitEmpty(ctx, field)).toBe(opts.result); + }, + [ + // empty omitEmptyTags means the result would be true all the time. + { + name: "empty omitEmptyTags means the result would be true all the time.", + pluginValue: [], + options: { + "(amino.dont_omitempty)": false, + }, + result: true, + }, + { + name: "empty omitEmptyTags means the result would be true all the time.", + pluginValue: [], + options: { + "(amino.dont_omitempty)": true, + }, + result: true, + }, + { + name: "empty omitEmptyTags means the result would be true all the time.", + pluginValue: [], + options: { + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "empty omitEmptyTags means the result would be true all the time.", + pluginValue: [], + options: { + "(gogoproto.jsontag)": "attributes", + }, + result: true, + }, + { + name: "empty omitEmptyTags means the result would be true all the time.", + pluginValue: [], + options: null, + result: true, + }, + + // aminoEncoding.omitEmptyTags includes "omitempty" + // if there're gogoproto.jsontag and cosmos_proto.json_tag and any of them includes omitempty, the result would be true, otherwise false. + { + name: "omitEmptyTags: omitempty, if none of gogoproto.jsontag and cosmos_proto.json_tag include omitempty, then false", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty, if gogoproto.jsontag includes omitempty, then true", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty, if there's jsontag and none of cosmos_proto.json_tag and cosmos_proto.json_tag include omitempty, then false", + pluginValue: ["omitempty"], + options: { + "(cosmos_proto.json_tag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty, if cosmos_proto.json_tag includes omitempty, then true", + pluginValue: ["omitempty"], + options: { + "(cosmos_proto.json_tag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty, if gogoproto.jsontag and cosmos_proto.json_tag both include omitempty, then true", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes,omitempty", + "(cosmos_proto.json_tag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty, if gogoproto.jsontag includes omitempty and cosmos_proto.json_tag does not include omitempty, then true", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes,omitempty", + "(cosmos_proto.json_tag)": "attributes", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty, if gogoproto.jsontag does not include omitempty and cosmos_proto.json_tag includes omitempty, then true", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + "(cosmos_proto.json_tag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty, if gogoproto.jsontag and cosmos_proto.json_tag both do not include omitempty, then false", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + "(cosmos_proto.json_tag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty, if gogoproto.jsontag and cosmos_proto.json_tag both do not include omitempty, then false. And amino.dont_omitempty will be ignored.", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + "(cosmos_proto.json_tag)": "attributes", + "(amino.dont_omitempty)": false, + }, + result: false, + }, + + // aminoEncoding.omitEmptyTags includes "dont_omitempty" only + // if amino.dont_omitempty is true, then false, otherwise true. + { + name: "omitEmptyTags: dont_omitempty, if amino.dont_omitempty is true, then false", + pluginValue: ["dont_omitempty"], + options: { + "(amino.dont_omitempty)": true, + }, + result: false, + }, + { + name: "omitEmptyTags: dont_omitempty, if amino.dont_omitempty is false, then true", + pluginValue: ["dont_omitempty"], + options: { + "(amino.dont_omitempty)": false, + }, + result: true, + }, + { + name: "omitEmptyTags: dont_omitempty, if amino.dont_omitempty is not present, then true", + pluginValue: ["dont_omitempty"], + options: {}, + result: true, + }, + { + name: "omitEmptyTags: dont_omitempty, if amino.dont_omitempty is true and gogoproto.jsontag includes omitempty, then false", + pluginValue: ["dont_omitempty"], + options: { + "(amino.dont_omitempty)": true, + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: false, + }, + { + name: "omitEmptyTags: dont_omitempty, if amino.dont_omitempty is false and gogoproto.jsontag includes omitempty, then true", + pluginValue: ["dont_omitempty"], + options: { + "(amino.dont_omitempty)": false, + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + + // aminoEncoding.omitEmptyTags includes both "omitempty" and "dont_omitempty" + // if there're gogoproto.jsontag and cosmos_proto.json_tag and any of them includes omitempty, the result would be true, otherwise false. And amino.dont_omitempty will be ignored. + // after that, if amino.dont_omitempty is true, then false, otherwise true. + // if there's no options, then true. + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is true, then false", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": true, + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is true and gogoproto.jsontag includes omitempty, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": true, + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is false and gogoproto.jsontag does not include omitempty, then false", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": false, + "(gogoproto.jsontag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is not present and gogoproto.jsontag includes omitempty, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is not present and gogoproto.jsontag does not include omitempty, then false", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is true and gogoproto.jsontag includes omitempty, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": true, + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is false and gogoproto.jsontag includes omitempty, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": false, + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is true and gogoproto.jsontag does not include omitempty, then false", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": true, + "(gogoproto.jsontag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is false and gogoproto.jsontag does not include omitempty, then false", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(amino.dont_omitempty)": false, + "(gogoproto.jsontag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is not present and gogoproto.jsontag includes omitempty, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(gogoproto.jsontag)": "attributes,omitempty", + }, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if amino.dont_omitempty is not present and gogoproto.jsontag does not include omitempty, then false", + pluginValue: ["omitempty", "dont_omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + }, + result: false, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if options is null, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: null, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if options is undefined, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: undefined, + result: true, + }, + { + name: "omitEmptyTags: omitempty and dont_omitempty, if options is an empty object, then true", + pluginValue: ["omitempty", "dont_omitempty"], + options: {}, + result: true, + }, + ] + ); +}); diff --git a/packages/utils/src/amino.ts b/packages/utils/src/amino.ts index 25b1c0e3b6..77b8e21eea 100644 --- a/packages/utils/src/amino.ts +++ b/packages/utils/src/amino.ts @@ -7,6 +7,7 @@ import { ProtoRef, TelescopeOptions, IParseContext, + ProtoField, } from "@cosmology/types"; import { kebab } from "case"; @@ -124,3 +125,43 @@ export const getAminoTypeNameByRef = ( } } }; + +/** + * Determines whether a field should be omitted when serializing to JSON based on its JSON tag options. + * + * @param ctx - The parse context. + * @param field - The field to check. + * @returns A boolean indicating whether the field should be omitted. + */ +export const shouldOmitEmpty = ( + ctx: IParseContext, + field: ProtoField +): boolean => { + const omitEmptyTags = ctx.pluginValue("aminoEncoding.omitEmptyTags") ?? []; + + if (omitEmptyTags.includes("omitempty")) { + // omitempty + // if any of gogoproto.jsontag or cosmos_proto.json_tag has omitempty, it should be omitted + let gogoJsonTag = field.options?.["(gogoproto.jsontag)"]; + let cosmosJsonTag = field.options?.["(cosmos_proto.json_tag)"]; + + if (gogoJsonTag || cosmosJsonTag) { + return ( + !!gogoJsonTag?.split(",").includes("omitempty") || + !!cosmosJsonTag?.split(",").includes("omitempty") + ); + } + } + + if (omitEmptyTags.includes("dont_omitempty")) { + // dont_omitempty + // null: should omit + // true: should not omit + // false: should omit + const dontOmitempty = !!field?.options?.["(amino.dont_omitempty)"]; + + return !dontOmitempty; + } + + return true; +}; diff --git a/packages/utils/types/amino.d.ts b/packages/utils/types/amino.d.ts index 9bb8548fe5..25e7de8f9c 100644 --- a/packages/utils/types/amino.d.ts +++ b/packages/utils/types/amino.d.ts @@ -1,5 +1,13 @@ -import { ProtoAny, ProtoRoot, ProtoType, ProtoRef, TelescopeOptions, IParseContext } from "@cosmology/types"; +import { ProtoAny, ProtoRoot, ProtoType, ProtoRef, TelescopeOptions, IParseContext, ProtoField } from "@cosmology/types"; export declare const getTypeUrlWithPkgAndName: (pkg: string, name: string) => string; export declare const getTypeUrl: (root: ProtoRoot, proto: ProtoAny | ProtoType) => string; export declare const getAminoTypeName: (context: IParseContext, root: ProtoRoot, proto: ProtoType) => any; export declare const getAminoTypeNameByRef: (ref: ProtoRef, options: TelescopeOptions, root: ProtoRoot, proto: ProtoType) => any; +/** + * Determines whether a field should be omitted when serializing to JSON based on its JSON tag options. + * + * @param ctx - The parse context. + * @param field - The field to check. + * @returns A boolean indicating whether the field should be omitted. + */ +export declare const shouldOmitEmpty: (ctx: IParseContext, field: ProtoField) => boolean; From 24421b97bb99b458e82c4cd544a3764000fcce36 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sun, 17 Mar 2024 12:50:26 +0800 Subject: [PATCH 18/24] fixed to amino omit empty logic --- .../akash/deployment/v1beta1/authz.ts | 4 +- .../cosmos/bank/v1beta1/tx.ts | 4 +- .../google/protobuf/descriptor.ts | 4 +- .../gogoproto/bundle.ts | 4 +- .../google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../misc/all_fields.ts | 66 +- .../misc/amino_fields.ts | 2564 ----------------- .../misc/bundle.ts | 30 +- .../amino-interface/gogoproto/bundle.ts | 4 +- .../amino-interface/google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../amino-interface/misc/all_fields.ts | 114 +- .../amino-interface/misc/amino_fields.ts | 2564 ----------------- .../amino-interface/misc/bundle.ts | 30 +- .../amino-legacy/gogoproto/bundle.ts | 4 +- .../amino-legacy/google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../amino-legacy/misc/all_fields.ts | 60 +- .../amino-legacy/misc/amino_fields.ts | 2387 --------------- .../amino-legacy/misc/bundle.ts | 24 +- .../amino-legacy/misc/tx.amino.ts | 12 +- .../amino-msg-no-func/gogoproto/bundle.ts | 4 +- .../amino-msg-no-func/google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../amino-msg-no-func/misc/all_fields.ts | 108 +- .../amino-msg-no-func/misc/amino_fields.ts | 2527 ---------------- .../amino-msg-no-func/misc/bundle.ts | 30 +- .../amino-msg-with-func/gogoproto/bundle.ts | 4 +- .../amino-msg-with-func/google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../amino-msg-with-func/misc/all_fields.ts | 108 +- .../amino-msg-with-func/misc/amino_fields.ts | 2527 ---------------- .../amino-msg-with-func/misc/bundle.ts | 30 +- .../gogoproto/bundle.ts | 4 +- .../amino-no-msg-with-func/google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../amino-no-msg-with-func/misc/all_fields.ts | 108 +- .../misc/amino_fields.ts | 2513 ---------------- .../amino-no-msg-with-func/misc/bundle.ts | 30 +- .../gogoproto/bundle.ts | 4 +- .../no-amino-legacy-no-proto/google/bundle.ts | 20 +- .../misc/amino_fields.ts | 1907 ------------ .../no-amino-legacy-no-proto/misc/bundle.ts | 22 +- .../no-amino-legacy/gogoproto/bundle.ts | 4 +- .../no-amino-legacy/google/bundle.ts | 20 +- .../google/protobuf/descriptor.ts | 4 +- .../no-amino-legacy/misc/all_fields.ts | 60 +- .../no-amino-legacy/misc/amino_fields.ts | 2387 --------------- .../no-amino-legacy/misc/bundle.ts | 22 +- .../no-amino-no-proto/gogoproto/bundle.ts | 4 +- .../no-amino-no-proto/google/bundle.ts | 18 +- .../no-amino-no-proto/misc/amino_fields.ts | 1907 ------------ .../no-amino-no-proto/misc/bundle.ts | 18 +- .../no-amino/gogoproto/bundle.ts | 4 +- .../no-amino/google/bundle.ts | 16 +- .../no-amino/google/protobuf/descriptor.ts | 4 +- .../no-amino/misc/all_fields.ts | 60 +- .../no-amino/misc/amino_fields.ts | 2387 --------------- .../no-amino/misc/bundle.ts | 16 +- .../proto-only-legacy/gogoproto/bundle.ts | 4 +- .../proto-only-legacy/google/bundle.ts | 20 +- .../proto-only-legacy/misc/amino_fields.ts | 1939 ------------- .../proto-only-legacy/misc/bundle.ts | 22 +- .../proto-only/gogoproto/bundle.ts | 4 +- .../proto-only/google/bundle.ts | 20 +- .../proto-only/misc/amino_fields.ts | 1939 ------------- .../proto-only/misc/bundle.ts | 22 +- .../misc/output/google/protobuf/descriptor.ts | 4 +- __fixtures__/misc/output/misc/all_fields.ts | 108 +- __fixtures__/misc/output/misc/amino_fields.ts | 2527 ---------------- __fixtures__/misc/output/misc/bundle.ts | 16 +- __fixtures__/misc/proto/misc/all_fields.proto | 135 +- .../misc/proto/misc/amino_fields.proto | 362 --- .../akash/base/v1beta1/attribute.ts | 2 +- .../akash/base/v1beta1/resource.ts | 4 +- .../akash/base/v1beta2/attribute.ts | 2 +- .../akash/base/v1beta2/resource.ts | 4 +- .../akash/cert/v1beta2/cert.ts | 2 +- .../akash/cert/v1beta2/genesis.ts | 2 +- .../akash/cert/v1beta2/query.ts | 2 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 16 +- .../akash/deployment/v1beta1/genesis.ts | 4 +- .../akash/deployment/v1beta1/group.ts | 18 +- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 2 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 4 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 12 +- .../akash/deployment/v1beta2/genesis.ts | 4 +- .../akash/deployment/v1beta2/group.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 2 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 2 +- .../akash/deployment/v1beta2/resource.ts | 4 +- .../akash/escrow/v1beta1/types.ts | 14 +- .../akash/escrow/v1beta2/types.ts | 16 +- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../akash/market/v1beta2/bid.ts | 14 +- .../akash/market/v1beta2/genesis.ts | 2 +- .../akash/market/v1beta2/lease.ts | 14 +- .../akash/market/v1beta2/order.ts | 6 +- .../akash/market/v1beta2/params.ts | 2 +- .../akash/provider/v1beta1/provider.ts | 6 +- .../akash/provider/v1beta2/provider.ts | 6 +- .../cosmos/auth/v1beta1/auth.ts | 14 +- .../cosmos/base/abci/v1beta1/abci.ts | 20 +- .../cosmos/base/query/v1beta1/pagination.ts | 6 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 4 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 2 +- .../cosmos/capability/v1beta1/genesis.ts | 4 +- .../distribution/v1beta1/distribution.ts | 6 +- .../cosmos/distribution/v1beta1/genesis.ts | 6 +- .../cosmos/distribution/v1beta1/query.ts | 4 +- .../cosmos/evidence/v1beta1/evidence.ts | 4 +- .../outputinstantrpc/cosmos/gov/v1/genesis.ts | 2 +- .../outputinstantrpc/cosmos/gov/v1/gov.ts | 6 +- .../outputinstantrpc/cosmos/gov/v1/query.ts | 12 +- .../outputinstantrpc/cosmos/gov/v1/tx.ts | 2 +- .../cosmos/gov/v1beta1/genesis.ts | 2 +- .../cosmos/gov/v1beta1/gov.ts | 4 +- .../cosmos/gov/v1beta1/query.ts | 12 +- .../outputinstantrpc/cosmos/gov/v1beta1/tx.ts | 2 +- .../cosmos/group/v1/events.ts | 14 +- .../cosmos/group/v1/genesis.ts | 6 +- .../outputinstantrpc/cosmos/group/v1/query.ts | 14 +- .../outputinstantrpc/cosmos/group/v1/tx.ts | 22 +- .../outputinstantrpc/cosmos/group/v1/types.ts | 18 +- .../cosmos/mint/v1beta1/mint.ts | 2 +- .../cosmos/nft/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/genesis.ts | 2 +- .../cosmos/slashing/v1beta1/slashing.ts | 8 +- .../cosmos/staking/v1beta1/genesis.ts | 2 +- .../cosmos/staking/v1beta1/query.ts | 2 +- .../cosmos/staking/v1beta1/staking.ts | 6 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../cosmos/tx/v1beta1/service.ts | 2 +- .../outputinstantrpc/cosmos/tx/v1beta1/tx.ts | 12 +- .../cosmos/upgrade/v1beta1/query.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 4 +- .../cosmos/vesting/v1beta1/tx.ts | 4 +- .../cosmos/vesting/v1beta1/vesting.ts | 8 +- .../cosmwasm/wasm/v1/genesis.ts | 4 +- .../outputinstantrpc/cosmwasm/wasm/v1/ibc.ts | 4 +- .../cosmwasm/wasm/v1/proposal.ts | 4 +- .../cosmwasm/wasm/v1/query.ts | 4 +- .../outputinstantrpc/cosmwasm/wasm/v1/tx.ts | 6 +- .../cosmwasm/wasm/v1/types.ts | 10 +- .../evmos/epochs/v1/genesis.ts | 4 +- .../outputinstantrpc/evmos/epochs/v1/query.ts | 2 +- .../outputinstantrpc/evmos/fees/v1/genesis.ts | 2 +- .../evmos/incentives/v1/incentives.ts | 4 +- .../evmos/incentives/v1/query.ts | 2 +- .../evmos/inflation/v1/genesis.ts | 6 +- .../evmos/inflation/v1/query.ts | 4 +- .../google/api/distribution.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- .../google/api/expr/v1alpha1/checked.ts | 4 +- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/api/expr/v1alpha1/explain.ts | 2 +- .../google/api/expr/v1alpha1/syntax.ts | 12 +- .../google/api/expr/v1alpha1/value.ts | 4 +- .../google/api/expr/v1beta1/expr.ts | 4 +- .../google/api/expr/v1beta1/value.ts | 4 +- .../outputinstantrpc/google/api/quota.ts | 10 +- .../api/servicecontrol/v1/distribution.ts | 2 +- .../api/servicecontrol/v1/http_request.ts | 6 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../api/servicecontrol/v1/metric_value.ts | 2 +- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 8 +- .../google/logging/type/http_request.ts | 6 +- .../google/logging/v2/log_entry.ts | 2 +- .../google/logging/v2/logging_config.ts | 2 +- .../google/protobuf/descriptor.ts | 4 +- .../google/protobuf/wrappers.ts | 4 +- .../google/rpc/context/attribute_context.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 2 +- .../ibc/core/channel/v1/channel.ts | 6 +- .../ibc/core/channel/v1/genesis.ts | 4 +- .../ibc/core/channel/v1/query.ts | 12 +- .../ibc/core/channel/v1/tx.ts | 4 +- .../ibc/core/client/v1/client.ts | 4 +- .../ibc/core/client/v1/genesis.ts | 2 +- .../ibc/core/client/v1/query.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 6 +- .../ibc/core/connection/v1/genesis.ts | 2 +- .../ibc/core/connection/v1/query.ts | 4 +- .../ibc/core/connection/v1/tx.ts | 4 +- .../solomachine/v1/solomachine.ts | 22 +- .../solomachine/v2/solomachine.ts | 20 +- .../lightclients/tendermint/v1/tendermint.ts | 4 +- .../osmosis/epochs/genesis.ts | 4 +- .../outputinstantrpc/osmosis/epochs/query.ts | 2 +- .../gamm/pool-models/balancer/balancerPool.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.ts | 2 +- .../pool-models/stableswap/stableswap_pool.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 4 +- .../osmosis/gamm/v1beta1/genesis.ts | 2 +- .../osmosis/gamm/v1beta1/query.ts | 24 +- .../osmosis/gamm/v1beta1/tx.ts | 16 +- .../outputinstantrpc/osmosis/gamm/v2/query.ts | 2 +- .../osmosis/incentives/gauge.ts | 6 +- .../osmosis/incentives/genesis.ts | 2 +- .../osmosis/incentives/query.ts | 4 +- .../outputinstantrpc/osmosis/incentives/tx.ts | 4 +- .../osmosis/lockup/genesis.ts | 2 +- .../outputinstantrpc/osmosis/lockup/lock.ts | 4 +- .../outputinstantrpc/osmosis/lockup/query.ts | 4 +- .../outputinstantrpc/osmosis/lockup/tx.ts | 8 +- .../osmosis/mint/v1beta1/genesis.ts | 2 +- .../osmosis/mint/v1beta1/mint.ts | 4 +- .../pool-incentives/v1beta1/incentives.ts | 6 +- .../osmosis/pool-incentives/v1beta1/query.ts | 8 +- .../osmosis/superfluid/query.ts | 4 +- .../osmosis/superfluid/superfluid.ts | 6 +- .../outputinstantrpc/osmosis/superfluid/tx.ts | 10 +- .../osmosis/twap/v1beta1/query.ts | 4 +- .../osmosis/twap/v1beta1/twap_record.ts | 2 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../osmosis/txfees/v1beta1/query.ts | 4 +- .../outputinstantrpc/tendermint/abci/types.ts | 46 +- .../tendermint/crypto/proof.ts | 4 +- .../tendermint/libs/bits/types.ts | 2 +- .../outputinstantrpc/tendermint/p2p/types.ts | 6 +- .../tendermint/types/evidence.ts | 8 +- .../tendermint/types/params.ts | 16 +- .../tendermint/types/types.ts | 12 +- .../tendermint/types/validator.ts | 8 +- .../tendermint/version/types.ts | 6 +- .../akash/base/v1beta1/attribute.ts | 2 +- .../akash/base/v1beta1/resource.ts | 4 +- .../akash/base/v1beta2/attribute.ts | 2 +- .../akash/base/v1beta2/resource.ts | 4 +- .../outputosmojs/akash/cert/v1beta2/cert.ts | 2 +- .../akash/cert/v1beta2/genesis.ts | 2 +- .../outputosmojs/akash/cert/v1beta2/query.ts | 2 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 16 +- .../akash/deployment/v1beta1/genesis.ts | 4 +- .../akash/deployment/v1beta1/group.ts | 18 +- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 2 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 4 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 12 +- .../akash/deployment/v1beta2/genesis.ts | 4 +- .../akash/deployment/v1beta2/group.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 2 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 2 +- .../akash/deployment/v1beta2/resource.ts | 4 +- .../akash/escrow/v1beta1/types.ts | 14 +- .../akash/escrow/v1beta2/types.ts | 16 +- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../outputosmojs/akash/market/v1beta2/bid.ts | 14 +- .../akash/market/v1beta2/genesis.ts | 2 +- .../akash/market/v1beta2/lease.ts | 14 +- .../akash/market/v1beta2/order.ts | 6 +- .../akash/market/v1beta2/params.ts | 2 +- .../akash/provider/v1beta1/provider.ts | 6 +- .../akash/provider/v1beta2/provider.ts | 6 +- .../outputosmojs/capability/v1/capability.ts | 2 +- .../outputosmojs/capability/v1/genesis.ts | 6 +- .../outputosmojs/cosmos/auth/v1beta1/auth.ts | 14 +- .../cosmos/base/abci/v1beta1/abci.ts | 20 +- .../cosmos/base/query/v1beta1/pagination.ts | 6 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 4 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 2 +- .../cosmos/capability/v1beta1/genesis.ts | 4 +- .../distribution/v1beta1/distribution.ts | 6 +- .../cosmos/distribution/v1beta1/genesis.ts | 6 +- .../cosmos/distribution/v1beta1/query.ts | 4 +- .../cosmos/evidence/v1beta1/evidence.ts | 4 +- .../outputosmojs/cosmos/gov/v1/genesis.ts | 2 +- .../v-next/outputosmojs/cosmos/gov/v1/gov.ts | 6 +- .../outputosmojs/cosmos/gov/v1/query.ts | 12 +- .../v-next/outputosmojs/cosmos/gov/v1/tx.ts | 2 +- .../cosmos/gov/v1beta1/genesis.ts | 2 +- .../outputosmojs/cosmos/gov/v1beta1/gov.ts | 4 +- .../outputosmojs/cosmos/gov/v1beta1/query.ts | 12 +- .../outputosmojs/cosmos/gov/v1beta1/tx.ts | 2 +- .../outputosmojs/cosmos/group/v1/events.ts | 14 +- .../outputosmojs/cosmos/group/v1/genesis.ts | 6 +- .../outputosmojs/cosmos/group/v1/query.ts | 14 +- .../v-next/outputosmojs/cosmos/group/v1/tx.ts | 22 +- .../outputosmojs/cosmos/group/v1/types.ts | 18 +- .../outputosmojs/cosmos/mint/v1beta1/mint.ts | 2 +- .../outputosmojs/cosmos/nft/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/genesis.ts | 2 +- .../cosmos/slashing/v1beta1/slashing.ts | 8 +- .../cosmos/staking/v1beta1/genesis.ts | 2 +- .../cosmos/staking/v1beta1/query.ts | 2 +- .../cosmos/staking/v1beta1/staking.ts | 6 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../outputosmojs/cosmos/tx/v1beta1/service.ts | 2 +- .../outputosmojs/cosmos/tx/v1beta1/tx.ts | 12 +- .../cosmos/upgrade/v1beta1/query.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 4 +- .../outputosmojs/cosmos/vesting/v1beta1/tx.ts | 4 +- .../cosmos/vesting/v1beta1/vesting.ts | 8 +- .../outputosmojs/cosmwasm/wasm/v1/authz.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/genesis.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/proposal.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/query.ts | 4 +- .../outputosmojs/cosmwasm/wasm/v1/tx.ts | 6 +- .../outputosmojs/cosmwasm/wasm/v1/types.ts | 10 +- .../outputosmojs/evmos/epochs/v1/genesis.ts | 4 +- .../outputosmojs/evmos/epochs/v1/query.ts | 2 +- .../outputosmojs/evmos/fees/v1/genesis.ts | 2 +- .../evmos/incentives/v1/incentives.ts | 4 +- .../outputosmojs/evmos/incentives/v1/query.ts | 2 +- .../evmos/inflation/v1/genesis.ts | 6 +- .../outputosmojs/evmos/inflation/v1/query.ts | 4 +- .../outputosmojs/google/api/distribution.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- .../google/api/expr/v1alpha1/checked.ts | 4 +- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/api/expr/v1alpha1/explain.ts | 2 +- .../google/api/expr/v1alpha1/syntax.ts | 12 +- .../google/api/expr/v1alpha1/value.ts | 4 +- .../google/api/expr/v1beta1/expr.ts | 4 +- .../google/api/expr/v1beta1/value.ts | 4 +- .../v-next/outputosmojs/google/api/quota.ts | 10 +- .../api/servicecontrol/v1/distribution.ts | 2 +- .../api/servicecontrol/v1/http_request.ts | 6 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../api/servicecontrol/v1/metric_value.ts | 2 +- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 8 +- .../google/logging/type/http_request.ts | 6 +- .../google/logging/v2/log_entry.ts | 2 +- .../google/logging/v2/logging_config.ts | 2 +- .../google/protobuf/descriptor.ts | 4 +- .../outputosmojs/google/protobuf/wrappers.ts | 4 +- .../google/rpc/context/attribute_context.ts | 8 +- .../ibc/applications/fee/v1/query.ts | 8 +- .../interchain_accounts/controller/v1/tx.ts | 4 +- .../ibc/applications/transfer/v1/tx.ts | 2 +- .../ibc/core/channel/v1/channel.ts | 6 +- .../ibc/core/channel/v1/genesis.ts | 4 +- .../outputosmojs/ibc/core/channel/v1/query.ts | 12 +- .../outputosmojs/ibc/core/channel/v1/tx.ts | 4 +- .../outputosmojs/ibc/core/client/v1/client.ts | 4 +- .../ibc/core/client/v1/genesis.ts | 2 +- .../outputosmojs/ibc/core/client/v1/query.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 6 +- .../ibc/core/connection/v1/genesis.ts | 2 +- .../ibc/core/connection/v1/query.ts | 4 +- .../outputosmojs/ibc/core/connection/v1/tx.ts | 4 +- .../solomachine/v1/solomachine.ts | 22 +- .../solomachine/v2/solomachine.ts | 20 +- .../solomachine/v3/solomachine.ts | 16 +- .../lightclients/tendermint/v1/tendermint.ts | 4 +- .../osmosis/concentrated-liquidity/genesis.ts | 6 +- .../incentive_record.ts | 2 +- .../pool-model/query.ts | 12 +- .../concentrated-liquidity/pool-model/tx.ts | 4 +- .../osmosis/concentrated-liquidity/pool.ts | 4 +- .../concentrated-liquidity/position.ts | 8 +- .../osmosis/concentrated-liquidity/tx.ts | 14 +- .../cosmwasmpool/v1beta1/model/pool.ts | 4 +- .../osmosis/cosmwasmpool/v1beta1/model/tx.ts | 4 +- .../outputosmojs/osmosis/epochs/genesis.ts | 4 +- .../outputosmojs/osmosis/epochs/query.ts | 2 +- .../gamm/pool-models/balancer/balancerPool.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.ts | 2 +- .../pool-models/stableswap/stableswap_pool.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 4 +- .../osmosis/gamm/v1beta1/genesis.ts | 2 +- .../osmosis/gamm/v1beta1/query.ts | 24 +- .../outputosmojs/osmosis/gamm/v1beta1/tx.ts | 16 +- .../outputosmojs/osmosis/gamm/v2/query.ts | 2 +- .../outputosmojs/osmosis/incentives/gauge.ts | 6 +- .../osmosis/incentives/genesis.ts | 2 +- .../outputosmojs/osmosis/incentives/query.ts | 4 +- .../outputosmojs/osmosis/incentives/tx.ts | 4 +- .../outputosmojs/osmosis/lockup/genesis.ts | 2 +- .../outputosmojs/osmosis/lockup/lock.ts | 4 +- .../outputosmojs/osmosis/lockup/query.ts | 4 +- .../v-next/outputosmojs/osmosis/lockup/tx.ts | 8 +- .../osmosis/mint/v1beta1/genesis.ts | 2 +- .../outputosmojs/osmosis/mint/v1beta1/mint.ts | 4 +- .../pool-incentives/v1beta1/incentives.ts | 6 +- .../osmosis/pool-incentives/v1beta1/query.ts | 8 +- .../osmosis/poolmanager/v1beta1/genesis.ts | 2 +- .../poolmanager/v1beta1/module_route.ts | 2 +- .../osmosis/poolmanager/v1beta1/query.ts | 16 +- .../osmosis/poolmanager/v1beta1/swap_route.ts | 4 +- .../osmosis/protorev/v1beta1/genesis.ts | 10 +- .../osmosis/protorev/v1beta1/protorev.ts | 8 +- .../osmosis/protorev/v1beta1/query.ts | 4 +- .../osmosis/protorev/v1beta1/tx.ts | 4 +- .../outputosmojs/osmosis/superfluid/query.ts | 4 +- .../osmosis/superfluid/superfluid.ts | 6 +- .../outputosmojs/osmosis/superfluid/tx.ts | 10 +- .../osmosis/twap/v1beta1/query.ts | 4 +- .../osmosis/twap/v1beta1/twap_record.ts | 2 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../osmosis/txfees/v1beta1/query.ts | 4 +- .../osmosis/valset-pref/v1beta1/tx.ts | 2 +- .../outputosmojs/tendermint/abci/types.ts | 46 +- .../outputosmojs/tendermint/crypto/proof.ts | 4 +- .../tendermint/libs/bits/types.ts | 2 +- .../outputosmojs/tendermint/p2p/types.ts | 6 +- .../outputosmojs/tendermint/types/evidence.ts | 8 +- .../outputosmojs/tendermint/types/params.ts | 16 +- .../outputosmojs/tendermint/types/types.ts | 12 +- .../tendermint/types/validator.ts | 8 +- .../outputosmojs/tendermint/version/types.ts | 6 +- .../outputsign/akash/audit/v1beta1/audit.ts | 30 +- .../outputsign/akash/audit/v1beta2/audit.ts | 30 +- .../outputsign/akash/audit/v1beta2/genesis.ts | 2 +- .../akash/base/v1beta1/attribute.ts | 10 +- .../outputsign/akash/base/v1beta1/resource.ts | 10 +- .../akash/base/v1beta2/attribute.ts | 10 +- .../outputsign/akash/base/v1beta2/endpoint.ts | 2 +- .../outputsign/akash/base/v1beta2/resource.ts | 10 +- .../akash/base/v1beta2/resourceunits.ts | 2 +- .../outputsign/akash/cert/v1beta2/cert.ts | 26 +- .../outputsign/akash/cert/v1beta2/genesis.ts | 8 +- .../outputsign/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 36 +- .../akash/deployment/v1beta1/genesis.ts | 8 +- .../akash/deployment/v1beta1/group.ts | 30 +- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 4 +- .../akash/deployment/v1beta2/authz.ts | 4 +- .../akash/deployment/v1beta2/deployment.ts | 20 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 34 +- .../akash/deployment/v1beta2/genesis.ts | 12 +- .../akash/deployment/v1beta2/group.ts | 12 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 12 +- .../akash/deployment/v1beta2/groupspec.ts | 8 +- .../akash/deployment/v1beta2/params.ts | 4 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 10 +- .../akash/escrow/v1beta1/genesis.ts | 4 +- .../outputsign/akash/escrow/v1beta1/types.ts | 44 +- .../akash/escrow/v1beta2/genesis.ts | 4 +- .../outputsign/akash/escrow/v1beta2/types.ts | 50 +- .../akash/inflation/v1beta2/genesis.ts | 4 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputsign/akash/market/v1beta2/bid.ts | 52 +- .../akash/market/v1beta2/genesis.ts | 8 +- .../outputsign/akash/market/v1beta2/lease.ts | 48 +- .../outputsign/akash/market/v1beta2/order.ts | 30 +- .../outputsign/akash/market/v1beta2/params.ts | 6 +- .../akash/provider/v1beta1/provider.ts | 36 +- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.ts | 36 +- .../outputsign/cosmos/auth/v1beta1/auth.ts | 14 +- .../cosmos/base/abci/v1beta1/abci.ts | 22 +- .../cosmos/base/query/v1beta1/pagination.ts | 6 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 4 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 2 +- .../cosmos/capability/v1beta1/genesis.ts | 4 +- .../distribution/v1beta1/distribution.ts | 8 +- .../cosmos/distribution/v1beta1/genesis.ts | 6 +- .../cosmos/distribution/v1beta1/query.ts | 4 +- .../cosmos/evidence/v1beta1/evidence.ts | 4 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../outputsign/cosmos/gov/v1/genesis.ts | 2 +- .../v-next/outputsign/cosmos/gov/v1/gov.ts | 6 +- .../v-next/outputsign/cosmos/gov/v1/query.ts | 12 +- .../v-next/outputsign/cosmos/gov/v1/tx.ts | 8 +- .../outputsign/cosmos/gov/v1beta1/genesis.ts | 2 +- .../outputsign/cosmos/gov/v1beta1/gov.ts | 6 +- .../outputsign/cosmos/gov/v1beta1/query.ts | 12 +- .../outputsign/cosmos/gov/v1beta1/tx.ts | 8 +- .../outputsign/cosmos/group/v1/events.ts | 14 +- .../outputsign/cosmos/group/v1/genesis.ts | 6 +- .../outputsign/cosmos/group/v1/query.ts | 14 +- .../v-next/outputsign/cosmos/group/v1/tx.ts | 22 +- .../outputsign/cosmos/group/v1/types.ts | 18 +- .../outputsign/cosmos/mint/v1beta1/mint.ts | 2 +- .../outputsign/cosmos/nft/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/genesis.ts | 2 +- .../cosmos/slashing/v1beta1/slashing.ts | 8 +- .../outputsign/cosmos/slashing/v1beta1/tx.ts | 2 +- .../cosmos/staking/v1beta1/genesis.ts | 2 +- .../cosmos/staking/v1beta1/query.ts | 2 +- .../cosmos/staking/v1beta1/staking.ts | 10 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../outputsign/cosmos/tx/v1beta1/service.ts | 2 +- .../v-next/outputsign/cosmos/tx/v1beta1/tx.ts | 12 +- .../cosmos/upgrade/v1beta1/query.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 4 +- .../outputsign/cosmos/vesting/v1beta1/tx.ts | 4 +- .../cosmos/vesting/v1beta1/vesting.ts | 8 +- .../outputsign/cosmwasm/wasm/v1/genesis.ts | 4 +- .../v-next/outputsign/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputsign/cosmwasm/wasm/v1/proposal.ts | 4 +- .../outputsign/cosmwasm/wasm/v1/query.ts | 8 +- .../v-next/outputsign/cosmwasm/wasm/v1/tx.ts | 6 +- .../outputsign/cosmwasm/wasm/v1/types.ts | 10 +- .../outputsign/evmos/epochs/v1/genesis.ts | 4 +- .../outputsign/evmos/epochs/v1/query.ts | 2 +- .../outputsign/evmos/fees/v1/genesis.ts | 2 +- .../evmos/incentives/v1/incentives.ts | 4 +- .../outputsign/evmos/incentives/v1/query.ts | 2 +- .../outputsign/evmos/inflation/v1/genesis.ts | 6 +- .../outputsign/evmos/inflation/v1/query.ts | 4 +- .../outputsign/google/api/distribution.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- .../google/api/expr/v1alpha1/checked.ts | 4 +- .../google/api/expr/v1alpha1/eval.ts | 4 +- .../google/api/expr/v1alpha1/explain.ts | 2 +- .../google/api/expr/v1alpha1/syntax.ts | 12 +- .../google/api/expr/v1alpha1/value.ts | 4 +- .../google/api/expr/v1beta1/expr.ts | 4 +- .../google/api/expr/v1beta1/value.ts | 4 +- .../v-next/outputsign/google/api/quota.ts | 10 +- .../api/servicecontrol/v1/distribution.ts | 2 +- .../api/servicecontrol/v1/http_request.ts | 6 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../api/servicecontrol/v1/metric_value.ts | 2 +- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 8 +- .../google/logging/type/http_request.ts | 6 +- .../outputsign/google/logging/v2/log_entry.ts | 2 +- .../google/logging/v2/logging_config.ts | 2 +- .../outputsign/google/protobuf/descriptor.ts | 4 +- .../outputsign/google/protobuf/wrappers.ts | 4 +- .../google/rpc/context/attribute_context.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 2 +- .../outputsign/ibc/core/channel/v1/channel.ts | 6 +- .../outputsign/ibc/core/channel/v1/genesis.ts | 4 +- .../outputsign/ibc/core/channel/v1/query.ts | 12 +- .../outputsign/ibc/core/channel/v1/tx.ts | 4 +- .../outputsign/ibc/core/client/v1/client.ts | 4 +- .../outputsign/ibc/core/client/v1/genesis.ts | 2 +- .../outputsign/ibc/core/client/v1/query.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 6 +- .../ibc/core/connection/v1/genesis.ts | 2 +- .../ibc/core/connection/v1/query.ts | 4 +- .../outputsign/ibc/core/connection/v1/tx.ts | 4 +- .../solomachine/v1/solomachine.ts | 22 +- .../solomachine/v2/solomachine.ts | 20 +- .../lightclients/tendermint/v1/tendermint.ts | 4 +- .../outputsign/osmosis/epochs/genesis.ts | 4 +- .../v-next/outputsign/osmosis/epochs/query.ts | 2 +- .../gamm/pool-models/balancer/balancerPool.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.ts | 2 +- .../pool-models/stableswap/stableswap_pool.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 4 +- .../osmosis/gamm/v1beta1/genesis.ts | 2 +- .../outputsign/osmosis/gamm/v1beta1/query.ts | 24 +- .../outputsign/osmosis/gamm/v1beta1/tx.ts | 16 +- .../outputsign/osmosis/gamm/v2/query.ts | 2 +- .../outputsign/osmosis/incentives/gauge.ts | 6 +- .../outputsign/osmosis/incentives/genesis.ts | 2 +- .../outputsign/osmosis/incentives/query.ts | 4 +- .../outputsign/osmosis/incentives/tx.ts | 4 +- .../outputsign/osmosis/lockup/genesis.ts | 2 +- .../v-next/outputsign/osmosis/lockup/lock.ts | 4 +- .../v-next/outputsign/osmosis/lockup/query.ts | 4 +- .../v-next/outputsign/osmosis/lockup/tx.ts | 8 +- .../osmosis/mint/v1beta1/genesis.ts | 2 +- .../outputsign/osmosis/mint/v1beta1/mint.ts | 4 +- .../pool-incentives/v1beta1/incentives.ts | 6 +- .../osmosis/pool-incentives/v1beta1/query.ts | 8 +- .../outputsign/osmosis/superfluid/query.ts | 4 +- .../osmosis/superfluid/superfluid.ts | 6 +- .../outputsign/osmosis/superfluid/tx.ts | 10 +- .../outputsign/osmosis/twap/v1beta1/query.ts | 4 +- .../osmosis/twap/v1beta1/twap_record.ts | 4 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../osmosis/txfees/v1beta1/query.ts | 4 +- .../outputsign/tendermint/abci/types.ts | 46 +- .../outputsign/tendermint/crypto/proof.ts | 4 +- .../outputsign/tendermint/libs/bits/types.ts | 2 +- .../v-next/outputsign/tendermint/p2p/types.ts | 6 +- .../outputsign/tendermint/types/evidence.ts | 8 +- .../outputsign/tendermint/types/params.ts | 16 +- .../outputsign/tendermint/types/types.ts | 12 +- .../outputsign/tendermint/types/validator.ts | 8 +- .../outputsign/tendermint/version/types.ts | 6 +- .../outputv2/akash/audit/v1beta1/audit.ts | 30 +- .../outputv2/akash/audit/v1beta2/audit.ts | 30 +- .../outputv2/akash/audit/v1beta2/genesis.ts | 2 +- .../outputv2/akash/base/v1beta1/attribute.ts | 10 +- .../outputv2/akash/base/v1beta1/resource.ts | 10 +- .../outputv2/akash/base/v1beta2/attribute.ts | 10 +- .../outputv2/akash/base/v1beta2/endpoint.ts | 2 +- .../outputv2/akash/base/v1beta2/resource.ts | 10 +- .../akash/base/v1beta2/resourceunits.ts | 2 +- .../outputv2/akash/cert/v1beta2/cert.ts | 26 +- .../outputv2/akash/cert/v1beta2/genesis.ts | 8 +- .../outputv2/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 4 +- .../akash/deployment/v1beta1/deployment.ts | 52 +- .../akash/deployment/v1beta1/genesis.ts | 12 +- .../akash/deployment/v1beta1/group.ts | 48 +- .../akash/deployment/v1beta1/params.ts | 4 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 4 +- .../akash/deployment/v1beta2/deployment.ts | 20 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 34 +- .../akash/deployment/v1beta2/genesis.ts | 12 +- .../akash/deployment/v1beta2/group.ts | 12 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 12 +- .../akash/deployment/v1beta2/groupspec.ts | 8 +- .../akash/deployment/v1beta2/params.ts | 4 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 10 +- .../outputv2/akash/escrow/v1beta1/genesis.ts | 4 +- .../outputv2/akash/escrow/v1beta1/types.ts | 44 +- .../outputv2/akash/escrow/v1beta2/genesis.ts | 4 +- .../outputv2/akash/escrow/v1beta2/types.ts | 50 +- .../akash/inflation/v1beta2/genesis.ts | 4 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputv2/akash/market/v1beta2/bid.ts | 52 +- .../outputv2/akash/market/v1beta2/genesis.ts | 8 +- .../outputv2/akash/market/v1beta2/lease.ts | 48 +- .../outputv2/akash/market/v1beta2/order.ts | 30 +- .../outputv2/akash/market/v1beta2/params.ts | 6 +- .../akash/provider/v1beta1/provider.ts | 36 +- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.ts | 36 +- .../outputv2/cosmos/auth/v1beta1/auth.ts | 14 +- .../outputv2/cosmos/base/abci/v1beta1/abci.ts | 22 +- .../cosmos/base/query/v1beta1/pagination.ts | 6 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 4 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 2 +- .../cosmos/capability/v1beta1/genesis.ts | 4 +- .../distribution/v1beta1/distribution.ts | 8 +- .../cosmos/distribution/v1beta1/genesis.ts | 6 +- .../cosmos/distribution/v1beta1/query.ts | 4 +- .../cosmos/evidence/v1beta1/evidence.ts | 4 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../v-next/outputv2/cosmos/gov/v1/genesis.ts | 2 +- .../v-next/outputv2/cosmos/gov/v1/gov.ts | 6 +- .../v-next/outputv2/cosmos/gov/v1/query.ts | 12 +- .../v-next/outputv2/cosmos/gov/v1/tx.ts | 8 +- .../outputv2/cosmos/gov/v1beta1/genesis.ts | 2 +- .../v-next/outputv2/cosmos/gov/v1beta1/gov.ts | 6 +- .../outputv2/cosmos/gov/v1beta1/query.ts | 12 +- .../v-next/outputv2/cosmos/gov/v1beta1/tx.ts | 8 +- .../v-next/outputv2/cosmos/group/v1/events.ts | 14 +- .../outputv2/cosmos/group/v1/genesis.ts | 6 +- .../v-next/outputv2/cosmos/group/v1/query.ts | 14 +- .../v-next/outputv2/cosmos/group/v1/tx.ts | 22 +- .../v-next/outputv2/cosmos/group/v1/types.ts | 18 +- .../outputv2/cosmos/mint/v1beta1/mint.ts | 2 +- .../outputv2/cosmos/nft/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/genesis.ts | 2 +- .../cosmos/slashing/v1beta1/slashing.ts | 8 +- .../outputv2/cosmos/slashing/v1beta1/tx.ts | 2 +- .../cosmos/staking/v1beta1/genesis.ts | 2 +- .../outputv2/cosmos/staking/v1beta1/query.ts | 2 +- .../cosmos/staking/v1beta1/staking.ts | 10 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../outputv2/cosmos/tx/v1beta1/service.ts | 2 +- .../v-next/outputv2/cosmos/tx/v1beta1/tx.ts | 12 +- .../outputv2/cosmos/upgrade/v1beta1/query.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 4 +- .../outputv2/cosmos/vesting/v1beta1/tx.ts | 4 +- .../cosmos/vesting/v1beta1/vesting.ts | 8 +- .../outputv2/cosmwasm/wasm/v1/genesis.ts | 4 +- .../v-next/outputv2/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputv2/cosmwasm/wasm/v1/proposal.ts | 4 +- .../v-next/outputv2/cosmwasm/wasm/v1/query.ts | 8 +- .../v-next/outputv2/cosmwasm/wasm/v1/tx.ts | 6 +- .../v-next/outputv2/cosmwasm/wasm/v1/types.ts | 10 +- .../outputv2/evmos/epochs/v1/genesis.ts | 4 +- .../v-next/outputv2/evmos/epochs/v1/query.ts | 2 +- .../v-next/outputv2/evmos/fees/v1/genesis.ts | 2 +- .../evmos/incentives/v1/incentives.ts | 4 +- .../outputv2/evmos/incentives/v1/query.ts | 2 +- .../outputv2/evmos/inflation/v1/genesis.ts | 6 +- .../outputv2/evmos/inflation/v1/query.ts | 4 +- .../outputv2/google/api/distribution.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- .../google/api/expr/v1alpha1/checked.ts | 4 +- .../outputv2/google/api/expr/v1alpha1/eval.ts | 4 +- .../google/api/expr/v1alpha1/explain.ts | 2 +- .../google/api/expr/v1alpha1/syntax.ts | 12 +- .../google/api/expr/v1alpha1/value.ts | 4 +- .../outputv2/google/api/expr/v1beta1/expr.ts | 4 +- .../outputv2/google/api/expr/v1beta1/value.ts | 4 +- .../v-next/outputv2/google/api/quota.ts | 10 +- .../api/servicecontrol/v1/distribution.ts | 2 +- .../api/servicecontrol/v1/http_request.ts | 6 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../api/servicecontrol/v1/metric_value.ts | 2 +- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 8 +- .../google/logging/type/http_request.ts | 6 +- .../outputv2/google/logging/v2/log_entry.ts | 2 +- .../google/logging/v2/logging_config.ts | 2 +- .../outputv2/google/protobuf/descriptor.ts | 4 +- .../outputv2/google/protobuf/wrappers.ts | 4 +- .../google/rpc/context/attribute_context.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 2 +- .../outputv2/ibc/core/channel/v1/channel.ts | 6 +- .../outputv2/ibc/core/channel/v1/genesis.ts | 4 +- .../outputv2/ibc/core/channel/v1/query.ts | 12 +- .../v-next/outputv2/ibc/core/channel/v1/tx.ts | 4 +- .../outputv2/ibc/core/client/v1/client.ts | 4 +- .../outputv2/ibc/core/client/v1/genesis.ts | 2 +- .../outputv2/ibc/core/client/v1/query.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 6 +- .../ibc/core/connection/v1/genesis.ts | 2 +- .../outputv2/ibc/core/connection/v1/query.ts | 4 +- .../outputv2/ibc/core/connection/v1/tx.ts | 4 +- .../solomachine/v1/solomachine.ts | 22 +- .../solomachine/v2/solomachine.ts | 20 +- .../lightclients/tendermint/v1/tendermint.ts | 4 +- .../v-next/outputv2/osmosis/epochs/genesis.ts | 4 +- .../v-next/outputv2/osmosis/epochs/query.ts | 2 +- .../gamm/pool-models/balancer/balancerPool.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.ts | 2 +- .../pool-models/stableswap/stableswap_pool.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 4 +- .../outputv2/osmosis/gamm/v1beta1/genesis.ts | 2 +- .../outputv2/osmosis/gamm/v1beta1/query.ts | 24 +- .../outputv2/osmosis/gamm/v1beta1/tx.ts | 16 +- .../v-next/outputv2/osmosis/gamm/v2/query.ts | 2 +- .../outputv2/osmosis/incentives/gauge.ts | 6 +- .../outputv2/osmosis/incentives/genesis.ts | 2 +- .../outputv2/osmosis/incentives/query.ts | 4 +- .../v-next/outputv2/osmosis/incentives/tx.ts | 4 +- .../v-next/outputv2/osmosis/lockup/genesis.ts | 2 +- .../v-next/outputv2/osmosis/lockup/lock.ts | 4 +- .../v-next/outputv2/osmosis/lockup/query.ts | 4 +- .../v-next/outputv2/osmosis/lockup/tx.ts | 8 +- .../outputv2/osmosis/mint/v1beta1/genesis.ts | 2 +- .../outputv2/osmosis/mint/v1beta1/mint.ts | 4 +- .../pool-incentives/v1beta1/incentives.ts | 6 +- .../osmosis/pool-incentives/v1beta1/query.ts | 8 +- .../outputv2/osmosis/superfluid/query.ts | 4 +- .../outputv2/osmosis/superfluid/superfluid.ts | 6 +- .../v-next/outputv2/osmosis/superfluid/tx.ts | 10 +- .../outputv2/osmosis/twap/v1beta1/query.ts | 4 +- .../osmosis/twap/v1beta1/twap_record.ts | 4 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../outputv2/osmosis/txfees/v1beta1/query.ts | 4 +- .../v-next/outputv2/tendermint/abci/types.ts | 46 +- .../outputv2/tendermint/crypto/proof.ts | 4 +- .../outputv2/tendermint/libs/bits/types.ts | 2 +- .../v-next/outputv2/tendermint/p2p/types.ts | 6 +- .../outputv2/tendermint/types/evidence.ts | 8 +- .../outputv2/tendermint/types/params.ts | 16 +- .../v-next/outputv2/tendermint/types/types.ts | 12 +- .../outputv2/tendermint/types/validator.ts | 8 +- .../outputv2/tendermint/version/types.ts | 6 +- .../outputv3/akash/audit/v1beta1/audit.ts | 30 +- .../outputv3/akash/audit/v1beta2/audit.ts | 30 +- .../outputv3/akash/audit/v1beta2/genesis.ts | 2 +- .../outputv3/akash/base/v1beta1/attribute.ts | 10 +- .../outputv3/akash/base/v1beta1/resource.ts | 10 +- .../outputv3/akash/base/v1beta2/attribute.ts | 10 +- .../outputv3/akash/base/v1beta2/endpoint.ts | 2 +- .../outputv3/akash/base/v1beta2/resource.ts | 10 +- .../akash/base/v1beta2/resourceunits.ts | 2 +- .../outputv3/akash/cert/v1beta2/cert.ts | 26 +- .../outputv3/akash/cert/v1beta2/genesis.ts | 8 +- .../outputv3/akash/cert/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta1/authz.ts | 4 +- .../akash/deployment/v1beta1/deployment.ts | 52 +- .../akash/deployment/v1beta1/genesis.ts | 12 +- .../akash/deployment/v1beta1/group.ts | 48 +- .../akash/deployment/v1beta1/params.ts | 4 +- .../akash/deployment/v1beta1/query.ts | 6 +- .../akash/deployment/v1beta2/authz.ts | 4 +- .../akash/deployment/v1beta2/deployment.ts | 20 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 34 +- .../akash/deployment/v1beta2/genesis.ts | 12 +- .../akash/deployment/v1beta2/group.ts | 12 +- .../akash/deployment/v1beta2/groupid.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 12 +- .../akash/deployment/v1beta2/groupspec.ts | 8 +- .../akash/deployment/v1beta2/params.ts | 4 +- .../akash/deployment/v1beta2/query.ts | 6 +- .../akash/deployment/v1beta2/resource.ts | 10 +- .../outputv3/akash/escrow/v1beta1/genesis.ts | 4 +- .../outputv3/akash/escrow/v1beta1/types.ts | 44 +- .../outputv3/akash/escrow/v1beta2/genesis.ts | 4 +- .../outputv3/akash/escrow/v1beta2/types.ts | 50 +- .../akash/inflation/v1beta2/genesis.ts | 4 +- .../akash/inflation/v1beta2/params.ts | 6 +- .../outputv3/akash/market/v1beta2/bid.ts | 52 +- .../outputv3/akash/market/v1beta2/genesis.ts | 8 +- .../outputv3/akash/market/v1beta2/lease.ts | 48 +- .../outputv3/akash/market/v1beta2/order.ts | 30 +- .../outputv3/akash/market/v1beta2/params.ts | 6 +- .../akash/provider/v1beta1/provider.ts | 36 +- .../akash/provider/v1beta2/genesis.ts | 2 +- .../akash/provider/v1beta2/provider.ts | 36 +- .../outputv3/cosmos/auth/v1beta1/auth.ts | 14 +- .../outputv3/cosmos/base/abci/v1beta1/abci.ts | 22 +- .../cosmos/base/query/v1beta1/pagination.ts | 6 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 4 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 2 +- .../cosmos/capability/v1beta1/genesis.ts | 4 +- .../distribution/v1beta1/distribution.ts | 8 +- .../cosmos/distribution/v1beta1/genesis.ts | 6 +- .../cosmos/distribution/v1beta1/query.ts | 4 +- .../cosmos/evidence/v1beta1/evidence.ts | 4 +- .../cosmos/genutil/v1beta1/genesis.ts | 2 +- .../v-next/outputv3/cosmos/gov/v1/genesis.ts | 2 +- .../v-next/outputv3/cosmos/gov/v1/gov.ts | 6 +- .../v-next/outputv3/cosmos/gov/v1/query.ts | 12 +- .../v-next/outputv3/cosmos/gov/v1/tx.ts | 8 +- .../outputv3/cosmos/gov/v1beta1/genesis.ts | 2 +- .../v-next/outputv3/cosmos/gov/v1beta1/gov.ts | 6 +- .../outputv3/cosmos/gov/v1beta1/query.ts | 12 +- .../v-next/outputv3/cosmos/gov/v1beta1/tx.ts | 8 +- .../v-next/outputv3/cosmos/group/v1/events.ts | 14 +- .../outputv3/cosmos/group/v1/genesis.ts | 6 +- .../v-next/outputv3/cosmos/group/v1/query.ts | 14 +- .../v-next/outputv3/cosmos/group/v1/tx.ts | 22 +- .../v-next/outputv3/cosmos/group/v1/types.ts | 18 +- .../outputv3/cosmos/mint/v1beta1/mint.ts | 2 +- .../outputv3/cosmos/nft/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/genesis.ts | 2 +- .../cosmos/slashing/v1beta1/slashing.ts | 8 +- .../outputv3/cosmos/slashing/v1beta1/tx.ts | 2 +- .../cosmos/staking/v1beta1/genesis.ts | 2 +- .../outputv3/cosmos/staking/v1beta1/query.ts | 2 +- .../cosmos/staking/v1beta1/staking.ts | 10 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../outputv3/cosmos/tx/v1beta1/service.ts | 2 +- .../v-next/outputv3/cosmos/tx/v1beta1/tx.ts | 12 +- .../outputv3/cosmos/upgrade/v1beta1/query.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 4 +- .../outputv3/cosmos/vesting/v1beta1/tx.ts | 4 +- .../cosmos/vesting/v1beta1/vesting.ts | 8 +- .../outputv3/cosmwasm/wasm/v1/genesis.ts | 4 +- .../v-next/outputv3/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputv3/cosmwasm/wasm/v1/proposal.ts | 4 +- .../v-next/outputv3/cosmwasm/wasm/v1/query.ts | 8 +- .../v-next/outputv3/cosmwasm/wasm/v1/tx.ts | 6 +- .../v-next/outputv3/cosmwasm/wasm/v1/types.ts | 10 +- .../outputv3/evmos/epochs/v1/genesis.ts | 4 +- .../v-next/outputv3/evmos/epochs/v1/query.ts | 2 +- .../v-next/outputv3/evmos/fees/v1/genesis.ts | 2 +- .../evmos/incentives/v1/incentives.ts | 4 +- .../outputv3/evmos/incentives/v1/query.ts | 2 +- .../outputv3/evmos/inflation/v1/genesis.ts | 6 +- .../outputv3/evmos/inflation/v1/query.ts | 4 +- .../outputv3/google/api/distribution.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- .../google/api/expr/v1alpha1/checked.ts | 4 +- .../outputv3/google/api/expr/v1alpha1/eval.ts | 4 +- .../google/api/expr/v1alpha1/explain.ts | 2 +- .../google/api/expr/v1alpha1/syntax.ts | 12 +- .../google/api/expr/v1alpha1/value.ts | 4 +- .../outputv3/google/api/expr/v1beta1/expr.ts | 4 +- .../outputv3/google/api/expr/v1beta1/value.ts | 4 +- .../v-next/outputv3/google/api/quota.ts | 10 +- .../api/servicecontrol/v1/distribution.ts | 2 +- .../api/servicecontrol/v1/http_request.ts | 6 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../api/servicecontrol/v1/metric_value.ts | 2 +- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 8 +- .../google/logging/type/http_request.ts | 6 +- .../outputv3/google/logging/v2/log_entry.ts | 2 +- .../google/logging/v2/logging_config.ts | 2 +- .../outputv3/google/protobuf/descriptor.ts | 4 +- .../outputv3/google/protobuf/wrappers.ts | 4 +- .../google/rpc/context/attribute_context.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 2 +- .../outputv3/ibc/core/channel/v1/channel.ts | 6 +- .../outputv3/ibc/core/channel/v1/genesis.ts | 4 +- .../outputv3/ibc/core/channel/v1/query.ts | 12 +- .../v-next/outputv3/ibc/core/channel/v1/tx.ts | 4 +- .../outputv3/ibc/core/client/v1/client.ts | 4 +- .../outputv3/ibc/core/client/v1/genesis.ts | 2 +- .../outputv3/ibc/core/client/v1/query.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 6 +- .../ibc/core/connection/v1/genesis.ts | 2 +- .../outputv3/ibc/core/connection/v1/query.ts | 4 +- .../outputv3/ibc/core/connection/v1/tx.ts | 4 +- .../solomachine/v1/solomachine.ts | 22 +- .../solomachine/v2/solomachine.ts | 20 +- .../lightclients/tendermint/v1/tendermint.ts | 4 +- .../v-next/outputv3/osmosis/epochs/genesis.ts | 4 +- .../v-next/outputv3/osmosis/epochs/query.ts | 2 +- .../gamm/pool-models/balancer/balancerPool.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.ts | 2 +- .../pool-models/stableswap/stableswap_pool.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 4 +- .../outputv3/osmosis/gamm/v1beta1/genesis.ts | 2 +- .../outputv3/osmosis/gamm/v1beta1/query.ts | 24 +- .../outputv3/osmosis/gamm/v1beta1/tx.ts | 16 +- .../v-next/outputv3/osmosis/gamm/v2/query.ts | 2 +- .../outputv3/osmosis/incentives/gauge.ts | 6 +- .../outputv3/osmosis/incentives/genesis.ts | 2 +- .../outputv3/osmosis/incentives/query.ts | 4 +- .../v-next/outputv3/osmosis/incentives/tx.ts | 4 +- .../v-next/outputv3/osmosis/lockup/genesis.ts | 2 +- .../v-next/outputv3/osmosis/lockup/lock.ts | 4 +- .../v-next/outputv3/osmosis/lockup/query.ts | 4 +- .../v-next/outputv3/osmosis/lockup/tx.ts | 8 +- .../outputv3/osmosis/mint/v1beta1/genesis.ts | 2 +- .../outputv3/osmosis/mint/v1beta1/mint.ts | 4 +- .../pool-incentives/v1beta1/incentives.ts | 6 +- .../osmosis/pool-incentives/v1beta1/query.ts | 8 +- .../outputv3/osmosis/superfluid/query.ts | 4 +- .../outputv3/osmosis/superfluid/superfluid.ts | 6 +- .../v-next/outputv3/osmosis/superfluid/tx.ts | 10 +- .../outputv3/osmosis/twap/v1beta1/query.ts | 4 +- .../osmosis/twap/v1beta1/twap_record.ts | 4 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../outputv3/osmosis/txfees/v1beta1/query.ts | 4 +- .../v-next/outputv3/tendermint/abci/types.ts | 46 +- .../outputv3/tendermint/crypto/proof.ts | 4 +- .../outputv3/tendermint/libs/bits/types.ts | 2 +- .../v-next/outputv3/tendermint/p2p/types.ts | 6 +- .../outputv3/tendermint/types/evidence.ts | 8 +- .../outputv3/tendermint/types/params.ts | 16 +- .../v-next/outputv3/tendermint/types/types.ts | 12 +- .../outputv3/tendermint/types/validator.ts | 8 +- .../outputv3/tendermint/version/types.ts | 6 +- .../outputv4/akash/base/v1beta1/attribute.ts | 2 +- .../outputv4/akash/base/v1beta1/resource.ts | 4 +- .../outputv4/akash/base/v1beta2/attribute.ts | 2 +- .../outputv4/akash/base/v1beta2/resource.ts | 4 +- .../outputv4/akash/cert/v1beta2/cert.ts | 2 +- .../outputv4/akash/cert/v1beta2/genesis.ts | 2 +- .../outputv4/akash/cert/v1beta2/query.ts | 2 +- .../akash/deployment/v1beta1/authz.ts | 2 +- .../akash/deployment/v1beta1/deployment.ts | 16 +- .../akash/deployment/v1beta1/genesis.ts | 4 +- .../akash/deployment/v1beta1/group.ts | 18 +- .../akash/deployment/v1beta1/params.ts | 2 +- .../akash/deployment/v1beta1/query.ts | 2 +- .../akash/deployment/v1beta2/authz.ts | 2 +- .../akash/deployment/v1beta2/deployment.ts | 4 +- .../akash/deployment/v1beta2/deploymentmsg.ts | 12 +- .../akash/deployment/v1beta2/genesis.ts | 4 +- .../akash/deployment/v1beta2/group.ts | 6 +- .../akash/deployment/v1beta2/groupmsg.ts | 6 +- .../akash/deployment/v1beta2/groupspec.ts | 2 +- .../akash/deployment/v1beta2/params.ts | 2 +- .../akash/deployment/v1beta2/query.ts | 2 +- .../akash/deployment/v1beta2/resource.ts | 4 +- .../outputv4/akash/escrow/v1beta1/types.ts | 14 +- .../outputv4/akash/escrow/v1beta2/types.ts | 16 +- .../akash/inflation/v1beta2/genesis.ts | 2 +- .../outputv4/akash/market/v1beta2/bid.ts | 14 +- .../outputv4/akash/market/v1beta2/genesis.ts | 2 +- .../outputv4/akash/market/v1beta2/lease.ts | 14 +- .../outputv4/akash/market/v1beta2/order.ts | 6 +- .../outputv4/akash/market/v1beta2/params.ts | 2 +- .../akash/provider/v1beta1/provider.ts | 6 +- .../akash/provider/v1beta2/provider.ts | 6 +- .../outputv4/cosmos/auth/v1beta1/auth.ts | 14 +- .../outputv4/cosmos/base/abci/v1beta1/abci.ts | 20 +- .../cosmos/base/query/v1beta1/pagination.ts | 6 +- .../cosmos/base/snapshots/v1beta1/snapshot.ts | 4 +- .../cosmos/base/store/v1beta1/commit_info.ts | 4 +- .../cosmos/base/tendermint/v1beta1/query.ts | 12 +- .../cosmos/capability/v1beta1/capability.ts | 2 +- .../cosmos/capability/v1beta1/genesis.ts | 4 +- .../distribution/v1beta1/distribution.ts | 6 +- .../cosmos/distribution/v1beta1/genesis.ts | 6 +- .../cosmos/distribution/v1beta1/query.ts | 4 +- .../cosmos/evidence/v1beta1/evidence.ts | 4 +- .../v-next/outputv4/cosmos/gov/v1/genesis.ts | 2 +- .../v-next/outputv4/cosmos/gov/v1/gov.ts | 6 +- .../v-next/outputv4/cosmos/gov/v1/query.ts | 12 +- .../v-next/outputv4/cosmos/gov/v1/tx.ts | 2 +- .../outputv4/cosmos/gov/v1beta1/genesis.ts | 2 +- .../v-next/outputv4/cosmos/gov/v1beta1/gov.ts | 4 +- .../outputv4/cosmos/gov/v1beta1/query.ts | 12 +- .../v-next/outputv4/cosmos/gov/v1beta1/tx.ts | 2 +- .../v-next/outputv4/cosmos/group/v1/events.ts | 14 +- .../outputv4/cosmos/group/v1/genesis.ts | 6 +- .../v-next/outputv4/cosmos/group/v1/query.ts | 14 +- .../v-next/outputv4/cosmos/group/v1/tx.ts | 22 +- .../v-next/outputv4/cosmos/group/v1/types.ts | 18 +- .../outputv4/cosmos/mint/v1beta1/mint.ts | 2 +- .../outputv4/cosmos/nft/v1beta1/query.ts | 4 +- .../cosmos/slashing/v1beta1/genesis.ts | 2 +- .../cosmos/slashing/v1beta1/slashing.ts | 8 +- .../cosmos/staking/v1beta1/genesis.ts | 2 +- .../outputv4/cosmos/staking/v1beta1/query.ts | 2 +- .../cosmos/staking/v1beta1/staking.ts | 6 +- .../cosmos/tx/signing/v1beta1/signing.ts | 2 +- .../outputv4/cosmos/tx/v1beta1/service.ts | 2 +- .../v-next/outputv4/cosmos/tx/v1beta1/tx.ts | 12 +- .../outputv4/cosmos/upgrade/v1beta1/query.ts | 4 +- .../cosmos/upgrade/v1beta1/upgrade.ts | 4 +- .../outputv4/cosmos/vesting/v1beta1/tx.ts | 4 +- .../cosmos/vesting/v1beta1/vesting.ts | 8 +- .../outputv4/cosmwasm/wasm/v1/genesis.ts | 4 +- .../v-next/outputv4/cosmwasm/wasm/v1/ibc.ts | 4 +- .../outputv4/cosmwasm/wasm/v1/proposal.ts | 4 +- .../v-next/outputv4/cosmwasm/wasm/v1/query.ts | 4 +- .../v-next/outputv4/cosmwasm/wasm/v1/tx.ts | 6 +- .../v-next/outputv4/cosmwasm/wasm/v1/types.ts | 10 +- .../outputv4/evmos/epochs/v1/genesis.ts | 4 +- .../v-next/outputv4/evmos/epochs/v1/query.ts | 2 +- .../v-next/outputv4/evmos/fees/v1/genesis.ts | 2 +- .../evmos/incentives/v1/incentives.ts | 4 +- .../outputv4/evmos/incentives/v1/query.ts | 2 +- .../outputv4/evmos/inflation/v1/genesis.ts | 6 +- .../outputv4/evmos/inflation/v1/query.ts | 4 +- .../outputv4/google/api/distribution.ts | 2 +- .../v1alpha1/conformance_service.ts | 2 +- .../google/api/expr/v1alpha1/checked.ts | 4 +- .../outputv4/google/api/expr/v1alpha1/eval.ts | 4 +- .../google/api/expr/v1alpha1/explain.ts | 2 +- .../google/api/expr/v1alpha1/syntax.ts | 12 +- .../google/api/expr/v1alpha1/value.ts | 4 +- .../outputv4/google/api/expr/v1beta1/expr.ts | 4 +- .../outputv4/google/api/expr/v1beta1/value.ts | 4 +- .../v-next/outputv4/google/api/quota.ts | 10 +- .../api/servicecontrol/v1/distribution.ts | 2 +- .../api/servicecontrol/v1/http_request.ts | 6 +- .../google/api/servicecontrol/v1/log_entry.ts | 2 +- .../api/servicecontrol/v1/metric_value.ts | 2 +- .../servicecontrol/v1/service_controller.ts | 4 +- .../api/serviceusage/v1beta1/resources.ts | 8 +- .../google/logging/type/http_request.ts | 6 +- .../outputv4/google/logging/v2/log_entry.ts | 2 +- .../google/logging/v2/logging_config.ts | 2 +- .../outputv4/google/protobuf/descriptor.ts | 4 +- .../outputv4/google/protobuf/wrappers.ts | 4 +- .../google/rpc/context/attribute_context.ts | 8 +- .../ibc/applications/transfer/v1/tx.ts | 2 +- .../outputv4/ibc/core/channel/v1/channel.ts | 6 +- .../outputv4/ibc/core/channel/v1/genesis.ts | 4 +- .../outputv4/ibc/core/channel/v1/query.ts | 12 +- .../v-next/outputv4/ibc/core/channel/v1/tx.ts | 4 +- .../outputv4/ibc/core/client/v1/client.ts | 4 +- .../outputv4/ibc/core/client/v1/genesis.ts | 2 +- .../outputv4/ibc/core/client/v1/query.ts | 4 +- .../ibc/core/connection/v1/connection.ts | 6 +- .../ibc/core/connection/v1/genesis.ts | 2 +- .../outputv4/ibc/core/connection/v1/query.ts | 4 +- .../outputv4/ibc/core/connection/v1/tx.ts | 4 +- .../solomachine/v1/solomachine.ts | 22 +- .../solomachine/v2/solomachine.ts | 20 +- .../lightclients/tendermint/v1/tendermint.ts | 4 +- .../v-next/outputv4/osmosis/epochs/genesis.ts | 4 +- .../v-next/outputv4/osmosis/epochs/query.ts | 2 +- .../gamm/pool-models/balancer/balancerPool.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.ts | 2 +- .../pool-models/stableswap/stableswap_pool.ts | 2 +- .../osmosis/gamm/pool-models/stableswap/tx.ts | 4 +- .../outputv4/osmosis/gamm/v1beta1/genesis.ts | 2 +- .../outputv4/osmosis/gamm/v1beta1/query.ts | 24 +- .../outputv4/osmosis/gamm/v1beta1/tx.ts | 16 +- .../v-next/outputv4/osmosis/gamm/v2/query.ts | 2 +- .../outputv4/osmosis/incentives/gauge.ts | 6 +- .../outputv4/osmosis/incentives/genesis.ts | 2 +- .../outputv4/osmosis/incentives/query.ts | 4 +- .../v-next/outputv4/osmosis/incentives/tx.ts | 4 +- .../v-next/outputv4/osmosis/lockup/genesis.ts | 2 +- .../v-next/outputv4/osmosis/lockup/lock.ts | 4 +- .../v-next/outputv4/osmosis/lockup/query.ts | 4 +- .../v-next/outputv4/osmosis/lockup/tx.ts | 8 +- .../outputv4/osmosis/mint/v1beta1/genesis.ts | 2 +- .../outputv4/osmosis/mint/v1beta1/mint.ts | 4 +- .../pool-incentives/v1beta1/incentives.ts | 6 +- .../osmosis/pool-incentives/v1beta1/query.ts | 8 +- .../outputv4/osmosis/superfluid/query.ts | 4 +- .../outputv4/osmosis/superfluid/superfluid.ts | 6 +- .../v-next/outputv4/osmosis/superfluid/tx.ts | 10 +- .../outputv4/osmosis/twap/v1beta1/query.ts | 4 +- .../osmosis/twap/v1beta1/twap_record.ts | 2 +- .../osmosis/txfees/v1beta1/feetoken.ts | 2 +- .../outputv4/osmosis/txfees/v1beta1/query.ts | 4 +- .../v-next/outputv4/tendermint/abci/types.ts | 46 +- .../outputv4/tendermint/crypto/proof.ts | 4 +- .../outputv4/tendermint/libs/bits/types.ts | 2 +- .../v-next/outputv4/tendermint/p2p/types.ts | 6 +- .../outputv4/tendermint/types/evidence.ts | 8 +- .../outputv4/tendermint/types/params.ts | 16 +- .../v-next/outputv4/tendermint/types/types.ts | 12 +- .../outputv4/tendermint/types/validator.ts | 8 +- .../outputv4/tendermint/version/types.ts | 6 +- package.json | 1 + packages/ast/package.json | 1 + .../__snapshots__/object.spec.ts.snap | 26 +- .../encoding/__tests__/misc.overall.test.ts | 3 +- .../src/encoding/amino/to-amino-json/index.ts | 3 +- .../interfaces-amino.test.ts.snap | 6 +- .../ast/src/encoding/proto/to-amino/utils.ts | 115 +- packages/ast/src/encoding/proto/types.ts | 5 +- packages/ast/src/encoding/types.ts | 21 + packages/ast/types/encoding/types.d.ts | 1 + packages/types/src/telescope.ts | 2 +- packages/types/types/telescope.d.ts | 2 +- packages/utils/src/__tests__/amino.test.ts | 10 + 1107 files changed, 4687 insertions(+), 35115 deletions(-) delete mode 100644 __fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/output/misc/amino_fields.ts delete mode 100644 __fixtures__/misc/proto/misc/amino_fields.proto diff --git a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts index 700d622d0f..0d56b06860 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/akash/deployment/v1beta1/authz.ts @@ -27,7 +27,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino; + spend_limit: CoinAmino; } export interface DepositDeploymentAuthorizationAminoMsg { type: "/akash.deployment.v1beta1.DepositDeploymentAuthorization"; @@ -120,7 +120,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts index 685f4711d7..bb4f13137e 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/cosmos/bank/v1beta1/tx.ts @@ -255,7 +255,7 @@ export const MsgInstantiateContract2 = { }, toAmino(message: MsgInstantiateContract2): MsgInstantiateContract2Amino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; if (message.funds) { obj.funds = message.funds.map(e => e ? Coin.toAmino(e) : undefined); @@ -264,7 +264,7 @@ export const MsgInstantiateContract2 = { } obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; obj.fix_msg = message.fixMsg === false ? undefined : message.fixMsg; - obj.dont_omitempty_fix_msg = message.dontOmitemptyFixMsg === false ? undefined : message.dontOmitemptyFixMsg; + obj.dont_omitempty_fix_msg = message.dontOmitemptyFixMsg ?? false; if (message.aListOfBytes) { obj.a_list_of_bytes = message.aListOfBytes.map(e => base64FromBytes(e)); } else { diff --git a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts index 0506edbebc..6c05a6dd8c 100644 --- a/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-impl-interfaces-gen/google/protobuf/descriptor.ts @@ -6185,8 +6185,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts index f3ab41977f..0ca519309d 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _156 from "./gogo"; +import * as _144 from "./gogo"; export const gogoproto = { - ..._156 + ..._144 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts index 19b14266f3..d93e55ceaa 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _157 from "./api/expr/v1alpha1/eval"; -import * as _158 from "./protobuf/any"; -import * as _159 from "./protobuf/duration"; -import * as _160 from "./protobuf/timestamp"; -import * as _161 from "./protobuf/descriptor"; +import * as _145 from "./api/expr/v1alpha1/eval"; +import * as _146 from "./protobuf/any"; +import * as _147 from "./protobuf/duration"; +import * as _148 from "./protobuf/timestamp"; +import * as _149 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._157 + ..._145 }; } } export const protobuf = { - ..._158, - ..._159, - ..._160, - ..._161 + ..._146, + ..._147, + ..._148, + ..._149 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts index 31c34d0cb8..194145283b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/google/protobuf/descriptor.ts @@ -6185,8 +6185,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts index bfee9f5347..eca657c32a 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/all_fields.ts @@ -1454,31 +1454,34 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : { + type: "", + value: {} + }; obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1570,7 +1573,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2624,31 +2627,34 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; + obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : { + type: "", + value: {} + }; obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toAminoMsg(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2740,7 +2746,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts deleted file mode 100644 index cd60effa7a..0000000000 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/amino_fields.ts +++ /dev/null @@ -1,2564 +0,0 @@ -import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, GenericAuthorization, GenericAuthorizationProtoMsg, GenericAuthorizationSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; -import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { GlobalDecoderRegistry } from "../registry"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: GenericAuthorization | Any | undefined; - dOAuth: GenericAuthorization | Any | undefined; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any | undefined; - dOPubkey: Any | undefined; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: (GenericAuthorization | Any)[] | Any[]; - dOAuths: (GenericAuthorization | Any)[] | Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export type AminoEncodingTestForDontOmitEncoded = Omit & { - /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - dOAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - /** pubkey */pubkey?: AnyProtoMsg | undefined; - dOPubkey?: AnyProtoMsg | undefined; - /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; - dOAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; -}; -export interface AminoEncodingTestForDontOmitAmino { - /** scalar */ - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - /** bigint */ - big: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt: string; - d_o_salt: string; - /** raw bytes */ - raw: any; - d_o_raw: any; - /** wasm bytes */ - wasm: string; - d_o_wasm: string; - /** enum */ - opt: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms: string[]; - d_o_wasms: string[]; - /** array enum */ - opts: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForDontOmitAminoMsg { - type: "/misc.AminoEncodingTestForDontOmit"; - value: AminoEncodingTestForDontOmitAmino; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: GenericAuthorizationSDKType | AnySDKType | undefined; - d_o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType | undefined; - d_o_pubkey: AnySDKType | undefined; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: (GenericAuthorizationSDKType | AnySDKType)[]; - d_o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: GenericAuthorization | Any | undefined; - oAuth: GenericAuthorization | Any | undefined; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any | undefined; - oPubkey: Any | undefined; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: (GenericAuthorization | Any)[] | Any[]; - oAuths: (GenericAuthorization | Any)[] | Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export type AminoEncodingTestForOmitEncoded = Omit & { - /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - oAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - /** pubkey */pubkey?: AnyProtoMsg | undefined; - oPubkey?: AnyProtoMsg | undefined; - /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; - oAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; -}; -export interface AminoEncodingTestForOmitAmino { - /** scalar */ - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - /** bigint */ - big: string; - o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - o_auth: AnyAmino; - /** bytes */ - salt: string; - o_salt: string; - /** raw bytes */ - raw: any; - o_raw: any; - /** wasm bytes */ - wasm: string; - o_wasm: string; - /** enum */ - opt: VoteOption; - o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - o_period: DurationAmino; - /** timestamp */ - date?: string; - o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - o_pubkey: AnyAmino; - /** array scalar */ - nums: number[]; - o_nums: number[]; - /** array bigint */ - bigs: string[]; - o_bigs: string[]; - /** array bytes */ - salts: string[]; - o_salts: string[]; - /** array raw bytes */ - raws: any[]; - o_raws: any[]; - /** array wasm bytes */ - wasms: string[]; - o_wasms: string[]; - /** array enum */ - opts: VoteOption[]; - o_opts: VoteOption[]; - /** array duration */ - periods: DurationAmino[]; - o_periods: DurationAmino[]; - /** array protoType */ - protos: AccessConfigAmino[]; - o_protos: AccessConfigAmino[]; - /** array anyType */ - auths: AnyAmino[]; - o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForOmitAminoMsg { - type: "/misc.AminoEncodingTestForOmit"; - value: AminoEncodingTestForOmitAmino; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: GenericAuthorizationSDKType | AnySDKType | undefined; - o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType | undefined; - o_pubkey: AnySDKType | undefined; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: (GenericAuthorizationSDKType | AnySDKType)[]; - o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - is(o: any): o is AminoEncodingTestForDontOmit { - return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.dOStr === "string" && typeof o.b === "boolean" && typeof o.dOB === "boolean" && typeof o.num === "number" && typeof o.dONum === "number" && typeof o.big === "bigint" && typeof o.dOBig === "bigint" && AccessConfig.is(o.dOProto) && (GenericAuthorization.is(o.dOAuth) || Any.is(o.dOAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.dOSalt instanceof Uint8Array || typeof o.dOSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.dORaw instanceof Uint8Array || typeof o.dORaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.dOWasm instanceof Uint8Array || typeof o.dOWasm === "string") && isSet(o.opt) && isSet(o.dOOpt) && Duration.is(o.dOPeriod) && Timestamp.is(o.dODate) && Any.is(o.dOPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.dONums) && (!o.dONums.length || typeof o.dONums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.dOBigs) && (!o.dOBigs.length || typeof o.dOBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.dOSalts) && (!o.dOSalts.length || o.dOSalts[0] instanceof Uint8Array || typeof o.dOSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.dORaws) && (!o.dORaws.length || o.dORaws[0] instanceof Uint8Array || typeof o.dORaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.dOWasms) && (!o.dOWasms.length || o.dOWasms[0] instanceof Uint8Array || typeof o.dOWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.dOOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.dOPeriods) && (!o.dOPeriods.length || Duration.is(o.dOPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.dOProtos) && (!o.dOProtos.length || AccessConfig.is(o.dOProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.dOAuths) && (!o.dOAuths.length || GenericAuthorization.is(o.dOAuths[0]) || Any.is(o.dOAuths[0]))); - }, - isSDK(o: any): o is AminoEncodingTestForDontOmitSDKType { - return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isSDK(o.d_o_proto) && (GenericAuthorization.isSDK(o.d_o_auth) || Any.isSDK(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isSDK(o.d_o_period) && Timestamp.isSDK(o.d_o_date) && Any.isSDK(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isSDK(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isSDK(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isSDK(o.d_o_auths[0]) || Any.isSDK(o.d_o_auths[0]))); - }, - isAmino(o: any): o is AminoEncodingTestForDontOmitAmino { - return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isAmino(o.d_o_proto) && (GenericAuthorization.isAmino(o.d_o_auth) || Any.isAmino(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isAmino(o.d_o_period) && Timestamp.isAmino(o.d_o_date) && Any.isAmino(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isAmino(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isAmino(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isAmino(o.d_o_auths[0]) || Any.isAmino(o.d_o_auths[0]))); - }, - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOAuth), writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOPubkey), writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 12: - message.dOAuth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 26: - message.dOPubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - case 46: - message.dOAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = GlobalDecoderRegistry.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = GlobalDecoderRegistry.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? GlobalDecoderRegistry.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? GlobalDecoderRegistry.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = GlobalDecoderRegistry.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - message.dOAuths = object.dOAuths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? GlobalDecoderRegistry.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? GlobalDecoderRegistry.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? GlobalDecoderRegistry.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromAminoMsg(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -GlobalDecoderRegistry.register(AminoEncodingTestForDontOmit.typeUrl, AminoEncodingTestForDontOmit); -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - is(o: any): o is AminoEncodingTestForOmit { - return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.oStr === "string" && typeof o.b === "boolean" && typeof o.oB === "boolean" && typeof o.num === "number" && typeof o.oNum === "number" && typeof o.big === "bigint" && typeof o.oBig === "bigint" && AccessConfig.is(o.oProto) && (GenericAuthorization.is(o.oAuth) || Any.is(o.oAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.oSalt instanceof Uint8Array || typeof o.oSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.oRaw instanceof Uint8Array || typeof o.oRaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.oWasm instanceof Uint8Array || typeof o.oWasm === "string") && isSet(o.opt) && isSet(o.oOpt) && Duration.is(o.oPeriod) && Timestamp.is(o.oDate) && Any.is(o.oPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.oNums) && (!o.oNums.length || typeof o.oNums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.oBigs) && (!o.oBigs.length || typeof o.oBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.oSalts) && (!o.oSalts.length || o.oSalts[0] instanceof Uint8Array || typeof o.oSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.oRaws) && (!o.oRaws.length || o.oRaws[0] instanceof Uint8Array || typeof o.oRaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.oWasms) && (!o.oWasms.length || o.oWasms[0] instanceof Uint8Array || typeof o.oWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.oOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.oPeriods) && (!o.oPeriods.length || Duration.is(o.oPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.oProtos) && (!o.oProtos.length || AccessConfig.is(o.oProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.oAuths) && (!o.oAuths.length || GenericAuthorization.is(o.oAuths[0]) || Any.is(o.oAuths[0]))); - }, - isSDK(o: any): o is AminoEncodingTestForOmitSDKType { - return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isSDK(o.o_proto) && (GenericAuthorization.isSDK(o.o_auth) || Any.isSDK(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isSDK(o.o_period) && Timestamp.isSDK(o.o_date) && Any.isSDK(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isSDK(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isSDK(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isSDK(o.o_auths[0]) || Any.isSDK(o.o_auths[0]))); - }, - isAmino(o: any): o is AminoEncodingTestForOmitAmino { - return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isAmino(o.o_proto) && (GenericAuthorization.isAmino(o.o_auth) || Any.isAmino(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isAmino(o.o_period) && Timestamp.isAmino(o.o_date) && Any.isAmino(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isAmino(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isAmino(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isAmino(o.o_auths[0]) || Any.isAmino(o.o_auths[0]))); - }, - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.oAuth), writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.oPubkey), writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 12: - message.oAuth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 26: - message.oPubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - case 46: - message.oAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = GlobalDecoderRegistry.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = GlobalDecoderRegistry.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? GlobalDecoderRegistry.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? GlobalDecoderRegistry.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = GlobalDecoderRegistry.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = GlobalDecoderRegistry.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - message.oAuths = object.oAuths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? GlobalDecoderRegistry.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? GlobalDecoderRegistry.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? GlobalDecoderRegistry.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = GlobalDecoderRegistry.fromAminoMsg(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - message.oAuths = object.o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toAminoMsg(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; -GlobalDecoderRegistry.register(AminoEncodingTestForOmit.typeUrl, AminoEncodingTestForOmit); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts index 66cb016ae2..e2bde6fb82 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface-proto-optionality/misc/bundle.ts @@ -1,20 +1,18 @@ -import * as _162 from "./all_fields"; -import * as _163 from "./amino_fields"; -import * as _164 from "./eval_request"; -import * as _165 from "./tx"; -import * as _166 from "./tx.amino"; -import * as _167 from "./tx.registry"; -import * as _168 from "./tx.rpc.msg"; -import * as _169 from "./rpc.tx"; +import * as _150 from "./all_fields"; +import * as _151 from "./eval_request"; +import * as _152 from "./tx"; +import * as _153 from "./tx.amino"; +import * as _154 from "./tx.registry"; +import * as _155 from "./tx.rpc.msg"; +import * as _156 from "./rpc.tx"; export const misc = { - ..._162, - ..._163, - ..._164, - ..._165, - ..._166, - ..._167, - ..._168, + ..._150, + ..._151, + ..._152, + ..._153, + ..._154, + ..._155, ClientFactory: { - ..._169 + ..._156 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts index f1b28eb282..f9d0d526f4 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _142 from "./gogo"; +import * as _131 from "./gogo"; export const gogoproto = { - ..._142 + ..._131 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts index 8a463bfb48..9362b29aa1 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _143 from "./api/expr/v1alpha1/eval"; -import * as _144 from "./protobuf/any"; -import * as _145 from "./protobuf/duration"; -import * as _146 from "./protobuf/timestamp"; -import * as _147 from "./protobuf/descriptor"; +import * as _132 from "./api/expr/v1alpha1/eval"; +import * as _133 from "./protobuf/any"; +import * as _134 from "./protobuf/duration"; +import * as _135 from "./protobuf/timestamp"; +import * as _136 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._143 + ..._132 }; } } export const protobuf = { - ..._144, - ..._145, - ..._146, - ..._147 + ..._133, + ..._134, + ..._135, + ..._136 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts index 0506edbebc..6c05a6dd8c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/google/protobuf/descriptor.ts @@ -6185,8 +6185,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts index d2220bc0b9..f8d70f7a95 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/all_fields.ts @@ -305,74 +305,74 @@ export type EncodingTestForOmitEncoded = Omit e); } else { @@ -1570,7 +1573,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2624,31 +2627,34 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; + obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : { + type: "", + value: {} + }; obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toAminoMsg(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2740,7 +2746,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts deleted file mode 100644 index 3ef9afa9c8..0000000000 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/amino_fields.ts +++ /dev/null @@ -1,2564 +0,0 @@ -import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, GenericAuthorization, GenericAuthorizationProtoMsg, GenericAuthorizationSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; -import { isSet, toTimestamp, fromTimestamp, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -import { GlobalDecoderRegistry } from "../registry"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: GenericAuthorization | Any | undefined; - dOAuth: GenericAuthorization | Any | undefined; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any | undefined; - dOPubkey: Any | undefined; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: (GenericAuthorization | Any)[] | Any[]; - dOAuths: (GenericAuthorization | Any)[] | Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export type AminoEncodingTestForDontOmitEncoded = Omit & { - /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - dOAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - /** pubkey */pubkey?: AnyProtoMsg | undefined; - dOPubkey?: AnyProtoMsg | undefined; - /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; - dOAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; -}; -export interface AminoEncodingTestForDontOmitAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForDontOmitAminoMsg { - type: "/misc.AminoEncodingTestForDontOmit"; - value: AminoEncodingTestForDontOmitAmino; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: GenericAuthorizationSDKType | AnySDKType | undefined; - d_o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType | undefined; - d_o_pubkey: AnySDKType | undefined; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: (GenericAuthorizationSDKType | AnySDKType)[]; - d_o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: GenericAuthorization | Any | undefined; - oAuth: GenericAuthorization | Any | undefined; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any | undefined; - oPubkey: Any | undefined; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: (GenericAuthorization | Any)[] | Any[]; - oAuths: (GenericAuthorization | Any)[] | Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export type AminoEncodingTestForOmitEncoded = Omit & { - /** anyType */auth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - oAuth?: GenericAuthorizationProtoMsg | AnyProtoMsg | undefined; - /** pubkey */pubkey?: AnyProtoMsg | undefined; - oPubkey?: AnyProtoMsg | undefined; - /** array anyType */auths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; - oAuths: (GenericAuthorizationProtoMsg | AnyProtoMsg)[]; -}; -export interface AminoEncodingTestForOmitAmino { - /** scalar */ - str?: string; - o_str?: string; - b?: boolean; - o_b?: boolean; - num?: number; - o_num?: number; - /** bigint */ - big?: string; - o_big?: string; - /** protoType */ - proto?: AccessConfigAmino; - o_proto?: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - o_auth?: AnyAmino; - /** bytes */ - salt?: string; - o_salt?: string; - /** raw bytes */ - raw?: any; - o_raw?: any; - /** wasm bytes */ - wasm?: string; - o_wasm?: string; - /** enum */ - opt?: VoteOption; - o_opt?: VoteOption; - /** duration */ - period?: DurationAmino; - o_period?: DurationAmino; - /** timestamp */ - date?: string; - o_date?: string; - /** pubkey */ - pubkey?: AnyAmino; - o_pubkey?: AnyAmino; - /** array scalar */ - nums?: number[]; - o_nums?: number[]; - /** array bigint */ - bigs?: string[]; - o_bigs?: string[]; - /** array bytes */ - salts?: string[]; - o_salts?: string[]; - /** array raw bytes */ - raws?: any[]; - o_raws?: any[]; - /** array wasm bytes */ - wasms?: string[]; - o_wasms?: string[]; - /** array enum */ - opts?: VoteOption[]; - o_opts?: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - o_periods?: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - o_protos?: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - o_auths?: AnyAmino[]; -} -export interface AminoEncodingTestForOmitAminoMsg { - type: "/misc.AminoEncodingTestForOmit"; - value: AminoEncodingTestForOmitAmino; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: GenericAuthorizationSDKType | AnySDKType | undefined; - o_auth: GenericAuthorizationSDKType | AnySDKType | undefined; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType | undefined; - o_pubkey: AnySDKType | undefined; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: (GenericAuthorizationSDKType | AnySDKType)[]; - o_auths: (GenericAuthorizationSDKType | AnySDKType)[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - is(o: any): o is AminoEncodingTestForDontOmit { - return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.dOStr === "string" && typeof o.b === "boolean" && typeof o.dOB === "boolean" && typeof o.num === "number" && typeof o.dONum === "number" && typeof o.big === "bigint" && typeof o.dOBig === "bigint" && AccessConfig.is(o.dOProto) && (GenericAuthorization.is(o.dOAuth) || Any.is(o.dOAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.dOSalt instanceof Uint8Array || typeof o.dOSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.dORaw instanceof Uint8Array || typeof o.dORaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.dOWasm instanceof Uint8Array || typeof o.dOWasm === "string") && isSet(o.opt) && isSet(o.dOOpt) && Duration.is(o.dOPeriod) && Timestamp.is(o.dODate) && Any.is(o.dOPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.dONums) && (!o.dONums.length || typeof o.dONums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.dOBigs) && (!o.dOBigs.length || typeof o.dOBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.dOSalts) && (!o.dOSalts.length || o.dOSalts[0] instanceof Uint8Array || typeof o.dOSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.dORaws) && (!o.dORaws.length || o.dORaws[0] instanceof Uint8Array || typeof o.dORaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.dOWasms) && (!o.dOWasms.length || o.dOWasms[0] instanceof Uint8Array || typeof o.dOWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.dOOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.dOPeriods) && (!o.dOPeriods.length || Duration.is(o.dOPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.dOProtos) && (!o.dOProtos.length || AccessConfig.is(o.dOProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.dOAuths) && (!o.dOAuths.length || GenericAuthorization.is(o.dOAuths[0]) || Any.is(o.dOAuths[0]))); - }, - isSDK(o: any): o is AminoEncodingTestForDontOmitSDKType { - return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isSDK(o.d_o_proto) && (GenericAuthorization.isSDK(o.d_o_auth) || Any.isSDK(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isSDK(o.d_o_period) && Timestamp.isSDK(o.d_o_date) && Any.isSDK(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isSDK(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isSDK(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isSDK(o.d_o_auths[0]) || Any.isSDK(o.d_o_auths[0]))); - }, - isAmino(o: any): o is AminoEncodingTestForDontOmitAmino { - return o && (o.$typeUrl === AminoEncodingTestForDontOmit.typeUrl || typeof o.str === "string" && typeof o.d_o_str === "string" && typeof o.b === "boolean" && typeof o.d_o_b === "boolean" && typeof o.num === "number" && typeof o.d_o_num === "number" && typeof o.big === "bigint" && typeof o.d_o_big === "bigint" && AccessConfig.isAmino(o.d_o_proto) && (GenericAuthorization.isAmino(o.d_o_auth) || Any.isAmino(o.d_o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.d_o_salt instanceof Uint8Array || typeof o.d_o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.d_o_raw instanceof Uint8Array || typeof o.d_o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.d_o_wasm instanceof Uint8Array || typeof o.d_o_wasm === "string") && isSet(o.opt) && isSet(o.d_o_opt) && Duration.isAmino(o.d_o_period) && Timestamp.isAmino(o.d_o_date) && Any.isAmino(o.d_o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.d_o_nums) && (!o.d_o_nums.length || typeof o.d_o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.d_o_bigs) && (!o.d_o_bigs.length || typeof o.d_o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.d_o_salts) && (!o.d_o_salts.length || o.d_o_salts[0] instanceof Uint8Array || typeof o.d_o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.d_o_raws) && (!o.d_o_raws.length || o.d_o_raws[0] instanceof Uint8Array || typeof o.d_o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.d_o_wasms) && (!o.d_o_wasms.length || o.d_o_wasms[0] instanceof Uint8Array || typeof o.d_o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.d_o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.d_o_periods) && (!o.d_o_periods.length || Duration.isAmino(o.d_o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.d_o_protos) && (!o.d_o_protos.length || AccessConfig.isAmino(o.d_o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.d_o_auths) && (!o.d_o_auths.length || GenericAuthorization.isAmino(o.d_o_auths[0]) || Any.isAmino(o.d_o_auths[0]))); - }, - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOAuth), writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.dOPubkey), writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 12: - message.dOAuth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 26: - message.dOPubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - case 46: - message.dOAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = GlobalDecoderRegistry.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = GlobalDecoderRegistry.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? GlobalDecoderRegistry.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? GlobalDecoderRegistry.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = GlobalDecoderRegistry.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - message.dOAuths = object.dOAuths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? GlobalDecoderRegistry.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? GlobalDecoderRegistry.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? GlobalDecoderRegistry.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = GlobalDecoderRegistry.fromAminoMsg(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? GlobalDecoderRegistry.toAminoMsg(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -GlobalDecoderRegistry.register(AminoEncodingTestForDontOmit.typeUrl, AminoEncodingTestForDontOmit); -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - is(o: any): o is AminoEncodingTestForOmit { - return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.oStr === "string" && typeof o.b === "boolean" && typeof o.oB === "boolean" && typeof o.num === "number" && typeof o.oNum === "number" && typeof o.big === "bigint" && typeof o.oBig === "bigint" && AccessConfig.is(o.oProto) && (GenericAuthorization.is(o.oAuth) || Any.is(o.oAuth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.oSalt instanceof Uint8Array || typeof o.oSalt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.oRaw instanceof Uint8Array || typeof o.oRaw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.oWasm instanceof Uint8Array || typeof o.oWasm === "string") && isSet(o.opt) && isSet(o.oOpt) && Duration.is(o.oPeriod) && Timestamp.is(o.oDate) && Any.is(o.oPubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.oNums) && (!o.oNums.length || typeof o.oNums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.oBigs) && (!o.oBigs.length || typeof o.oBigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.oSalts) && (!o.oSalts.length || o.oSalts[0] instanceof Uint8Array || typeof o.oSalts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.oRaws) && (!o.oRaws.length || o.oRaws[0] instanceof Uint8Array || typeof o.oRaws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.oWasms) && (!o.oWasms.length || o.oWasms[0] instanceof Uint8Array || typeof o.oWasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.oOpts) && Array.isArray(o.periods) && (!o.periods.length || Duration.is(o.periods[0])) && Array.isArray(o.oPeriods) && (!o.oPeriods.length || Duration.is(o.oPeriods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.is(o.protos[0])) && Array.isArray(o.oProtos) && (!o.oProtos.length || AccessConfig.is(o.oProtos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.is(o.auths[0]) || Any.is(o.auths[0])) && Array.isArray(o.oAuths) && (!o.oAuths.length || GenericAuthorization.is(o.oAuths[0]) || Any.is(o.oAuths[0]))); - }, - isSDK(o: any): o is AminoEncodingTestForOmitSDKType { - return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isSDK(o.o_proto) && (GenericAuthorization.isSDK(o.o_auth) || Any.isSDK(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isSDK(o.o_period) && Timestamp.isSDK(o.o_date) && Any.isSDK(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isSDK(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isSDK(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isSDK(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isSDK(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isSDK(o.auths[0]) || Any.isSDK(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isSDK(o.o_auths[0]) || Any.isSDK(o.o_auths[0]))); - }, - isAmino(o: any): o is AminoEncodingTestForOmitAmino { - return o && (o.$typeUrl === AminoEncodingTestForOmit.typeUrl || typeof o.str === "string" && typeof o.o_str === "string" && typeof o.b === "boolean" && typeof o.o_b === "boolean" && typeof o.num === "number" && typeof o.o_num === "number" && typeof o.big === "bigint" && typeof o.o_big === "bigint" && AccessConfig.isAmino(o.o_proto) && (GenericAuthorization.isAmino(o.o_auth) || Any.isAmino(o.o_auth)) && (o.salt instanceof Uint8Array || typeof o.salt === "string") && (o.o_salt instanceof Uint8Array || typeof o.o_salt === "string") && (o.raw instanceof Uint8Array || typeof o.raw === "string") && (o.o_raw instanceof Uint8Array || typeof o.o_raw === "string") && (o.wasm instanceof Uint8Array || typeof o.wasm === "string") && (o.o_wasm instanceof Uint8Array || typeof o.o_wasm === "string") && isSet(o.opt) && isSet(o.o_opt) && Duration.isAmino(o.o_period) && Timestamp.isAmino(o.o_date) && Any.isAmino(o.o_pubkey) && Array.isArray(o.nums) && (!o.nums.length || typeof o.nums[0] === "number") && Array.isArray(o.o_nums) && (!o.o_nums.length || typeof o.o_nums[0] === "number") && Array.isArray(o.bigs) && (!o.bigs.length || typeof o.bigs[0] === "bigint") && Array.isArray(o.o_bigs) && (!o.o_bigs.length || typeof o.o_bigs[0] === "bigint") && Array.isArray(o.salts) && (!o.salts.length || o.salts[0] instanceof Uint8Array || typeof o.salts[0] === "string") && Array.isArray(o.o_salts) && (!o.o_salts.length || o.o_salts[0] instanceof Uint8Array || typeof o.o_salts[0] === "string") && Array.isArray(o.raws) && (!o.raws.length || o.raws[0] instanceof Uint8Array || typeof o.raws[0] === "string") && Array.isArray(o.o_raws) && (!o.o_raws.length || o.o_raws[0] instanceof Uint8Array || typeof o.o_raws[0] === "string") && Array.isArray(o.wasms) && (!o.wasms.length || o.wasms[0] instanceof Uint8Array || typeof o.wasms[0] === "string") && Array.isArray(o.o_wasms) && (!o.o_wasms.length || o.o_wasms[0] instanceof Uint8Array || typeof o.o_wasms[0] === "string") && Array.isArray(o.opts) && Array.isArray(o.o_opts) && Array.isArray(o.periods) && (!o.periods.length || Duration.isAmino(o.periods[0])) && Array.isArray(o.o_periods) && (!o.o_periods.length || Duration.isAmino(o.o_periods[0])) && Array.isArray(o.protos) && (!o.protos.length || AccessConfig.isAmino(o.protos[0])) && Array.isArray(o.o_protos) && (!o.o_protos.length || AccessConfig.isAmino(o.o_protos[0])) && Array.isArray(o.auths) && (!o.auths.length || GenericAuthorization.isAmino(o.auths[0]) || Any.isAmino(o.auths[0])) && Array.isArray(o.o_auths) && (!o.o_auths.length || GenericAuthorization.isAmino(o.o_auths[0]) || Any.isAmino(o.o_auths[0]))); - }, - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.auth), writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.oAuth), writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.pubkey), writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(GlobalDecoderRegistry.wrapAny(message.oPubkey), writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(GlobalDecoderRegistry.wrapAny(v!), writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 12: - message.oAuth = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 26: - message.oPubkey = GlobalDecoderRegistry.unwrapAny(reader); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - case 46: - message.oAuths.push(GlobalDecoderRegistry.unwrapAny(reader)); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = GlobalDecoderRegistry.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = GlobalDecoderRegistry.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = GlobalDecoderRegistry.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = GlobalDecoderRegistry.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => GlobalDecoderRegistry.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? GlobalDecoderRegistry.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? GlobalDecoderRegistry.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = GlobalDecoderRegistry.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = GlobalDecoderRegistry.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = GlobalDecoderRegistry.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - message.oAuths = object.oAuths?.map(e => (GlobalDecoderRegistry.fromPartial(e) as any)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? GlobalDecoderRegistry.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? GlobalDecoderRegistry.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? GlobalDecoderRegistry.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? GlobalDecoderRegistry.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? GlobalDecoderRegistry.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? GlobalDecoderRegistry.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? GlobalDecoderRegistry.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => GlobalDecoderRegistry.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? GlobalDecoderRegistry.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? GlobalDecoderRegistry.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? GlobalDecoderRegistry.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = GlobalDecoderRegistry.fromAminoMsg(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = GlobalDecoderRegistry.fromAminoMsg(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - message.oAuths = object.o_auths?.map(e => GlobalDecoderRegistry.fromAminoMsg(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? GlobalDecoderRegistry.toAminoMsg(message.auth) : undefined; - obj.o_auth = message.oAuth ? GlobalDecoderRegistry.toAminoMsg(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? GlobalDecoderRegistry.toAminoMsg(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; -GlobalDecoderRegistry.register(AminoEncodingTestForOmit.typeUrl, AminoEncodingTestForOmit); \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts index 4e71462b50..91e0305f04 100644 --- a/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-interface/misc/bundle.ts @@ -1,20 +1,18 @@ -import * as _148 from "./all_fields"; -import * as _149 from "./amino_fields"; -import * as _150 from "./eval_request"; -import * as _151 from "./tx"; -import * as _152 from "./tx.amino"; -import * as _153 from "./tx.registry"; -import * as _154 from "./tx.rpc.msg"; -import * as _155 from "./rpc.tx"; +import * as _137 from "./all_fields"; +import * as _138 from "./eval_request"; +import * as _139 from "./tx"; +import * as _140 from "./tx.amino"; +import * as _141 from "./tx.registry"; +import * as _142 from "./tx.rpc.msg"; +import * as _143 from "./rpc.tx"; export const misc = { - ..._148, - ..._149, - ..._150, - ..._151, - ..._152, - ..._153, - ..._154, + ..._137, + ..._138, + ..._139, + ..._140, + ..._141, + ..._142, ClientFactory: { - ..._155 + ..._143 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts index 8a5681c38d..9b9fc6d670 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _38 from "./gogo"; +import * as _35 from "./gogo"; export const gogoproto = { - ..._38 + ..._35 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts index d98ead9d0a..39ebd5c73e 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _39 from "./api/expr/v1alpha1/eval"; -import * as _40 from "./protobuf/any"; -import * as _41 from "./protobuf/duration"; -import * as _42 from "./protobuf/timestamp"; -import * as _43 from "./protobuf/descriptor"; +import * as _36 from "./api/expr/v1alpha1/eval"; +import * as _37 from "./protobuf/any"; +import * as _38 from "./protobuf/duration"; +import * as _39 from "./protobuf/timestamp"; +import * as _40 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._39 + ..._36 }; } } export const protobuf = { - ..._40, - ..._41, - ..._42, - ..._43 + ..._37, + ..._38, + ..._39, + ..._40 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts index 69375952f9..d61dd5109c 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/google/protobuf/descriptor.ts @@ -5154,8 +5154,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts index db16f1aa61..4033db4742 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/all_fields.ts @@ -1276,31 +1276,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1392,7 +1392,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = padDecimal(message.dec) === "" ? undefined : padDecimal(message.dec); - obj.d_o_dec = padDecimal(message.dODec) === "" ? undefined : padDecimal(message.dODec); + obj.d_o_dec = padDecimal(message.dODec) ?? ""; if (message.decs) { obj.decs = message.decs.map(e => padDecimal(e)); } else { @@ -2436,31 +2436,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2552,7 +2552,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = padDecimal(message.dec) === "" ? undefined : padDecimal(message.dec); + obj.dec = padDecimal(message.dec) ?? ""; obj.o_dec = padDecimal(message.oDec) === "" ? undefined : padDecimal(message.oDec); if (message.decs) { obj.decs = message.decs.map(e => padDecimal(e)); diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts deleted file mode 100644 index 4a5b8c662a..0000000000 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/amino_fields.ts +++ /dev/null @@ -1,2387 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts index efc8492ace..2255cfaaae 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/bundle.ts @@ -1,20 +1,18 @@ -import * as _44 from "./all_fields"; -import * as _45 from "./amino_fields"; -import * as _46 from "./eval_request"; -import * as _47 from "./tx"; -import * as _48 from "./tx.amino"; -import * as _49 from "./tx.registry"; -import * as _50 from "./tx.rpc.msg"; -import * as _51 from "./rpc.tx"; +import * as _41 from "./all_fields"; +import * as _42 from "./eval_request"; +import * as _43 from "./tx"; +import * as _44 from "./tx.amino"; +import * as _45 from "./tx.registry"; +import * as _46 from "./tx.rpc.msg"; +import * as _47 from "./rpc.tx"; export const misc = { + ..._41, + ..._42, + ..._43, ..._44, ..._45, ..._46, - ..._47, - ..._48, - ..._49, - ..._50, ClientFactory: { - ..._51 + ..._47 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts index 00f2964c39..fc7ff4bbec 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -188,11 +188,11 @@ export const AminoConverter = { str: dOTests.str, d_o_str: dOTests.dOStr, b: omitDefault(dOTests.b), - d_o_b: omitDefault(dOTests.dOB), + d_o_b: dOTests.dOB, num: omitDefault(dOTests.num), - d_o_num: omitDefault(dOTests.dONum), + d_o_num: dOTests.dONum, big: omitDefault(dOTests.big)?.toString?.(), - d_o_big: omitDefault(dOTests.dOBig)?.toString?.(), + d_o_big: dOTests.dOBig?.toString?.(), proto: { sender: dOTests.proto.sender }, @@ -263,11 +263,11 @@ export const AminoConverter = { o_tests: { str: oTests.str, o_str: oTests.oStr, - b: omitDefault(oTests.b), + b: oTests.b, o_b: omitDefault(oTests.oB), - num: omitDefault(oTests.num), + num: oTests.num, o_num: omitDefault(oTests.oNum), - big: omitDefault(oTests.big)?.toString?.(), + big: oTests.big?.toString?.(), o_big: omitDefault(oTests.oBig)?.toString?.(), proto: { sender: oTests.proto.sender diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts index e6c0292c67..3025fa61bf 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _114 from "./gogo"; +import * as _105 from "./gogo"; export const gogoproto = { - ..._114 + ..._105 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts index 4ba7255fe0..5f3575035b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _115 from "./api/expr/v1alpha1/eval"; -import * as _116 from "./protobuf/any"; -import * as _117 from "./protobuf/duration"; -import * as _118 from "./protobuf/timestamp"; -import * as _119 from "./protobuf/descriptor"; +import * as _106 from "./api/expr/v1alpha1/eval"; +import * as _107 from "./protobuf/any"; +import * as _108 from "./protobuf/duration"; +import * as _109 from "./protobuf/timestamp"; +import * as _110 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._115 + ..._106 }; } } export const protobuf = { - ..._116, - ..._117, - ..._118, - ..._119 + ..._107, + ..._108, + ..._109, + ..._110 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts index 951a8fee11..4189965ecb 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/google/protobuf/descriptor.ts @@ -5965,8 +5965,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts index 8f21bdd306..77411e862b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/all_fields.ts @@ -288,74 +288,74 @@ export interface EncodingTestForOmitProtoMsg { } export interface EncodingTestForOmitAmino { /** scalar */ - str?: string; + str: string; o_str?: string; - b?: boolean; + b: boolean; o_b?: boolean; - num?: number; + num: number; o_num?: number; /** bigint */ - big?: string; + big: string; o_big?: string; /** protoType */ - proto?: AccessConfigAmino; + proto: AccessConfigAmino; o_proto?: AccessConfigAmino; /** anyType */ - auth?: AnyAmino; + auth: AnyAmino; o_auth?: AnyAmino; /** bytes */ - salt?: string; + salt: string; o_salt?: string; /** raw bytes */ - raw?: any; + raw: any; o_raw?: any; /** wasm bytes */ - wasm?: string; + wasm: string; o_wasm?: string; /** enum */ - opt?: VoteOption; + opt: VoteOption; o_opt?: VoteOption; /** duration */ - period?: DurationAmino; + period: DurationAmino; o_period?: DurationAmino; /** timestamp */ - date?: string; + date: string; o_date?: string; /** pubkey */ - pubkey?: AnyAmino; + pubkey: AnyAmino; o_pubkey?: AnyAmino; /** array scalar */ - nums?: number[]; + nums: number[]; o_nums?: number[]; /** array bigint */ - bigs?: string[]; + bigs: string[]; o_bigs?: string[]; /** array bytes */ - salts?: string[]; + salts: string[]; o_salts?: string[]; /** array raw bytes */ - raws?: any[]; + raws: any[]; o_raws?: any[]; /** array wasm bytes */ - wasms?: string[]; + wasms: string[]; o_wasms?: string[]; /** array enum */ - opts?: VoteOption[]; + opts: VoteOption[]; o_opts?: VoteOption[]; /** array duration */ - periods?: DurationAmino[]; + periods: DurationAmino[]; o_periods?: DurationAmino[]; /** array protoType */ - protos?: AccessConfigAmino[]; + protos: AccessConfigAmino[]; o_protos?: AccessConfigAmino[]; /** array anyType */ - auths?: AnyAmino[]; + auths: AnyAmino[]; o_auths?: AnyAmino[]; /** dec */ - dec?: string; + dec: string; o_dec?: string; /** array dec */ - decs?: string[]; + decs: string[]; o_decs?: string[]; } export interface EncodingTestForOmitAminoMsg { @@ -1428,31 +1428,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1544,7 +1544,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2588,31 +2588,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2704,7 +2704,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts deleted file mode 100644 index ad128f88ec..0000000000 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/amino_fields.ts +++ /dev/null @@ -1,2527 +0,0 @@ -import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForDontOmitAminoMsg { - type: "/misc.AminoEncodingTestForDontOmit"; - value: AminoEncodingTestForDontOmitAmino; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitAmino { - /** scalar */ - str?: string; - o_str?: string; - b?: boolean; - o_b?: boolean; - num?: number; - o_num?: number; - /** bigint */ - big?: string; - o_big?: string; - /** protoType */ - proto?: AccessConfigAmino; - o_proto?: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - o_auth?: AnyAmino; - /** bytes */ - salt?: string; - o_salt?: string; - /** raw bytes */ - raw?: any; - o_raw?: any; - /** wasm bytes */ - wasm?: string; - o_wasm?: string; - /** enum */ - opt?: VoteOption; - o_opt?: VoteOption; - /** duration */ - period?: DurationAmino; - o_period?: DurationAmino; - /** timestamp */ - date?: string; - o_date?: string; - /** pubkey */ - pubkey?: AnyAmino; - o_pubkey?: AnyAmino; - /** array scalar */ - nums?: number[]; - o_nums?: number[]; - /** array bigint */ - bigs?: string[]; - o_bigs?: string[]; - /** array bytes */ - salts?: string[]; - o_salts?: string[]; - /** array raw bytes */ - raws?: any[]; - o_raws?: any[]; - /** array wasm bytes */ - wasms?: string[]; - o_wasms?: string[]; - /** array enum */ - opts?: VoteOption[]; - o_opts?: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - o_periods?: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - o_protos?: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - o_auths?: AnyAmino[]; -} -export interface AminoEncodingTestForOmitAminoMsg { - type: "/misc.AminoEncodingTestForOmit"; - value: AminoEncodingTestForOmitAmino; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts index 67b38c3ab3..2be9294a05 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-no-func/misc/bundle.ts @@ -1,20 +1,18 @@ -import * as _120 from "./all_fields"; -import * as _121 from "./amino_fields"; -import * as _122 from "./eval_request"; -import * as _123 from "./tx"; -import * as _124 from "./tx.amino"; -import * as _125 from "./tx.registry"; -import * as _126 from "./tx.rpc.msg"; -import * as _127 from "./rpc.tx"; +import * as _111 from "./all_fields"; +import * as _112 from "./eval_request"; +import * as _113 from "./tx"; +import * as _114 from "./tx.amino"; +import * as _115 from "./tx.registry"; +import * as _116 from "./tx.rpc.msg"; +import * as _117 from "./rpc.tx"; export const misc = { - ..._120, - ..._121, - ..._122, - ..._123, - ..._124, - ..._125, - ..._126, + ..._111, + ..._112, + ..._113, + ..._114, + ..._115, + ..._116, ClientFactory: { - ..._127 + ..._117 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts index 33a6fc1b62..f0a946b17a 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _100 from "./gogo"; +import * as _92 from "./gogo"; export const gogoproto = { - ..._100 + ..._92 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts index 151db8a724..821d114d55 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _101 from "./api/expr/v1alpha1/eval"; -import * as _102 from "./protobuf/any"; -import * as _103 from "./protobuf/duration"; -import * as _104 from "./protobuf/timestamp"; -import * as _105 from "./protobuf/descriptor"; +import * as _93 from "./api/expr/v1alpha1/eval"; +import * as _94 from "./protobuf/any"; +import * as _95 from "./protobuf/duration"; +import * as _96 from "./protobuf/timestamp"; +import * as _97 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._101 + ..._93 }; } } export const protobuf = { - ..._102, - ..._103, - ..._104, - ..._105 + ..._94, + ..._95, + ..._96, + ..._97 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts index 951a8fee11..4189965ecb 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/google/protobuf/descriptor.ts @@ -5965,8 +5965,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts index 8f21bdd306..77411e862b 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/all_fields.ts @@ -288,74 +288,74 @@ export interface EncodingTestForOmitProtoMsg { } export interface EncodingTestForOmitAmino { /** scalar */ - str?: string; + str: string; o_str?: string; - b?: boolean; + b: boolean; o_b?: boolean; - num?: number; + num: number; o_num?: number; /** bigint */ - big?: string; + big: string; o_big?: string; /** protoType */ - proto?: AccessConfigAmino; + proto: AccessConfigAmino; o_proto?: AccessConfigAmino; /** anyType */ - auth?: AnyAmino; + auth: AnyAmino; o_auth?: AnyAmino; /** bytes */ - salt?: string; + salt: string; o_salt?: string; /** raw bytes */ - raw?: any; + raw: any; o_raw?: any; /** wasm bytes */ - wasm?: string; + wasm: string; o_wasm?: string; /** enum */ - opt?: VoteOption; + opt: VoteOption; o_opt?: VoteOption; /** duration */ - period?: DurationAmino; + period: DurationAmino; o_period?: DurationAmino; /** timestamp */ - date?: string; + date: string; o_date?: string; /** pubkey */ - pubkey?: AnyAmino; + pubkey: AnyAmino; o_pubkey?: AnyAmino; /** array scalar */ - nums?: number[]; + nums: number[]; o_nums?: number[]; /** array bigint */ - bigs?: string[]; + bigs: string[]; o_bigs?: string[]; /** array bytes */ - salts?: string[]; + salts: string[]; o_salts?: string[]; /** array raw bytes */ - raws?: any[]; + raws: any[]; o_raws?: any[]; /** array wasm bytes */ - wasms?: string[]; + wasms: string[]; o_wasms?: string[]; /** array enum */ - opts?: VoteOption[]; + opts: VoteOption[]; o_opts?: VoteOption[]; /** array duration */ - periods?: DurationAmino[]; + periods: DurationAmino[]; o_periods?: DurationAmino[]; /** array protoType */ - protos?: AccessConfigAmino[]; + protos: AccessConfigAmino[]; o_protos?: AccessConfigAmino[]; /** array anyType */ - auths?: AnyAmino[]; + auths: AnyAmino[]; o_auths?: AnyAmino[]; /** dec */ - dec?: string; + dec: string; o_dec?: string; /** array dec */ - decs?: string[]; + decs: string[]; o_decs?: string[]; } export interface EncodingTestForOmitAminoMsg { @@ -1428,31 +1428,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1544,7 +1544,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2588,31 +2588,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2704,7 +2704,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts deleted file mode 100644 index ad128f88ec..0000000000 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/amino_fields.ts +++ /dev/null @@ -1,2527 +0,0 @@ -import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForDontOmitAminoMsg { - type: "/misc.AminoEncodingTestForDontOmit"; - value: AminoEncodingTestForDontOmitAmino; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitAmino { - /** scalar */ - str?: string; - o_str?: string; - b?: boolean; - o_b?: boolean; - num?: number; - o_num?: number; - /** bigint */ - big?: string; - o_big?: string; - /** protoType */ - proto?: AccessConfigAmino; - o_proto?: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - o_auth?: AnyAmino; - /** bytes */ - salt?: string; - o_salt?: string; - /** raw bytes */ - raw?: any; - o_raw?: any; - /** wasm bytes */ - wasm?: string; - o_wasm?: string; - /** enum */ - opt?: VoteOption; - o_opt?: VoteOption; - /** duration */ - period?: DurationAmino; - o_period?: DurationAmino; - /** timestamp */ - date?: string; - o_date?: string; - /** pubkey */ - pubkey?: AnyAmino; - o_pubkey?: AnyAmino; - /** array scalar */ - nums?: number[]; - o_nums?: number[]; - /** array bigint */ - bigs?: string[]; - o_bigs?: string[]; - /** array bytes */ - salts?: string[]; - o_salts?: string[]; - /** array raw bytes */ - raws?: any[]; - o_raws?: any[]; - /** array wasm bytes */ - wasms?: string[]; - o_wasms?: string[]; - /** array enum */ - opts?: VoteOption[]; - o_opts?: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - o_periods?: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - o_protos?: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - o_auths?: AnyAmino[]; -} -export interface AminoEncodingTestForOmitAminoMsg { - type: "/misc.AminoEncodingTestForOmit"; - value: AminoEncodingTestForOmitAmino; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts index d12796a689..85849e4350 100644 --- a/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-msg-with-func/misc/bundle.ts @@ -1,20 +1,18 @@ -import * as _106 from "./all_fields"; -import * as _107 from "./amino_fields"; -import * as _108 from "./eval_request"; -import * as _109 from "./tx"; -import * as _110 from "./tx.amino"; -import * as _111 from "./tx.registry"; -import * as _112 from "./tx.rpc.msg"; -import * as _113 from "./rpc.tx"; +import * as _98 from "./all_fields"; +import * as _99 from "./eval_request"; +import * as _100 from "./tx"; +import * as _101 from "./tx.amino"; +import * as _102 from "./tx.registry"; +import * as _103 from "./tx.rpc.msg"; +import * as _104 from "./rpc.tx"; export const misc = { - ..._106, - ..._107, - ..._108, - ..._109, - ..._110, - ..._111, - ..._112, + ..._98, + ..._99, + ..._100, + ..._101, + ..._102, + ..._103, ClientFactory: { - ..._113 + ..._104 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts index eb10531c6d..0dfabdc9b7 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _128 from "./gogo"; +import * as _118 from "./gogo"; export const gogoproto = { - ..._128 + ..._118 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts index f97f86cfc9..3c7862a96a 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _129 from "./api/expr/v1alpha1/eval"; -import * as _130 from "./protobuf/any"; -import * as _131 from "./protobuf/duration"; -import * as _132 from "./protobuf/timestamp"; -import * as _133 from "./protobuf/descriptor"; +import * as _119 from "./api/expr/v1alpha1/eval"; +import * as _120 from "./protobuf/any"; +import * as _121 from "./protobuf/duration"; +import * as _122 from "./protobuf/timestamp"; +import * as _123 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._129 + ..._119 }; } } export const protobuf = { - ..._130, - ..._131, - ..._132, - ..._133 + ..._120, + ..._121, + ..._122, + ..._123 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts index ffe9d1ccee..bef5d2f48a 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/google/protobuf/descriptor.ts @@ -5794,8 +5794,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts index 97c801d3fe..ea58b4b073 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/all_fields.ts @@ -284,74 +284,74 @@ export interface EncodingTestForOmitProtoMsg { } export interface EncodingTestForOmitAmino { /** scalar */ - str?: string; + str: string; o_str?: string; - b?: boolean; + b: boolean; o_b?: boolean; - num?: number; + num: number; o_num?: number; /** bigint */ - big?: string; + big: string; o_big?: string; /** protoType */ - proto?: AccessConfigAmino; + proto: AccessConfigAmino; o_proto?: AccessConfigAmino; /** anyType */ - auth?: AnyAmino; + auth: AnyAmino; o_auth?: AnyAmino; /** bytes */ - salt?: string; + salt: string; o_salt?: string; /** raw bytes */ - raw?: any; + raw: any; o_raw?: any; /** wasm bytes */ - wasm?: string; + wasm: string; o_wasm?: string; /** enum */ - opt?: VoteOption; + opt: VoteOption; o_opt?: VoteOption; /** duration */ - period?: DurationAmino; + period: DurationAmino; o_period?: DurationAmino; /** timestamp */ - date?: string; + date: string; o_date?: string; /** pubkey */ - pubkey?: AnyAmino; + pubkey: AnyAmino; o_pubkey?: AnyAmino; /** array scalar */ - nums?: number[]; + nums: number[]; o_nums?: number[]; /** array bigint */ - bigs?: string[]; + bigs: string[]; o_bigs?: string[]; /** array bytes */ - salts?: string[]; + salts: string[]; o_salts?: string[]; /** array raw bytes */ - raws?: any[]; + raws: any[]; o_raws?: any[]; /** array wasm bytes */ - wasms?: string[]; + wasms: string[]; o_wasms?: string[]; /** array enum */ - opts?: VoteOption[]; + opts: VoteOption[]; o_opts?: VoteOption[]; /** array duration */ - periods?: DurationAmino[]; + periods: DurationAmino[]; o_periods?: DurationAmino[]; /** array protoType */ - protos?: AccessConfigAmino[]; + protos: AccessConfigAmino[]; o_protos?: AccessConfigAmino[]; /** array anyType */ - auths?: AnyAmino[]; + auths: AnyAmino[]; o_auths?: AnyAmino[]; /** dec */ - dec?: string; + dec: string; o_dec?: string; /** array dec */ - decs?: string[]; + decs: string[]; o_decs?: string[]; } export interface EncodingTestForOmitSDKType { @@ -1420,31 +1420,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1536,7 +1536,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2577,31 +2577,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2693,7 +2693,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts deleted file mode 100644 index 71de359eb2..0000000000 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/amino_fields.ts +++ /dev/null @@ -1,2513 +0,0 @@ -import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitAmino { - /** scalar */ - str?: string; - o_str?: string; - b?: boolean; - o_b?: boolean; - num?: number; - o_num?: number; - /** bigint */ - big?: string; - o_big?: string; - /** protoType */ - proto?: AccessConfigAmino; - o_proto?: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - o_auth?: AnyAmino; - /** bytes */ - salt?: string; - o_salt?: string; - /** raw bytes */ - raw?: any; - o_raw?: any; - /** wasm bytes */ - wasm?: string; - o_wasm?: string; - /** enum */ - opt?: VoteOption; - o_opt?: VoteOption; - /** duration */ - period?: DurationAmino; - o_period?: DurationAmino; - /** timestamp */ - date?: string; - o_date?: string; - /** pubkey */ - pubkey?: AnyAmino; - o_pubkey?: AnyAmino; - /** array scalar */ - nums?: number[]; - o_nums?: number[]; - /** array bigint */ - bigs?: string[]; - o_bigs?: string[]; - /** array bytes */ - salts?: string[]; - o_salts?: string[]; - /** array raw bytes */ - raws?: any[]; - o_raws?: any[]; - /** array wasm bytes */ - wasms?: string[]; - o_wasms?: string[]; - /** array enum */ - opts?: VoteOption[]; - o_opts?: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - o_periods?: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - o_protos?: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - o_auths?: AnyAmino[]; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts index 3788dd7318..42a3e09ec2 100644 --- a/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/amino-no-msg-with-func/misc/bundle.ts @@ -1,20 +1,18 @@ -import * as _134 from "./all_fields"; -import * as _135 from "./amino_fields"; -import * as _136 from "./eval_request"; -import * as _137 from "./tx"; -import * as _138 from "./tx.amino"; -import * as _139 from "./tx.registry"; -import * as _140 from "./tx.rpc.msg"; -import * as _141 from "./rpc.tx"; +import * as _124 from "./all_fields"; +import * as _125 from "./eval_request"; +import * as _126 from "./tx"; +import * as _127 from "./tx.amino"; +import * as _128 from "./tx.registry"; +import * as _129 from "./tx.rpc.msg"; +import * as _130 from "./rpc.tx"; export const misc = { - ..._134, - ..._135, - ..._136, - ..._137, - ..._138, - ..._139, - ..._140, + ..._124, + ..._125, + ..._126, + ..._127, + ..._128, + ..._129, ClientFactory: { - ..._141 + ..._130 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts index 748cdf1f53..cb53ce409c 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _64 from "./gogo"; +import * as _59 from "./gogo"; export const gogoproto = { - ..._64 + ..._59 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts index 7309e9b92e..fd5144dcd9 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _65 from "./api/expr/v1alpha1/eval"; -import * as _66 from "./protobuf/any"; -import * as _67 from "./protobuf/duration"; -import * as _68 from "./protobuf/timestamp"; -import * as _69 from "./protobuf/descriptor"; +import * as _60 from "./api/expr/v1alpha1/eval"; +import * as _61 from "./protobuf/any"; +import * as _62 from "./protobuf/duration"; +import * as _63 from "./protobuf/timestamp"; +import * as _64 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._65 + ..._60 }; } } export const protobuf = { - ..._66, - ..._67, - ..._68, - ..._69 + ..._61, + ..._62, + ..._63, + ..._64 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts deleted file mode 100644 index 70ea955b33..0000000000 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/amino_fields.ts +++ /dev/null @@ -1,1907 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts index 784975a4a8..0c42774738 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy-no-proto/misc/bundle.ts @@ -1,16 +1,14 @@ -import * as _70 from "./all_fields"; -import * as _71 from "./amino_fields"; -import * as _72 from "./eval_request"; -import * as _73 from "./tx"; -import * as _74 from "./tx.rpc.msg"; -import * as _75 from "./rpc.tx"; +import * as _65 from "./all_fields"; +import * as _66 from "./eval_request"; +import * as _67 from "./tx"; +import * as _68 from "./tx.rpc.msg"; +import * as _69 from "./rpc.tx"; export const misc = { - ..._70, - ..._71, - ..._72, - ..._73, - ..._74, + ..._65, + ..._66, + ..._67, + ..._68, ClientFactory: { - ..._75 + ..._69 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts index 9e7ff6dd71..5cfa81caa6 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _52 from "./gogo"; +import * as _48 from "./gogo"; export const gogoproto = { - ..._52 + ..._48 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts index 4c26aa7925..099f7e617f 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _53 from "./api/expr/v1alpha1/eval"; -import * as _54 from "./protobuf/any"; -import * as _55 from "./protobuf/duration"; -import * as _56 from "./protobuf/timestamp"; -import * as _57 from "./protobuf/descriptor"; +import * as _49 from "./api/expr/v1alpha1/eval"; +import * as _50 from "./protobuf/any"; +import * as _51 from "./protobuf/duration"; +import * as _52 from "./protobuf/timestamp"; +import * as _53 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._53 + ..._49 }; } } export const protobuf = { - ..._54, - ..._55, - ..._56, - ..._57 + ..._50, + ..._51, + ..._52, + ..._53 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts index 69375952f9..d61dd5109c 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/google/protobuf/descriptor.ts @@ -5154,8 +5154,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts index 3a1d158085..7f5731ed7a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/all_fields.ts @@ -1276,31 +1276,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1392,7 +1392,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2436,31 +2436,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2552,7 +2552,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts deleted file mode 100644 index 4a5b8c662a..0000000000 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/amino_fields.ts +++ /dev/null @@ -1,2387 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts index bbdaaab70c..03f7ed2b70 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-legacy/misc/bundle.ts @@ -1,16 +1,14 @@ -import * as _58 from "./all_fields"; -import * as _59 from "./amino_fields"; -import * as _60 from "./eval_request"; -import * as _61 from "./tx"; -import * as _62 from "./tx.rpc.msg"; -import * as _63 from "./rpc.tx"; +import * as _54 from "./all_fields"; +import * as _55 from "./eval_request"; +import * as _56 from "./tx"; +import * as _57 from "./tx.rpc.msg"; +import * as _58 from "./rpc.tx"; export const misc = { - ..._58, - ..._59, - ..._60, - ..._61, - ..._62, + ..._54, + ..._55, + ..._56, + ..._57, ClientFactory: { - ..._63 + ..._58 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts index b39fc5162a..d2e9312f2e 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _26 from "./gogo"; +import * as _24 from "./gogo"; export const gogoproto = { - ..._26 + ..._24 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts index 89418f615a..b29367d0ff 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _27 from "./api/expr/v1alpha1/eval"; -import * as _28 from "./protobuf/any"; -import * as _29 from "./protobuf/duration"; -import * as _30 from "./protobuf/timestamp"; -import * as _31 from "./protobuf/descriptor"; +import * as _25 from "./api/expr/v1alpha1/eval"; +import * as _26 from "./protobuf/any"; +import * as _27 from "./protobuf/duration"; +import * as _28 from "./protobuf/timestamp"; +import * as _29 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._27 + ..._25 }; } } export const protobuf = { + ..._26, + ..._27, ..._28, - ..._29, - ..._30, - ..._31 + ..._29 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts deleted file mode 100644 index 70ea955b33..0000000000 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/amino_fields.ts +++ /dev/null @@ -1,1907 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts index 84844db382..96447afbf2 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino-no-proto/misc/bundle.ts @@ -1,16 +1,14 @@ -import * as _32 from "./all_fields"; -import * as _33 from "./amino_fields"; -import * as _34 from "./eval_request"; -import * as _35 from "./tx"; -import * as _36 from "./tx.rpc.msg"; -import * as _37 from "./rpc.tx"; +import * as _30 from "./all_fields"; +import * as _31 from "./eval_request"; +import * as _32 from "./tx"; +import * as _33 from "./tx.rpc.msg"; +import * as _34 from "./rpc.tx"; export const misc = { + ..._30, + ..._31, ..._32, ..._33, - ..._34, - ..._35, - ..._36, ClientFactory: { - ..._37 + ..._34 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts index 35aacd21ad..6a167339ea 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _14 from "./gogo"; +import * as _13 from "./gogo"; export const gogoproto = { - ..._14 + ..._13 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts index 9bc838d884..7d94284e1c 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _15 from "./api/expr/v1alpha1/eval"; -import * as _16 from "./protobuf/any"; -import * as _17 from "./protobuf/duration"; -import * as _18 from "./protobuf/timestamp"; -import * as _19 from "./protobuf/descriptor"; +import * as _14 from "./api/expr/v1alpha1/eval"; +import * as _15 from "./protobuf/any"; +import * as _16 from "./protobuf/duration"; +import * as _17 from "./protobuf/timestamp"; +import * as _18 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._15 + ..._14 }; } } export const protobuf = { + ..._15, ..._16, ..._17, - ..._18, - ..._19 + ..._18 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts index 69375952f9..d61dd5109c 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/google/protobuf/descriptor.ts @@ -5154,8 +5154,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts index 3a1d158085..7f5731ed7a 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/all_fields.ts @@ -1276,31 +1276,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1392,7 +1392,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2436,31 +2436,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2552,7 +2552,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts deleted file mode 100644 index 4a5b8c662a..0000000000 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/amino_fields.ts +++ /dev/null @@ -1,2387 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts index c1d317533f..53bd951ffa 100644 --- a/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/no-amino/misc/bundle.ts @@ -1,16 +1,14 @@ -import * as _20 from "./all_fields"; -import * as _21 from "./amino_fields"; -import * as _22 from "./eval_request"; -import * as _23 from "./tx"; -import * as _24 from "./tx.rpc.msg"; -import * as _25 from "./rpc.tx"; +import * as _19 from "./all_fields"; +import * as _20 from "./eval_request"; +import * as _21 from "./tx"; +import * as _22 from "./tx.rpc.msg"; +import * as _23 from "./rpc.tx"; export const misc = { + ..._19, ..._20, ..._21, ..._22, - ..._23, - ..._24, ClientFactory: { - ..._25 + ..._23 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts index 81c0534fa2..2d45725f12 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _88 from "./gogo"; +import * as _81 from "./gogo"; export const gogoproto = { - ..._88 + ..._81 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts index 9058060d45..ec7d7ceb55 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _89 from "./api/expr/v1alpha1/eval"; -import * as _90 from "./protobuf/any"; -import * as _91 from "./protobuf/duration"; -import * as _92 from "./protobuf/timestamp"; -import * as _93 from "./protobuf/descriptor"; +import * as _82 from "./api/expr/v1alpha1/eval"; +import * as _83 from "./protobuf/any"; +import * as _84 from "./protobuf/duration"; +import * as _85 from "./protobuf/timestamp"; +import * as _86 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._89 + ..._82 }; } } export const protobuf = { - ..._90, - ..._91, - ..._92, - ..._93 + ..._83, + ..._84, + ..._85, + ..._86 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts deleted file mode 100644 index d961ddf7ad..0000000000 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/amino_fields.ts +++ /dev/null @@ -1,1939 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts index 108fee9bfb..0ee9ceb562 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only-legacy/misc/bundle.ts @@ -1,16 +1,14 @@ -import * as _94 from "./all_fields"; -import * as _95 from "./amino_fields"; -import * as _96 from "./eval_request"; -import * as _97 from "./tx"; -import * as _98 from "./tx.rpc.msg"; -import * as _99 from "./rpc.tx"; +import * as _87 from "./all_fields"; +import * as _88 from "./eval_request"; +import * as _89 from "./tx"; +import * as _90 from "./tx.rpc.msg"; +import * as _91 from "./rpc.tx"; export const misc = { - ..._94, - ..._95, - ..._96, - ..._97, - ..._98, + ..._87, + ..._88, + ..._89, + ..._90, ClientFactory: { - ..._99 + ..._91 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts index 019169e797..0a786ca9fc 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/gogoproto/bundle.ts @@ -1,4 +1,4 @@ -import * as _76 from "./gogo"; +import * as _70 from "./gogo"; export const gogoproto = { - ..._76 + ..._70 }; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts index 5905b381f7..8800ad45c8 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/google/bundle.ts @@ -1,20 +1,20 @@ -import * as _77 from "./api/expr/v1alpha1/eval"; -import * as _78 from "./protobuf/any"; -import * as _79 from "./protobuf/duration"; -import * as _80 from "./protobuf/timestamp"; -import * as _81 from "./protobuf/descriptor"; +import * as _71 from "./api/expr/v1alpha1/eval"; +import * as _72 from "./protobuf/any"; +import * as _73 from "./protobuf/duration"; +import * as _74 from "./protobuf/timestamp"; +import * as _75 from "./protobuf/descriptor"; export namespace google { export namespace api { export namespace expr { export const v1alpha1 = { - ..._77 + ..._71 }; } } export const protobuf = { - ..._78, - ..._79, - ..._80, - ..._81 + ..._72, + ..._73, + ..._74, + ..._75 }; } \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts deleted file mode 100644 index d961ddf7ad..0000000000 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/amino_fields.ts +++ /dev/null @@ -1,1939 +0,0 @@ -import { AccessConfig, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts b/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts index 41d2ba0003..70c4e61299 100644 --- a/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts +++ b/__fixtures__/misc/output-proto-amino/proto-only/misc/bundle.ts @@ -1,16 +1,14 @@ -import * as _82 from "./all_fields"; -import * as _83 from "./amino_fields"; -import * as _84 from "./eval_request"; -import * as _85 from "./tx"; -import * as _86 from "./tx.rpc.msg"; -import * as _87 from "./rpc.tx"; +import * as _76 from "./all_fields"; +import * as _77 from "./eval_request"; +import * as _78 from "./tx"; +import * as _79 from "./tx.rpc.msg"; +import * as _80 from "./rpc.tx"; export const misc = { - ..._82, - ..._83, - ..._84, - ..._85, - ..._86, + ..._76, + ..._77, + ..._78, + ..._79, ClientFactory: { - ..._87 + ..._80 } }; \ No newline at end of file diff --git a/__fixtures__/misc/output/google/protobuf/descriptor.ts b/__fixtures__/misc/output/google/protobuf/descriptor.ts index 951a8fee11..4189965ecb 100644 --- a/__fixtures__/misc/output/google/protobuf/descriptor.ts +++ b/__fixtures__/misc/output/google/protobuf/descriptor.ts @@ -5965,8 +5965,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/misc/output/misc/all_fields.ts b/__fixtures__/misc/output/misc/all_fields.ts index 8f21bdd306..77411e862b 100644 --- a/__fixtures__/misc/output/misc/all_fields.ts +++ b/__fixtures__/misc/output/misc/all_fields.ts @@ -288,74 +288,74 @@ export interface EncodingTestForOmitProtoMsg { } export interface EncodingTestForOmitAmino { /** scalar */ - str?: string; + str: string; o_str?: string; - b?: boolean; + b: boolean; o_b?: boolean; - num?: number; + num: number; o_num?: number; /** bigint */ - big?: string; + big: string; o_big?: string; /** protoType */ - proto?: AccessConfigAmino; + proto: AccessConfigAmino; o_proto?: AccessConfigAmino; /** anyType */ - auth?: AnyAmino; + auth: AnyAmino; o_auth?: AnyAmino; /** bytes */ - salt?: string; + salt: string; o_salt?: string; /** raw bytes */ - raw?: any; + raw: any; o_raw?: any; /** wasm bytes */ - wasm?: string; + wasm: string; o_wasm?: string; /** enum */ - opt?: VoteOption; + opt: VoteOption; o_opt?: VoteOption; /** duration */ - period?: DurationAmino; + period: DurationAmino; o_period?: DurationAmino; /** timestamp */ - date?: string; + date: string; o_date?: string; /** pubkey */ - pubkey?: AnyAmino; + pubkey: AnyAmino; o_pubkey?: AnyAmino; /** array scalar */ - nums?: number[]; + nums: number[]; o_nums?: number[]; /** array bigint */ - bigs?: string[]; + bigs: string[]; o_bigs?: string[]; /** array bytes */ - salts?: string[]; + salts: string[]; o_salts?: string[]; /** array raw bytes */ - raws?: any[]; + raws: any[]; o_raws?: any[]; /** array wasm bytes */ - wasms?: string[]; + wasms: string[]; o_wasms?: string[]; /** array enum */ - opts?: VoteOption[]; + opts: VoteOption[]; o_opts?: VoteOption[]; /** array duration */ - periods?: DurationAmino[]; + periods: DurationAmino[]; o_periods?: DurationAmino[]; /** array protoType */ - protos?: AccessConfigAmino[]; + protos: AccessConfigAmino[]; o_protos?: AccessConfigAmino[]; /** array anyType */ - auths?: AnyAmino[]; + auths: AnyAmino[]; o_auths?: AnyAmino[]; /** dec */ - dec?: string; + dec: string; o_dec?: string; /** array dec */ - decs?: string[]; + decs: string[]; o_decs?: string[]; } export interface EncodingTestForOmitAminoMsg { @@ -1428,31 +1428,31 @@ export const EncodingTestForDontOmit = { toAmino(message: EncodingTestForDontOmit): EncodingTestForDontOmitAmino { const obj: any = {}; obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; + obj.d_o_str = message.dOStr ?? ""; obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; + obj.d_o_b = message.dOB ?? false; obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; + obj.d_o_num = message.dONum ?? 0; + obj.big = message.big !== BigInt(0) ? message.big.toString() : undefined; + obj.d_o_big = message.dOBig ? message.dOBig.toString() : "0"; obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; + obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; + obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : Any.toAmino(Any.fromPartial({})); obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; + obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : ""; obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; + obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : {}; obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; + obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : ""; obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; + obj.d_o_opt = message.dOOpt ?? 0; obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; + obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : Duration.toAmino(Duration.fromPartial({})); obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; + obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : new Date(); obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; + obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : Any.fromPartial({}); if (message.nums) { obj.nums = message.nums.map(e => e); } else { @@ -1544,7 +1544,7 @@ export const EncodingTestForDontOmit = { obj.d_o_auths = message.dOAuths; } obj.dec = message.dec === "" ? undefined : message.dec; - obj.d_o_dec = message.dODec === "" ? undefined : message.dODec; + obj.d_o_dec = message.dODec ?? ""; if (message.decs) { obj.decs = message.decs.map(e => e); } else { @@ -2588,31 +2588,31 @@ export const EncodingTestForOmit = { }, toAmino(message: EncodingTestForOmit): EncodingTestForOmitAmino { const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; + obj.str = message.str ?? ""; obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; + obj.b = message.b ?? false; obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; + obj.num = message.num ?? 0; obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; + obj.big = message.big ? message.big.toString() : "0"; + obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; + obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; + obj.auth = message.auth ? Any.toAmino(message.auth) : Any.toAmino(Any.fromPartial({})); obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; + obj.salt = message.salt ? base64FromBytes(message.salt) : ""; obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; + obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : {}; obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; + obj.wasm = message.wasm ? toBase64(message.wasm) : ""; obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; + obj.opt = message.opt ?? 0; obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; + obj.period = message.period ? Duration.toAmino(message.period) : Duration.toAmino(Duration.fromPartial({})); obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; + obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : null; obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; + obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : null; obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; if (message.nums) { obj.nums = message.nums.map(e => e); @@ -2704,7 +2704,7 @@ export const EncodingTestForOmit = { } else { obj.o_auths = message.oAuths; } - obj.dec = message.dec === "" ? undefined : message.dec; + obj.dec = message.dec ?? ""; obj.o_dec = message.oDec === "" ? undefined : message.oDec; if (message.decs) { obj.decs = message.decs.map(e => e); diff --git a/__fixtures__/misc/output/misc/amino_fields.ts b/__fixtures__/misc/output/misc/amino_fields.ts deleted file mode 100644 index ad128f88ec..0000000000 --- a/__fixtures__/misc/output/misc/amino_fields.ts +++ /dev/null @@ -1,2527 +0,0 @@ -import { AccessConfig, AccessConfigAmino, AccessConfigSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON, voteOptionToJSON } from "./eval_request"; -import { Any, AnyProtoMsg, AnyAmino, AnySDKType } from "../google/protobuf/any"; -import { Duration, DurationAmino, DurationSDKType } from "../google/protobuf/duration"; -import { Timestamp, TimestampAmino, TimestampSDKType } from "../google/protobuf/timestamp"; -import { BinaryReader, BinaryWriter } from "../binary"; -import { toTimestamp, fromTimestamp, isSet, bytesFromBase64, base64FromBytes, DeepPartial } from "../helpers"; -import { toUtf8, fromBase64, fromUtf8, toBase64 } from "@cosmjs/encoding"; -import { encodePubkey, decodePubkey } from "@cosmjs/proto-signing"; -export const protobufPackage = "misc"; -export interface AminoEncodingTestForDontOmit { - /** scalar */ - str: string; - dOStr: string; - b: boolean; - dOB: boolean; - num: number; - dONum: number; - /** bigint */ - big: bigint; - dOBig: bigint; - /** protoType */ - proto?: AccessConfig; - dOProto: AccessConfig; - /** anyType */ - auth?: Any; - dOAuth: Any; - /** bytes */ - salt: Uint8Array; - dOSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - dORaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - dOWasm: Uint8Array; - /** enum */ - opt: VoteOption; - dOOpt: VoteOption; - /** duration */ - period?: Duration; - dOPeriod: Duration; - /** timestamp */ - date?: Date; - dODate: Date; - /** pubkey */ - pubkey?: Any; - dOPubkey: Any; - /** array scalar */ - nums: number[]; - dONums: number[]; - /** array bigint */ - bigs: bigint[]; - dOBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - dOSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - dORaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - dOWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - dOOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - dOPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - dOProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - dOAuths: Any[]; -} -export interface AminoEncodingTestForDontOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForDontOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForDontOmitAmino { - /** scalar */ - str?: string; - d_o_str: string; - b?: boolean; - d_o_b: boolean; - num?: number; - d_o_num: number; - /** bigint */ - big?: string; - d_o_big: string; - /** protoType */ - proto?: AccessConfigAmino; - d_o_proto: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - d_o_auth: AnyAmino; - /** bytes */ - salt?: string; - d_o_salt: string; - /** raw bytes */ - raw?: any; - d_o_raw: any; - /** wasm bytes */ - wasm?: string; - d_o_wasm: string; - /** enum */ - opt?: VoteOption; - d_o_opt: VoteOption; - /** duration */ - period?: DurationAmino; - d_o_period: DurationAmino; - /** timestamp */ - date?: string; - d_o_date: string; - /** pubkey */ - pubkey?: AnyAmino; - d_o_pubkey: AnyAmino; - /** array scalar */ - nums?: number[]; - d_o_nums: number[]; - /** array bigint */ - bigs?: string[]; - d_o_bigs: string[]; - /** array bytes */ - salts?: string[]; - d_o_salts: string[]; - /** array raw bytes */ - raws?: any[]; - d_o_raws: any[]; - /** array wasm bytes */ - wasms?: string[]; - d_o_wasms: string[]; - /** array enum */ - opts?: VoteOption[]; - d_o_opts: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - d_o_periods: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - d_o_protos: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - d_o_auths: AnyAmino[]; -} -export interface AminoEncodingTestForDontOmitAminoMsg { - type: "/misc.AminoEncodingTestForDontOmit"; - value: AminoEncodingTestForDontOmitAmino; -} -export interface AminoEncodingTestForDontOmitSDKType { - str: string; - d_o_str: string; - b: boolean; - d_o_b: boolean; - num: number; - d_o_num: number; - big: bigint; - d_o_big: bigint; - proto?: AccessConfigSDKType; - d_o_proto: AccessConfigSDKType; - auth?: AnySDKType; - d_o_auth: AnySDKType; - salt: Uint8Array; - d_o_salt: Uint8Array; - raw: Uint8Array; - d_o_raw: Uint8Array; - wasm: Uint8Array; - d_o_wasm: Uint8Array; - opt: VoteOption; - d_o_opt: VoteOption; - period?: DurationSDKType; - d_o_period: DurationSDKType; - date?: Date; - d_o_date: Date; - pubkey?: AnySDKType; - d_o_pubkey: AnySDKType; - nums: number[]; - d_o_nums: number[]; - bigs: bigint[]; - d_o_bigs: bigint[]; - salts: Uint8Array[]; - d_o_salts: Uint8Array[]; - raws: Uint8Array[]; - d_o_raws: Uint8Array[]; - wasms: Uint8Array[]; - d_o_wasms: Uint8Array[]; - opts: VoteOption[]; - d_o_opts: VoteOption[]; - periods: DurationSDKType[]; - d_o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - d_o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - d_o_auths: AnySDKType[]; -} -export interface AminoEncodingTestForOmit { - /** scalar */ - str: string; - oStr: string; - b: boolean; - oB: boolean; - num: number; - oNum: number; - /** bigint */ - big: bigint; - oBig: bigint; - /** protoType */ - proto?: AccessConfig; - oProto: AccessConfig; - /** anyType */ - auth?: Any; - oAuth: Any; - /** bytes */ - salt: Uint8Array; - oSalt: Uint8Array; - /** raw bytes */ - raw: Uint8Array; - oRaw: Uint8Array; - /** wasm bytes */ - wasm: Uint8Array; - oWasm: Uint8Array; - /** enum */ - opt: VoteOption; - oOpt: VoteOption; - /** duration */ - period?: Duration; - oPeriod: Duration; - /** timestamp */ - date?: Date; - oDate: Date; - /** pubkey */ - pubkey?: Any; - oPubkey: Any; - /** array scalar */ - nums: number[]; - oNums: number[]; - /** array bigint */ - bigs: bigint[]; - oBigs: bigint[]; - /** array bytes */ - salts: Uint8Array[]; - oSalts: Uint8Array[]; - /** array raw bytes */ - raws: Uint8Array[]; - oRaws: Uint8Array[]; - /** array wasm bytes */ - wasms: Uint8Array[]; - oWasms: Uint8Array[]; - /** array enum */ - opts: VoteOption[]; - oOpts: VoteOption[]; - /** array duration */ - periods: Duration[]; - oPeriods: Duration[]; - /** array protoType */ - protos: AccessConfig[]; - oProtos: AccessConfig[]; - /** array anyType */ - auths: Any[]; - oAuths: Any[]; -} -export interface AminoEncodingTestForOmitProtoMsg { - typeUrl: "/misc.AminoEncodingTestForOmit"; - value: Uint8Array; -} -export interface AminoEncodingTestForOmitAmino { - /** scalar */ - str?: string; - o_str?: string; - b?: boolean; - o_b?: boolean; - num?: number; - o_num?: number; - /** bigint */ - big?: string; - o_big?: string; - /** protoType */ - proto?: AccessConfigAmino; - o_proto?: AccessConfigAmino; - /** anyType */ - auth?: AnyAmino; - o_auth?: AnyAmino; - /** bytes */ - salt?: string; - o_salt?: string; - /** raw bytes */ - raw?: any; - o_raw?: any; - /** wasm bytes */ - wasm?: string; - o_wasm?: string; - /** enum */ - opt?: VoteOption; - o_opt?: VoteOption; - /** duration */ - period?: DurationAmino; - o_period?: DurationAmino; - /** timestamp */ - date?: string; - o_date?: string; - /** pubkey */ - pubkey?: AnyAmino; - o_pubkey?: AnyAmino; - /** array scalar */ - nums?: number[]; - o_nums?: number[]; - /** array bigint */ - bigs?: string[]; - o_bigs?: string[]; - /** array bytes */ - salts?: string[]; - o_salts?: string[]; - /** array raw bytes */ - raws?: any[]; - o_raws?: any[]; - /** array wasm bytes */ - wasms?: string[]; - o_wasms?: string[]; - /** array enum */ - opts?: VoteOption[]; - o_opts?: VoteOption[]; - /** array duration */ - periods?: DurationAmino[]; - o_periods?: DurationAmino[]; - /** array protoType */ - protos?: AccessConfigAmino[]; - o_protos?: AccessConfigAmino[]; - /** array anyType */ - auths?: AnyAmino[]; - o_auths?: AnyAmino[]; -} -export interface AminoEncodingTestForOmitAminoMsg { - type: "/misc.AminoEncodingTestForOmit"; - value: AminoEncodingTestForOmitAmino; -} -export interface AminoEncodingTestForOmitSDKType { - str: string; - o_str: string; - b: boolean; - o_b: boolean; - num: number; - o_num: number; - big: bigint; - o_big: bigint; - proto?: AccessConfigSDKType; - o_proto: AccessConfigSDKType; - auth?: AnySDKType; - o_auth: AnySDKType; - salt: Uint8Array; - o_salt: Uint8Array; - raw: Uint8Array; - o_raw: Uint8Array; - wasm: Uint8Array; - o_wasm: Uint8Array; - opt: VoteOption; - o_opt: VoteOption; - period?: DurationSDKType; - o_period: DurationSDKType; - date?: Date; - o_date: Date; - pubkey?: AnySDKType; - o_pubkey: AnySDKType; - nums: number[]; - o_nums: number[]; - bigs: bigint[]; - o_bigs: bigint[]; - salts: Uint8Array[]; - o_salts: Uint8Array[]; - raws: Uint8Array[]; - o_raws: Uint8Array[]; - wasms: Uint8Array[]; - o_wasms: Uint8Array[]; - opts: VoteOption[]; - o_opts: VoteOption[]; - periods: DurationSDKType[]; - o_periods: DurationSDKType[]; - protos: AccessConfigSDKType[]; - o_protos: AccessConfigSDKType[]; - auths: AnySDKType[]; - o_auths: AnySDKType[]; -} -function createBaseAminoEncodingTestForDontOmit(): AminoEncodingTestForDontOmit { - return { - str: "", - dOStr: "", - b: false, - dOB: false, - num: 0, - dONum: 0, - big: BigInt(0), - dOBig: BigInt(0), - proto: undefined, - dOProto: AccessConfig.fromPartial({}), - auth: undefined, - dOAuth: Any.fromPartial({}), - salt: new Uint8Array(), - dOSalt: new Uint8Array(), - raw: new Uint8Array(), - dORaw: new Uint8Array(), - wasm: new Uint8Array(), - dOWasm: new Uint8Array(), - opt: 0, - dOOpt: 0, - period: undefined, - dOPeriod: Duration.fromPartial({}), - date: undefined, - dODate: new Date(), - pubkey: undefined, - dOPubkey: Any.fromPartial({}), - nums: [], - dONums: [], - bigs: [], - dOBigs: [], - salts: [], - dOSalts: [], - raws: [], - dORaws: [], - wasms: [], - dOWasms: [], - opts: [], - dOOpts: [], - periods: [], - dOPeriods: [], - protos: [], - dOProtos: [], - auths: [], - dOAuths: [] - }; -} -export const AminoEncodingTestForDontOmit = { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - encode(message: AminoEncodingTestForDontOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.dOStr !== "") { - writer.uint32(18).string(message.dOStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.dOB === true) { - writer.uint32(32).bool(message.dOB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.dONum !== 0) { - writer.uint32(48).int32(message.dONum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.dOBig !== BigInt(0)) { - writer.uint32(64).int64(message.dOBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.dOProto !== undefined) { - AccessConfig.encode(message.dOProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.dOAuth !== undefined) { - Any.encode(message.dOAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.dOSalt.length !== 0) { - writer.uint32(114).bytes(message.dOSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.dORaw.length !== 0) { - writer.uint32(130).bytes(message.dORaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.dOWasm.length !== 0) { - writer.uint32(146).bytes(message.dOWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.dOOpt !== 0) { - writer.uint32(160).int32(message.dOOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.dOPeriod !== undefined) { - Duration.encode(message.dOPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.dODate !== undefined) { - Timestamp.encode(toTimestamp(message.dODate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.dOPubkey !== undefined) { - Any.encode(message.dOPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.dONums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.dOBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.dOSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.dORaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.dOWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.dOOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.dOPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.dOProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.dOAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForDontOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForDontOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.dOStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.dOB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.dONum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.dOBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.dOProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.dOAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.dOSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.dORaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.dOWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.dOOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.dOPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.dODate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.dOPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dONums.push(reader.int32()); - } - } else { - message.dONums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOBigs.push(reader.int64()); - } - } else { - message.dOBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.dOSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.dORaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.dOWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.dOOpts.push((reader.int32() as any)); - } - } else { - message.dOOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.dOPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.dOProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.dOAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForDontOmit { - const obj = createBaseAminoEncodingTestForDontOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.dOStr)) obj.dOStr = String(object.dOStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.dOB)) obj.dOB = Boolean(object.dOB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.dONum)) obj.dONum = Number(object.dONum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.dOBig)) obj.dOBig = BigInt(object.dOBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.dOProto)) obj.dOProto = AccessConfig.fromJSON(object.dOProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.dOAuth)) obj.dOAuth = Any.fromJSON(object.dOAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.dOSalt)) obj.dOSalt = bytesFromBase64(object.dOSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.dORaw)) obj.dORaw = bytesFromBase64(object.dORaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.dOWasm)) obj.dOWasm = bytesFromBase64(object.dOWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.dOOpt)) obj.dOOpt = voteOptionFromJSON(object.dOOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.dOPeriod)) obj.dOPeriod = Duration.fromJSON(object.dOPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.dODate)) obj.dODate = new Date(object.dODate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.dOPubkey)) obj.dOPubkey = Any.fromJSON(object.dOPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.dONums)) obj.dONums = object.dONums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.dOBigs)) obj.dOBigs = object.dOBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOSalts)) obj.dOSalts = object.dOSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dORaws)) obj.dORaws = object.dORaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.dOWasms)) obj.dOWasms = object.dOWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.dOOpts)) obj.dOOpts = object.dOOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.dOPeriods)) obj.dOPeriods = object.dOPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.dOProtos)) obj.dOProtos = object.dOProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.dOAuths)) obj.dOAuths = object.dOAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForDontOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.dOStr !== undefined && (obj.dOStr = message.dOStr); - message.b !== undefined && (obj.b = message.b); - message.dOB !== undefined && (obj.dOB = message.dOB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.dONum !== undefined && (obj.dONum = Math.round(message.dONum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.dOBig !== undefined && (obj.dOBig = (message.dOBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.dOProto !== undefined && (obj.dOProto = message.dOProto ? AccessConfig.toJSON(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.dOAuth !== undefined && (obj.dOAuth = message.dOAuth ? Any.toJSON(message.dOAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.dOSalt !== undefined && (obj.dOSalt = base64FromBytes(message.dOSalt !== undefined ? message.dOSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.dORaw !== undefined && (obj.dORaw = base64FromBytes(message.dORaw !== undefined ? message.dORaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.dOWasm !== undefined && (obj.dOWasm = base64FromBytes(message.dOWasm !== undefined ? message.dOWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.dOOpt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.dOPeriod !== undefined && (obj.dOPeriod = message.dOPeriod ? Duration.toJSON(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.dODate !== undefined && (obj.dODate = message.dODate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.dOPubkey = message.dOPubkey ? Any.toJSON(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.dONums = message.dONums.map(e => Math.round(e)); - } else { - obj.dONums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.dOBigs = message.dOBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.dOBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.dOSalts = message.dOSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.dORaws = message.dORaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dORaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.dOWasms = message.dOWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.dOWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.dOOpts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.dOOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.dOPeriods = message.dOPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.dOPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.dOProtos = message.dOProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.dOProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.dOAuths = message.dOAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.dOAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - message.str = object.str ?? ""; - message.dOStr = object.dOStr ?? ""; - message.b = object.b ?? false; - message.dOB = object.dOB ?? false; - message.num = object.num ?? 0; - message.dONum = object.dONum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.dOBig !== undefined && object.dOBig !== null) { - message.dOBig = BigInt(object.dOBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.dOProto !== undefined && object.dOProto !== null) { - message.dOProto = AccessConfig.fromPartial(object.dOProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.dOAuth !== undefined && object.dOAuth !== null) { - message.dOAuth = Any.fromPartial(object.dOAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.dOSalt = object.dOSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.dORaw = object.dORaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.dOWasm = object.dOWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.dOOpt = object.dOOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.dOPeriod !== undefined && object.dOPeriod !== null) { - message.dOPeriod = Duration.fromPartial(object.dOPeriod); - } - message.date = object.date ?? undefined; - message.dODate = object.dODate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.dOPubkey !== undefined && object.dOPubkey !== null) { - message.dOPubkey = Any.fromPartial(object.dOPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.dONums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.dOBigs = object.dOBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.dOSalts = object.dOSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.dORaws = object.dORaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.dOWasms = object.dOWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.dOOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.dOPeriods = object.dOPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.dOProtos = object.dOProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.dOAuths = object.dOAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForDontOmitSDKType): AminoEncodingTestForDontOmit { - return { - str: object?.str, - dOStr: object?.d_o_str, - b: object?.b, - dOB: object?.d_o_b, - num: object?.num, - dONum: object?.d_o_num, - big: object?.big, - dOBig: object?.d_o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - dOProto: object.d_o_proto ? AccessConfig.fromSDK(object.d_o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - dOAuth: object.d_o_auth ? Any.fromSDK(object.d_o_auth) : undefined, - salt: object?.salt, - dOSalt: object?.d_o_salt, - raw: object?.raw, - dORaw: object?.d_o_raw, - wasm: object?.wasm, - dOWasm: object?.d_o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - dOOpt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - dOPeriod: object.d_o_period ? Duration.fromSDK(object.d_o_period) : undefined, - date: object.date ?? undefined, - dODate: object.d_o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - dOPubkey: object.d_o_pubkey ? Any.fromSDK(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - dONums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - dOBigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - dOSalts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - dORaws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - dOWasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - dOOpts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - dOPeriods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - dOProtos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - dOAuths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForDontOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - d_o_str: isSet(object.d_o_str) ? String(object.d_o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - d_o_b: isSet(object.d_o_b) ? Boolean(object.d_o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - d_o_num: isSet(object.d_o_num) ? Number(object.d_o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - d_o_big: isSet(object.d_o_big) ? BigInt(object.d_o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - d_o_proto: isSet(object.d_o_proto) ? AccessConfig.fromSDKJSON(object.d_o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - d_o_auth: isSet(object.d_o_auth) ? Any.fromSDKJSON(object.d_o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - d_o_salt: isSet(object.d_o_salt) ? bytesFromBase64(object.d_o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - d_o_raw: isSet(object.d_o_raw) ? bytesFromBase64(object.d_o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - d_o_wasm: isSet(object.d_o_wasm) ? bytesFromBase64(object.d_o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - d_o_opt: isSet(object.d_o_opt) ? voteOptionFromJSON(object.d_o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - d_o_period: isSet(object.d_o_period) ? Duration.fromSDKJSON(object.d_o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - d_o_date: isSet(object.d_o_date) ? new Date(object.d_o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - d_o_pubkey: isSet(object.d_o_pubkey) ? Any.fromSDKJSON(object.d_o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - d_o_nums: Array.isArray(object?.d_o_nums) ? object.d_o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - d_o_bigs: Array.isArray(object?.d_o_bigs) ? object.d_o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - d_o_salts: Array.isArray(object?.d_o_salts) ? object.d_o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - d_o_raws: Array.isArray(object?.d_o_raws) ? object.d_o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - d_o_wasms: Array.isArray(object?.d_o_wasms) ? object.d_o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - d_o_opts: Array.isArray(object?.d_o_opts) ? object.d_o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - d_o_periods: Array.isArray(object?.d_o_periods) ? object.d_o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - d_o_protos: Array.isArray(object?.d_o_protos) ? object.d_o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - d_o_auths: Array.isArray(object?.d_o_auths) ? object.d_o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.d_o_str = message.dOStr; - obj.b = message.b; - obj.d_o_b = message.dOB; - obj.num = message.num; - obj.d_o_num = message.dONum; - obj.big = message.big; - obj.d_o_big = message.dOBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.dOProto !== undefined && (obj.d_o_proto = message.dOProto ? AccessConfig.toSDK(message.dOProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.dOAuth !== undefined && (obj.d_o_auth = message.dOAuth ? Any.toSDK(message.dOAuth) : undefined); - obj.salt = message.salt; - obj.d_o_salt = message.dOSalt; - obj.raw = message.raw; - obj.d_o_raw = message.dORaw; - obj.wasm = message.wasm; - obj.d_o_wasm = message.dOWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.dOOpt !== undefined && (obj.d_o_opt = voteOptionToJSON(message.dOOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.dOPeriod !== undefined && (obj.d_o_period = message.dOPeriod ? Duration.toSDK(message.dOPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.dODate !== undefined && (obj.d_o_date = message.dODate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.dOPubkey !== undefined && (obj.d_o_pubkey = message.dOPubkey ? Any.toSDK(message.dOPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e); - } else { - obj.d_o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => e); - } else { - obj.d_o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => e); - } else { - obj.d_o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => e); - } else { - obj.d_o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => voteOptionToJSON(e)); - } else { - obj.d_o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.d_o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.d_o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.d_o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForDontOmitAmino): AminoEncodingTestForDontOmit { - const message = createBaseAminoEncodingTestForDontOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.d_o_str !== undefined && object.d_o_str !== null) { - message.dOStr = object.d_o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.d_o_b !== undefined && object.d_o_b !== null) { - message.dOB = object.d_o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.d_o_num !== undefined && object.d_o_num !== null) { - message.dONum = object.d_o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.d_o_big !== undefined && object.d_o_big !== null) { - message.dOBig = BigInt(object.d_o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.d_o_proto !== undefined && object.d_o_proto !== null) { - message.dOProto = AccessConfig.fromAmino(object.d_o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.d_o_auth !== undefined && object.d_o_auth !== null) { - message.dOAuth = Any.fromAmino(object.d_o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.d_o_salt !== undefined && object.d_o_salt !== null) { - message.dOSalt = bytesFromBase64(object.d_o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.d_o_raw !== undefined && object.d_o_raw !== null) { - message.dORaw = toUtf8(JSON.stringify(object.d_o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.d_o_wasm !== undefined && object.d_o_wasm !== null) { - message.dOWasm = fromBase64(object.d_o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.d_o_opt !== undefined && object.d_o_opt !== null) { - message.dOOpt = object.d_o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.d_o_period !== undefined && object.d_o_period !== null) { - message.dOPeriod = Duration.fromAmino(object.d_o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.d_o_date !== undefined && object.d_o_date !== null) { - message.dODate = fromTimestamp(Timestamp.fromAmino(object.d_o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.d_o_pubkey !== undefined && object.d_o_pubkey !== null) { - message.dOPubkey = encodePubkey(object.d_o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.dONums = object.d_o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.dOBigs = object.d_o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.dOSalts = object.d_o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.dORaws = object.d_o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.dOWasms = object.d_o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.dOOpts = object.d_o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.dOPeriods = object.d_o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.dOProtos = object.d_o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.dOAuths = object.d_o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.d_o_str = message.dOStr === "" ? undefined : message.dOStr; - obj.b = message.b === false ? undefined : message.b; - obj.d_o_b = message.dOB === false ? undefined : message.dOB; - obj.num = message.num === 0 ? undefined : message.num; - obj.d_o_num = message.dONum === 0 ? undefined : message.dONum; - obj.big = message.big ? message.big.toString() : undefined; - obj.d_o_big = message.dOBig ? message.dOBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.d_o_proto = message.dOProto ? AccessConfig.toAmino(message.dOProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.d_o_auth = message.dOAuth ? Any.toAmino(message.dOAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.d_o_salt = message.dOSalt ? base64FromBytes(message.dOSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.d_o_raw = message.dORaw ? JSON.parse(fromUtf8(message.dORaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.d_o_wasm = message.dOWasm ? toBase64(message.dOWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.d_o_opt = message.dOOpt === 0 ? undefined : message.dOOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.d_o_period = message.dOPeriod ? Duration.toAmino(message.dOPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.d_o_date = message.dODate ? Timestamp.toAmino(toTimestamp(message.dODate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.d_o_pubkey = message.dOPubkey ? decodePubkey(message.dOPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.dONums) { - obj.d_o_nums = message.dONums.map(e => e); - } else { - obj.d_o_nums = message.dONums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.dOBigs) { - obj.d_o_bigs = message.dOBigs.map(e => e.toString()); - } else { - obj.d_o_bigs = message.dOBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.dOSalts) { - obj.d_o_salts = message.dOSalts.map(e => base64FromBytes(e)); - } else { - obj.d_o_salts = message.dOSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.dORaws) { - obj.d_o_raws = message.dORaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.d_o_raws = message.dORaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.dOWasms) { - obj.d_o_wasms = message.dOWasms.map(e => toBase64(e)); - } else { - obj.d_o_wasms = message.dOWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.dOOpts) { - obj.d_o_opts = message.dOOpts.map(e => e); - } else { - obj.d_o_opts = message.dOOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.dOPeriods) { - obj.d_o_periods = message.dOPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.d_o_periods = message.dOPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.dOProtos) { - obj.d_o_protos = message.dOProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.d_o_protos = message.dOProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.dOAuths) { - obj.d_o_auths = message.dOAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.d_o_auths = message.dOAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForDontOmitAminoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForDontOmitProtoMsg): AminoEncodingTestForDontOmit { - return AminoEncodingTestForDontOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForDontOmit): Uint8Array { - return AminoEncodingTestForDontOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForDontOmit): AminoEncodingTestForDontOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForDontOmit", - value: AminoEncodingTestForDontOmit.encode(message).finish() - }; - } -}; -function createBaseAminoEncodingTestForOmit(): AminoEncodingTestForOmit { - return { - str: "", - oStr: "", - b: false, - oB: false, - num: 0, - oNum: 0, - big: BigInt(0), - oBig: BigInt(0), - proto: undefined, - oProto: AccessConfig.fromPartial({}), - auth: undefined, - oAuth: Any.fromPartial({}), - salt: new Uint8Array(), - oSalt: new Uint8Array(), - raw: new Uint8Array(), - oRaw: new Uint8Array(), - wasm: new Uint8Array(), - oWasm: new Uint8Array(), - opt: 0, - oOpt: 0, - period: undefined, - oPeriod: Duration.fromPartial({}), - date: undefined, - oDate: new Date(), - pubkey: undefined, - oPubkey: Any.fromPartial({}), - nums: [], - oNums: [], - bigs: [], - oBigs: [], - salts: [], - oSalts: [], - raws: [], - oRaws: [], - wasms: [], - oWasms: [], - opts: [], - oOpts: [], - periods: [], - oPeriods: [], - protos: [], - oProtos: [], - auths: [], - oAuths: [] - }; -} -export const AminoEncodingTestForOmit = { - typeUrl: "/misc.AminoEncodingTestForOmit", - encode(message: AminoEncodingTestForOmit, writer: BinaryWriter = BinaryWriter.create()): BinaryWriter { - if (message.str !== "") { - writer.uint32(10).string(message.str); - } - if (message.oStr !== "") { - writer.uint32(18).string(message.oStr); - } - if (message.b === true) { - writer.uint32(24).bool(message.b); - } - if (message.oB === true) { - writer.uint32(32).bool(message.oB); - } - if (message.num !== 0) { - writer.uint32(40).int32(message.num); - } - if (message.oNum !== 0) { - writer.uint32(48).int32(message.oNum); - } - if (message.big !== BigInt(0)) { - writer.uint32(56).int64(message.big); - } - if (message.oBig !== BigInt(0)) { - writer.uint32(64).int64(message.oBig); - } - if (message.proto !== undefined) { - AccessConfig.encode(message.proto, writer.uint32(74).fork()).ldelim(); - } - if (message.oProto !== undefined) { - AccessConfig.encode(message.oProto, writer.uint32(82).fork()).ldelim(); - } - if (message.auth !== undefined) { - Any.encode(message.auth, writer.uint32(90).fork()).ldelim(); - } - if (message.oAuth !== undefined) { - Any.encode(message.oAuth, writer.uint32(98).fork()).ldelim(); - } - if (message.salt.length !== 0) { - writer.uint32(106).bytes(message.salt); - } - if (message.oSalt.length !== 0) { - writer.uint32(114).bytes(message.oSalt); - } - if (message.raw.length !== 0) { - writer.uint32(122).bytes(message.raw); - } - if (message.oRaw.length !== 0) { - writer.uint32(130).bytes(message.oRaw); - } - if (message.wasm.length !== 0) { - writer.uint32(138).bytes(message.wasm); - } - if (message.oWasm.length !== 0) { - writer.uint32(146).bytes(message.oWasm); - } - if (message.opt !== 0) { - writer.uint32(152).int32(message.opt); - } - if (message.oOpt !== 0) { - writer.uint32(160).int32(message.oOpt); - } - if (message.period !== undefined) { - Duration.encode(message.period, writer.uint32(170).fork()).ldelim(); - } - if (message.oPeriod !== undefined) { - Duration.encode(message.oPeriod, writer.uint32(178).fork()).ldelim(); - } - if (message.date !== undefined) { - Timestamp.encode(toTimestamp(message.date), writer.uint32(186).fork()).ldelim(); - } - if (message.oDate !== undefined) { - Timestamp.encode(toTimestamp(message.oDate), writer.uint32(194).fork()).ldelim(); - } - if (message.pubkey !== undefined) { - Any.encode(message.pubkey, writer.uint32(202).fork()).ldelim(); - } - if (message.oPubkey !== undefined) { - Any.encode(message.oPubkey, writer.uint32(210).fork()).ldelim(); - } - writer.uint32(218).fork(); - for (const v of message.nums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(226).fork(); - for (const v of message.oNums) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(234).fork(); - for (const v of message.bigs) { - writer.int64(v); - } - writer.ldelim(); - writer.uint32(242).fork(); - for (const v of message.oBigs) { - writer.int64(v); - } - writer.ldelim(); - for (const v of message.salts) { - writer.uint32(250).bytes(v!); - } - for (const v of message.oSalts) { - writer.uint32(258).bytes(v!); - } - for (const v of message.raws) { - writer.uint32(266).bytes(v!); - } - for (const v of message.oRaws) { - writer.uint32(274).bytes(v!); - } - for (const v of message.wasms) { - writer.uint32(282).bytes(v!); - } - for (const v of message.oWasms) { - writer.uint32(290).bytes(v!); - } - writer.uint32(298).fork(); - for (const v of message.opts) { - writer.int32(v); - } - writer.ldelim(); - writer.uint32(306).fork(); - for (const v of message.oOpts) { - writer.int32(v); - } - writer.ldelim(); - for (const v of message.periods) { - Duration.encode(v!, writer.uint32(314).fork()).ldelim(); - } - for (const v of message.oPeriods) { - Duration.encode(v!, writer.uint32(322).fork()).ldelim(); - } - for (const v of message.protos) { - AccessConfig.encode(v!, writer.uint32(346).fork()).ldelim(); - } - for (const v of message.oProtos) { - AccessConfig.encode(v!, writer.uint32(354).fork()).ldelim(); - } - for (const v of message.auths) { - Any.encode(v!, writer.uint32(362).fork()).ldelim(); - } - for (const v of message.oAuths) { - Any.encode(v!, writer.uint32(370).fork()).ldelim(); - } - return writer; - }, - decode(input: BinaryReader | Uint8Array, length?: number): AminoEncodingTestForOmit { - const reader = input instanceof BinaryReader ? input : new BinaryReader(input); - let end = length === undefined ? reader.len : reader.pos + length; - const message = createBaseAminoEncodingTestForOmit(); - while (reader.pos < end) { - const tag = reader.uint32(); - switch (tag >>> 3) { - case 1: - message.str = reader.string(); - break; - case 2: - message.oStr = reader.string(); - break; - case 3: - message.b = reader.bool(); - break; - case 4: - message.oB = reader.bool(); - break; - case 5: - message.num = reader.int32(); - break; - case 6: - message.oNum = reader.int32(); - break; - case 7: - message.big = reader.int64(); - break; - case 8: - message.oBig = reader.int64(); - break; - case 9: - message.proto = AccessConfig.decode(reader, reader.uint32()); - break; - case 10: - message.oProto = AccessConfig.decode(reader, reader.uint32()); - break; - case 11: - message.auth = Any.decode(reader, reader.uint32()); - break; - case 12: - message.oAuth = Any.decode(reader, reader.uint32()); - break; - case 13: - message.salt = reader.bytes(); - break; - case 14: - message.oSalt = reader.bytes(); - break; - case 15: - message.raw = reader.bytes(); - break; - case 16: - message.oRaw = reader.bytes(); - break; - case 17: - message.wasm = reader.bytes(); - break; - case 18: - message.oWasm = reader.bytes(); - break; - case 19: - message.opt = (reader.int32() as any); - break; - case 20: - message.oOpt = (reader.int32() as any); - break; - case 21: - message.period = Duration.decode(reader, reader.uint32()); - break; - case 22: - message.oPeriod = Duration.decode(reader, reader.uint32()); - break; - case 23: - message.date = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 24: - message.oDate = fromTimestamp(Timestamp.decode(reader, reader.uint32())); - break; - case 25: - message.pubkey = Any.decode(reader, reader.uint32()); - break; - case 26: - message.oPubkey = Any.decode(reader, reader.uint32()); - break; - case 27: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.nums.push(reader.int32()); - } - } else { - message.nums.push(reader.int32()); - } - break; - case 28: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oNums.push(reader.int32()); - } - } else { - message.oNums.push(reader.int32()); - } - break; - case 29: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.bigs.push(reader.int64()); - } - } else { - message.bigs.push(reader.int64()); - } - break; - case 30: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oBigs.push(reader.int64()); - } - } else { - message.oBigs.push(reader.int64()); - } - break; - case 31: - message.salts.push(reader.bytes()); - break; - case 32: - message.oSalts.push(reader.bytes()); - break; - case 33: - message.raws.push(reader.bytes()); - break; - case 34: - message.oRaws.push(reader.bytes()); - break; - case 35: - message.wasms.push(reader.bytes()); - break; - case 36: - message.oWasms.push(reader.bytes()); - break; - case 37: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.opts.push((reader.int32() as any)); - } - } else { - message.opts.push((reader.int32() as any)); - } - break; - case 38: - if ((tag & 7) === 2) { - const end2 = reader.uint32() + reader.pos; - while (reader.pos < end2) { - message.oOpts.push((reader.int32() as any)); - } - } else { - message.oOpts.push((reader.int32() as any)); - } - break; - case 39: - message.periods.push(Duration.decode(reader, reader.uint32())); - break; - case 40: - message.oPeriods.push(Duration.decode(reader, reader.uint32())); - break; - case 43: - message.protos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 44: - message.oProtos.push(AccessConfig.decode(reader, reader.uint32())); - break; - case 45: - message.auths.push(Any.decode(reader, reader.uint32())); - break; - case 46: - message.oAuths.push(Any.decode(reader, reader.uint32())); - break; - default: - reader.skipType(tag & 7); - break; - } - } - return message; - }, - fromJSON(object: any): AminoEncodingTestForOmit { - const obj = createBaseAminoEncodingTestForOmit(); - if (isSet(object.str)) obj.str = String(object.str); - if (isSet(object.oStr)) obj.oStr = String(object.oStr); - if (isSet(object.b)) obj.b = Boolean(object.b); - if (isSet(object.oB)) obj.oB = Boolean(object.oB); - if (isSet(object.num)) obj.num = Number(object.num); - if (isSet(object.oNum)) obj.oNum = Number(object.oNum); - if (isSet(object.big)) obj.big = BigInt(object.big.toString()); - if (isSet(object.oBig)) obj.oBig = BigInt(object.oBig.toString()); - if (isSet(object.proto)) obj.proto = AccessConfig.fromJSON(object.proto); - if (isSet(object.oProto)) obj.oProto = AccessConfig.fromJSON(object.oProto); - if (isSet(object.auth)) obj.auth = Any.fromJSON(object.auth); - if (isSet(object.oAuth)) obj.oAuth = Any.fromJSON(object.oAuth); - if (isSet(object.salt)) obj.salt = bytesFromBase64(object.salt); - if (isSet(object.oSalt)) obj.oSalt = bytesFromBase64(object.oSalt); - if (isSet(object.raw)) obj.raw = bytesFromBase64(object.raw); - if (isSet(object.oRaw)) obj.oRaw = bytesFromBase64(object.oRaw); - if (isSet(object.wasm)) obj.wasm = bytesFromBase64(object.wasm); - if (isSet(object.oWasm)) obj.oWasm = bytesFromBase64(object.oWasm); - if (isSet(object.opt)) obj.opt = voteOptionFromJSON(object.opt); - if (isSet(object.oOpt)) obj.oOpt = voteOptionFromJSON(object.oOpt); - if (isSet(object.period)) obj.period = Duration.fromJSON(object.period); - if (isSet(object.oPeriod)) obj.oPeriod = Duration.fromJSON(object.oPeriod); - if (isSet(object.date)) obj.date = new Date(object.date); - if (isSet(object.oDate)) obj.oDate = new Date(object.oDate); - if (isSet(object.pubkey)) obj.pubkey = Any.fromJSON(object.pubkey); - if (isSet(object.oPubkey)) obj.oPubkey = Any.fromJSON(object.oPubkey); - if (Array.isArray(object?.nums)) obj.nums = object.nums.map((e: any) => Number(e)); - if (Array.isArray(object?.oNums)) obj.oNums = object.oNums.map((e: any) => Number(e)); - if (Array.isArray(object?.bigs)) obj.bigs = object.bigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.oBigs)) obj.oBigs = object.oBigs.map((e: any) => BigInt(e.toString())); - if (Array.isArray(object?.salts)) obj.salts = object.salts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oSalts)) obj.oSalts = object.oSalts.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.raws)) obj.raws = object.raws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oRaws)) obj.oRaws = object.oRaws.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.wasms)) obj.wasms = object.wasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.oWasms)) obj.oWasms = object.oWasms.map((e: any) => bytesFromBase64(e)); - if (Array.isArray(object?.opts)) obj.opts = object.opts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.oOpts)) obj.oOpts = object.oOpts.map((e: any) => voteOptionFromJSON(e)); - if (Array.isArray(object?.periods)) obj.periods = object.periods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.oPeriods)) obj.oPeriods = object.oPeriods.map((e: any) => Duration.fromJSON(e)); - if (Array.isArray(object?.protos)) obj.protos = object.protos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.oProtos)) obj.oProtos = object.oProtos.map((e: any) => AccessConfig.fromJSON(e)); - if (Array.isArray(object?.auths)) obj.auths = object.auths.map((e: any) => Any.fromJSON(e)); - if (Array.isArray(object?.oAuths)) obj.oAuths = object.oAuths.map((e: any) => Any.fromJSON(e)); - return obj; - }, - toJSON(message: AminoEncodingTestForOmit): unknown { - const obj: any = {}; - message.str !== undefined && (obj.str = message.str); - message.oStr !== undefined && (obj.oStr = message.oStr); - message.b !== undefined && (obj.b = message.b); - message.oB !== undefined && (obj.oB = message.oB); - message.num !== undefined && (obj.num = Math.round(message.num)); - message.oNum !== undefined && (obj.oNum = Math.round(message.oNum)); - message.big !== undefined && (obj.big = (message.big || BigInt(0)).toString()); - message.oBig !== undefined && (obj.oBig = (message.oBig || BigInt(0)).toString()); - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toJSON(message.proto) : undefined); - message.oProto !== undefined && (obj.oProto = message.oProto ? AccessConfig.toJSON(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toJSON(message.auth) : undefined); - message.oAuth !== undefined && (obj.oAuth = message.oAuth ? Any.toJSON(message.oAuth) : undefined); - message.salt !== undefined && (obj.salt = base64FromBytes(message.salt !== undefined ? message.salt : new Uint8Array())); - message.oSalt !== undefined && (obj.oSalt = base64FromBytes(message.oSalt !== undefined ? message.oSalt : new Uint8Array())); - message.raw !== undefined && (obj.raw = base64FromBytes(message.raw !== undefined ? message.raw : new Uint8Array())); - message.oRaw !== undefined && (obj.oRaw = base64FromBytes(message.oRaw !== undefined ? message.oRaw : new Uint8Array())); - message.wasm !== undefined && (obj.wasm = base64FromBytes(message.wasm !== undefined ? message.wasm : new Uint8Array())); - message.oWasm !== undefined && (obj.oWasm = base64FromBytes(message.oWasm !== undefined ? message.oWasm : new Uint8Array())); - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.oOpt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toJSON(message.period) : undefined); - message.oPeriod !== undefined && (obj.oPeriod = message.oPeriod ? Duration.toJSON(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date.toISOString()); - message.oDate !== undefined && (obj.oDate = message.oDate.toISOString()); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toJSON(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.oPubkey = message.oPubkey ? Any.toJSON(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => Math.round(e)); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.oNums = message.oNums.map(e => Math.round(e)); - } else { - obj.oNums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.oBigs = message.oBigs.map(e => (e || BigInt(0)).toString()); - } else { - obj.oBigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.oSalts = message.oSalts.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oSalts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.oRaws = message.oRaws.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oRaws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.oWasms = message.oWasms.map(e => base64FromBytes(e !== undefined ? e : new Uint8Array())); - } else { - obj.oWasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.oOpts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.oOpts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.oPeriods = message.oPeriods.map(e => e ? Duration.toJSON(e) : undefined); - } else { - obj.oPeriods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.oProtos = message.oProtos.map(e => e ? AccessConfig.toJSON(e) : undefined); - } else { - obj.oProtos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.oAuths = message.oAuths.map(e => e ? Any.toJSON(e) : undefined); - } else { - obj.oAuths = []; - } - return obj; - }, - fromPartial(object: DeepPartial): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - message.str = object.str ?? ""; - message.oStr = object.oStr ?? ""; - message.b = object.b ?? false; - message.oB = object.oB ?? false; - message.num = object.num ?? 0; - message.oNum = object.oNum ?? 0; - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big.toString()); - } - if (object.oBig !== undefined && object.oBig !== null) { - message.oBig = BigInt(object.oBig.toString()); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromPartial(object.proto); - } - if (object.oProto !== undefined && object.oProto !== null) { - message.oProto = AccessConfig.fromPartial(object.oProto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromPartial(object.auth); - } - if (object.oAuth !== undefined && object.oAuth !== null) { - message.oAuth = Any.fromPartial(object.oAuth); - } - message.salt = object.salt ?? new Uint8Array(); - message.oSalt = object.oSalt ?? new Uint8Array(); - message.raw = object.raw ?? new Uint8Array(); - message.oRaw = object.oRaw ?? new Uint8Array(); - message.wasm = object.wasm ?? new Uint8Array(); - message.oWasm = object.oWasm ?? new Uint8Array(); - message.opt = object.opt ?? 0; - message.oOpt = object.oOpt ?? 0; - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromPartial(object.period); - } - if (object.oPeriod !== undefined && object.oPeriod !== null) { - message.oPeriod = Duration.fromPartial(object.oPeriod); - } - message.date = object.date ?? undefined; - message.oDate = object.oDate ?? undefined; - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = Any.fromPartial(object.pubkey); - } - if (object.oPubkey !== undefined && object.oPubkey !== null) { - message.oPubkey = Any.fromPartial(object.oPubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.oNums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e.toString())) || []; - message.oBigs = object.oBigs?.map(e => BigInt(e.toString())) || []; - message.salts = object.salts?.map(e => e) || []; - message.oSalts = object.oSalts?.map(e => e) || []; - message.raws = object.raws?.map(e => e) || []; - message.oRaws = object.oRaws?.map(e => e) || []; - message.wasms = object.wasms?.map(e => e) || []; - message.oWasms = object.oWasms?.map(e => e) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.oOpts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromPartial(e)) || []; - message.oPeriods = object.oPeriods?.map(e => Duration.fromPartial(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromPartial(e)) || []; - message.oProtos = object.oProtos?.map(e => AccessConfig.fromPartial(e)) || []; - message.auths = object.auths?.map(e => Any.fromPartial(e)) || []; - message.oAuths = object.oAuths?.map(e => Any.fromPartial(e)) || []; - return message; - }, - fromSDK(object: AminoEncodingTestForOmitSDKType): AminoEncodingTestForOmit { - return { - str: object?.str, - oStr: object?.o_str, - b: object?.b, - oB: object?.o_b, - num: object?.num, - oNum: object?.o_num, - big: object?.big, - oBig: object?.o_big, - proto: object.proto ? AccessConfig.fromSDK(object.proto) : undefined, - oProto: object.o_proto ? AccessConfig.fromSDK(object.o_proto) : undefined, - auth: object.auth ? Any.fromSDK(object.auth) : undefined, - oAuth: object.o_auth ? Any.fromSDK(object.o_auth) : undefined, - salt: object?.salt, - oSalt: object?.o_salt, - raw: object?.raw, - oRaw: object?.o_raw, - wasm: object?.wasm, - oWasm: object?.o_wasm, - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - oOpt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: object.period ? Duration.fromSDK(object.period) : undefined, - oPeriod: object.o_period ? Duration.fromSDK(object.o_period) : undefined, - date: object.date ?? undefined, - oDate: object.o_date ?? undefined, - pubkey: object.pubkey ? Any.fromSDK(object.pubkey) : undefined, - oPubkey: object.o_pubkey ? Any.fromSDK(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => e) : [], - oNums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => e) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => e) : [], - oBigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => e) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => e) : [], - oSalts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => e) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => e) : [], - oRaws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => e) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => e) : [], - oWasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => e) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - oOpts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDK(e)) : [], - oPeriods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDK(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - oProtos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDK(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDK(e)) : [], - oAuths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDK(e)) : [] - }; - }, - fromSDKJSON(object: any): AminoEncodingTestForOmitSDKType { - return { - str: isSet(object.str) ? String(object.str) : "", - o_str: isSet(object.o_str) ? String(object.o_str) : "", - b: isSet(object.b) ? Boolean(object.b) : false, - o_b: isSet(object.o_b) ? Boolean(object.o_b) : false, - num: isSet(object.num) ? Number(object.num) : 0, - o_num: isSet(object.o_num) ? Number(object.o_num) : 0, - big: isSet(object.big) ? BigInt(object.big.toString()) : BigInt(0), - o_big: isSet(object.o_big) ? BigInt(object.o_big.toString()) : BigInt(0), - proto: isSet(object.proto) ? AccessConfig.fromSDKJSON(object.proto) : undefined, - o_proto: isSet(object.o_proto) ? AccessConfig.fromSDKJSON(object.o_proto) : undefined, - auth: isSet(object.auth) ? Any.fromSDKJSON(object.auth) : undefined, - o_auth: isSet(object.o_auth) ? Any.fromSDKJSON(object.o_auth) : undefined, - salt: isSet(object.salt) ? bytesFromBase64(object.salt) : new Uint8Array(), - o_salt: isSet(object.o_salt) ? bytesFromBase64(object.o_salt) : new Uint8Array(), - raw: isSet(object.raw) ? bytesFromBase64(object.raw) : new Uint8Array(), - o_raw: isSet(object.o_raw) ? bytesFromBase64(object.o_raw) : new Uint8Array(), - wasm: isSet(object.wasm) ? bytesFromBase64(object.wasm) : new Uint8Array(), - o_wasm: isSet(object.o_wasm) ? bytesFromBase64(object.o_wasm) : new Uint8Array(), - opt: isSet(object.opt) ? voteOptionFromJSON(object.opt) : -1, - o_opt: isSet(object.o_opt) ? voteOptionFromJSON(object.o_opt) : -1, - period: isSet(object.period) ? Duration.fromSDKJSON(object.period) : undefined, - o_period: isSet(object.o_period) ? Duration.fromSDKJSON(object.o_period) : undefined, - date: isSet(object.date) ? new Date(object.date) : undefined, - o_date: isSet(object.o_date) ? new Date(object.o_date) : undefined, - pubkey: isSet(object.pubkey) ? Any.fromSDKJSON(object.pubkey) : undefined, - o_pubkey: isSet(object.o_pubkey) ? Any.fromSDKJSON(object.o_pubkey) : undefined, - nums: Array.isArray(object?.nums) ? object.nums.map((e: any) => Number(e)) : [], - o_nums: Array.isArray(object?.o_nums) ? object.o_nums.map((e: any) => Number(e)) : [], - bigs: Array.isArray(object?.bigs) ? object.bigs.map((e: any) => BigInt(e.toString())) : [], - o_bigs: Array.isArray(object?.o_bigs) ? object.o_bigs.map((e: any) => BigInt(e.toString())) : [], - salts: Array.isArray(object?.salts) ? object.salts.map((e: any) => bytesFromBase64(e)) : [], - o_salts: Array.isArray(object?.o_salts) ? object.o_salts.map((e: any) => bytesFromBase64(e)) : [], - raws: Array.isArray(object?.raws) ? object.raws.map((e: any) => bytesFromBase64(e)) : [], - o_raws: Array.isArray(object?.o_raws) ? object.o_raws.map((e: any) => bytesFromBase64(e)) : [], - wasms: Array.isArray(object?.wasms) ? object.wasms.map((e: any) => bytesFromBase64(e)) : [], - o_wasms: Array.isArray(object?.o_wasms) ? object.o_wasms.map((e: any) => bytesFromBase64(e)) : [], - opts: Array.isArray(object?.opts) ? object.opts.map((e: any) => voteOptionFromJSON(e)) : [], - o_opts: Array.isArray(object?.o_opts) ? object.o_opts.map((e: any) => voteOptionFromJSON(e)) : [], - periods: Array.isArray(object?.periods) ? object.periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - o_periods: Array.isArray(object?.o_periods) ? object.o_periods.map((e: any) => Duration.fromSDKJSON(e)) : [], - protos: Array.isArray(object?.protos) ? object.protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - o_protos: Array.isArray(object?.o_protos) ? object.o_protos.map((e: any) => AccessConfig.fromSDKJSON(e)) : [], - auths: Array.isArray(object?.auths) ? object.auths.map((e: any) => Any.fromSDKJSON(e)) : [], - o_auths: Array.isArray(object?.o_auths) ? object.o_auths.map((e: any) => Any.fromSDKJSON(e)) : [] - }; - }, - toSDK(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitSDKType { - const obj: any = {}; - obj.str = message.str; - obj.o_str = message.oStr; - obj.b = message.b; - obj.o_b = message.oB; - obj.num = message.num; - obj.o_num = message.oNum; - obj.big = message.big; - obj.o_big = message.oBig; - message.proto !== undefined && (obj.proto = message.proto ? AccessConfig.toSDK(message.proto) : undefined); - message.oProto !== undefined && (obj.o_proto = message.oProto ? AccessConfig.toSDK(message.oProto) : undefined); - message.auth !== undefined && (obj.auth = message.auth ? Any.toSDK(message.auth) : undefined); - message.oAuth !== undefined && (obj.o_auth = message.oAuth ? Any.toSDK(message.oAuth) : undefined); - obj.salt = message.salt; - obj.o_salt = message.oSalt; - obj.raw = message.raw; - obj.o_raw = message.oRaw; - obj.wasm = message.wasm; - obj.o_wasm = message.oWasm; - message.opt !== undefined && (obj.opt = voteOptionToJSON(message.opt)); - message.oOpt !== undefined && (obj.o_opt = voteOptionToJSON(message.oOpt)); - message.period !== undefined && (obj.period = message.period ? Duration.toSDK(message.period) : undefined); - message.oPeriod !== undefined && (obj.o_period = message.oPeriod ? Duration.toSDK(message.oPeriod) : undefined); - message.date !== undefined && (obj.date = message.date ?? undefined); - message.oDate !== undefined && (obj.o_date = message.oDate ?? undefined); - message.pubkey !== undefined && (obj.pubkey = message.pubkey ? Any.toSDK(message.pubkey) : undefined); - message.oPubkey !== undefined && (obj.o_pubkey = message.oPubkey ? Any.toSDK(message.oPubkey) : undefined); - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = []; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = []; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e); - } else { - obj.bigs = []; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e); - } else { - obj.o_bigs = []; - } - if (message.salts) { - obj.salts = message.salts.map(e => e); - } else { - obj.salts = []; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => e); - } else { - obj.o_salts = []; - } - if (message.raws) { - obj.raws = message.raws.map(e => e); - } else { - obj.raws = []; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => e); - } else { - obj.o_raws = []; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => e); - } else { - obj.wasms = []; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => e); - } else { - obj.o_wasms = []; - } - if (message.opts) { - obj.opts = message.opts.map(e => voteOptionToJSON(e)); - } else { - obj.opts = []; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => voteOptionToJSON(e)); - } else { - obj.o_opts = []; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.periods = []; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toSDK(e) : undefined); - } else { - obj.o_periods = []; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.protos = []; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toSDK(e) : undefined); - } else { - obj.o_protos = []; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.auths = []; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toSDK(e) : undefined); - } else { - obj.o_auths = []; - } - return obj; - }, - fromAmino(object: AminoEncodingTestForOmitAmino): AminoEncodingTestForOmit { - const message = createBaseAminoEncodingTestForOmit(); - if (object.str !== undefined && object.str !== null) { - message.str = object.str; - } - if (object.o_str !== undefined && object.o_str !== null) { - message.oStr = object.o_str; - } - if (object.b !== undefined && object.b !== null) { - message.b = object.b; - } - if (object.o_b !== undefined && object.o_b !== null) { - message.oB = object.o_b; - } - if (object.num !== undefined && object.num !== null) { - message.num = object.num; - } - if (object.o_num !== undefined && object.o_num !== null) { - message.oNum = object.o_num; - } - if (object.big !== undefined && object.big !== null) { - message.big = BigInt(object.big); - } - if (object.o_big !== undefined && object.o_big !== null) { - message.oBig = BigInt(object.o_big); - } - if (object.proto !== undefined && object.proto !== null) { - message.proto = AccessConfig.fromAmino(object.proto); - } - if (object.o_proto !== undefined && object.o_proto !== null) { - message.oProto = AccessConfig.fromAmino(object.o_proto); - } - if (object.auth !== undefined && object.auth !== null) { - message.auth = Any.fromAmino(object.auth); - } - if (object.o_auth !== undefined && object.o_auth !== null) { - message.oAuth = Any.fromAmino(object.o_auth); - } - if (object.salt !== undefined && object.salt !== null) { - message.salt = bytesFromBase64(object.salt); - } - if (object.o_salt !== undefined && object.o_salt !== null) { - message.oSalt = bytesFromBase64(object.o_salt); - } - if (object.raw !== undefined && object.raw !== null) { - message.raw = toUtf8(JSON.stringify(object.raw)); - } - if (object.o_raw !== undefined && object.o_raw !== null) { - message.oRaw = toUtf8(JSON.stringify(object.o_raw)); - } - if (object.wasm !== undefined && object.wasm !== null) { - message.wasm = fromBase64(object.wasm); - } - if (object.o_wasm !== undefined && object.o_wasm !== null) { - message.oWasm = fromBase64(object.o_wasm); - } - if (object.opt !== undefined && object.opt !== null) { - message.opt = object.opt; - } - if (object.o_opt !== undefined && object.o_opt !== null) { - message.oOpt = object.o_opt; - } - if (object.period !== undefined && object.period !== null) { - message.period = Duration.fromAmino(object.period); - } - if (object.o_period !== undefined && object.o_period !== null) { - message.oPeriod = Duration.fromAmino(object.o_period); - } - if (object.date !== undefined && object.date !== null) { - message.date = fromTimestamp(Timestamp.fromAmino(object.date)); - } - if (object.o_date !== undefined && object.o_date !== null) { - message.oDate = fromTimestamp(Timestamp.fromAmino(object.o_date)); - } - if (object.pubkey !== undefined && object.pubkey !== null) { - message.pubkey = encodePubkey(object.pubkey); - } - if (object.o_pubkey !== undefined && object.o_pubkey !== null) { - message.oPubkey = encodePubkey(object.o_pubkey); - } - message.nums = object.nums?.map(e => e) || []; - message.oNums = object.o_nums?.map(e => e) || []; - message.bigs = object.bigs?.map(e => BigInt(e)) || []; - message.oBigs = object.o_bigs?.map(e => BigInt(e)) || []; - message.salts = object.salts?.map(e => bytesFromBase64(e)) || []; - message.oSalts = object.o_salts?.map(e => bytesFromBase64(e)) || []; - message.raws = object.raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.oRaws = object.o_raws?.map(e => toUtf8(JSON.stringify(e))) || []; - message.wasms = object.wasms?.map(e => fromBase64(e)) || []; - message.oWasms = object.o_wasms?.map(e => fromBase64(e)) || []; - message.opts = object.opts?.map(e => e) || []; - message.oOpts = object.o_opts?.map(e => e) || []; - message.periods = object.periods?.map(e => Duration.fromAmino(e)) || []; - message.oPeriods = object.o_periods?.map(e => Duration.fromAmino(e)) || []; - message.protos = object.protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.oProtos = object.o_protos?.map(e => AccessConfig.fromAmino(e)) || []; - message.auths = object.auths?.map(e => Any.fromAmino(e)) || []; - message.oAuths = object.o_auths?.map(e => Any.fromAmino(e)) || []; - return message; - }, - toAmino(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitAmino { - const obj: any = {}; - obj.str = message.str === "" ? undefined : message.str; - obj.o_str = message.oStr === "" ? undefined : message.oStr; - obj.b = message.b === false ? undefined : message.b; - obj.o_b = message.oB === false ? undefined : message.oB; - obj.num = message.num === 0 ? undefined : message.num; - obj.o_num = message.oNum === 0 ? undefined : message.oNum; - obj.big = message.big ? message.big.toString() : undefined; - obj.o_big = message.oBig ? message.oBig.toString() : undefined; - obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : undefined; - obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; - obj.auth = message.auth ? Any.toAmino(message.auth) : undefined; - obj.o_auth = message.oAuth ? Any.toAmino(message.oAuth) : undefined; - obj.salt = message.salt ? base64FromBytes(message.salt) : undefined; - obj.o_salt = message.oSalt ? base64FromBytes(message.oSalt) : undefined; - obj.raw = message.raw ? JSON.parse(fromUtf8(message.raw)) : undefined; - obj.o_raw = message.oRaw ? JSON.parse(fromUtf8(message.oRaw)) : undefined; - obj.wasm = message.wasm ? toBase64(message.wasm) : undefined; - obj.o_wasm = message.oWasm ? toBase64(message.oWasm) : undefined; - obj.opt = message.opt === 0 ? undefined : message.opt; - obj.o_opt = message.oOpt === 0 ? undefined : message.oOpt; - obj.period = message.period ? Duration.toAmino(message.period) : undefined; - obj.o_period = message.oPeriod ? Duration.toAmino(message.oPeriod) : undefined; - obj.date = message.date ? Timestamp.toAmino(toTimestamp(message.date)) : undefined; - obj.o_date = message.oDate ? Timestamp.toAmino(toTimestamp(message.oDate)) : undefined; - obj.pubkey = message.pubkey ? decodePubkey(message.pubkey) : undefined; - obj.o_pubkey = message.oPubkey ? decodePubkey(message.oPubkey) : undefined; - if (message.nums) { - obj.nums = message.nums.map(e => e); - } else { - obj.nums = message.nums; - } - if (message.oNums) { - obj.o_nums = message.oNums.map(e => e); - } else { - obj.o_nums = message.oNums; - } - if (message.bigs) { - obj.bigs = message.bigs.map(e => e.toString()); - } else { - obj.bigs = message.bigs; - } - if (message.oBigs) { - obj.o_bigs = message.oBigs.map(e => e.toString()); - } else { - obj.o_bigs = message.oBigs; - } - if (message.salts) { - obj.salts = message.salts.map(e => base64FromBytes(e)); - } else { - obj.salts = message.salts; - } - if (message.oSalts) { - obj.o_salts = message.oSalts.map(e => base64FromBytes(e)); - } else { - obj.o_salts = message.oSalts; - } - if (message.raws) { - obj.raws = message.raws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.raws = message.raws; - } - if (message.oRaws) { - obj.o_raws = message.oRaws.map(e => JSON.parse(fromUtf8(e))); - } else { - obj.o_raws = message.oRaws; - } - if (message.wasms) { - obj.wasms = message.wasms.map(e => toBase64(e)); - } else { - obj.wasms = message.wasms; - } - if (message.oWasms) { - obj.o_wasms = message.oWasms.map(e => toBase64(e)); - } else { - obj.o_wasms = message.oWasms; - } - if (message.opts) { - obj.opts = message.opts.map(e => e); - } else { - obj.opts = message.opts; - } - if (message.oOpts) { - obj.o_opts = message.oOpts.map(e => e); - } else { - obj.o_opts = message.oOpts; - } - if (message.periods) { - obj.periods = message.periods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.periods = message.periods; - } - if (message.oPeriods) { - obj.o_periods = message.oPeriods.map(e => e ? Duration.toAmino(e) : undefined); - } else { - obj.o_periods = message.oPeriods; - } - if (message.protos) { - obj.protos = message.protos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.protos = message.protos; - } - if (message.oProtos) { - obj.o_protos = message.oProtos.map(e => e ? AccessConfig.toAmino(e) : undefined); - } else { - obj.o_protos = message.oProtos; - } - if (message.auths) { - obj.auths = message.auths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.auths = message.auths; - } - if (message.oAuths) { - obj.o_auths = message.oAuths.map(e => e ? Any.toAmino(e) : undefined); - } else { - obj.o_auths = message.oAuths; - } - return obj; - }, - fromAminoMsg(object: AminoEncodingTestForOmitAminoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.fromAmino(object.value); - }, - fromProtoMsg(message: AminoEncodingTestForOmitProtoMsg): AminoEncodingTestForOmit { - return AminoEncodingTestForOmit.decode(message.value); - }, - toProto(message: AminoEncodingTestForOmit): Uint8Array { - return AminoEncodingTestForOmit.encode(message).finish(); - }, - toProtoMsg(message: AminoEncodingTestForOmit): AminoEncodingTestForOmitProtoMsg { - return { - typeUrl: "/misc.AminoEncodingTestForOmit", - value: AminoEncodingTestForOmit.encode(message).finish() - }; - } -}; \ No newline at end of file diff --git a/__fixtures__/misc/output/misc/bundle.ts b/__fixtures__/misc/output/misc/bundle.ts index d8bac32982..5f27aea44c 100644 --- a/__fixtures__/misc/output/misc/bundle.ts +++ b/__fixtures__/misc/output/misc/bundle.ts @@ -1,11 +1,10 @@ import * as _6 from "./all_fields"; -import * as _7 from "./amino_fields"; -import * as _8 from "./eval_request"; -import * as _9 from "./tx"; -import * as _10 from "./tx.amino"; -import * as _11 from "./tx.registry"; -import * as _12 from "./tx.rpc.msg"; -import * as _13 from "./rpc.tx"; +import * as _7 from "./eval_request"; +import * as _8 from "./tx"; +import * as _9 from "./tx.amino"; +import * as _10 from "./tx.registry"; +import * as _11 from "./tx.rpc.msg"; +import * as _12 from "./rpc.tx"; export const misc = { ..._6, ..._7, @@ -13,8 +12,7 @@ export const misc = { ..._9, ..._10, ..._11, - ..._12, ClientFactory: { - ..._13 + ..._12 } }; \ No newline at end of file diff --git a/__fixtures__/misc/proto/misc/all_fields.proto b/__fixtures__/misc/proto/misc/all_fields.proto index e0db0417a4..999359ffee 100644 --- a/__fixtures__/misc/proto/misc/all_fields.proto +++ b/__fixtures__/misc/proto/misc/all_fields.proto @@ -3,8 +3,8 @@ syntax = "proto3"; package misc; import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; import "misc/eval_request.proto"; message EncodingTestForDontOmit { @@ -57,9 +57,7 @@ message EncodingTestForDontOmit { ]; // raw bytes - bytes raw = 15 [ - (gogoproto.casttype) = "RawContractMessage" - ]; + bytes raw = 15 [(gogoproto.casttype) = "RawContractMessage"]; bytes d_o_raw = 16 [ (gogoproto.casttype) = "RawContractMessage", (gogoproto.nullable) = false, @@ -67,9 +65,7 @@ message EncodingTestForDontOmit { ]; // wasm bytes - bytes wasm = 17 [ - (gogoproto.customname) = "WASMByteCode" - ]; + bytes wasm = 17 [(gogoproto.customname) = "WASMByteCode"]; bytes d_o_wasm = 18 [ (gogoproto.customname) = "WASMByteCode", (gogoproto.nullable) = false, @@ -127,9 +123,7 @@ message EncodingTestForDontOmit { ]; // array raw bytes - repeated bytes raws = 33 [ - (gogoproto.casttype) = "RawContractMessage" - ]; + repeated bytes raws = 33 [(gogoproto.casttype) = "RawContractMessage"]; repeated bytes d_o_raws = 34 [ (gogoproto.casttype) = "RawContractMessage", (gogoproto.nullable) = false, @@ -137,9 +131,7 @@ message EncodingTestForDontOmit { ]; // array wasm bytes - repeated bytes wasms = 35 [ - (gogoproto.customname) = "WASMByteCode" - ]; + repeated bytes wasms = 35 [(gogoproto.customname) = "WASMByteCode"]; repeated bytes d_o_wasms = 36 [ (gogoproto.customname) = "WASMByteCode", (gogoproto.nullable) = false, @@ -202,155 +194,165 @@ message EncodingTestForDontOmit { message EncodingTestForOmit { // scalar - string str = 1; + string str = 1 [(gogoproto.jsontag) = "str"]; string o_str = 2 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_str,omitempty" + (gogoproto.jsontag) = "o_str,omitempty" ]; - bool b = 3; + bool b = 3 [(gogoproto.jsontag) = "b"]; bool o_b = 4 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_b,omitempty" + (gogoproto.jsontag) = "o_b,omitempty" ]; - int32 num = 5; + int32 num = 5 [(gogoproto.jsontag) = "num"]; int32 o_num = 6 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_num,omitempty" + (gogoproto.jsontag) = "o_num,omitempty" ]; // bigint - int64 big = 7; + int64 big = 7 [(gogoproto.jsontag) = "big"]; int64 o_big = 8 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_big,omitempty" + (gogoproto.jsontag) = "o_big,omitempty" ]; // protoType - AccessConfig proto = 9; + AccessConfig proto = 9 [(gogoproto.jsontag) = "proto"]; AccessConfig o_proto = 10 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_proto,omitempty" + (gogoproto.jsontag) = "o_proto,omitempty" ]; // anyType - google.protobuf.Any auth = 11 [(cosmos_proto.accepts_interface) = "Authorization"]; + google.protobuf.Any auth = 11 [ + (cosmos_proto.accepts_interface) = "Authorization", + (gogoproto.jsontag) = "auth" + ]; google.protobuf.Any o_auth = 12 [ (cosmos_proto.accepts_interface) = "Authorization", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_auth,omitempty" + (gogoproto.jsontag) = "o_auth,omitempty" ]; // bytes - bytes salt = 13; + bytes salt = 13 [(gogoproto.jsontag) = "salt"]; bytes o_salt = 14 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_salt,omitempty" + (gogoproto.jsontag) = "o_salt,omitempty" ]; // raw bytes bytes raw = 15 [ - (gogoproto.casttype) = "RawContractMessage" + (gogoproto.casttype) = "RawContractMessage", + (gogoproto.jsontag) = "raw" ]; bytes o_raw = 16 [ (gogoproto.casttype) = "RawContractMessage", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_raw,omitempty" + (gogoproto.jsontag) = "o_raw,omitempty" ]; // wasm bytes bytes wasm = 17 [ - (gogoproto.customname) = "WASMByteCode" + (gogoproto.customname) = "WASMByteCode", + (gogoproto.jsontag) = "wasm" ]; bytes o_wasm = 18 [ (gogoproto.customname) = "WASMByteCode", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_wasm,omitempty" + (gogoproto.jsontag) = "o_wasm,omitempty" ]; // enum - VoteOption opt = 19; + VoteOption opt = 19 [(gogoproto.jsontag) = "opt"]; VoteOption o_opt = 20 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_opt,omitempty" + (gogoproto.jsontag) = "o_opt,omitempty" ]; // duration - google.protobuf.Duration period = 21; + google.protobuf.Duration period = 21 [(gogoproto.jsontag) = "period"]; google.protobuf.Duration o_period = 22 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_period,omitempty" + (gogoproto.jsontag) = "o_period,omitempty" ]; // timestamp - google.protobuf.Timestamp date = 23; + google.protobuf.Timestamp date = 23 [(gogoproto.jsontag) = "date"]; google.protobuf.Timestamp o_date = 24 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_date,omitempty" + (gogoproto.jsontag) = "o_date,omitempty" ]; // pubkey - google.protobuf.Any pubkey = 25 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; + google.protobuf.Any pubkey = 25 [ + (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", + (gogoproto.jsontag) = "pubkey" + ]; google.protobuf.Any o_pubkey = 26 [ (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_pubkey,omitempty" + (gogoproto.jsontag) = "o_pubkey,omitempty" ]; // array scalar - repeated int32 nums = 27; + repeated int32 nums = 27 [(gogoproto.jsontag) = "nums"]; repeated int32 o_nums = 28 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_nums,omitempty" + (gogoproto.jsontag) = "o_nums,omitempty" ]; // array bigint - repeated int64 bigs = 29; + repeated int64 bigs = 29 [(gogoproto.jsontag) = "bigs"]; repeated int64 o_bigs = 30 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_bigs,omitempty" + (gogoproto.jsontag) = "o_bigs,omitempty" ]; // array bytes - repeated bytes salts = 31; + repeated bytes salts = 31 [(gogoproto.jsontag) = "salts"]; repeated bytes o_salts = 32 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_salts,omitempty" + (gogoproto.jsontag) = "o_salts,omitempty" ]; // array raw bytes repeated bytes raws = 33 [ - (gogoproto.casttype) = "RawContractMessage" + (gogoproto.casttype) = "RawContractMessage", + (gogoproto.jsontag) = "raws" ]; repeated bytes o_raws = 34 [ (gogoproto.casttype) = "RawContractMessage", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_raws,omitempty" + (gogoproto.jsontag) = "o_raws,omitempty" ]; // array wasm bytes repeated bytes wasms = 35 [ - (gogoproto.customname) = "WASMByteCode" + (gogoproto.customname) = "WASMByteCode", + (gogoproto.jsontag) = "wasms" ]; repeated bytes o_wasms = 36 [ (gogoproto.customname) = "WASMByteCode", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_wasms,omitempty" + (gogoproto.jsontag) = "o_wasms,omitempty" ]; // array enum - repeated VoteOption opts = 37; + repeated VoteOption opts = 37 [(gogoproto.jsontag) = "opts"]; repeated VoteOption o_opts = 38 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_opts,omitempty" + (gogoproto.jsontag) = "o_opts,omitempty" ]; // array duration - repeated google.protobuf.Duration periods = 39; + repeated google.protobuf.Duration periods = 39 [(gogoproto.jsontag) = "periods"]; repeated google.protobuf.Duration o_periods = 40 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_periods,omitempty" + (gogoproto.jsontag) = "o_periods,omitempty" ]; // array timestamp @@ -362,33 +364,42 @@ message EncodingTestForOmit { // ]; // array protoType - repeated AccessConfig protos = 43; + repeated AccessConfig protos = 43 [(gogoproto.jsontag) = "protos"]; repeated AccessConfig o_protos = 44 [ (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_protos,omitempty" + (gogoproto.jsontag) = "o_protos,omitempty" ]; // array anyType - repeated google.protobuf.Any auths = 45 [(cosmos_proto.accepts_interface) = "Authorization"]; + repeated google.protobuf.Any auths = 45 [ + (cosmos_proto.accepts_interface) = "Authorization", + (gogoproto.jsontag) = "auths" + ]; repeated google.protobuf.Any o_auths = 46 [ (cosmos_proto.accepts_interface) = "Authorization", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_auths,omitempty" + (gogoproto.jsontag) = "o_auths,omitempty" ]; // dec - string dec = 47 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + string dec = 47 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.jsontag) = "dec" + ]; string o_dec = 48 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_dec,omitempty" + (gogoproto.jsontag) = "o_dec,omitempty" ]; // array dec - repeated string decs = 49 [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec"]; + repeated string decs = 49 [ + (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.jsontag) = "decs" + ]; repeated string o_decs = 50 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_decs,omitempty" + (gogoproto.jsontag) = "o_decs,omitempty" ]; -} \ No newline at end of file +} diff --git a/__fixtures__/misc/proto/misc/amino_fields.proto b/__fixtures__/misc/proto/misc/amino_fields.proto deleted file mode 100644 index e7230a4947..0000000000 --- a/__fixtures__/misc/proto/misc/amino_fields.proto +++ /dev/null @@ -1,362 +0,0 @@ -syntax = "proto3"; - -package misc; - -import "google/protobuf/any.proto"; -import "google/protobuf/timestamp.proto"; -import "google/protobuf/duration.proto"; -import "misc/eval_request.proto"; - -message AminoEncodingTestForDontOmit { - // scalar - string str = 1; - string d_o_str = 2 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - bool b = 3; - bool d_o_b = 4 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - int32 num = 5; - int32 d_o_num = 6 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // bigint - int64 big = 7; - int64 d_o_big = 8 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // protoType - AccessConfig proto = 9; - AccessConfig d_o_proto = 10 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // anyType - google.protobuf.Any auth = 11 [(cosmos_proto.accepts_interface) = "Authorization"]; - google.protobuf.Any d_o_auth = 12 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (cosmos_proto.accepts_interface) = "Authorization" - ]; - - // bytes - bytes salt = 13; - bytes d_o_salt = 14 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // raw bytes - bytes raw = 15 [ - (gogoproto.casttype) = "RawContractMessage" - ]; - bytes d_o_raw = 16 [ - (gogoproto.casttype) = "RawContractMessage", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // wasm bytes - bytes wasm = 17 [ - (gogoproto.customname) = "WASMByteCode" - ]; - bytes d_o_wasm = 18 [ - (gogoproto.customname) = "WASMByteCode", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // enum - VoteOption opt = 19; - VoteOption d_o_opt = 20 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // duration - google.protobuf.Duration period = 21; - google.protobuf.Duration d_o_period = 22 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // timestamp - google.protobuf.Timestamp date = 23; - google.protobuf.Timestamp d_o_date = 24 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // pubkey - google.protobuf.Any pubkey = 25 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; - google.protobuf.Any d_o_pubkey = 26 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey" - ]; - - // array scalar - repeated int32 nums = 27; - repeated int32 d_o_nums = 28 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array bigint - repeated int64 bigs = 29; - repeated int64 d_o_bigs = 30 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array bytes - repeated bytes salts = 31; - repeated bytes d_o_salts = 32 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array raw bytes - repeated bytes raws = 33 [ - (gogoproto.casttype) = "RawContractMessage" - ]; - repeated bytes d_o_raws = 34 [ - (gogoproto.casttype) = "RawContractMessage", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array wasm bytes - repeated bytes wasms = 35 [ - (gogoproto.customname) = "WASMByteCode" - ]; - repeated bytes d_o_wasms = 36 [ - (gogoproto.customname) = "WASMByteCode", - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array enum - repeated VoteOption opts = 37; - repeated VoteOption d_o_opts = 38 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array duration - repeated google.protobuf.Duration periods = 39; - repeated google.protobuf.Duration d_o_periods = 40 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array timestamp - // TODO:: need to debug - // repeated google.protobuf.Timestamp dates = 41; - // repeated google.protobuf.Timestamp d_o_dates = 42 [ - // (gogoproto.nullable) = false, - // (amino.dont_omitempty) = true - // ]; - - // array protoType - repeated AccessConfig protos = 43; - repeated AccessConfig d_o_protos = 44 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // array anyType - repeated google.protobuf.Any auths = 45 [(cosmos_proto.accepts_interface) = "Authorization"]; - repeated google.protobuf.Any d_o_auths = 46 [ - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true, - (cosmos_proto.accepts_interface) = "Authorization" - ]; -} - -message AminoEncodingTestForOmit { - // scalar - string str = 1; - string o_str = 2 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_str,omitempty" - ]; - - bool b = 3; - bool o_b = 4 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_b,omitempty" - ]; - - int32 num = 5; - int32 o_num = 6 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_num,omitempty" - ]; - - // bigint - int64 big = 7; - int64 o_big = 8 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_big,omitempty" - ]; - - // protoType - AccessConfig proto = 9; - AccessConfig o_proto = 10 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_proto,omitempty" - ]; - - // anyType - google.protobuf.Any auth = 11 [(cosmos_proto.accepts_interface) = "Authorization"]; - google.protobuf.Any o_auth = 12 [ - (cosmos_proto.accepts_interface) = "Authorization", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_auth,omitempty" - ]; - - // bytes - bytes salt = 13; - bytes o_salt = 14 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_salt,omitempty" - ]; - - // raw bytes - bytes raw = 15 [ - (gogoproto.casttype) = "RawContractMessage" - ]; - bytes o_raw = 16 [ - (gogoproto.casttype) = "RawContractMessage", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_raw,omitempty" - ]; - - // wasm bytes - bytes wasm = 17 [ - (gogoproto.customname) = "WASMByteCode" - ]; - bytes o_wasm = 18 [ - (gogoproto.customname) = "WASMByteCode", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_wasm,omitempty" - ]; - - // enum - VoteOption opt = 19; - VoteOption o_opt = 20 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_opt,omitempty" - ]; - - // duration - google.protobuf.Duration period = 21; - google.protobuf.Duration o_period = 22 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_period,omitempty" - ]; - - // timestamp - google.protobuf.Timestamp date = 23; - google.protobuf.Timestamp o_date = 24 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_date,omitempty" - ]; - - // pubkey - google.protobuf.Any pubkey = 25 [(cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey"]; - google.protobuf.Any o_pubkey = 26 [ - (cosmos_proto.accepts_interface) = "cosmos.crypto.PubKey", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_pubkey,omitempty" - ]; - - // array scalar - repeated int32 nums = 27; - repeated int32 o_nums = 28 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_nums,omitempty" - ]; - - // array bigint - repeated int64 bigs = 29; - repeated int64 o_bigs = 30 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_bigs,omitempty" - ]; - - // array bytes - repeated bytes salts = 31; - repeated bytes o_salts = 32 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_salts,omitempty" - ]; - - // array raw bytes - repeated bytes raws = 33 [ - (gogoproto.casttype) = "RawContractMessage" - ]; - repeated bytes o_raws = 34 [ - (gogoproto.casttype) = "RawContractMessage", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_raws,omitempty" - ]; - - // array wasm bytes - repeated bytes wasms = 35 [ - (gogoproto.customname) = "WASMByteCode" - ]; - repeated bytes o_wasms = 36 [ - (gogoproto.customname) = "WASMByteCode", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_wasms,omitempty" - ]; - - // array enum - repeated VoteOption opts = 37; - repeated VoteOption o_opts = 38 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_opts,omitempty" - ]; - - // array duration - repeated google.protobuf.Duration periods = 39; - repeated google.protobuf.Duration o_periods = 40 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_periods,omitempty" - ]; - - // array timestamp - // TODO:: need to debug - // repeated google.protobuf.Timestamp dates = 41; - // repeated google.protobuf.Timestamp o_dates = 42 [ - // (gogoproto.nullable) = false, - // (gogoproto.jsontag) = "o_dates,omitempty" - // ]; - - // array protoType - repeated AccessConfig protos = 43; - repeated AccessConfig o_protos = 44 [ - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_protos,omitempty" - ]; - - // array anyType - repeated google.protobuf.Any auths = 45 [(cosmos_proto.accepts_interface) = "Authorization"]; - repeated google.protobuf.Any o_auths = 46 [ - (cosmos_proto.accepts_interface) = "Authorization", - (gogoproto.nullable) = false, - (gogoproto.jsontag) = "o_auths,omitempty" - ]; -} \ No newline at end of file diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts index 447d3f8556..c1e8cf5e25 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/attribute.ts @@ -392,7 +392,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts index 2e5716a6cb..c640281aef 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta1/resource.ts @@ -286,7 +286,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -409,7 +409,7 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts index 193b3ae103..ecb63a9eb4 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/attribute.ts @@ -392,7 +392,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts index 19df53bad2..89353bc2fd 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/base/v1beta2/resource.ts @@ -263,7 +263,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -403,7 +403,7 @@ export const Storage = { toAmino(message: Storage): StorageAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts index bfb3981741..ef849758bf 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.ts @@ -772,7 +772,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.toAmino(CertificateID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts index 3cb6a37102..5d914a929b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/genesis.ts @@ -116,7 +116,7 @@ export const GenesisCertificate = { toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; obj.owner = message.owner ?? ""; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts index c3cd752c70..17d1f5c3b1 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/query.ts @@ -132,7 +132,7 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); obj.serial = message.serial ?? ""; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts index 136c503512..7c7934f29f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts index 5646d8b982..a27fac0ffe 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/deployment.ts @@ -314,14 +314,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -509,8 +509,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -718,7 +718,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { @@ -894,7 +894,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1227,10 +1227,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts index 21ac8f466c..e4342465b7 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/genesis.ts @@ -125,7 +125,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts index 18926deffa..77bd5bab7d 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/group.ts @@ -256,7 +256,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -426,7 +426,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -596,7 +596,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -935,7 +935,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { @@ -1088,10 +1088,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1221,9 +1221,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); + obj.price = message.price ? Coin.toAmino(message.price) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts index 54dd585a27..ce3bc32ff9 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts index 85d4cab9da..495784b205 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta1/query.ts @@ -531,7 +531,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts index 0174ebbd77..2fa97819d2 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts index ede028f38f..2a9ba1f985 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deployment.ts @@ -324,10 +324,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts index 6f620bcc9e..c166c25279 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/deploymentmsg.ts @@ -243,14 +243,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -455,8 +455,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -643,7 +643,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, @@ -814,7 +814,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts index 7853419e04..5e8fb1bcff 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/genesis.ts @@ -125,7 +125,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts index 3d95c54aa7..062e1029ca 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/group.ts @@ -199,10 +199,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts index 1df98da044..cdc733348e 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupmsg.ts @@ -133,7 +133,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -303,7 +303,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -473,7 +473,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts index 88ade8bf5a..2fa61a4718 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/groupspec.ts @@ -129,7 +129,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts index 65b3ab2e8d..e8dc65f255 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts index 1e1a51a14f..685288ea85 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/query.ts @@ -531,7 +531,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts index 3ad5531a6f..a274baf4d2 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/resource.ts @@ -124,9 +124,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts index a6a3f865f3..9a8c14a44f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta1/types.ts @@ -432,11 +432,11 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.toAmino(Coin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, @@ -635,13 +635,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.toAmino(Coin.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts index a007accce1..060c1be323 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/escrow/v1beta2/types.ts @@ -479,14 +479,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.toAmino(DecCoin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; obj.depositor = message.depositor ?? ""; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -684,13 +684,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts index c1830d787a..b91bdb499a 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/inflation/v1beta2/genesis.ts @@ -85,7 +85,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts index 4d7f7d6e7c..167485e3e3 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/bid.ts @@ -293,10 +293,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.toAmino(OrderID.fromPartial({})); obj.provider = message.provider ?? ""; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -466,7 +466,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -852,10 +852,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts index 83cac6aee6..8e9edf33e0 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/genesis.ts @@ -145,7 +145,7 @@ export const GenesisState = { } else { obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts index da39230d92..88f34d516b 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/lease.ts @@ -478,11 +478,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn !== BigInt(0) ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -759,7 +759,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -929,7 +929,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1099,7 +1099,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts index 9e91c39142..7ed65f9cde 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/order.ts @@ -376,10 +376,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.toAmino(OrderID.fromPartial({})); obj.state = message.state ?? 0; - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts index eaf1756342..283be606bd 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/market/v1beta2/params.ts @@ -103,7 +103,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.toAmino(Coin.fromPartial({})); obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts index 86ade67186..ee65d646fa 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta1/provider.ts @@ -349,7 +349,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -580,7 +580,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -979,7 +979,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts index c3ebfde66f..4ecc7b636f 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/provider/v1beta2/provider.ts @@ -349,7 +349,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -580,7 +580,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -979,7 +979,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts index a2e543f322..0c6cdcd43d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/auth/v1beta1/auth.ts @@ -189,8 +189,8 @@ export const BaseAccount = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -498,11 +498,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts index 17bb26fd6f..c56f04653d 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/abci/v1beta1/abci.ts @@ -563,7 +563,7 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.txhash = message.txhash === "" ? undefined : message.txhash; obj.codespace = message.codespace === "" ? undefined : message.codespace; obj.code = message.code === 0 ? undefined : message.code; @@ -575,8 +575,8 @@ export const TxResponse = { obj.logs = message.logs; } obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { @@ -1067,8 +1067,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1780,11 +1780,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts index 7a03f47a54..c8852c94c9 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/query/v1beta1/pagination.ts @@ -239,8 +239,8 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; obj.count_total = message.countTotal === false ? undefined : message.countTotal; obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; @@ -355,7 +355,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts index 6a2bfd1322..cf4ec701d6 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -277,7 +277,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; @@ -816,7 +816,7 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.height = message.height === 0 ? undefined : message.height; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts index 189b44abe3..41b0949aaa 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/store/v1beta1/commit_info.ts @@ -154,7 +154,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -384,7 +384,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts index 5ce8b2c682..e27447c1b3 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/base/tendermint/v1beta1/query.ts @@ -311,7 +311,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -448,7 +448,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -686,7 +686,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -842,8 +842,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -939,7 +939,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts index 560e36c210..6b7d06d10b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/capability.ts @@ -128,7 +128,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts index babd51f927..9d53937e94 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/capability/v1beta1/genesis.ts @@ -126,7 +126,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -245,7 +245,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts index a15594fad5..5313c8c869 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/distribution.ts @@ -633,7 +633,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = message.rewards; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -953,7 +953,7 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; obj.fraction = message.fraction === "" ? undefined : message.fraction; return obj; }, @@ -1447,7 +1447,7 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; obj.stake = message.stake === "" ? undefined : message.stake; obj.height = message.height ? message.height.toString() : "0"; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts index 770aac4ff1..eccbb020af 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/genesis.ts @@ -638,7 +638,7 @@ export const ValidatorHistoricalRewardsRecord = { toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -1031,8 +1031,8 @@ export const ValidatorSlashEventRecord = { toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts index 09b6b4786c..b86c0725a9 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/distribution/v1beta1/query.ts @@ -1015,8 +1015,8 @@ export const QueryValidatorSlashesRequest = { toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts index 177cc55a60..fd98bae28c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/evidence/v1beta1/evidence.ts @@ -147,9 +147,9 @@ export const Equivocation = { }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts index ca340c46b4..0d917dde42 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/genesis.ts @@ -224,7 +224,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts index 2d1a4fad72..b308c32d54 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/gov.ts @@ -529,7 +529,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -789,7 +789,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1101,7 +1101,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts index d62ff97658..ff094623c0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/query.ts @@ -324,7 +324,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -802,7 +802,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1013,7 +1013,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1477,7 +1477,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1688,7 +1688,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1908,7 +1908,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts index e373ff2c21..ce4992c22c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.ts @@ -383,7 +383,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts index 86d0f07abe..b3be36ca4f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/genesis.ts @@ -224,7 +224,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts index c2ecd2a63c..8f979c59c0 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/gov.ts @@ -673,7 +673,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -913,7 +913,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts index 9424d83417..6d6b571cb7 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/query.ts @@ -324,7 +324,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -802,7 +802,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1013,7 +1013,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1477,7 +1477,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1688,7 +1688,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1908,7 +1908,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts index c51f6d9e71..9e2119fe97 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.ts @@ -465,7 +465,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts index dcea2fb135..ebcd8c38bd 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/events.ts @@ -196,7 +196,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -292,7 +292,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -576,7 +576,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -672,7 +672,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -768,7 +768,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -880,7 +880,7 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.result = message.result === 0 ? undefined : message.result; return obj; }, @@ -993,7 +993,7 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts index 8f63f57201..c6880bfa8a 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/genesis.ts @@ -262,7 +262,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -273,13 +273,13 @@ export const GenesisState = { } else { obj.group_members = message.groupMembers; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = message.groupPolicies; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts index e28bd59ec0..7b2e5f6f33 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/query.ts @@ -463,7 +463,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -863,7 +863,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1337,7 +1337,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1793,7 +1793,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2237,7 +2237,7 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -2448,7 +2448,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3140,7 +3140,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts index 9978c185d0..50c88e1588 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.ts @@ -683,7 +683,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -818,7 +818,7 @@ export const MsgUpdateGroupMembers = { toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1026,7 +1026,7 @@ export const MsgUpdateGroupAdmin = { toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, @@ -1230,7 +1230,7 @@ export const MsgUpdateGroupMetadata = { toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, @@ -1452,7 +1452,7 @@ export const MsgCreateGroupPolicy = { toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; @@ -1979,7 +1979,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, @@ -2738,7 +2738,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2850,7 +2850,7 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -3085,7 +3085,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; @@ -3275,7 +3275,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -3463,7 +3463,7 @@ export const MsgLeaveGroup = { toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts index 0f7746a3b5..276eed1f6f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/types.ts @@ -1269,10 +1269,10 @@ export const GroupInfo = { }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1388,7 +1388,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1586,10 +1586,10 @@ export const GroupPolicyInfo = { toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1897,7 +1897,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { @@ -1906,8 +1906,8 @@ export const Proposal = { obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; @@ -2222,7 +2222,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts index ed88b30692..369098833b 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/mint/v1beta1/mint.ts @@ -313,7 +313,7 @@ export const Params = { obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts index 31c7ee24a1..f871471cd2 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/nft/v1beta1/query.ts @@ -368,7 +368,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -763,7 +763,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts index ade24fdab1..c5a03f1532 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/genesis.ts @@ -552,7 +552,7 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.missed = message.missed === false ? undefined : message.missed; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts index a82bd224c5..e1f9756e10 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/slashing/v1beta1/slashing.ts @@ -222,11 +222,11 @@ export const ValidatorSigningInfo = { toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.start_height = message.startHeight !== BigInt(0) ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset !== BigInt(0) ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.missed_blocks_counter = message.missedBlocksCounter !== BigInt(0) ? message.missedBlocksCounter.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -388,7 +388,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = message.signedBlocksWindow !== BigInt(0) ? message.signedBlocksWindow.toString() : undefined; obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts index 7f2b0792a3..0c34e2d307 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/genesis.ts @@ -410,7 +410,7 @@ export const LastValidatorPower = { toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts index cf5479ff8b..8949ac7d7c 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/query.ts @@ -3086,7 +3086,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts index b93573ca8f..a9f39d7534 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/staking/v1beta1/staking.ts @@ -1297,7 +1297,7 @@ export const Validator = { obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -2261,7 +2261,7 @@ export const UnbondingDelegationEntry = { }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; @@ -2408,7 +2408,7 @@ export const RedelegationEntry = { }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts index f014120f56..d6f2bf58bb 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/signing/v1beta1/signing.ts @@ -393,7 +393,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts index 854df5e397..4c39105a05 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/service.ts @@ -1358,7 +1358,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts index b0bbbeddf4..94569400d1 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/tx/v1beta1/tx.ts @@ -842,7 +842,7 @@ export const SignDoc = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1027,8 +1027,8 @@ export const SignDocDirectAux = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1213,7 +1213,7 @@ export const TxBody = { obj.messages = message.messages; } obj.memo = message.memo === "" ? undefined : message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1499,7 +1499,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1986,7 +1986,7 @@ export const Fee = { } else { obj.amount = message.amount; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; obj.payer = message.payer === "" ? undefined : message.payer; obj.granter = message.granter === "" ? undefined : message.granter; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts index d4742ee7d4..3802cccd71 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/query.ts @@ -539,7 +539,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -635,7 +635,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts index f7c0520f77..c77b4f802f 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/upgrade/v1beta1/upgrade.ts @@ -271,7 +271,7 @@ export const Plan = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -627,7 +627,7 @@ export const ModuleVersion = { toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts index 23ff1b99de..5d51a93a48 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/tx.ts @@ -253,7 +253,7 @@ export const MsgCreateVestingAccount = { } else { obj.amount = message.amount; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, @@ -692,7 +692,7 @@ export const MsgCreatePeriodicVestingAccount = { const obj: any = {}; obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; obj.to_address = message.toAddress === "" ? undefined : message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts index d46fa33da4..a08a48b3fd 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/vesting/v1beta1/vesting.ts @@ -300,7 +300,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -415,7 +415,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -629,7 +629,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -771,7 +771,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts index a0cf4fa807..81f21b3f15 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/genesis.ts @@ -553,7 +553,7 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; obj.pinned = message.pinned === false ? undefined : message.pinned; @@ -809,7 +809,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts index 8e7cd6c134..e9ac988fc2 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/ibc.ts @@ -166,8 +166,8 @@ export const MsgIBCSend = { toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; obj.channel = message.channel === "" ? undefined : message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts index 5026591c1b..f3f216feba 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/proposal.ts @@ -604,7 +604,7 @@ export const InstantiateContractProposal = { obj.description = message.description === "" ? undefined : message.description; obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -774,7 +774,7 @@ export const MigrateContractProposal = { obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts index eb38798ea0..922d121679 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/query.ts @@ -900,7 +900,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1766,7 +1766,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts index 4659919c1e..a4fcbdb309 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/tx.ts @@ -414,7 +414,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -598,7 +598,7 @@ export const MsgInstantiateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -1111,7 +1111,7 @@ export const MsgMigrateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts index 8eef86ad3d..04502688af 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmwasm/wasm/v1/types.ts @@ -570,7 +570,7 @@ export const Params = { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.max_wasm_code_size = message.maxWasmCodeSize !== BigInt(0) ? message.maxWasmCodeSize.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -896,7 +896,7 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.creator = message.creator === "" ? undefined : message.creator; obj.admin = message.admin === "" ? undefined : message.admin; obj.label = message.label === "" ? undefined : message.label; @@ -1049,7 +1049,7 @@ export const ContractCodeHistoryEntry = { toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; obj.operation = message.operation === 0 ? undefined : message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1165,8 +1165,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts index 7ce1b4da96..7266b7325e 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/genesis.ts @@ -211,10 +211,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts index 96bb2a0e58..259c230ef8 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/epochs/v1/query.ts @@ -411,7 +411,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts index af6cebf85f..81003cf27c 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/fees/v1/genesis.ts @@ -308,7 +308,7 @@ export const Params = { obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate.toString() : undefined; obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts index 397ec5baa2..7424e30ede 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/incentives.ts @@ -246,7 +246,7 @@ export const Incentive = { } obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = message.totalGas !== BigInt(0) ? message.totalGas.toString() : undefined; return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -370,7 +370,7 @@ export const GasMeter = { const obj: any = {}; obj.contract = message.contract === "" ? undefined : message.contract; obj.participant = message.participant === "" ? undefined : message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.cumulative_gas = message.cumulativeGas !== BigInt(0) ? message.cumulativeGas.toString() : undefined; return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts index 0e03fbe393..9858d8ae82 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/incentives/v1/query.ts @@ -1045,7 +1045,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = message.gasMeter !== BigInt(0) ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts index 2390374c0a..12c5cc94f0 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/genesis.ts @@ -191,10 +191,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.epochs_per_period = message.epochsPerPeriod !== BigInt(0) ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts index 1dbbea2864..9b13bfcea1 100644 --- a/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/evmos/inflation/v1/query.ts @@ -317,7 +317,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -633,7 +633,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts b/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts index 50c81443a3..0967ffbaaf 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/distribution.ts @@ -523,7 +523,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts index 6a5142fdc6..fcf3d0737c 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -1271,7 +1271,7 @@ export const IssueDetails = { const obj: any = {}; obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts index 4a275bcb18..1bb1e2eb2d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/checked.ts @@ -663,7 +663,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -765,7 +765,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts index 7578b2cf10..6a6f5d581d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/eval.ts @@ -365,8 +365,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = message.expr !== BigInt(0) ? message.expr.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts index fb9adcfcc5..d803047c0d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/explain.ts @@ -265,7 +265,7 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts index 8707c2b3cd..801b92b798 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/syntax.ts @@ -842,7 +842,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1550,7 +1550,7 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; @@ -1981,8 +1981,8 @@ export const Constant = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -2092,7 +2092,7 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value === 0 ? undefined : message.value; return obj; }, @@ -2194,7 +2194,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts index a2a4461fbe..f7387d7dc3 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1alpha1/value.ts @@ -410,8 +410,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts index 558ab489b3..d461fbe243 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/expr.ts @@ -1830,8 +1830,8 @@ export const Literal = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts index 9b332a9930..5de8bc247e 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/expr/v1beta1/value.ts @@ -410,8 +410,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts b/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts index 750cfdfbd4..62d8ed3331 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/quota.ts @@ -513,7 +513,7 @@ export const MetricRule_MetricCostsEntry = { toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -766,7 +766,7 @@ export const QuotaLimit_ValuesEntry = { toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1043,9 +1043,9 @@ export const QuotaLimit = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.description = message.description === "" ? undefined : message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit !== BigInt(0) ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier !== BigInt(0) ? message.freeTier.toString() : undefined; obj.duration = message.duration === "" ? undefined : message.duration; obj.metric = message.metric === "" ? undefined : message.metric; obj.unit = message.unit === "" ? undefined : message.unit; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts index 14f84eed08..2d585a36c2 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/distribution.ts @@ -416,7 +416,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.minimum = message.minimum === 0 ? undefined : message.minimum; obj.maximum = message.maximum === 0 ? undefined : message.maximum; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts index 6908f69686..62ddb90d53 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/http_request.ts @@ -408,9 +408,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -419,7 +419,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts index 4fdb683fb5..3217d86cfe 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/log_entry.ts @@ -851,7 +851,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts index 53dc5f8432..47d8c3ac9d 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/metric_value.ts @@ -429,7 +429,7 @@ export const MetricValue = { obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts index 0b5467322d..cba968e113 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/servicecontrol/v1/service_controller.ts @@ -806,9 +806,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; + obj.project_number = message.projectNumber !== BigInt(0) ? message.projectNumber.toString() : undefined; obj.type = message.type === 0 ? undefined : message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.consumer_number = message.consumerNumber !== BigInt(0) ? message.consumerNumber.toString() : undefined; return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts index d4583eb019..c772a7d927 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/api/serviceusage/v1beta1/resources.ts @@ -1860,8 +1860,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = message.effectiveLimit !== BigInt(0) ? message.effectiveLimit.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2182,7 +2182,7 @@ export const QuotaOverride = { toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.override_value = message.overrideValue !== BigInt(0) ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { @@ -2601,7 +2601,7 @@ export const AdminQuotaPolicy = { toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.policy_value = message.policyValue !== BigInt(0) ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts index 073190bdac..0a812f230f 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/type/http_request.ts @@ -410,9 +410,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -421,7 +421,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts index 30e86d2510..8d788c0a02 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/log_entry.ts @@ -1064,7 +1064,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts index 9cb168f8c8..c69b11ff68 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/logging/v2/logging_config.ts @@ -6529,7 +6529,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = message.logEntriesCopiedCount !== BigInt(0) ? message.logEntriesCopiedCount.toString() : undefined; return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts index c3f1203ab9..0e1d99dacf 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/descriptor.ts @@ -5154,8 +5154,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts index 814ea49c4c..e22e95be06 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/protobuf/wrappers.ts @@ -437,7 +437,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -527,7 +527,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { diff --git a/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts index 0165405e0a..4ec47edc48 100644 --- a/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputinstantrpc/google/rpc/context/attribute_context.ts @@ -1085,7 +1085,7 @@ export const AttributeContext_Peer = { toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; obj.ip = message.ip === "" ? undefined : message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.port = message.port !== BigInt(0) ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -1832,7 +1832,7 @@ export const AttributeContext_Request = { obj.scheme = message.scheme === "" ? undefined : message.scheme; obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; @@ -2134,8 +2134,8 @@ export const AttributeContext_Response = { }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = message.code !== BigInt(0) ? message.code.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts index a833616377..cef091965d 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/applications/transfer/v1/tx.ts @@ -233,7 +233,7 @@ export const MsgTransfer = { obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts index 8a19cbb071..02430de508 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/channel.ts @@ -982,14 +982,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1135,7 +1135,7 @@ export const PacketState = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts index 229991d01f..c91ee16cc9 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/genesis.ts @@ -311,7 +311,7 @@ export const GenesisState = { } else { obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -441,7 +441,7 @@ export const PacketSequence = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts index 7326d28aaa..4f7af83913 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/query.ts @@ -1730,8 +1730,8 @@ export const QueryChannelConsensusStateRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -2010,7 +2010,7 @@ export const QueryPacketCommitmentRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2542,7 +2542,7 @@ export const QueryPacketReceiptRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2802,7 +2802,7 @@ export const QueryPacketAcknowledgementRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -4039,7 +4039,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts index 78b3c99694..b9be74e602 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.ts @@ -2128,7 +2128,7 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2387,7 +2387,7 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts index ab02de0478..a6e02d50d0 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/client.ts @@ -915,8 +915,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts index 52eff4f978..d78d54a3fd 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/genesis.ts @@ -259,7 +259,7 @@ export const GenesisState = { } obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts index 753af92de0..facf10a215 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/client/v1/query.ts @@ -896,8 +896,8 @@ export const QueryConsensusStateRequest = { toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts index 965fa427e4..a0ad2cdc6e 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/connection.ts @@ -379,7 +379,7 @@ export const ConnectionEnd = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -572,7 +572,7 @@ export const IdentifiedConnection = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -1144,7 +1144,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts index 8280f6b8e5..bdc3b303c7 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/genesis.ts @@ -164,7 +164,7 @@ export const GenesisState = { } else { obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts index ec6bc9cb01..b43d22b7ae 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/query.ts @@ -1263,8 +1263,8 @@ export const QueryConnectionConsensusStateRequest = { toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts index b327cae029..0448be92eb 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/connection/v1/tx.ts @@ -333,7 +333,7 @@ export const MsgConnectionOpenInit = { obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -698,7 +698,7 @@ export const MsgConnectionOpenTry = { obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts index eb3629e7b1..5248697115 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v1/solomachine.ts @@ -559,8 +559,8 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence !== BigInt(0) ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; @@ -694,7 +694,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -858,8 +858,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1011,7 +1011,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1160,7 +1160,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1273,7 +1273,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1435,8 +1435,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2433,7 +2433,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts index a2b744046e..87fe47bfc0 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/solomachine/v2/solomachine.ts @@ -557,7 +557,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; @@ -692,7 +692,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -856,8 +856,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1009,7 +1009,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1158,7 +1158,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1271,7 +1271,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1433,8 +1433,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2431,7 +2431,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts index 2caa3c6e01..d6152bc9fa 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/lightclients/tendermint/v1/tendermint.ts @@ -979,8 +979,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts index c55d1e3936..b5a7cb4406 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/genesis.ts @@ -264,10 +264,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts index efeb5c1186..ea9d933e90 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/epochs/query.ts @@ -381,7 +381,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts index e99a1675d8..2343660f0f 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -748,7 +748,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts index 84eb8cdd7f..f7ac466bd8 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -260,7 +260,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 0b89fa139e..52dd53a9d3 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -387,7 +387,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts index 0fe4465e12..54cebe6395 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/pool-models/stableswap/tx.ts @@ -346,7 +346,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -490,7 +490,7 @@ export const MsgStableSwapAdjustScalingFactors = { toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts index a167293adc..bf076f10b6 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/genesis.ts @@ -252,7 +252,7 @@ export const GenesisState = { } else { obj.pools = message.pools; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = message.nextPoolNumber !== BigInt(0) ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts index c6a83f0e1d..6157ab7910 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/query.ts @@ -452,7 +452,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -937,7 +937,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1033,7 +1033,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1245,7 +1245,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1483,7 +1483,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, @@ -1684,7 +1684,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1876,7 +1876,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2076,7 +2076,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2290,7 +2290,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2544,7 +2544,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; @@ -3054,7 +3054,7 @@ export const QuerySwapExactAmountInRequest = { toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); @@ -3305,7 +3305,7 @@ export const QuerySwapExactAmountOutRequest = { toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts index 096beac3dc..cc37726c6d 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v1beta1/tx.ts @@ -394,7 +394,7 @@ export const MsgJoinPool = { toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); @@ -672,7 +672,7 @@ export const MsgExitPool = { toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); @@ -894,7 +894,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -1258,7 +1258,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, @@ -1657,7 +1657,7 @@ export const MsgJoinSwapExternAmountIn = { toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; @@ -1914,7 +1914,7 @@ export const MsgJoinSwapShareAmountOut = { toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; @@ -2172,7 +2172,7 @@ export const MsgExitSwapShareAmountIn = { toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; @@ -2416,7 +2416,7 @@ export const MsgExitSwapExternAmountOut = { toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts index 0793fc0d01..69c0eb93a8 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/gamm/v2/query.ts @@ -145,7 +145,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts index 9081c6e243..9eb54c3651 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/gauge.ts @@ -277,7 +277,7 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { @@ -286,8 +286,8 @@ export const Gauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; + obj.filled_epochs = message.filledEpochs !== BigInt(0) ? message.filledEpochs.toString() : undefined; if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts index da04c4968a..8fca4595f6 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/genesis.ts @@ -182,7 +182,7 @@ export const GenesisState = { } else { obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = message.lastGaugeId !== BigInt(0) ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts index f7c21c9cd7..c78c530b74 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/query.ts @@ -475,7 +475,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1849,7 +1849,7 @@ export const RewardsEstRequest = { } else { obj.lock_ids = message.lockIds; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = message.endEpoch !== BigInt(0) ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts index 8bd45ca411..6fb60a8117 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/incentives/tx.ts @@ -243,7 +243,7 @@ export const MsgCreateGauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -452,7 +452,7 @@ export const MsgAddToGauge = { toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts index 8a142aa777..fa76db0580 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/genesis.ts @@ -133,7 +133,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = message.lastLockId !== BigInt(0) ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts index 893e285ca6..0b299f3be4 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/lock.ts @@ -315,7 +315,7 @@ export const PeriodLock = { }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; @@ -616,7 +616,7 @@ export const SyntheticLock = { }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; + obj.underlying_lock_id = message.underlyingLockId !== BigInt(0) ? message.underlyingLockId.toString() : undefined; obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts index 096af91e0d..610bbb6503 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/query.ts @@ -2461,7 +2461,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2653,7 +2653,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts index 95df255a3b..12fe8486f3 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/lockup/tx.ts @@ -353,7 +353,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -686,7 +686,7 @@ export const MsgBeginUnlocking = { toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -916,7 +916,7 @@ export const MsgExtendLockup = { toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1146,7 +1146,7 @@ export const MsgForceUnlock = { toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/genesis.ts index e2474a70b7..366c3b7419 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/genesis.ts @@ -133,7 +133,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = message.reductionStartedEpoch !== BigInt(0) ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts index 6b0a5b76ec..8b83124382 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/mint/v1beta1/mint.ts @@ -677,7 +677,7 @@ export const Params = { obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs.toString() : undefined; obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { @@ -685,7 +685,7 @@ export const Params = { } else { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch !== BigInt(0) ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts index d300003020..437da4cd52 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/incentives.ts @@ -482,7 +482,7 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, @@ -615,8 +615,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts index 296e0a744e..87d6b46376 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/pool-incentives/v1beta1/query.ts @@ -203,7 +203,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -437,7 +437,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; @@ -1163,9 +1163,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts index 023c4bb8bc..d0655c731c 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/query.ts @@ -1195,7 +1195,7 @@ export const SuperfluidIntermediaryAccountInfo = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -1511,7 +1511,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts index 51eef72917..598fda8724 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/superfluid.ts @@ -387,7 +387,7 @@ export const SuperfluidIntermediaryAccount = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -515,7 +515,7 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; return obj; @@ -778,7 +778,7 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts index 510ec0f9ff..0930d7ecab 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/superfluid/tx.ts @@ -238,7 +238,7 @@ export const MsgSuperfluidDelegate = { toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, @@ -426,7 +426,7 @@ export const MsgSuperfluidUndelegate = { toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -613,7 +613,7 @@ export const MsgSuperfluidUnbondLock = { toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -921,7 +921,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1034,7 +1034,7 @@ export const MsgUnPoolWhitelistedPool = { toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts index 8361f269c0..16342b7412 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/query.ts @@ -209,7 +209,7 @@ export const ArithmeticTwapRequest = { }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; @@ -451,7 +451,7 @@ export const ArithmeticTwapToNowRequest = { }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts index 73cb746fc5..00fa424091 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/twap/v1beta1/twap_record.ts @@ -282,7 +282,7 @@ export const TwapRecord = { }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height.toString() : "0"; diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts index 4a8467c23d..1bdf14c875 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/feetoken.ts @@ -113,7 +113,7 @@ export const FeeToken = { toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts index 8a90de2a62..610d234fc1 100644 --- a/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputinstantrpc/osmosis/txfees/v1beta1/query.ts @@ -452,7 +452,7 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, @@ -643,7 +643,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts index 04a1eac3b4..bde3491e77 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/abci/types.ts @@ -1535,8 +1535,8 @@ export const RequestInfo = { toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; obj.version = message.version === "" ? undefined : message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1828,7 +1828,7 @@ export const RequestInitChain = { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -1968,7 +1968,7 @@ export const RequestQuery = { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.path = message.path === "" ? undefined : message.path; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.prove = message.prove === false ? undefined : message.prove; return obj; }, @@ -2405,7 +2405,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -2770,7 +2770,7 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; @@ -3671,8 +3671,8 @@ export const ResponseInfo = { const obj: any = {}; obj.data = message.data === "" ? undefined : message.data; obj.version = message.version === "" ? undefined : message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; return obj; }, @@ -4154,11 +4154,11 @@ export const ResponseQuery = { obj.code = message.code === 0 ? undefined : message.code; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, @@ -4471,8 +4471,8 @@ export const ResponseCheckTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4692,8 +4692,8 @@ export const ResponseDeliverTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4950,7 +4950,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -5630,8 +5630,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -6123,7 +6123,7 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; @@ -6233,7 +6233,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -6342,7 +6342,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6609,9 +6609,9 @@ export const Evidence = { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6765,7 +6765,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts index 6393e6860c..eb3082cbcd 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/crypto/proof.ts @@ -208,8 +208,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts index ca7ef79b7b..b824c36692 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/libs/bits/types.ts @@ -115,7 +115,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts index 2303697558..1c24960afa 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/p2p/types.ts @@ -189,9 +189,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts index 5543313c32..06bf9dba0a 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/evidence.ts @@ -318,8 +318,8 @@ export const DuplicateVoteEvidence = { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -485,13 +485,13 @@ export const LightClientAttackEvidence = { toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts index 7ac17d0710..5c31de35d1 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/params.ts @@ -396,9 +396,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs !== BigInt(0) ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -524,9 +524,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -714,7 +714,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -822,8 +822,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts index 1c6e685520..62180c51dc 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/types.ts @@ -969,7 +969,7 @@ export const Header = { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; @@ -1283,7 +1283,7 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -1435,7 +1435,7 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { @@ -1770,7 +1770,7 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; @@ -2138,9 +2138,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts index e4dcd1df7b..cd32dbc43c 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/types/validator.ts @@ -161,7 +161,7 @@ export const ValidatorSet = { obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -305,8 +305,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -415,7 +415,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts b/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts index a4fa8adb2e..1f1933a734 100644 --- a/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputinstantrpc/tendermint/version/types.ts @@ -132,7 +132,7 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; obj.software = message.software === "" ? undefined : message.software; return obj; }, @@ -241,8 +241,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts index 795564d5ab..0405c8ca0c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/attribute.ts @@ -390,7 +390,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts index 2952b003de..3e6be68b63 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta1/resource.ts @@ -282,7 +282,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -403,7 +403,7 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts index 94ec94a9ad..dada7de403 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/attribute.ts @@ -390,7 +390,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts index ebf175c5da..5b41690d9f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputosmojs/akash/base/v1beta2/resource.ts @@ -259,7 +259,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -397,7 +397,7 @@ export const Storage = { toAmino(message: Storage): StorageAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts index 85be35e2d2..857bcd76c6 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.ts @@ -769,7 +769,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.toAmino(CertificateID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts index 2eaeabe483..195a8987cf 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/genesis.ts @@ -114,7 +114,7 @@ export const GenesisCertificate = { toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; obj.owner = message.owner ?? ""; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts index 052e85a1bd..9908e7b4bd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/query.ts @@ -130,7 +130,7 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); obj.serial = message.serial ?? ""; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts index 2d44e7d00b..3559e1b744 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/authz.ts @@ -93,7 +93,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts index 84962d1153..940ff40e54 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/deployment.ts @@ -309,14 +309,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -499,8 +499,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -705,7 +705,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { @@ -878,7 +878,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1204,10 +1204,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts index 91a8b7b9e8..066e8e409b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/genesis.ts @@ -123,7 +123,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -249,7 +249,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts index c87af8edfb..7468b3dff2 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/group.ts @@ -254,7 +254,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -421,7 +421,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -588,7 +588,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -922,7 +922,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { @@ -1069,10 +1069,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1198,9 +1198,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); + obj.price = message.price ? Coin.toAmino(message.price) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts index 2e3bcdfd95..c9b28304ca 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/params.ts @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts index 070df61d68..b10eaf1a91 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta1/query.ts @@ -519,7 +519,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts index 634df2e79b..af82c5c9c4 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/authz.ts @@ -93,7 +93,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts index ac7a64875d..6527471172 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deployment.ts @@ -318,10 +318,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts index becae35579..2628ed0754 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/deploymentmsg.ts @@ -239,14 +239,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -446,8 +446,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -631,7 +631,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, @@ -799,7 +799,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts index 67f5f75a50..81683d56f5 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/genesis.ts @@ -123,7 +123,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -249,7 +249,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts index f22ef7825a..eac0bd777b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/group.ts @@ -193,10 +193,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts index c7d7c8794f..7cb6bd0e2b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupmsg.ts @@ -131,7 +131,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -298,7 +298,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -465,7 +465,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts index 348c8404dd..82b174d5d3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/groupspec.ts @@ -127,7 +127,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts index 4d0f379f40..205cb61597 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/params.ts @@ -83,7 +83,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts index 0b1dd61131..ec7efeaff6 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/query.ts @@ -519,7 +519,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts index 7e8cd775d4..68882c0e85 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/resource.ts @@ -120,9 +120,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts index ea0603b2bf..86bee0581b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta1/types.ts @@ -424,11 +424,11 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.toAmino(Coin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, @@ -619,13 +619,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.toAmino(Coin.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts index b5a84739fd..387ff89a2d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputosmojs/akash/escrow/v1beta2/types.ts @@ -469,14 +469,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.toAmino(DecCoin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; obj.depositor = message.depositor ?? ""; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -666,13 +666,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts index 47f8cedbd1..c783bcf04c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/inflation/v1beta2/genesis.ts @@ -83,7 +83,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts index a557ebdae8..51429f4e41 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/bid.ts @@ -287,10 +287,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.toAmino(OrderID.fromPartial({})); obj.provider = message.provider ?? ""; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -457,7 +457,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -834,10 +834,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts index aaabda5bff..238f4ffc8c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/genesis.ts @@ -143,7 +143,7 @@ export const GenesisState = { } else { obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts index 9d4b850b65..13a4261809 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/lease.ts @@ -468,11 +468,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn !== BigInt(0) ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -745,7 +745,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -912,7 +912,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1079,7 +1079,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts index 0b91ae0a3f..e4cb15d7e3 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/order.ts @@ -368,10 +368,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.toAmino(OrderID.fromPartial({})); obj.state = message.state ?? 0; - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts index 55097d51a9..9f336ccde1 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/params.ts @@ -101,7 +101,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.toAmino(Coin.fromPartial({})); obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts index 5efcee47a3..571d017d5f 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.ts @@ -347,7 +347,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -575,7 +575,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -970,7 +970,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts index 44fe450f46..113e5c3a21 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.ts @@ -347,7 +347,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -575,7 +575,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -970,7 +970,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts b/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts index d3a5f64934..82e57bc128 100644 --- a/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts +++ b/__fixtures__/v-next/outputosmojs/capability/v1/capability.ts @@ -126,7 +126,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { diff --git a/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts index a45ec787fa..38c7e1de99 100644 --- a/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/capability/v1/genesis.ts @@ -122,8 +122,8 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; - obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; + obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : CapabilityOwners.toAmino(CapabilityOwners.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisOwnersAminoMsg): GenesisOwners { @@ -233,7 +233,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts index b2db394435..096e1ad34f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/auth/v1beta1/auth.ts @@ -183,8 +183,8 @@ export const BaseAccount = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -480,11 +480,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts index 318f5ebb22..8471e06873 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/abci/v1beta1/abci.ts @@ -555,7 +555,7 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.txhash = message.txhash === "" ? undefined : message.txhash; obj.codespace = message.codespace === "" ? undefined : message.codespace; obj.code = message.code === 0 ? undefined : message.code; @@ -567,8 +567,8 @@ export const TxResponse = { obj.logs = message.logs; } obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { @@ -1055,8 +1055,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1754,11 +1754,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts index 9735629f38..3996520628 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/query/v1beta1/pagination.ts @@ -235,8 +235,8 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; obj.count_total = message.countTotal === false ? undefined : message.countTotal; obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; @@ -349,7 +349,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts index 5c3b4b8b46..e493cf3ce3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -273,7 +273,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; @@ -798,7 +798,7 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.height = message.height === 0 ? undefined : message.height; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts index a619fad8c3..5a918f65d7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/store/v1beta1/commit_info.ts @@ -152,7 +152,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -378,7 +378,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts index e8c3efc632..54a4fbd24e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/base/tendermint/v1beta1/query.ts @@ -307,7 +307,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -440,7 +440,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -672,7 +672,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -822,8 +822,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -917,7 +917,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts index b7bdb0eca0..aabda996ac 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/capability.ts @@ -126,7 +126,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts index 1eed614f22..aee0a7b705 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/capability/v1beta1/genesis.ts @@ -122,7 +122,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -239,7 +239,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts index b548da6261..b388c995e7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/distribution.ts @@ -631,7 +631,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = message.rewards; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -949,7 +949,7 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; obj.fraction = message.fraction === "" ? undefined : message.fraction; return obj; }, @@ -1439,7 +1439,7 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; obj.stake = message.stake === "" ? undefined : message.stake; obj.height = message.height ? message.height.toString() : "0"; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts index 0e10589c86..f5b95117bf 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/genesis.ts @@ -632,7 +632,7 @@ export const ValidatorHistoricalRewardsRecord = { toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -1015,8 +1015,8 @@ export const ValidatorSlashEventRecord = { toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts index 6f371fb9d9..ea10c0e1e4 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/query.ts @@ -1002,8 +1002,8 @@ export const QueryValidatorSlashesRequest = { toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts index 2023957a7c..e55fced8cc 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/evidence.ts @@ -143,9 +143,9 @@ export const Equivocation = { }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts index a56e70033f..909158856c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/genesis.ts @@ -216,7 +216,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts index b96b22f7e6..76dd4ad4a2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/gov.ts @@ -527,7 +527,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -783,7 +783,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1093,7 +1093,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts index 7ad43394e5..c4dd5ac69e 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/query.ts @@ -322,7 +322,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -792,7 +792,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -997,7 +997,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1451,7 +1451,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1656,7 +1656,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1872,7 +1872,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts index e78bee2a2b..e3dc9f3d78 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.ts @@ -381,7 +381,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts index e4a104c14c..6d4b780328 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/genesis.ts @@ -216,7 +216,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts index 9bd2ed6e39..e452f9afd0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/gov.ts @@ -671,7 +671,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -905,7 +905,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts index d2c004fdfc..428ddf02eb 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/query.ts @@ -322,7 +322,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -792,7 +792,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -997,7 +997,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1451,7 +1451,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1656,7 +1656,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1872,7 +1872,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts index 9100dc0ecd..adcf7333ea 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.ts @@ -459,7 +459,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts index 9587f19981..99ade65b50 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/events.ts @@ -194,7 +194,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -288,7 +288,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -570,7 +570,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -664,7 +664,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -758,7 +758,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -868,7 +868,7 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.result = message.result === 0 ? undefined : message.result; return obj; }, @@ -979,7 +979,7 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts index 8cc0c14195..426e7beb6f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/genesis.ts @@ -256,7 +256,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -267,13 +267,13 @@ export const GenesisState = { } else { obj.group_members = message.groupMembers; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = message.groupPolicies; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts index b8a5930a07..341c2fd9a8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/query.ts @@ -461,7 +461,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -853,7 +853,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1317,7 +1317,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1765,7 +1765,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2201,7 +2201,7 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -2406,7 +2406,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3086,7 +3086,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts index 10104bd574..3b09e110f6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.ts @@ -681,7 +681,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -814,7 +814,7 @@ export const MsgUpdateGroupMembers = { toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1019,7 +1019,7 @@ export const MsgUpdateGroupAdmin = { toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, @@ -1220,7 +1220,7 @@ export const MsgUpdateGroupMetadata = { toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, @@ -1437,7 +1437,7 @@ export const MsgCreateGroupPolicy = { toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; @@ -1960,7 +1960,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, @@ -2712,7 +2712,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2822,7 +2822,7 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -3054,7 +3054,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; @@ -3241,7 +3241,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -3426,7 +3426,7 @@ export const MsgLeaveGroup = { toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts index 73b4063c32..80899202ce 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/types.ts @@ -1257,10 +1257,10 @@ export const GroupInfo = { }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1372,7 +1372,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1564,10 +1564,10 @@ export const GroupPolicyInfo = { toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1867,7 +1867,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { @@ -1876,8 +1876,8 @@ export const Proposal = { obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; @@ -2190,7 +2190,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts index f482fe4ee0..684f6af8b8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/mint/v1beta1/mint.ts @@ -311,7 +311,7 @@ export const Params = { obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts index a624b1e3f4..d8db51c510 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/nft/v1beta1/query.ts @@ -366,7 +366,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -759,7 +759,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts index a67badb043..b5cf799c7c 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/genesis.ts @@ -546,7 +546,7 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.missed = message.missed === false ? undefined : message.missed; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts index cff5d64084..60a6d7b15f 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/slashing/v1beta1/slashing.ts @@ -216,11 +216,11 @@ export const ValidatorSigningInfo = { toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.start_height = message.startHeight !== BigInt(0) ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset !== BigInt(0) ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.missed_blocks_counter = message.missedBlocksCounter !== BigInt(0) ? message.missedBlocksCounter.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -378,7 +378,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = message.signedBlocksWindow !== BigInt(0) ? message.signedBlocksWindow.toString() : undefined; obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts index d1d79c6bc8..8ae04683d9 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/genesis.ts @@ -406,7 +406,7 @@ export const LastValidatorPower = { toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts index 7fbfaf652f..d067a67dc0 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/query.ts @@ -3048,7 +3048,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts index 5a0b87930a..730936a756 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/staking.ts @@ -1285,7 +1285,7 @@ export const Validator = { obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -2247,7 +2247,7 @@ export const UnbondingDelegationEntry = { }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; @@ -2392,7 +2392,7 @@ export const RedelegationEntry = { }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts index 1c77a38c7b..0b69c9bfc6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/signing/v1beta1/signing.ts @@ -387,7 +387,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts index be830eac4f..85b244d189 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/service.ts @@ -1338,7 +1338,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts index d184e8a9f2..3200a9f147 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/tx/v1beta1/tx.ts @@ -836,7 +836,7 @@ export const SignDoc = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1013,8 +1013,8 @@ export const SignDocDirectAux = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1197,7 +1197,7 @@ export const TxBody = { obj.messages = message.messages; } obj.memo = message.memo === "" ? undefined : message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1473,7 +1473,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1952,7 +1952,7 @@ export const Fee = { } else { obj.amount = message.amount; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; obj.payer = message.payer === "" ? undefined : message.payer; obj.granter = message.granter === "" ? undefined : message.granter; return obj; diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts index b943cfbbd9..47129244a6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/query.ts @@ -534,7 +534,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -628,7 +628,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts index 9106903c36..c1cd9a61b7 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/upgrade.ts @@ -267,7 +267,7 @@ export const Plan = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -619,7 +619,7 @@ export const ModuleVersion = { toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts index 8db83d0b54..99ade6c6df 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.ts @@ -251,7 +251,7 @@ export const MsgCreateVestingAccount = { } else { obj.amount = message.amount; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, @@ -686,7 +686,7 @@ export const MsgCreatePeriodicVestingAccount = { const obj: any = {}; obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; obj.to_address = message.toAddress === "" ? undefined : message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts index 7f9a183e5f..9b3fc1bca6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/vesting.ts @@ -296,7 +296,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -407,7 +407,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -617,7 +617,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -755,7 +755,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts index b17333e345..7a2d330e87 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/authz.ts @@ -599,7 +599,7 @@ export const MaxCallsLimit = { }, toAmino(message: MaxCallsLimit): MaxCallsLimitAmino { const obj: any = {}; - obj.remaining = message.remaining ? message.remaining.toString() : undefined; + obj.remaining = message.remaining !== BigInt(0) ? message.remaining.toString() : undefined; return obj; }, fromAminoMsg(object: MaxCallsLimitAminoMsg): MaxCallsLimit { @@ -819,7 +819,7 @@ export const CombinedLimit = { }, toAmino(message: CombinedLimit): CombinedLimitAmino { const obj: any = {}; - obj.calls_remaining = message.callsRemaining ? message.callsRemaining.toString() : undefined; + obj.calls_remaining = message.callsRemaining !== BigInt(0) ? message.callsRemaining.toString() : undefined; if (message.amounts) { obj.amounts = message.amounts.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts index 7d8179f081..c7a00c9b49 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/genesis.ts @@ -541,7 +541,7 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; obj.pinned = message.pinned === false ? undefined : message.pinned; @@ -793,7 +793,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts index 7f8ed59d54..4e828cde26 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/ibc.ts @@ -162,8 +162,8 @@ export const MsgIBCSend = { toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; obj.channel = message.channel === "" ? undefined : message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts index 97a075a35e..3880732d73 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/proposal.ts @@ -600,7 +600,7 @@ export const InstantiateContractProposal = { obj.description = message.description === "" ? undefined : message.description; obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -768,7 +768,7 @@ export const MigrateContractProposal = { obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts index c97f57b0db..bc5822633b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/query.ts @@ -890,7 +890,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1748,7 +1748,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts index 8925655d3a..722e20d1a3 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.ts @@ -410,7 +410,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -592,7 +592,7 @@ export const MsgInstantiateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -1103,7 +1103,7 @@ export const MsgMigrateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts index 246bc67fd5..a1578dadb8 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/types.ts @@ -566,7 +566,7 @@ export const Params = { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.max_wasm_code_size = message.maxWasmCodeSize !== BigInt(0) ? message.maxWasmCodeSize.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -884,7 +884,7 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.creator = message.creator === "" ? undefined : message.creator; obj.admin = message.admin === "" ? undefined : message.admin; obj.label = message.label === "" ? undefined : message.label; @@ -1033,7 +1033,7 @@ export const ContractCodeHistoryEntry = { toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; obj.operation = message.operation === 0 ? undefined : message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1145,8 +1145,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts index 8121ee1aa1..6c1b3ecefb 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/genesis.ts @@ -205,10 +205,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts index 740e19087d..bc4ba475b9 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/epochs/v1/query.ts @@ -405,7 +405,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts index fcbae793f6..17d2fdeb08 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/genesis.ts @@ -304,7 +304,7 @@ export const Params = { obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate.toString() : undefined; obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts index 06b1ccdf05..4253f0e658 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/incentives.ts @@ -244,7 +244,7 @@ export const Incentive = { } obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = message.totalGas !== BigInt(0) ? message.totalGas.toString() : undefined; return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -366,7 +366,7 @@ export const GasMeter = { const obj: any = {}; obj.contract = message.contract === "" ? undefined : message.contract; obj.participant = message.participant === "" ? undefined : message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.cumulative_gas = message.cumulativeGas !== BigInt(0) ? message.cumulativeGas.toString() : undefined; return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { diff --git a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts index d7ea6bbc22..e6de05423e 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/incentives/v1/query.ts @@ -1033,7 +1033,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = message.gasMeter !== BigInt(0) ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts index 5067ec9475..5f56ff0ba3 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/genesis.ts @@ -183,10 +183,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.epochs_per_period = message.epochsPerPeriod !== BigInt(0) ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts index 6ef86832b3..72ef9fa379 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/inflation/v1/query.ts @@ -314,7 +314,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -624,7 +624,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { diff --git a/__fixtures__/v-next/outputosmojs/google/api/distribution.ts b/__fixtures__/v-next/outputosmojs/google/api/distribution.ts index 60bda2d65a..e15ba63698 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/distribution.ts @@ -517,7 +517,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts index 1b4e7a7db3..e2db0c3173 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -1253,7 +1253,7 @@ export const IssueDetails = { const obj: any = {}; obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts index cfd08ea9d7..422b442ccc 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/checked.ts @@ -659,7 +659,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -757,7 +757,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts index 866006f708..19b4d1333c 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/eval.ts @@ -361,8 +361,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = message.expr !== BigInt(0) ? message.expr.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts index 0edf23f26d..a9f3766d08 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/explain.ts @@ -263,7 +263,7 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts index 3606b3d7a6..5dca79dbde 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/syntax.ts @@ -822,7 +822,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1520,7 +1520,7 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; @@ -1935,8 +1935,8 @@ export const Constant = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -2044,7 +2044,7 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value === 0 ? undefined : message.value; return obj; }, @@ -2142,7 +2142,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts index d57eefc5dd..1685c533c3 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1alpha1/value.ts @@ -398,8 +398,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts index d58a01a12e..221e99356f 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/expr.ts @@ -1790,8 +1790,8 @@ export const Literal = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts index 5fd366e283..c8f1fa9ed9 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/expr/v1beta1/value.ts @@ -398,8 +398,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/google/api/quota.ts b/__fixtures__/v-next/outputosmojs/google/api/quota.ts index 2c21ac194b..6e30403b15 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/quota.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/quota.ts @@ -511,7 +511,7 @@ export const MetricRule_MetricCostsEntry = { toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -762,7 +762,7 @@ export const QuotaLimit_ValuesEntry = { toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1033,9 +1033,9 @@ export const QuotaLimit = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.description = message.description === "" ? undefined : message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit !== BigInt(0) ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier !== BigInt(0) ? message.freeTier.toString() : undefined; obj.duration = message.duration === "" ? undefined : message.duration; obj.metric = message.metric === "" ? undefined : message.metric; obj.unit = message.unit === "" ? undefined : message.unit; diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts index 632d45e59a..129860ef8c 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/distribution.ts @@ -408,7 +408,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.minimum = message.minimum === 0 ? undefined : message.minimum; obj.maximum = message.maximum === 0 ? undefined : message.maximum; diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts index 8b5815c699..d1b1dca6f6 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/http_request.ts @@ -400,9 +400,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -411,7 +411,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts index 9523bbb2ad..93685dc851 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/log_entry.ts @@ -839,7 +839,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts index 086ca8e542..1464723e1e 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/metric_value.ts @@ -425,7 +425,7 @@ export const MetricValue = { obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts index 10eaf425e5..4fed73ac79 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/servicecontrol/v1/service_controller.ts @@ -796,9 +796,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; + obj.project_number = message.projectNumber !== BigInt(0) ? message.projectNumber.toString() : undefined; obj.type = message.type === 0 ? undefined : message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.consumer_number = message.consumerNumber !== BigInt(0) ? message.consumerNumber.toString() : undefined; return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { diff --git a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts index a3d9539c1d..26279523e2 100644 --- a/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputosmojs/google/api/serviceusage/v1beta1/resources.ts @@ -1838,8 +1838,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = message.effectiveLimit !== BigInt(0) ? message.effectiveLimit.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2158,7 +2158,7 @@ export const QuotaOverride = { toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.override_value = message.overrideValue !== BigInt(0) ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { @@ -2575,7 +2575,7 @@ export const AdminQuotaPolicy = { toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.policy_value = message.policyValue !== BigInt(0) ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts b/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts index 3eef764c1f..982a8b1e82 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/type/http_request.ts @@ -402,9 +402,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -413,7 +413,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts index 2bb750c63b..3874e2ab8e 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/log_entry.ts @@ -1048,7 +1048,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts index e79c91750e..6d537e65c7 100644 --- a/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputosmojs/google/logging/v2/logging_config.ts @@ -6489,7 +6489,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = message.logEntriesCopiedCount !== BigInt(0) ? message.logEntriesCopiedCount.toString() : undefined; return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts index b50e35a551..9fee1d5d09 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/descriptor.ts @@ -5130,8 +5130,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts index ce270c54b8..ad662746fc 100644 --- a/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputosmojs/google/protobuf/wrappers.ts @@ -435,7 +435,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -523,7 +523,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { diff --git a/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts index dda03523d5..e752e7c45d 100644 --- a/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputosmojs/google/rpc/context/attribute_context.ts @@ -1069,7 +1069,7 @@ export const AttributeContext_Peer = { toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; obj.ip = message.ip === "" ? undefined : message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.port = message.port !== BigInt(0) ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -1810,7 +1810,7 @@ export const AttributeContext_Request = { obj.scheme = message.scheme === "" ? undefined : message.scheme; obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; @@ -2106,8 +2106,8 @@ export const AttributeContext_Response = { }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = message.code !== BigInt(0) ? message.code.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts index d0b3daeba7..d19c90e8d6 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/query.ts @@ -373,7 +373,7 @@ export const QueryIncentivizedPacketsRequest = { toAmino(message: QueryIncentivizedPacketsRequest): QueryIncentivizedPacketsRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = message.queryHeight !== BigInt(0) ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryIncentivizedPacketsRequestAminoMsg): QueryIncentivizedPacketsRequest { @@ -588,7 +588,7 @@ export const QueryIncentivizedPacketRequest = { }, toAmino(message: QueryIncentivizedPacketRequest): QueryIncentivizedPacketRequestAmino { const obj: any = {}; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = message.queryHeight !== BigInt(0) ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryIncentivizedPacketRequestAminoMsg): QueryIncentivizedPacketRequest { @@ -827,7 +827,7 @@ export const QueryIncentivizedPacketsForChannelRequest = { obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = message.queryHeight !== BigInt(0) ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryIncentivizedPacketsForChannelRequestAminoMsg): QueryIncentivizedPacketsForChannelRequest { @@ -2000,7 +2000,7 @@ export const QueryFeeEnabledChannelsRequest = { toAmino(message: QueryFeeEnabledChannelsRequest): QueryFeeEnabledChannelsRequestAmino { const obj: any = {}; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; - obj.query_height = message.queryHeight ? message.queryHeight.toString() : undefined; + obj.query_height = message.queryHeight !== BigInt(0) ? message.queryHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryFeeEnabledChannelsRequestAminoMsg): QueryFeeEnabledChannelsRequest { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts index 5427811a51..401848ea43 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.ts @@ -425,7 +425,7 @@ export const MsgSendTx = { obj.owner = message.owner === "" ? undefined : message.owner; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; obj.packet_data = message.packetData ? InterchainAccountPacketData.toAmino(message.packetData) : undefined; - obj.relative_timeout = message.relativeTimeout ? message.relativeTimeout.toString() : undefined; + obj.relative_timeout = message.relativeTimeout !== BigInt(0) ? message.relativeTimeout.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSendTxAminoMsg): MsgSendTx { @@ -519,7 +519,7 @@ export const MsgSendTxResponse = { }, toAmino(message: MsgSendTxResponse): MsgSendTxResponseAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSendTxResponseAminoMsg): MsgSendTxResponse { diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts index 5087670a8d..2d13b3ccf7 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.ts @@ -227,7 +227,7 @@ export const MsgTransfer = { obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts index 18c02caad9..eb1ac45eee 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/channel.ts @@ -972,14 +972,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1123,7 +1123,7 @@ export const PacketState = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts index 1b622838c5..38122814c8 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/genesis.ts @@ -309,7 +309,7 @@ export const GenesisState = { } else { obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -437,7 +437,7 @@ export const PacketSequence = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts index 0de63dd02b..8b69156c77 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/query.ts @@ -1706,8 +1706,8 @@ export const QueryChannelConsensusStateRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -1980,7 +1980,7 @@ export const QueryPacketCommitmentRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2502,7 +2502,7 @@ export const QueryPacketReceiptRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2758,7 +2758,7 @@ export const QueryPacketAcknowledgementRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -3979,7 +3979,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts index 6d135de26a..f3ae6c81fd 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.ts @@ -2099,7 +2099,7 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2351,7 +2351,7 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts index 611b20bf1c..156bad00e1 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/client.ts @@ -901,8 +901,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts index 2ac904b685..d22142a5a2 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/genesis.ts @@ -255,7 +255,7 @@ export const GenesisState = { } obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts index b1c24ef0eb..c7f77c84cc 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/query.ts @@ -884,8 +884,8 @@ export const QueryConsensusStateRequest = { toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts index 452b71da45..431d96329e 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/connection.ts @@ -375,7 +375,7 @@ export const ConnectionEnd = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -564,7 +564,7 @@ export const IdentifiedConnection = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -1132,7 +1132,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts index fc225ca31b..ee20700a6d 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/genesis.ts @@ -160,7 +160,7 @@ export const GenesisState = { } else { obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts index e0641a40c2..4d68e1bffb 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/query.ts @@ -1243,8 +1243,8 @@ export const QueryConnectionConsensusStateRequest = { toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts index 8384d8fb83..e591d22038 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.ts @@ -327,7 +327,7 @@ export const MsgConnectionOpenInit = { obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -681,7 +681,7 @@ export const MsgConnectionOpenTry = { obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts index 3d3a0708e2..a89558ef7b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v1/solomachine.ts @@ -553,8 +553,8 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence !== BigInt(0) ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; @@ -684,7 +684,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -842,8 +842,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -989,7 +989,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1136,7 +1136,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1247,7 +1247,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1405,8 +1405,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2391,7 +2391,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts index 744cf6fb1b..dcbafb6c77 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v2/solomachine.ts @@ -553,7 +553,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; @@ -684,7 +684,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -842,8 +842,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -989,7 +989,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1136,7 +1136,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1247,7 +1247,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1405,8 +1405,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2391,7 +2391,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts index 2a815fcc94..6655597b1b 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/solomachine/v3/solomachine.ts @@ -282,7 +282,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; return obj; @@ -412,7 +412,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -554,7 +554,7 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -683,7 +683,7 @@ export const Misbehaviour = { }, toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -830,7 +830,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.path = message.path ? base64FromBytes(message.path) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -941,7 +941,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1099,8 +1099,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.path = message.path ? base64FromBytes(message.path) : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts index 78de32c375..126c61fda1 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/lightclients/tendermint/v1/tendermint.ts @@ -949,8 +949,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts index 53631ce3d7..04a0e7e74c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/genesis.ts @@ -195,8 +195,8 @@ export const FullTick = { }, toAmino(message: FullTick): FullTickAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.tick_index = message.tickIndex ? message.tickIndex.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.tick_index = message.tickIndex !== BigInt(0) ? message.tickIndex.toString() : undefined; obj.info = message.info ? TickInfo.toAmino(message.info) : undefined; return obj; }, @@ -554,7 +554,7 @@ export const GenesisState = { } else { obj.positions = message.positions; } - obj.next_position_id = message.nextPositionId ? message.nextPositionId.toString() : undefined; + obj.next_position_id = message.nextPositionId !== BigInt(0) ? message.nextPositionId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts index 95d1e3b13f..a1e1a33d3c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/incentive_record.ts @@ -207,7 +207,7 @@ export const IncentiveRecord = { }, toAmino(message: IncentiveRecord): IncentiveRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; obj.incentive_creator_addr = message.incentiveCreatorAddr === "" ? undefined : message.incentiveCreatorAddr; obj.incentive_record_body = message.incentiveRecordBody ? IncentiveRecordBody.toAmino(message.incentiveRecordBody) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts index bc13fd5133..f7f9dc3e38 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/query.ts @@ -285,7 +285,7 @@ export const QueryUserPositionsRequest = { toAmino(message: QueryUserPositionsRequest): QueryUserPositionsRequestAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUserPositionsRequestAminoMsg): QueryUserPositionsRequest { @@ -483,7 +483,7 @@ export const QueryPositionByIdRequest = { }, toAmino(message: QueryPositionByIdRequest): QueryPositionByIdRequestAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = message.positionId !== BigInt(0) ? message.positionId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPositionByIdRequestAminoMsg): QueryPositionByIdRequest { @@ -1340,7 +1340,7 @@ export const QueryLiquidityNetInDirectionRequest = { }, toAmino(message: QueryLiquidityNetInDirectionRequest): QueryLiquidityNetInDirectionRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; obj.start_tick = message.startTick === null ? undefined : message.startTick; obj.bound_tick = message.boundTick === null ? undefined : message.boundTick; @@ -1480,7 +1480,7 @@ export const QueryLiquidityNetInDirectionResponse = { } else { obj.liquidity_depths = message.liquidityDepths; } - obj.current_tick = message.currentTick ? message.currentTick.toString() : undefined; + obj.current_tick = message.currentTick !== BigInt(0) ? message.currentTick.toString() : undefined; obj.current_liquidity = message.currentLiquidity === "" ? undefined : message.currentLiquidity; return obj; }, @@ -1575,7 +1575,7 @@ export const QueryTotalLiquidityForRangeRequest = { }, toAmino(message: QueryTotalLiquidityForRangeRequest): QueryTotalLiquidityForRangeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalLiquidityForRangeRequestAminoMsg): QueryTotalLiquidityForRangeRequest { @@ -1773,7 +1773,7 @@ export const QueryClaimableFeesRequest = { }, toAmino(message: QueryClaimableFeesRequest): QueryClaimableFeesRequestAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = message.positionId !== BigInt(0) ? message.positionId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryClaimableFeesRequestAminoMsg): QueryClaimableFeesRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts index 0a25922632..031c606271 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool-model/tx.ts @@ -188,7 +188,7 @@ export const MsgCreateConcentratedPool = { obj.sender = message.sender === "" ? undefined : message.sender; obj.denom0 = message.denom0 === "" ? undefined : message.denom0; obj.denom1 = message.denom1 === "" ? undefined : message.denom1; - obj.tick_spacing = message.tickSpacing ? message.tickSpacing.toString() : undefined; + obj.tick_spacing = message.tickSpacing !== BigInt(0) ? message.tickSpacing.toString() : undefined; obj.exponent_at_price_one = message.exponentAtPriceOne === "" ? undefined : message.exponentAtPriceOne; obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; return obj; @@ -284,7 +284,7 @@ export const MsgCreateConcentratedPoolResponse = { }, toAmino(message: MsgCreateConcentratedPoolResponse): MsgCreateConcentratedPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateConcentratedPoolResponseAminoMsg): MsgCreateConcentratedPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts index b36b4b1f3f..47d52209a3 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/pool.ts @@ -294,13 +294,13 @@ export const Pool = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.incentives_address = message.incentivesAddress === "" ? undefined : message.incentivesAddress; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.current_tick_liquidity = message.currentTickLiquidity === "" ? undefined : message.currentTickLiquidity; obj.token0 = message.token0 === "" ? undefined : message.token0; obj.token1 = message.token1 === "" ? undefined : message.token1; obj.current_sqrt_price = message.currentSqrtPrice === "" ? undefined : message.currentSqrtPrice; obj.current_tick = message.currentTick === "" ? undefined : message.currentTick; - obj.tick_spacing = message.tickSpacing ? message.tickSpacing.toString() : undefined; + obj.tick_spacing = message.tickSpacing !== BigInt(0) ? message.tickSpacing.toString() : undefined; obj.exponent_at_price_one = message.exponentAtPriceOne === "" ? undefined : message.exponentAtPriceOne; obj.swap_fee = message.swapFee === "" ? undefined : message.swapFee; obj.last_liquidity_update = message.lastLiquidityUpdate ? Timestamp.toAmino(toTimestamp(message.lastLiquidityUpdate)) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts index 6979c3ce0a..5d32d51c16 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/position.ts @@ -213,11 +213,11 @@ export const Position = { }, toAmino(message: Position): PositionAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = message.positionId !== BigInt(0) ? message.positionId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.lower_tick = message.lowerTick ? message.lowerTick.toString() : undefined; - obj.upper_tick = message.upperTick ? message.upperTick.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.lower_tick = message.lowerTick !== BigInt(0) ? message.lowerTick.toString() : undefined; + obj.upper_tick = message.upperTick !== BigInt(0) ? message.upperTick.toString() : undefined; obj.join_time = message.joinTime ? Timestamp.toAmino(toTimestamp(message.joinTime)) : undefined; obj.liquidity = message.liquidity === "" ? undefined : message.liquidity; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts index 6a4285d455..4653ddcd7a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.ts @@ -372,10 +372,10 @@ export const MsgCreatePosition = { }, toAmino(message: MsgCreatePosition): MsgCreatePositionAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lower_tick = message.lowerTick ? message.lowerTick.toString() : undefined; - obj.upper_tick = message.upperTick ? message.upperTick.toString() : undefined; + obj.lower_tick = message.lowerTick !== BigInt(0) ? message.lowerTick.toString() : undefined; + obj.upper_tick = message.upperTick !== BigInt(0) ? message.upperTick.toString() : undefined; obj.token_desired0 = message.tokenDesired0 ? Coin.toAmino(message.tokenDesired0) : undefined; obj.token_desired1 = message.tokenDesired1 ? Coin.toAmino(message.tokenDesired1) : undefined; obj.token_min_amount0 = message.tokenMinAmount0 === "" ? undefined : message.tokenMinAmount0; @@ -537,7 +537,7 @@ export const MsgCreatePositionResponse = { }, toAmino(message: MsgCreatePositionResponse): MsgCreatePositionResponseAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = message.positionId !== BigInt(0) ? message.positionId.toString() : undefined; obj.amount0 = message.amount0 === "" ? undefined : message.amount0; obj.amount1 = message.amount1 === "" ? undefined : message.amount1; obj.join_time = message.joinTime ? Timestamp.toAmino(toTimestamp(message.joinTime)) : undefined; @@ -667,7 +667,7 @@ export const MsgWithdrawPosition = { }, toAmino(message: MsgWithdrawPosition): MsgWithdrawPositionAmino { const obj: any = {}; - obj.position_id = message.positionId ? message.positionId.toString() : undefined; + obj.position_id = message.positionId !== BigInt(0) ? message.positionId.toString() : undefined; obj.sender = message.sender === "" ? undefined : message.sender; obj.liquidity_amount = message.liquidityAmount === "" ? undefined : message.liquidityAmount; return obj; @@ -1438,7 +1438,7 @@ export const MsgCreateIncentive = { }, toAmino(message: MsgCreateIncentive): MsgCreateIncentiveAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.sender = message.sender === "" ? undefined : message.sender; obj.incentive_denom = message.incentiveDenom === "" ? undefined : message.incentiveDenom; obj.incentive_amount = message.incentiveAmount === "" ? undefined : message.incentiveAmount; @@ -1830,7 +1830,7 @@ export const MsgFungifyChargedPositionsResponse = { }, toAmino(message: MsgFungifyChargedPositionsResponse): MsgFungifyChargedPositionsResponseAmino { const obj: any = {}; - obj.new_position_id = message.newPositionId ? message.newPositionId.toString() : undefined; + obj.new_position_id = message.newPositionId !== BigInt(0) ? message.newPositionId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgFungifyChargedPositionsResponseAminoMsg): MsgFungifyChargedPositionsResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts index 7fe05b816a..12d605fdef 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/pool.ts @@ -136,8 +136,8 @@ export const CosmWasmPool = { const obj: any = {}; obj.pool_address = message.poolAddress === "" ? undefined : message.poolAddress; obj.contract_address = message.contractAddress === "" ? undefined : message.contractAddress; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: CosmWasmPoolAminoMsg): CosmWasmPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts index 5669bcd43c..327adf8a92 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/cosmwasmpool/v1beta1/model/tx.ts @@ -130,7 +130,7 @@ export const MsgCreateCosmWasmPool = { }, toAmino(message: MsgCreateCosmWasmPool): MsgCreateCosmWasmPoolAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.instantiate_msg = message.instantiateMsg ? base64FromBytes(message.instantiateMsg) : undefined; obj.sender = message.sender === "" ? undefined : message.sender; return obj; @@ -226,7 +226,7 @@ export const MsgCreateCosmWasmPoolResponse = { }, toAmino(message: MsgCreateCosmWasmPoolResponse): MsgCreateCosmWasmPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateCosmWasmPoolResponseAminoMsg): MsgCreateCosmWasmPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts index ebdd8bfaba..46bc729a2d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/genesis.ts @@ -258,10 +258,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts index 7e83a61bf7..8c7f220e90 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/epochs/query.ts @@ -378,7 +378,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts index 7551332558..7b2eee84d4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -736,7 +736,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts index 55a00278db..b29295b832 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -256,7 +256,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 23eb911cc2..776cf4e300 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -381,7 +381,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts index 4b28ae903e..dcbea7198a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.ts @@ -342,7 +342,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -484,7 +484,7 @@ export const MsgStableSwapAdjustScalingFactors = { toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts index dc29b093d9..5a36100be8 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/genesis.ts @@ -248,7 +248,7 @@ export const GenesisState = { } else { obj.pools = message.pools; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = message.nextPoolNumber !== BigInt(0) ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts index 589ab086db..7160035b8b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/query.ts @@ -450,7 +450,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -926,7 +926,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1020,7 +1020,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1230,7 +1230,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1466,7 +1466,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, @@ -1665,7 +1665,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1853,7 +1853,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2051,7 +2051,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2261,7 +2261,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2513,7 +2513,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; @@ -3017,7 +3017,7 @@ export const QuerySwapExactAmountInRequest = { toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); @@ -3266,7 +3266,7 @@ export const QuerySwapExactAmountOutRequest = { toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts index 6fb6a535c3..09b338ecac 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.ts @@ -392,7 +392,7 @@ export const MsgJoinPool = { toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); @@ -668,7 +668,7 @@ export const MsgExitPool = { toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); @@ -888,7 +888,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -1248,7 +1248,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, @@ -1641,7 +1641,7 @@ export const MsgJoinSwapExternAmountIn = { toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; @@ -1896,7 +1896,7 @@ export const MsgJoinSwapShareAmountOut = { toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; @@ -2152,7 +2152,7 @@ export const MsgExitSwapShareAmountIn = { toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; @@ -2392,7 +2392,7 @@ export const MsgExitSwapExternAmountOut = { toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts index a6ce4af12a..f0354c1b15 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v2/query.ts @@ -143,7 +143,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts index 0ef9325d65..3020a18db4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/gauge.ts @@ -269,7 +269,7 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { @@ -278,8 +278,8 @@ export const Gauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; + obj.filled_epochs = message.filledEpochs !== BigInt(0) ? message.filledEpochs.toString() : undefined; if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts index 1bece77cf0..08329d5f30 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/genesis.ts @@ -178,7 +178,7 @@ export const GenesisState = { } else { obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = message.lastGaugeId !== BigInt(0) ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts index 1cee9da980..c5cd878eda 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/query.ts @@ -472,7 +472,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1822,7 +1822,7 @@ export const RewardsEstRequest = { } else { obj.lock_ids = message.lockIds; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = message.endEpoch !== BigInt(0) ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts index c04852797a..18f415b567 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.ts @@ -239,7 +239,7 @@ export const MsgCreateGauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -445,7 +445,7 @@ export const MsgAddToGauge = { toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts index c2b3148c15..5ec5382776 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/genesis.ts @@ -131,7 +131,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = message.lastLockId !== BigInt(0) ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts index 64626a76c0..42c725c29c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/lock.ts @@ -311,7 +311,7 @@ export const PeriodLock = { }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; @@ -606,7 +606,7 @@ export const SyntheticLock = { }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; + obj.underlying_lock_id = message.underlyingLockId !== BigInt(0) ? message.underlyingLockId.toString() : undefined; obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts index b7c059655a..b8c0dbabb6 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/query.ts @@ -2455,7 +2455,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2643,7 +2643,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts index 0c2ef782fd..8a6ac989c2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.ts @@ -349,7 +349,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -680,7 +680,7 @@ export const MsgBeginUnlocking = { toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -906,7 +906,7 @@ export const MsgExtendLockup = { toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1134,7 +1134,7 @@ export const MsgForceUnlock = { toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts index 01bd7f3c8a..a073e3bd93 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/genesis.ts @@ -127,7 +127,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = message.reductionStartedEpoch !== BigInt(0) ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts index fadb505e16..b737746cdf 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/mint/v1beta1/mint.ts @@ -671,7 +671,7 @@ export const Params = { obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs.toString() : undefined; obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { @@ -679,7 +679,7 @@ export const Params = { } else { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch !== BigInt(0) ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts index 2fd17937ef..52863699d5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/incentives.ts @@ -480,7 +480,7 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, @@ -607,8 +607,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts index 739daf3e0a..e5809a9867 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/pool-incentives/v1beta1/query.ts @@ -201,7 +201,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -431,7 +431,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; @@ -1143,9 +1143,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts index 9496c0fc59..181614ee58 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/genesis.ts @@ -245,7 +245,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.next_pool_id = message.nextPoolId ? message.nextPoolId.toString() : undefined; + obj.next_pool_id = message.nextPoolId !== BigInt(0) ? message.nextPoolId.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; if (message.poolRoutes) { obj.pool_routes = message.poolRoutes.map(e => e ? ModuleRoute.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts index 40050fc02c..fbfa4379d1 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/module_route.ts @@ -171,7 +171,7 @@ export const ModuleRoute = { toAmino(message: ModuleRoute): ModuleRouteAmino { const obj: any = {}; obj.pool_type = message.poolType === 0 ? undefined : message.poolType; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: ModuleRouteAminoMsg): ModuleRoute { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts index 07d1456e28..0f2e21361e 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/query.ts @@ -479,7 +479,7 @@ export const EstimateSwapExactAmountInRequest = { }, toAmino(message: EstimateSwapExactAmountInRequest): EstimateSwapExactAmountInRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); @@ -611,7 +611,7 @@ export const EstimateSinglePoolSwapExactAmountInRequest = { }, toAmino(message: EstimateSinglePoolSwapExactAmountInRequest): EstimateSinglePoolSwapExactAmountInRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; @@ -839,7 +839,7 @@ export const EstimateSwapExactAmountOutRequest = { }, toAmino(message: EstimateSwapExactAmountOutRequest): EstimateSwapExactAmountOutRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { @@ -971,7 +971,7 @@ export const EstimateSinglePoolSwapExactAmountOutRequest = { }, toAmino(message: EstimateSinglePoolSwapExactAmountOutRequest): EstimateSinglePoolSwapExactAmountOutRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; @@ -1234,7 +1234,7 @@ export const NumPoolsResponse = { }, toAmino(message: NumPoolsResponse): NumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: NumPoolsResponseAminoMsg): NumPoolsResponse { @@ -1328,7 +1328,7 @@ export const PoolRequest = { }, toAmino(message: PoolRequest): PoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: PoolRequestAminoMsg): PoolRequest { @@ -1516,7 +1516,7 @@ export const AllPoolsRequest = { }, toAmino(message: AllPoolsRequest): AllPoolsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: AllPoolsRequestAminoMsg): AllPoolsRequest { @@ -1746,7 +1746,7 @@ export const SpotPriceRequest = { }, toAmino(message: SpotPriceRequest): SpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts index f10782535c..5f638d47b7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/swap_route.ts @@ -110,7 +110,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -221,7 +221,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts index 700133a96c..0e5ba65f58 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/genesis.ts @@ -318,17 +318,17 @@ export const GenesisState = { obj.base_denoms = message.baseDenoms; } obj.pool_weights = message.poolWeights ? PoolWeights.toAmino(message.poolWeights) : undefined; - obj.days_since_module_genesis = message.daysSinceModuleGenesis ? message.daysSinceModuleGenesis.toString() : undefined; + obj.days_since_module_genesis = message.daysSinceModuleGenesis !== BigInt(0) ? message.daysSinceModuleGenesis.toString() : undefined; if (message.developerFees) { obj.developer_fees = message.developerFees.map(e => e ? Coin.toAmino(e) : undefined); } else { obj.developer_fees = message.developerFees; } - obj.latest_block_height = message.latestBlockHeight ? message.latestBlockHeight.toString() : undefined; + obj.latest_block_height = message.latestBlockHeight !== BigInt(0) ? message.latestBlockHeight.toString() : undefined; obj.developer_address = message.developerAddress === "" ? undefined : message.developerAddress; - obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; - obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; - obj.point_count_for_block = message.pointCountForBlock ? message.pointCountForBlock.toString() : undefined; + obj.max_pool_points_per_block = message.maxPoolPointsPerBlock !== BigInt(0) ? message.maxPoolPointsPerBlock.toString() : undefined; + obj.max_pool_points_per_tx = message.maxPoolPointsPerTx !== BigInt(0) ? message.maxPoolPointsPerTx.toString() : undefined; + obj.point_count_for_block = message.pointCountForBlock !== BigInt(0) ? message.pointCountForBlock.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts index ae21deb630..c33bed0152 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/protorev.ts @@ -508,7 +508,7 @@ export const Trade = { }, toAmino(message: Trade): TradeAmino { const obj: any = {}; - obj.pool = message.pool ? message.pool.toString() : undefined; + obj.pool = message.pool !== BigInt(0) ? message.pool.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; obj.token_out = message.tokenOut === "" ? undefined : message.tokenOut; return obj; @@ -793,9 +793,9 @@ export const PoolWeights = { }, toAmino(message: PoolWeights): PoolWeightsAmino { const obj: any = {}; - obj.stable_weight = message.stableWeight ? message.stableWeight.toString() : undefined; - obj.balancer_weight = message.balancerWeight ? message.balancerWeight.toString() : undefined; - obj.concentrated_weight = message.concentratedWeight ? message.concentratedWeight.toString() : undefined; + obj.stable_weight = message.stableWeight !== BigInt(0) ? message.stableWeight.toString() : undefined; + obj.balancer_weight = message.balancerWeight !== BigInt(0) ? message.balancerWeight.toString() : undefined; + obj.concentrated_weight = message.concentratedWeight !== BigInt(0) ? message.concentratedWeight.toString() : undefined; return obj; }, fromAminoMsg(object: PoolWeightsAminoMsg): PoolWeights { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts index d46067205f..f1a6ef31bf 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/query.ts @@ -2382,7 +2382,7 @@ export const QueryGetProtoRevMaxPoolPointsPerBlockResponse = { }, toAmino(message: QueryGetProtoRevMaxPoolPointsPerBlockResponse): QueryGetProtoRevMaxPoolPointsPerBlockResponseAmino { const obj: any = {}; - obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; + obj.max_pool_points_per_block = message.maxPoolPointsPerBlock !== BigInt(0) ? message.maxPoolPointsPerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGetProtoRevMaxPoolPointsPerBlockResponseAminoMsg): QueryGetProtoRevMaxPoolPointsPerBlockResponse { @@ -2549,7 +2549,7 @@ export const QueryGetProtoRevMaxPoolPointsPerTxResponse = { }, toAmino(message: QueryGetProtoRevMaxPoolPointsPerTxResponse): QueryGetProtoRevMaxPoolPointsPerTxResponseAmino { const obj: any = {}; - obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; + obj.max_pool_points_per_tx = message.maxPoolPointsPerTx !== BigInt(0) ? message.maxPoolPointsPerTx.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGetProtoRevMaxPoolPointsPerTxResponseAminoMsg): QueryGetProtoRevMaxPoolPointsPerTxResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts index 8fc8badb62..ed44edea78 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.ts @@ -830,7 +830,7 @@ export const MsgSetMaxPoolPointsPerTx = { toAmino(message: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.max_pool_points_per_tx = message.maxPoolPointsPerTx ? message.maxPoolPointsPerTx.toString() : undefined; + obj.max_pool_points_per_tx = message.maxPoolPointsPerTx !== BigInt(0) ? message.maxPoolPointsPerTx.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSetMaxPoolPointsPerTxAminoMsg): MsgSetMaxPoolPointsPerTx { @@ -1014,7 +1014,7 @@ export const MsgSetMaxPoolPointsPerBlock = { toAmino(message: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.max_pool_points_per_block = message.maxPoolPointsPerBlock ? message.maxPoolPointsPerBlock.toString() : undefined; + obj.max_pool_points_per_block = message.maxPoolPointsPerBlock !== BigInt(0) ? message.maxPoolPointsPerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSetMaxPoolPointsPerBlockAminoMsg): MsgSetMaxPoolPointsPerBlock { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts index 8d953228d9..ed423009b5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/query.ts @@ -1187,7 +1187,7 @@ export const SuperfluidIntermediaryAccountInfo = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -1497,7 +1497,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts index 228eff1637..c714e8ef0a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/superfluid.ts @@ -385,7 +385,7 @@ export const SuperfluidIntermediaryAccount = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -511,7 +511,7 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; return obj; @@ -768,7 +768,7 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts index e6c9a84325..21692ec61f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.ts @@ -236,7 +236,7 @@ export const MsgSuperfluidDelegate = { toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, @@ -421,7 +421,7 @@ export const MsgSuperfluidUndelegate = { toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -605,7 +605,7 @@ export const MsgSuperfluidUnbondLock = { toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -910,7 +910,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1021,7 +1021,7 @@ export const MsgUnPoolWhitelistedPool = { toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts index 37dc784e6d..ed52e74842 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/query.ts @@ -207,7 +207,7 @@ export const ArithmeticTwapRequest = { }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; @@ -447,7 +447,7 @@ export const ArithmeticTwapToNowRequest = { }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts index 3daf84b133..24298d3669 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/twap/v1beta1/twap_record.ts @@ -278,7 +278,7 @@ export const TwapRecord = { }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height.toString() : "0"; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts index afb398278d..d2ed1dbbd5 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/feetoken.ts @@ -111,7 +111,7 @@ export const FeeToken = { toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts index 465ebbd344..bafe35bc59 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/txfees/v1beta1/query.ts @@ -449,7 +449,7 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, @@ -638,7 +638,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts index 6526b20f1b..517c63ba35 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.ts @@ -1168,7 +1168,7 @@ export const MsgDelegateBondedTokens = { toAmino(message: MsgDelegateBondedTokens): MsgDelegateBondedTokensAmino { const obj: any = {}; obj.delegator = message.delegator === "" ? undefined : message.delegator; - obj.lockID = message.lockID ? message.lockID.toString() : undefined; + obj.lockID = message.lockID !== BigInt(0) ? message.lockID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgDelegateBondedTokensAminoMsg): MsgDelegateBondedTokens { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts index 4a2ed2dec4..2b916b10f3 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/abci/types.ts @@ -1500,8 +1500,8 @@ export const RequestInfo = { toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; obj.version = message.version === "" ? undefined : message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1789,7 +1789,7 @@ export const RequestInitChain = { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -1927,7 +1927,7 @@ export const RequestQuery = { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.path = message.path === "" ? undefined : message.path; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.prove = message.prove === false ? undefined : message.prove; return obj; }, @@ -2358,7 +2358,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -2717,7 +2717,7 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; @@ -3581,8 +3581,8 @@ export const ResponseInfo = { const obj: any = {}; obj.data = message.data === "" ? undefined : message.data; obj.version = message.version === "" ? undefined : message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; return obj; }, @@ -4056,11 +4056,11 @@ export const ResponseQuery = { obj.code = message.code === 0 ? undefined : message.code; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, @@ -4369,8 +4369,8 @@ export const ResponseCheckTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4586,8 +4586,8 @@ export const ResponseDeliverTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4840,7 +4840,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -5508,8 +5508,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -5997,7 +5997,7 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; @@ -6105,7 +6105,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -6210,7 +6210,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6469,9 +6469,9 @@ export const Evidence = { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6623,7 +6623,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; diff --git a/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts index f1e5065d68..7a59ba49bd 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/crypto/proof.ts @@ -204,8 +204,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); diff --git a/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts index a9137583ff..1e9018985a 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/libs/bits/types.ts @@ -113,7 +113,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts index 0b99e48fc4..bd031073e7 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/p2p/types.ts @@ -183,9 +183,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts index 61e21d689c..5ad23fab38 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/evidence.ts @@ -306,8 +306,8 @@ export const DuplicateVoteEvidence = { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -467,13 +467,13 @@ export const LightClientAttackEvidence = { toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts index 1d9f99501c..33988f99ba 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/params.ts @@ -382,9 +382,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs !== BigInt(0) ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -504,9 +504,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -692,7 +692,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -796,8 +796,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts index a83b356513..c632d5efed 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/types.ts @@ -959,7 +959,7 @@ export const Header = { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; @@ -1269,7 +1269,7 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -1417,7 +1417,7 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { @@ -1748,7 +1748,7 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; @@ -2100,9 +2100,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts b/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts index e3a1ffbaf7..1b2f53da01 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/types/validator.ts @@ -157,7 +157,7 @@ export const ValidatorSet = { obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -295,8 +295,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -401,7 +401,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts b/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts index e4b3f8b347..2df00a0513 100644 --- a/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputosmojs/tendermint/version/types.ts @@ -130,7 +130,7 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; obj.software = message.software === "" ? undefined : message.software; return obj; }, @@ -235,8 +235,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts index f273193c75..c64a4f2bef 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta1/audit.ts @@ -14,9 +14,9 @@ export interface ProviderProtoMsg { } /** Provider stores owner auditor and attributes details */ export interface ProviderAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface ProviderAminoMsg { type: "/akash.audit.v1beta1.Provider"; @@ -40,9 +40,9 @@ export interface AuditedAttributesProtoMsg { } /** Attributes */ export interface AuditedAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface AuditedAttributesAminoMsg { type: "/akash.audit.v1beta1.AuditedAttributes"; @@ -64,7 +64,7 @@ export interface AttributesResponseProtoMsg { } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } export interface AttributesResponseAminoMsg { type: "/akash.audit.v1beta1.AttributesResponse"; @@ -85,8 +85,8 @@ export interface AttributesFiltersProtoMsg { } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersAmino { - auditors?: string[]; - owners?: string[]; + auditors: string[]; + owners: string[]; } export interface AttributesFiltersAminoMsg { type: "/akash.audit.v1beta1.AttributesFilters"; @@ -109,9 +109,9 @@ export interface MsgSignProviderAttributesProtoMsg { } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface MsgSignProviderAttributesAminoMsg { type: "/akash.audit.v1beta1.MsgSignProviderAttributes"; @@ -149,9 +149,9 @@ export interface MsgDeleteProviderAttributesProtoMsg { } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesAmino { - owner?: string; - auditor?: string; - keys?: string[]; + owner: string; + auditor: string; + keys: string[]; } export interface MsgDeleteProviderAttributesAminoMsg { type: "/akash.audit.v1beta1.MsgDeleteProviderAttributes"; diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts index 75c2c1b455..95413f7774 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/audit.ts @@ -14,9 +14,9 @@ export interface ProviderProtoMsg { } /** Provider stores owner auditor and attributes details */ export interface ProviderAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface ProviderAminoMsg { type: "/akash.audit.v1beta2.Provider"; @@ -40,9 +40,9 @@ export interface AuditedAttributesProtoMsg { } /** Attributes */ export interface AuditedAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface AuditedAttributesAminoMsg { type: "/akash.audit.v1beta2.AuditedAttributes"; @@ -64,7 +64,7 @@ export interface AttributesResponseProtoMsg { } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } export interface AttributesResponseAminoMsg { type: "/akash.audit.v1beta2.AttributesResponse"; @@ -85,8 +85,8 @@ export interface AttributesFiltersProtoMsg { } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersAmino { - auditors?: string[]; - owners?: string[]; + auditors: string[]; + owners: string[]; } export interface AttributesFiltersAminoMsg { type: "/akash.audit.v1beta2.AttributesFilters"; @@ -109,9 +109,9 @@ export interface MsgSignProviderAttributesProtoMsg { } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface MsgSignProviderAttributesAminoMsg { type: "/akash.audit.v1beta2.MsgSignProviderAttributes"; @@ -149,9 +149,9 @@ export interface MsgDeleteProviderAttributesProtoMsg { } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesAmino { - owner?: string; - auditor?: string; - keys?: string[]; + owner: string; + auditor: string; + keys: string[]; } export interface MsgDeleteProviderAttributesAminoMsg { type: "/akash.audit.v1beta2.MsgDeleteProviderAttributes"; diff --git a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts index 07509ab649..944a7d48b7 100644 --- a/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/audit/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by audit module */ export interface GenesisStateAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.audit.v1beta2.GenesisState"; diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts index 8bd1d886d1..294068604d 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta1/attribute.ts @@ -48,9 +48,9 @@ export interface SignedByProtoMsg { */ export interface SignedByAmino { /** all_of all keys in this list must have signed attributes */ - all_of?: string[]; + all_of: string[]; /** any_of at least of of the keys from the list must have signed attributes */ - any_of?: string[]; + any_of: string[]; } export interface SignedByAminoMsg { type: "/akash.base.v1beta1.SignedBy"; @@ -80,9 +80,9 @@ export interface PlacementRequirementsProtoMsg { /** PlacementRequirements */ export interface PlacementRequirementsAmino { /** SignedBy list of keys that tenants expect to have signatures from */ - signed_by?: SignedByAmino; + signed_by: SignedByAmino; /** Attribute list of attributes tenant expects from the provider */ - attributes?: AttributeAmino[]; + attributes: AttributeAmino[]; } export interface PlacementRequirementsAminoMsg { type: "/akash.base.v1beta1.PlacementRequirements"; @@ -302,7 +302,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts index cb4999381b..b1013b737f 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta1/resource.ts @@ -38,7 +38,7 @@ export interface MemoryProtoMsg { } /** Memory stores resource quantity and memory attributes */ export interface MemoryAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface MemoryAminoMsg { @@ -61,7 +61,7 @@ export interface StorageProtoMsg { } /** Storage stores resource quantity and storage attributes */ export interface StorageAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface StorageAminoMsg { @@ -95,7 +95,7 @@ export interface ResourceUnitsAmino { cpu?: CPUAmino; memory?: MemoryAmino; storage?: StorageAmino; - endpoints?: EndpointAmino[]; + endpoints: EndpointAmino[]; } export interface ResourceUnitsAminoMsg { type: "/akash.base.v1beta1.ResourceUnits"; @@ -245,7 +245,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -324,7 +324,7 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts index c989ece6bf..e86d3ce98e 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/attribute.ts @@ -48,9 +48,9 @@ export interface SignedByProtoMsg { */ export interface SignedByAmino { /** all_of all keys in this list must have signed attributes */ - all_of?: string[]; + all_of: string[]; /** any_of at least of of the keys from the list must have signed attributes */ - any_of?: string[]; + any_of: string[]; } export interface SignedByAminoMsg { type: "/akash.base.v1beta2.SignedBy"; @@ -80,9 +80,9 @@ export interface PlacementRequirementsProtoMsg { /** PlacementRequirements */ export interface PlacementRequirementsAmino { /** SignedBy list of keys that tenants expect to have signatures from */ - signed_by?: SignedByAmino; + signed_by: SignedByAmino; /** Attribute list of attributes tenant expects from the provider */ - attributes?: AttributeAmino[]; + attributes: AttributeAmino[]; } export interface PlacementRequirementsAminoMsg { type: "/akash.base.v1beta2.PlacementRequirements"; @@ -302,7 +302,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts index bbc058e325..4e0aba56ab 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/endpoint.ts @@ -55,7 +55,7 @@ export interface EndpointProtoMsg { /** Endpoint describes a publicly accessible IP service */ export interface EndpointAmino { kind?: Endpoint_Kind; - sequence_number?: number; + sequence_number: number; } export interface EndpointAminoMsg { type: "/akash.base.v1beta2.Endpoint"; diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts index 4f89d3a89d..cbe93378ef 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resource.ts @@ -37,7 +37,7 @@ export interface MemoryProtoMsg { } /** Memory stores resource quantity and memory attributes */ export interface MemoryAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface MemoryAminoMsg { @@ -61,8 +61,8 @@ export interface StorageProtoMsg { } /** Storage stores resource quantity and storage attributes */ export interface StorageAmino { - name?: string; - quantity?: ResourceValueAmino; + name: string; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface StorageAminoMsg { @@ -209,7 +209,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -300,7 +300,7 @@ export const Storage = { toAmino(message: Storage): StorageAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts index 5f15ef50c0..8305acaaa4 100644 --- a/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputsign/akash/base/v1beta2/resourceunits.ts @@ -25,7 +25,7 @@ export interface ResourceUnitsAmino { cpu?: CPUAmino; memory?: MemoryAmino; storage?: StorageAmino[]; - endpoints?: EndpointAmino[]; + endpoints: EndpointAmino[]; } export interface ResourceUnitsAminoMsg { type: "/akash.base.v1beta2.ResourceUnits"; diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts index 1a2cb550ab..a65d230171 100644 --- a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/cert.ts @@ -54,8 +54,8 @@ export interface CertificateIDProtoMsg { } /** CertificateID stores owner and sequence number */ export interface CertificateIDAmino { - owner?: string; - serial?: string; + owner: string; + serial: string; } export interface CertificateIDAminoMsg { type: "/akash.cert.v1beta2.CertificateID"; @@ -78,9 +78,9 @@ export interface CertificateProtoMsg { } /** Certificate stores state, certificate and it's public key */ export interface CertificateAmino { - state?: Certificate_State; - cert?: string; - pubkey?: string; + state: Certificate_State; + cert: string; + pubkey: string; } export interface CertificateAminoMsg { type: "/akash.cert.v1beta2.Certificate"; @@ -104,9 +104,9 @@ export interface CertificateFilterProtoMsg { } /** CertificateFilter defines filters used to filter certificates */ export interface CertificateFilterAmino { - owner?: string; - serial?: string; - state?: string; + owner: string; + serial: string; + state: string; } export interface CertificateFilterAminoMsg { type: "/akash.cert.v1beta2.CertificateFilter"; @@ -130,9 +130,9 @@ export interface MsgCreateCertificateProtoMsg { } /** MsgCreateCertificate defines an SDK message for creating certificate */ export interface MsgCreateCertificateAmino { - owner?: string; - cert?: string; - pubkey?: string; + owner: string; + cert: string; + pubkey: string; } export interface MsgCreateCertificateAminoMsg { type: "/akash.cert.v1beta2.MsgCreateCertificate"; @@ -168,7 +168,7 @@ export interface MsgRevokeCertificateProtoMsg { } /** MsgRevokeCertificate defines an SDK message for revoking certificate */ export interface MsgRevokeCertificateAmino { - id?: CertificateIDAmino; + id: CertificateIDAmino; } export interface MsgRevokeCertificateAminoMsg { type: "/akash.cert.v1beta2.MsgRevokeCertificate"; @@ -624,7 +624,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.toAmino(CertificateID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts index e45f7ee3be..fbe1f3bab7 100644 --- a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisCertificateProtoMsg { } /** GenesisCertificate defines certificate entry at genesis */ export interface GenesisCertificateAmino { - owner?: string; - certificate?: CertificateAmino; + owner: string; + certificate: CertificateAmino; } export interface GenesisCertificateAminoMsg { type: "/akash.cert.v1beta2.GenesisCertificate"; @@ -35,7 +35,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by cert module */ export interface GenesisStateAmino { - certificates?: GenesisCertificateAmino[]; + certificates: GenesisCertificateAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.cert.v1beta2.GenesisState"; @@ -103,7 +103,7 @@ export const GenesisCertificate = { toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; obj.owner = message.owner ?? ""; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { diff --git a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts index 84eea06a9e..6686991ab6 100644 --- a/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/cert/v1beta2/query.ts @@ -14,8 +14,8 @@ export interface CertificateResponseProtoMsg { } /** CertificateResponse contains a single X509 certificate and its serial number */ export interface CertificateResponseAmino { - certificate?: CertificateAmino; - serial?: string; + certificate: CertificateAmino; + serial: string; } export interface CertificateResponseAminoMsg { type: "/akash.cert.v1beta2.CertificateResponse"; @@ -129,7 +129,7 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); obj.serial = message.serial ?? ""; return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/authz.ts index 6757f14cc7..19a44e3743 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/authz.ts @@ -26,7 +26,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino | undefined; + spend_limit: CoinAmino | undefined; } export interface DepositDeploymentAuthorizationAminoMsg { type: "/akash.deployment.v1beta1.DepositDeploymentAuthorization"; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.ts index 415966077f..f1e6b67191 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/deployment.ts @@ -61,10 +61,10 @@ export interface MsgCreateDeploymentProtoMsg { } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentAmino { - id?: DeploymentIDAmino | undefined; - groups?: GroupSpecAmino[]; - version?: string; - deposit?: CoinAmino | undefined; + id: DeploymentIDAmino | undefined; + groups: GroupSpecAmino[]; + version: string; + deposit: CoinAmino | undefined; } export interface MsgCreateDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgCreateDeployment"; @@ -102,8 +102,8 @@ export interface MsgDepositDeploymentProtoMsg { } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentAmino { - id?: DeploymentIDAmino | undefined; - amount?: CoinAmino | undefined; + id: DeploymentIDAmino | undefined; + amount: CoinAmino | undefined; } export interface MsgDepositDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgDepositDeployment"; @@ -140,9 +140,9 @@ export interface MsgUpdateDeploymentProtoMsg { } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentAmino { - id?: DeploymentIDAmino | undefined; - groups?: GroupSpecAmino[]; - version?: string; + id: DeploymentIDAmino | undefined; + groups: GroupSpecAmino[]; + version: string; } export interface MsgUpdateDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgUpdateDeployment"; @@ -178,7 +178,7 @@ export interface MsgCloseDeploymentProtoMsg { } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentAmino { - id?: DeploymentIDAmino | undefined; + id: DeploymentIDAmino | undefined; } export interface MsgCloseDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgCloseDeployment"; @@ -213,8 +213,8 @@ export interface DeploymentIDProtoMsg { } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDAmino { - owner?: string; - dseq?: string; + owner: string; + dseq: string; } export interface DeploymentIDAminoMsg { type: "/akash.deployment.v1beta1.DeploymentID"; @@ -238,9 +238,9 @@ export interface DeploymentProtoMsg { } /** Deployment stores deploymentID, state and version details */ export interface DeploymentAmino { - deployment_id?: DeploymentIDAmino | undefined; - state?: Deployment_State; - version?: string; + deployment_id: DeploymentIDAmino | undefined; + state: Deployment_State; + version: string; created_at?: string; } export interface DeploymentAminoMsg { @@ -266,9 +266,9 @@ export interface DeploymentFiltersProtoMsg { } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersAmino { - owner?: string; - dseq?: string; - state?: string; + owner: string; + dseq: string; + state: string; } export interface DeploymentFiltersAminoMsg { type: "/akash.deployment.v1beta1.DeploymentFilters"; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/genesis.ts index 550855e76a..8043e23794 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/genesis.ts @@ -15,8 +15,8 @@ export interface GenesisDeploymentProtoMsg { } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentAmino { - deployment?: DeploymentAmino | undefined; - groups?: GroupAmino[]; + deployment: DeploymentAmino | undefined; + groups: GroupAmino[]; } export interface GenesisDeploymentAminoMsg { type: "/akash.deployment.v1beta1.GenesisDeployment"; @@ -38,8 +38,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - deployments?: GenesisDeploymentAmino[]; - params?: ParamsAmino | undefined; + deployments: GenesisDeploymentAmino[]; + params: ParamsAmino | undefined; } export interface GenesisStateAminoMsg { type: "/akash.deployment.v1beta1.GenesisState"; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/group.ts index 1763faba22..bfaa69f191 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/group.ts @@ -70,7 +70,7 @@ export interface MsgCloseGroupProtoMsg { } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupAmino { - id?: GroupIDAmino | undefined; + id: GroupIDAmino | undefined; } export interface MsgCloseGroupAminoMsg { type: "/akash.deployment.v1beta1.MsgCloseGroup"; @@ -104,7 +104,7 @@ export interface MsgPauseGroupProtoMsg { } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupAmino { - id?: GroupIDAmino | undefined; + id: GroupIDAmino | undefined; } export interface MsgPauseGroupAminoMsg { type: "/akash.deployment.v1beta1.MsgPauseGroup"; @@ -138,7 +138,7 @@ export interface MsgStartGroupProtoMsg { } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupAmino { - id?: GroupIDAmino | undefined; + id: GroupIDAmino | undefined; } export interface MsgStartGroupAminoMsg { type: "/akash.deployment.v1beta1.MsgStartGroup"; @@ -174,9 +174,9 @@ export interface GroupIDProtoMsg { } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDAmino { - owner?: string; - dseq?: string; - gseq?: number; + owner: string; + dseq: string; + gseq: number; } export interface GroupIDAminoMsg { type: "/akash.deployment.v1beta1.GroupID"; @@ -200,9 +200,9 @@ export interface GroupSpecProtoMsg { } /** GroupSpec stores group specifications */ export interface GroupSpecAmino { - name?: string; - requirements?: PlacementRequirementsAmino | undefined; - resources?: ResourceAmino[]; + name: string; + requirements: PlacementRequirementsAmino | undefined; + resources: ResourceAmino[]; } export interface GroupSpecAminoMsg { type: "/akash.deployment.v1beta1.GroupSpec"; @@ -227,9 +227,9 @@ export interface GroupProtoMsg { } /** Group stores group id, state and specifications of group */ export interface GroupAmino { - group_id?: GroupIDAmino | undefined; - state?: Group_State; - group_spec?: GroupSpecAmino | undefined; + group_id: GroupIDAmino | undefined; + state: Group_State; + group_spec: GroupSpecAmino | undefined; created_at?: string; } export interface GroupAminoMsg { @@ -255,9 +255,9 @@ export interface ResourceProtoMsg { } /** Resource stores unit, total count and price of resource */ export interface ResourceAmino { - resources?: ResourceUnitsAmino | undefined; - count?: number; - price?: CoinAmino | undefined; + resources: ResourceUnitsAmino | undefined; + count: number; + price: CoinAmino | undefined; } export interface ResourceAminoMsg { type: "/akash.deployment.v1beta1.Resource"; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/params.ts index 7a2492aa39..cb4724e5ad 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/params.ts @@ -12,7 +12,7 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { - deployment_min_deposit?: CoinAmino | undefined; + deployment_min_deposit: CoinAmino | undefined; } export interface ParamsAminoMsg { type: "/akash.deployment.v1beta1.Params"; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.ts index 83e25b02e8..82565b7d2c 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta1/query.ts @@ -85,8 +85,8 @@ export interface QueryDeploymentResponseProtoMsg { } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ export interface QueryDeploymentResponseAmino { - deployment?: DeploymentAmino | undefined; - groups?: GroupAmino[]; + deployment: DeploymentAmino | undefined; + groups: GroupAmino[]; escrow_account?: AccountAmino | undefined; } export interface QueryDeploymentResponseAminoMsg { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts index a61da08414..d2f03ddac8 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/authz.ts @@ -26,7 +26,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino; + spend_limit: CoinAmino; } export interface DepositDeploymentAuthorizationAminoMsg { type: "/akash.deployment.v1beta2.DepositDeploymentAuthorization"; @@ -85,7 +85,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts index 5fe1ad51e3..032dddb4f6 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deployment.ts @@ -54,8 +54,8 @@ export interface DeploymentIDProtoMsg { } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDAmino { - owner?: string; - dseq?: string; + owner: string; + dseq: string; } export interface DeploymentIDAminoMsg { type: "/akash.deployment.v1beta2.DeploymentID"; @@ -79,9 +79,9 @@ export interface DeploymentProtoMsg { } /** Deployment stores deploymentID, state and version details */ export interface DeploymentAmino { - deployment_id?: DeploymentIDAmino; - state?: Deployment_State; - version?: string; + deployment_id: DeploymentIDAmino; + state: Deployment_State; + version: string; created_at?: string; } export interface DeploymentAminoMsg { @@ -107,9 +107,9 @@ export interface DeploymentFiltersProtoMsg { } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersAmino { - owner?: string; - dseq?: string; - state?: string; + owner: string; + dseq: string; + state: string; } export interface DeploymentFiltersAminoMsg { type: "/akash.deployment.v1beta2.DeploymentFilters"; @@ -279,10 +279,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts index 198a9ed0a2..5b3eda4af7 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/deploymentmsg.ts @@ -19,12 +19,12 @@ export interface MsgCreateDeploymentProtoMsg { } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; - deposit?: CoinAmino; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; + deposit: CoinAmino; /** Depositor pays for the deposit */ - depositor?: string; + depositor: string; } export interface MsgCreateDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgCreateDeployment"; @@ -65,10 +65,10 @@ export interface MsgDepositDeploymentProtoMsg { } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentAmino { - id?: DeploymentIDAmino; - amount?: CoinAmino; + id: DeploymentIDAmino; + amount: CoinAmino; /** Depositor pays for the deposit */ - depositor?: string; + depositor: string; } export interface MsgDepositDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgDepositDeployment"; @@ -105,8 +105,8 @@ export interface MsgUpdateDeploymentProtoMsg { } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentAmino { - id?: DeploymentIDAmino; - version?: string; + id: DeploymentIDAmino; + version: string; } export interface MsgUpdateDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgUpdateDeployment"; @@ -141,7 +141,7 @@ export interface MsgCloseDeploymentProtoMsg { } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentAmino { - id?: DeploymentIDAmino; + id: DeploymentIDAmino; } export interface MsgCloseDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgCloseDeployment"; @@ -255,14 +255,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -402,8 +402,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -530,7 +530,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, @@ -646,7 +646,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts index f8e57c6429..001f418651 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/genesis.ts @@ -15,8 +15,8 @@ export interface GenesisDeploymentProtoMsg { } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; } export interface GenesisDeploymentAminoMsg { type: "/akash.deployment.v1beta2.GenesisDeployment"; @@ -38,8 +38,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - deployments?: GenesisDeploymentAmino[]; - params?: ParamsAmino; + deployments: GenesisDeploymentAmino[]; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.deployment.v1beta2.GenesisState"; @@ -105,7 +105,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -189,7 +189,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts index eb194dc201..7a07799d70 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/group.ts @@ -72,9 +72,9 @@ export interface GroupProtoMsg { } /** Group stores group id, state and specifications of group */ export interface GroupAmino { - group_id?: GroupIDAmino; - state?: Group_State; - group_spec?: GroupSpecAmino; + group_id: GroupIDAmino; + state: Group_State; + group_spec: GroupSpecAmino; created_at?: string; } export interface GroupAminoMsg { @@ -171,10 +171,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts index 8d6dc518bb..e1f896a492 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupid.ts @@ -13,9 +13,9 @@ export interface GroupIDProtoMsg { } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDAmino { - owner?: string; - dseq?: string; - gseq?: number; + owner: string; + dseq: string; + gseq: number; } export interface GroupIDAminoMsg { type: "/akash.deployment.v1beta2.GroupID"; diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts index 784438a380..dfee69b8f1 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupmsg.ts @@ -12,7 +12,7 @@ export interface MsgCloseGroupProtoMsg { } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgCloseGroupAminoMsg { type: "/akash.deployment.v1beta2.MsgCloseGroup"; @@ -46,7 +46,7 @@ export interface MsgPauseGroupProtoMsg { } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgPauseGroupAminoMsg { type: "/akash.deployment.v1beta2.MsgPauseGroup"; @@ -80,7 +80,7 @@ export interface MsgStartGroupProtoMsg { } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgStartGroupAminoMsg { type: "/akash.deployment.v1beta2.MsgStartGroup"; @@ -150,7 +150,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -265,7 +265,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -380,7 +380,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts index 79cecb5c24..fd4dd14241 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/groupspec.ts @@ -15,9 +15,9 @@ export interface GroupSpecProtoMsg { } /** GroupSpec stores group specifications */ export interface GroupSpecAmino { - name?: string; - requirements?: PlacementRequirementsAmino; - resources?: ResourceAmino[]; + name: string; + requirements: PlacementRequirementsAmino; + resources: ResourceAmino[]; } export interface GroupSpecAminoMsg { type: "/akash.deployment.v1beta2.GroupSpec"; @@ -96,7 +96,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts index a3ba56bae8..4d0c3328a1 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/params.ts @@ -12,7 +12,7 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { - deployment_min_deposit?: CoinAmino; + deployment_min_deposit: CoinAmino; } export interface ParamsAminoMsg { type: "/akash.deployment.v1beta2.Params"; @@ -68,7 +68,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts index 150f80537e..cebf7d8966 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/query.ts @@ -84,8 +84,8 @@ export interface QueryDeploymentResponseProtoMsg { } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ export interface QueryDeploymentResponseAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; escrow_account?: AccountAmino; } export interface QueryDeploymentResponseAminoMsg { @@ -429,7 +429,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts index cb1314511f..d8d66e68ef 100644 --- a/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputsign/akash/deployment/v1beta2/resource.ts @@ -15,9 +15,9 @@ export interface ResourceProtoMsg { } /** Resource stores unit, total count and price of resource */ export interface ResourceAmino { - resources?: ResourceUnitsAmino; - count?: number; - price?: DecCoinAmino; + resources: ResourceUnitsAmino; + count: number; + price: DecCoinAmino; } export interface ResourceAminoMsg { type: "/akash.deployment.v1beta2.Resource"; @@ -99,9 +99,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts index 24eb9edf33..979bdd5919 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateAmino { - accounts?: AccountAmino[]; - payments?: PaymentAmino[]; + accounts: AccountAmino[]; + payments: PaymentAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.escrow.v1beta1.GenesisState"; diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts index 00d9890dcc..b737a5c08b 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta1/types.ts @@ -111,8 +111,8 @@ export interface AccountIDProtoMsg { } /** AccountID is the account identifier */ export interface AccountIDAmino { - scope?: string; - xid?: string; + scope: string; + xid: string; } export interface AccountIDAminoMsg { type: "/akash.escrow.v1beta1.AccountID"; @@ -145,17 +145,17 @@ export interface AccountProtoMsg { /** Account stores state for an escrow account */ export interface AccountAmino { /** unique identifier for this escrow account */ - id?: AccountIDAmino; + id: AccountIDAmino; /** bech32 encoded account address of the owner of this escrow account */ - owner?: string; + owner: string; /** current state of this escrow account */ - state?: Account_State; + state: Account_State; /** unspent coins received from the owner's wallet */ - balance?: CoinAmino; + balance: CoinAmino; /** total coins spent by this account */ - transferred?: CoinAmino; + transferred: CoinAmino; /** block height at which this account was last settled */ - settled_at?: string; + settled_at: string; } export interface AccountAminoMsg { type: "/akash.escrow.v1beta1.Account"; @@ -186,13 +186,13 @@ export interface PaymentProtoMsg { } /** Payment stores state for a payment */ export interface PaymentAmino { - account_id?: AccountIDAmino; - payment_id?: string; - owner?: string; - state?: Payment_State; - rate?: CoinAmino; - balance?: CoinAmino; - withdrawn?: CoinAmino; + account_id: AccountIDAmino; + payment_id: string; + owner: string; + state: Payment_State; + rate: CoinAmino; + balance: CoinAmino; + withdrawn: CoinAmino; } export interface PaymentAminoMsg { type: "/akash.escrow.v1beta1.Payment"; @@ -390,11 +390,11 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.toAmino(Coin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, @@ -532,13 +532,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.toAmino(Coin.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts index 7ef7c18b3d..fc602e7bfe 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateAmino { - accounts?: AccountAmino[]; - payments?: FractionalPaymentAmino[]; + accounts: AccountAmino[]; + payments: FractionalPaymentAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.escrow.v1beta2.GenesisState"; diff --git a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts index a142b1f62c..64ae8b14b0 100644 --- a/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputsign/akash/escrow/v1beta2/types.ts @@ -111,8 +111,8 @@ export interface AccountIDProtoMsg { } /** AccountID is the account identifier */ export interface AccountIDAmino { - scope?: string; - xid?: string; + scope: string; + xid: string; } export interface AccountIDAminoMsg { type: "/akash.escrow.v1beta2.AccountID"; @@ -156,28 +156,28 @@ export interface AccountProtoMsg { /** Account stores state for an escrow account */ export interface AccountAmino { /** unique identifier for this escrow account */ - id?: AccountIDAmino; + id: AccountIDAmino; /** bech32 encoded account address of the owner of this escrow account */ - owner?: string; + owner: string; /** current state of this escrow account */ - state?: Account_State; + state: Account_State; /** unspent coins received from the owner's wallet */ - balance?: DecCoinAmino; + balance: DecCoinAmino; /** total coins spent by this account */ - transferred?: DecCoinAmino; + transferred: DecCoinAmino; /** block height at which this account was last settled */ - settled_at?: string; + settled_at: string; /** * bech32 encoded account address of the depositor. * If depositor is same as the owner, then any incoming coins are added to the Balance. * If depositor isn't same as the owner, then any incoming coins are added to the Funds. */ - depositor?: string; + depositor: string; /** * Funds are unspent coins received from the (non-Owner) Depositor's wallet. * If there are any funds, they should be spent before spending the Balance. */ - funds?: DecCoinAmino; + funds: DecCoinAmino; } export interface AccountAminoMsg { type: "/akash.escrow.v1beta2.Account"; @@ -210,13 +210,13 @@ export interface FractionalPaymentProtoMsg { } /** Payment stores state for a payment */ export interface FractionalPaymentAmino { - account_id?: AccountIDAmino; - payment_id?: string; - owner?: string; - state?: FractionalPayment_State; - rate?: DecCoinAmino; - balance?: DecCoinAmino; - withdrawn?: CoinAmino; + account_id: AccountIDAmino; + payment_id: string; + owner: string; + state: FractionalPayment_State; + rate: DecCoinAmino; + balance: DecCoinAmino; + withdrawn: CoinAmino; } export interface FractionalPaymentAminoMsg { type: "/akash.escrow.v1beta2.FractionalPayment"; @@ -438,14 +438,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.toAmino(DecCoin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; obj.depositor = message.depositor ?? ""; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -582,13 +582,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts index 9ee6751c01..7aa29f2a74 100644 --- a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - params?: ParamsAmino; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.inflation.v1beta2.GenesisState"; @@ -68,7 +68,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts index 370a2cbbb7..eb6743c1f9 100644 --- a/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/inflation/v1beta2/params.ts @@ -24,17 +24,17 @@ export interface ParamsProtoMsg { /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { /** InflationDecayFactor is the number of years it takes inflation to halve. */ - inflation_decay_factor?: string; + inflation_decay_factor: string; /** * InitialInflation is the rate at which inflation starts at genesis. * It is a decimal value in the range [0.0, 100.0]. */ - initial_inflation?: string; + initial_inflation: string; /** * Variance defines the fraction by which inflation can vary from ideal inflation in a block. * It is a decimal value in the range [0.0, 1.0]. */ - variance?: string; + variance: string; } export interface ParamsAminoMsg { type: "/akash.inflation.v1beta2.Params"; diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts index 627ed47dcf..734c204845 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/bid.ts @@ -72,10 +72,10 @@ export interface MsgCreateBidProtoMsg { } /** MsgCreateBid defines an SDK message for creating Bid */ export interface MsgCreateBidAmino { - order?: OrderIDAmino; - provider?: string; - price?: DecCoinAmino; - deposit?: CoinAmino; + order: OrderIDAmino; + provider: string; + price: DecCoinAmino; + deposit: CoinAmino; } export interface MsgCreateBidAminoMsg { type: "/akash.market.v1beta2.MsgCreateBid"; @@ -112,7 +112,7 @@ export interface MsgCloseBidProtoMsg { } /** MsgCloseBid defines an SDK message for closing bid */ export interface MsgCloseBidAmino { - bid_id?: BidIDAmino; + bid_id: BidIDAmino; } export interface MsgCloseBidAminoMsg { type: "/akash.market.v1beta2.MsgCloseBid"; @@ -156,11 +156,11 @@ export interface BidIDProtoMsg { * A successful bid becomes a Lease(ID). */ export interface BidIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; } export interface BidIDAminoMsg { type: "/akash.market.v1beta2.BidID"; @@ -190,9 +190,9 @@ export interface BidProtoMsg { } /** Bid stores BidID, state of bid and price */ export interface BidAmino { - bid_id?: BidIDAmino; - state?: Bid_State; - price?: DecCoinAmino; + bid_id: BidIDAmino; + state: Bid_State; + price: DecCoinAmino; created_at?: string; } export interface BidAminoMsg { @@ -221,12 +221,12 @@ export interface BidFiltersProtoMsg { } /** BidFilters defines flags for bid list filter */ export interface BidFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; + state: string; } export interface BidFiltersAminoMsg { type: "/akash.market.v1beta2.BidFilters"; @@ -324,10 +324,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.toAmino(OrderID.fromPartial({})); obj.provider = message.provider ?? ""; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -442,7 +442,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -707,10 +707,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts index c93771aa8d..cddbd22597 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/genesis.ts @@ -16,9 +16,9 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by market module */ export interface GenesisStateAmino { - orders?: OrderAmino[]; - leases?: LeaseAmino[]; - params?: ParamsAmino; + orders: OrderAmino[]; + leases: LeaseAmino[]; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.market.v1beta2.GenesisState"; @@ -104,7 +104,7 @@ export const GenesisState = { } else { obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts index 5755bc4dd4..ad70cffb52 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/lease.ts @@ -66,11 +66,11 @@ export interface LeaseIDProtoMsg { } /** LeaseID stores bid details of lease */ export interface LeaseIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; } export interface LeaseIDAminoMsg { type: "/akash.market.v1beta2.LeaseID"; @@ -98,9 +98,9 @@ export interface LeaseProtoMsg { } /** Lease stores LeaseID, state of lease and price */ export interface LeaseAmino { - lease_id?: LeaseIDAmino; - state?: Lease_State; - price?: DecCoinAmino; + lease_id: LeaseIDAmino; + state: Lease_State; + price: DecCoinAmino; created_at?: string; closed_on?: string; } @@ -131,12 +131,12 @@ export interface LeaseFiltersProtoMsg { } /** LeaseFilters defines flags for lease list filter */ export interface LeaseFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; + state: string; } export interface LeaseFiltersAminoMsg { type: "/akash.market.v1beta2.LeaseFilters"; @@ -161,7 +161,7 @@ export interface MsgCreateLeaseProtoMsg { } /** MsgCreateLease is sent to create a lease */ export interface MsgCreateLeaseAmino { - bid_id?: BidIDAmino; + bid_id: BidIDAmino; } export interface MsgCreateLeaseAminoMsg { type: "/akash.market.v1beta2.MsgCreateLease"; @@ -195,7 +195,7 @@ export interface MsgWithdrawLeaseProtoMsg { } /** MsgWithdrawLease defines an SDK message for closing bid */ export interface MsgWithdrawLeaseAmino { - bid_id?: LeaseIDAmino; + bid_id: LeaseIDAmino; } export interface MsgWithdrawLeaseAminoMsg { type: "/akash.market.v1beta2.MsgWithdrawLease"; @@ -229,7 +229,7 @@ export interface MsgCloseLeaseProtoMsg { } /** MsgCloseLease defines an SDK message for closing order */ export interface MsgCloseLeaseAmino { - lease_id?: LeaseIDAmino; + lease_id: LeaseIDAmino; } export interface MsgCloseLeaseAminoMsg { type: "/akash.market.v1beta2.MsgCloseLease"; @@ -462,11 +462,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn !== BigInt(0) ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -656,7 +656,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -771,7 +771,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -886,7 +886,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts index 132ef5bd1d..e5066ab15e 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/order.ts @@ -64,10 +64,10 @@ export interface OrderIDProtoMsg { } /** OrderID stores owner and all other seq numbers */ export interface OrderIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; + owner: string; + dseq: string; + gseq: number; + oseq: number; } export interface OrderIDAminoMsg { type: "/akash.market.v1beta2.OrderID"; @@ -93,9 +93,9 @@ export interface OrderProtoMsg { } /** Order stores orderID, state of order and other details */ export interface OrderAmino { - order_id?: OrderIDAmino; - state?: Order_State; - spec?: GroupSpecAmino; + order_id: OrderIDAmino; + state: Order_State; + spec: GroupSpecAmino; created_at?: string; } export interface OrderAminoMsg { @@ -123,11 +123,11 @@ export interface OrderFiltersProtoMsg { } /** OrderFilters defines flags for order list filter */ export interface OrderFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + state: string; } export interface OrderFiltersAminoMsg { type: "/akash.market.v1beta2.OrderFilters"; @@ -325,10 +325,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.toAmino(OrderID.fromPartial({})); obj.state = message.state ?? 0; - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { diff --git a/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts index 57cd4603d4..2e16b2cfd3 100644 --- a/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputsign/akash/market/v1beta2/params.ts @@ -13,8 +13,8 @@ export interface ParamsProtoMsg { } /** Params is the params for the x/market module */ export interface ParamsAmino { - bid_min_deposit?: CoinAmino; - order_max_bids?: number; + bid_min_deposit: CoinAmino; + order_max_bids: number; } export interface ParamsAminoMsg { type: "/akash.market.v1beta2.Params"; @@ -82,7 +82,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.toAmino(Coin.fromPartial({})); obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts index 3d588c7297..cec99228f5 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta1/provider.ts @@ -13,8 +13,8 @@ export interface ProviderInfoProtoMsg { } /** ProviderInfo */ export interface ProviderInfoAmino { - email?: string; - website?: string; + email: string; + website: string; } export interface ProviderInfoAminoMsg { type: "/akash.provider.v1beta1.ProviderInfo"; @@ -38,10 +38,10 @@ export interface MsgCreateProviderProtoMsg { } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgCreateProviderAminoMsg { type: "/akash.provider.v1beta1.MsgCreateProvider"; @@ -81,10 +81,10 @@ export interface MsgUpdateProviderProtoMsg { } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgUpdateProviderAminoMsg { type: "/akash.provider.v1beta1.MsgUpdateProvider"; @@ -121,7 +121,7 @@ export interface MsgDeleteProviderProtoMsg { } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderAmino { - owner?: string; + owner: string; } export interface MsgDeleteProviderAminoMsg { type: "/akash.provider.v1beta1.MsgDeleteProvider"; @@ -158,10 +158,10 @@ export interface ProviderProtoMsg { } /** Provider stores owner and host details */ export interface ProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface ProviderAminoMsg { type: "/akash.provider.v1beta1.Provider"; @@ -333,7 +333,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -486,7 +486,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -752,7 +752,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts index 8d356a90f4..feebc5a408 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by provider module */ export interface GenesisStateAmino { - providers?: ProviderAmino[]; + providers: ProviderAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.provider.v1beta2.GenesisState"; diff --git a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts index 59435fb758..628b9b28eb 100644 --- a/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputsign/akash/provider/v1beta2/provider.ts @@ -13,8 +13,8 @@ export interface ProviderInfoProtoMsg { } /** ProviderInfo */ export interface ProviderInfoAmino { - email?: string; - website?: string; + email: string; + website: string; } export interface ProviderInfoAminoMsg { type: "/akash.provider.v1beta2.ProviderInfo"; @@ -38,10 +38,10 @@ export interface MsgCreateProviderProtoMsg { } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgCreateProviderAminoMsg { type: "/akash.provider.v1beta2.MsgCreateProvider"; @@ -81,10 +81,10 @@ export interface MsgUpdateProviderProtoMsg { } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgUpdateProviderAminoMsg { type: "/akash.provider.v1beta2.MsgUpdateProvider"; @@ -121,7 +121,7 @@ export interface MsgDeleteProviderProtoMsg { } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderAmino { - owner?: string; + owner: string; } export interface MsgDeleteProviderAminoMsg { type: "/akash.provider.v1beta2.MsgDeleteProvider"; @@ -158,10 +158,10 @@ export interface ProviderProtoMsg { } /** Provider stores owner and host details */ export interface ProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface ProviderAminoMsg { type: "/akash.provider.v1beta2.Provider"; @@ -333,7 +333,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -486,7 +486,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -752,7 +752,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts index 2ae8e31382..0627d0e88b 100644 --- a/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputsign/cosmos/auth/v1beta1/auth.ts @@ -186,8 +186,8 @@ export const BaseAccount = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -407,11 +407,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts index 30ad603024..9a0aa5cc77 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/abci/v1beta1/abci.ts @@ -138,7 +138,7 @@ export interface ABCIMessageLogProtoMsg { } /** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ export interface ABCIMessageLogAmino { - msg_index?: number; + msg_index: number; log?: string; /** * Events contains a slice of Event objects that were emitted during some @@ -652,7 +652,7 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.txhash = message.txhash === "" ? undefined : message.txhash; obj.codespace = message.codespace === "" ? undefined : message.codespace; obj.code = message.code === 0 ? undefined : message.code; @@ -664,8 +664,8 @@ export const TxResponse = { obj.logs = message.logs; } obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { @@ -1015,8 +1015,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1508,11 +1508,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts index 9173ec4cef..371007ed7f 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/query/v1beta1/pagination.ts @@ -265,8 +265,8 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; obj.count_total = message.countTotal === false ? undefined : message.countTotal; obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; @@ -351,7 +351,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts index de5921491e..964df2aa93 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -321,7 +321,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; @@ -712,7 +712,7 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.height = message.height === 0 ? undefined : message.height; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts index a0abd17fef..9952dde2a4 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/store/v1beta1/commit_info.ts @@ -152,7 +152,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -322,7 +322,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts index 8ea8f7bc9d..0670214496 100644 --- a/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/base/tendermint/v1beta1/query.ts @@ -423,7 +423,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -517,7 +517,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -687,7 +687,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -803,8 +803,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -875,7 +875,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts index ddb9068488..c2b4ec8d77 100644 --- a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/capability.ts @@ -137,7 +137,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { diff --git a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts index 5422161ba2..8aba75de4c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/capability/v1beta1/genesis.ts @@ -121,7 +121,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -202,7 +202,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts index fc2b9003fc..28b1015173 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/distribution.ts @@ -334,7 +334,7 @@ export interface DelegatorStartingInfoProtoMsg { export interface DelegatorStartingInfoAmino { previous_period?: string; stake?: string; - height?: string; + height: string; } export interface DelegatorStartingInfoAminoMsg { type: "cosmos-sdk/DelegatorStartingInfo"; @@ -674,7 +674,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = message.rewards; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -898,7 +898,7 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; obj.fraction = message.fraction === "" ? undefined : message.fraction; return obj; }, @@ -1243,7 +1243,7 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; obj.stake = message.stake === "" ? undefined : message.stake; obj.height = message.height ? message.height.toString() : "0"; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts index fb6508ff92..8e7cb693b3 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/genesis.ts @@ -627,7 +627,7 @@ export const ValidatorHistoricalRewardsRecord = { toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -915,8 +915,8 @@ export const ValidatorSlashEventRecord = { toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts index f7bf3eb404..e3c08a9613 100644 --- a/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/distribution/v1beta1/query.ts @@ -1047,8 +1047,8 @@ export const QueryValidatorSlashesRequest = { toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts index 0e6de839c7..8629d48486 100644 --- a/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputsign/cosmos/evidence/v1beta1/evidence.ts @@ -121,9 +121,9 @@ export const Equivocation = { }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts index 4ed8f79637..878b839c5d 100644 --- a/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/genutil/v1beta1/genesis.ts @@ -13,7 +13,7 @@ export interface GenesisStateProtoMsg { /** GenesisState defines the raw genesis transaction in JSON. */ export interface GenesisStateAmino { /** gen_txs defines the genesis transactions. */ - gen_txs?: string[]; + gen_txs: string[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts index 5a2f7024b3..aceda8643c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/genesis.ts @@ -166,7 +166,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts index 4e5aca8097..bf0530ac91 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/gov.ts @@ -571,7 +571,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -745,7 +745,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -969,7 +969,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts index c61f31318d..d2d8f6bf5b 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/query.ts @@ -470,7 +470,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -815,7 +815,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -971,7 +971,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1307,7 +1307,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1463,7 +1463,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1620,7 +1620,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts index b0cafe4f7b..0655fa50dc 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1/tx.ts @@ -127,7 +127,7 @@ export interface MsgVoteProtoMsg { } /** MsgVote defines a message to cast a vote. */ export interface MsgVoteAmino { - proposal_id?: string; + proposal_id: string; voter?: string; option?: VoteOption; metadata?: string; @@ -170,7 +170,7 @@ export interface MsgVoteWeightedProtoMsg { } /** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeightedAmino { - proposal_id?: string; + proposal_id: string; voter?: string; options?: WeightedVoteOptionAmino[]; metadata?: string; @@ -212,7 +212,7 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { - proposal_id?: string; + proposal_id: string; depositor?: string; amount?: CoinAmino[]; } @@ -395,7 +395,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts index 24e06bd099..1fbb949655 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/genesis.ts @@ -166,7 +166,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts index 07b5539478..96b581df2c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/gov.ts @@ -351,7 +351,7 @@ export interface VoteProtoMsg { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface VoteAmino { - proposal_id?: string; + proposal_id: string; voter?: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries @@ -705,7 +705,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -872,7 +872,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts index 32e9998efb..476b84ce30 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/query.ts @@ -470,7 +470,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -815,7 +815,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -971,7 +971,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1307,7 +1307,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1463,7 +1463,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1620,7 +1620,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts index 6e5f6ec48c..fbe80718a2 100644 --- a/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/gov/v1beta1/tx.ts @@ -49,7 +49,7 @@ export interface MsgSubmitProposalResponseProtoMsg { } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponseAmino { - proposal_id?: string; + proposal_id: string; } export interface MsgSubmitProposalResponseAminoMsg { type: "cosmos-sdk/MsgSubmitProposalResponse"; @@ -119,7 +119,7 @@ export interface MsgVoteWeightedProtoMsg { * Since: cosmos-sdk 0.43 */ export interface MsgVoteWeightedAmino { - proposal_id?: string; + proposal_id: string; voter?: string; options?: WeightedVoteOptionAmino[]; } @@ -175,7 +175,7 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { - proposal_id?: string; + proposal_id: string; depositor?: string; amount?: CoinAmino[]; } @@ -439,7 +439,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts index 80b3becab3..7084fd4206 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/events.ts @@ -256,7 +256,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -327,7 +327,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -536,7 +536,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -607,7 +607,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -678,7 +678,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -760,7 +760,7 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.result = message.result === 0 ? undefined : message.result; return obj; }, @@ -843,7 +843,7 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts index 190ce70c9a..eb0992a890 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/genesis.ts @@ -194,7 +194,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -205,13 +205,13 @@ export const GenesisState = { } else { obj.group_members = message.groupMembers; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = message.groupPolicies; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts index 3a3b69dfed..21bb6f00ab 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/query.ts @@ -706,7 +706,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -1001,7 +1001,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1339,7 +1339,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1664,7 +1664,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -1985,7 +1985,7 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -2141,7 +2141,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2634,7 +2634,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts index 38209a3667..5e626bf23c 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/tx.ts @@ -919,7 +919,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -1011,7 +1011,7 @@ export const MsgUpdateGroupMembers = { toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1166,7 +1166,7 @@ export const MsgUpdateGroupAdmin = { toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, @@ -1317,7 +1317,7 @@ export const MsgUpdateGroupMetadata = { toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, @@ -1481,7 +1481,7 @@ export const MsgCreateGroupPolicy = { toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; @@ -1860,7 +1860,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, @@ -2409,7 +2409,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2491,7 +2491,7 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -2663,7 +2663,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; @@ -2805,7 +2805,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2945,7 +2945,7 @@ export const MsgLeaveGroup = { toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts index daf100bcaa..18a61663fc 100644 --- a/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputsign/cosmos/group/v1/types.ts @@ -1284,10 +1284,10 @@ export const GroupInfo = { }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1373,7 +1373,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1516,10 +1516,10 @@ export const GroupPolicyInfo = { toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1726,7 +1726,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { @@ -1735,8 +1735,8 @@ export const Proposal = { obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; @@ -1966,7 +1966,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; diff --git a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts index 1cad92e6f2..29322fc701 100644 --- a/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputsign/cosmos/mint/v1beta1/mint.ts @@ -263,7 +263,7 @@ export const Params = { obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts index 6064849d71..c16a018e21 100644 --- a/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/nft/v1beta1/query.ts @@ -433,7 +433,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -723,7 +723,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts index 75cc537c12..14d94bc21f 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/genesis.ts @@ -458,7 +458,7 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.missed = message.missed === false ? undefined : message.missed; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts index 3899ffd52c..f43d516797 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/slashing.ts @@ -215,11 +215,11 @@ export const ValidatorSigningInfo = { toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.start_height = message.startHeight !== BigInt(0) ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset !== BigInt(0) ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.missed_blocks_counter = message.missedBlocksCounter !== BigInt(0) ? message.missedBlocksCounter.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -336,7 +336,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = message.signedBlocksWindow !== BigInt(0) ? message.signedBlocksWindow.toString() : undefined; obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; diff --git a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts index 105bec6f30..87972e6806 100644 --- a/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/slashing/v1beta1/tx.ts @@ -11,7 +11,7 @@ export interface MsgUnjailProtoMsg { } /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjailAmino { - validator_addr?: string; + validator_addr: string; } export interface MsgUnjailAminoMsg { type: "cosmos-sdk/MsgUnjail"; diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts index b42d253f23..76f304ddc2 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/genesis.ts @@ -319,7 +319,7 @@ export const LastValidatorPower = { toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts index 8def391e81..070e12287e 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/query.ts @@ -2694,7 +2694,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts index f7af099879..be5d7ef149 100644 --- a/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputsign/cosmos/staking/v1beta1/staking.ts @@ -811,8 +811,8 @@ export interface PoolProtoMsg { * denomination. */ export interface PoolAmino { - not_bonded_tokens?: string; - bonded_tokens?: string; + not_bonded_tokens: string; + bonded_tokens: string; } export interface PoolAminoMsg { type: "cosmos-sdk/Pool"; @@ -1373,7 +1373,7 @@ export const Validator = { obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -2055,7 +2055,7 @@ export const UnbondingDelegationEntry = { }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; @@ -2162,7 +2162,7 @@ export const RedelegationEntry = { }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts index 9bdb78689d..7786fc840e 100644 --- a/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputsign/cosmos/tx/signing/v1beta1/signing.ts @@ -389,7 +389,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts index 196812a7cb..f47bff1506 100644 --- a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/service.ts @@ -1214,7 +1214,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts index e6d0cdf1f3..9072a6c7d2 100644 --- a/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/tx/v1beta1/tx.ts @@ -1034,7 +1034,7 @@ export const SignDoc = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1169,8 +1169,8 @@ export const SignDocDirectAux = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1286,7 +1286,7 @@ export const TxBody = { obj.messages = message.messages; } obj.memo = message.memo === "" ? undefined : message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1494,7 +1494,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1840,7 +1840,7 @@ export const Fee = { } else { obj.amount = message.amount; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; obj.payer = message.payer === "" ? undefined : message.payer; obj.granter = message.granter === "" ? undefined : message.granter; return obj; diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts index ff78dcda4c..2d04e00e29 100644 --- a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/query.ts @@ -574,7 +574,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -645,7 +645,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { diff --git a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts index 3201a6beb0..1bc7112f21 100644 --- a/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputsign/cosmos/upgrade/v1beta1/upgrade.ts @@ -313,7 +313,7 @@ export const Plan = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -574,7 +574,7 @@ export const ModuleVersion = { toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts index c10ccb3a83..bdd13877ce 100644 --- a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/tx.ts @@ -263,7 +263,7 @@ export const MsgCreateVestingAccount = { } else { obj.amount = message.amount; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, @@ -575,7 +575,7 @@ export const MsgCreatePeriodicVestingAccount = { const obj: any = {}; obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; obj.to_address = message.toAddress === "" ? undefined : message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts index 2f534ff04d..bfbde8facc 100644 --- a/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputsign/cosmos/vesting/v1beta1/vesting.ts @@ -306,7 +306,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -391,7 +391,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -542,7 +542,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -641,7 +641,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts index c9f20c3a0b..a956a920f9 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/genesis.ts @@ -457,7 +457,7 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; obj.pinned = message.pinned === false ? undefined : message.pinned; @@ -640,7 +640,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts index f7b89af6f9..1c72b3b41a 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/ibc.ts @@ -158,8 +158,8 @@ export const MsgIBCSend = { toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; obj.channel = message.channel === "" ? undefined : message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts index eaf994b901..65219cb28f 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/proposal.ts @@ -651,7 +651,7 @@ export const InstantiateContractProposal = { obj.description = message.description === "" ? undefined : message.description; obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -776,7 +776,7 @@ export const MigrateContractProposal = { obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts index d53cd60680..15cbc1a709 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/query.ts @@ -451,7 +451,7 @@ export interface CodeInfoResponseProtoMsg { } /** CodeInfoResponse contains code meta data from CodeInfo */ export interface CodeInfoResponseAmino { - code_id?: string; + code_id: string; creator?: string; data_hash?: string; } @@ -477,7 +477,7 @@ export interface QueryCodeResponseProtoMsg { /** QueryCodeResponse is the response type for the Query/Code RPC method */ export interface QueryCodeResponseAmino { code_info?: CodeInfoResponseAmino; - data?: string; + data: string; } export interface QueryCodeResponseAminoMsg { type: "wasm/QueryCodeResponse"; @@ -979,7 +979,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1604,7 +1604,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts index 267d005a43..fae9221080 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/tx.ts @@ -499,7 +499,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -625,7 +625,7 @@ export const MsgInstantiateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -995,7 +995,7 @@ export const MsgMigrateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts index 7b93cc4486..4ee9845466 100644 --- a/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputsign/cosmwasm/wasm/v1/types.ts @@ -590,7 +590,7 @@ export const Params = { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.max_wasm_code_size = message.maxWasmCodeSize !== BigInt(0) ? message.maxWasmCodeSize.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -826,7 +826,7 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.creator = message.creator === "" ? undefined : message.creator; obj.admin = message.admin === "" ? undefined : message.admin; obj.label = message.label === "" ? undefined : message.label; @@ -939,7 +939,7 @@ export const ContractCodeHistoryEntry = { toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; obj.operation = message.operation === 0 ? undefined : message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1025,8 +1025,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts index d7d3ed3ac0..6226eaf525 100644 --- a/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/epochs/v1/genesis.ts @@ -177,10 +177,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts index 6bf375da71..a072466cea 100644 --- a/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/epochs/v1/query.ts @@ -327,7 +327,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts index 6bccad3d80..1009adaef3 100644 --- a/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/fees/v1/genesis.ts @@ -262,7 +262,7 @@ export const Params = { obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate.toString() : undefined; obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; return obj; }, diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts index d26162b8c2..413df93d10 100644 --- a/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/incentives.ts @@ -256,7 +256,7 @@ export const Incentive = { } obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = message.totalGas !== BigInt(0) ? message.totalGas.toString() : undefined; return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -345,7 +345,7 @@ export const GasMeter = { const obj: any = {}; obj.contract = message.contract === "" ? undefined : message.contract; obj.participant = message.participant === "" ? undefined : message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.cumulative_gas = message.cumulativeGas !== BigInt(0) ? message.cumulativeGas.toString() : undefined; return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { diff --git a/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts index fe2b4f0f6d..094855e1e0 100644 --- a/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/incentives/v1/query.ts @@ -972,7 +972,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = message.gasMeter !== BigInt(0) ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts index 49434f595a..47e7ff5d6d 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/genesis.ts @@ -178,10 +178,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.epochs_per_period = message.epochsPerPeriod !== BigInt(0) ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts index d8d21e5da7..9fb79b60e4 100644 --- a/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputsign/evmos/inflation/v1/query.ts @@ -388,7 +388,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -618,7 +618,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { diff --git a/__fixtures__/v-next/outputsign/google/api/distribution.ts b/__fixtures__/v-next/outputsign/google/api/distribution.ts index 91bab34f10..a23cb60a8c 100644 --- a/__fixtures__/v-next/outputsign/google/api/distribution.ts +++ b/__fixtures__/v-next/outputsign/google/api/distribution.ts @@ -668,7 +668,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; diff --git a/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts index e5995a8d89..72f4f86c7a 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -1064,7 +1064,7 @@ export const IssueDetails = { const obj: any = {}; obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts index db0694a8de..1ef927f85d 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/checked.ts @@ -956,7 +956,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -1028,7 +1028,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts index 1c1945a7d0..13a09e0325 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/eval.ts @@ -401,8 +401,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = message.expr !== BigInt(0) ? message.expr.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts index 7495904f35..4569dfb94a 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/explain.ts @@ -226,7 +226,7 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts index d4f88c785b..146a4f3c14 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/syntax.ts @@ -1113,7 +1113,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1607,7 +1607,7 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; @@ -1914,8 +1914,8 @@ export const Constant = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -1995,7 +1995,7 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value === 0 ? undefined : message.value; return obj; }, @@ -2067,7 +2067,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts index e6b818937d..cdffd1b69e 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1alpha1/value.ts @@ -422,8 +422,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts index ea6788d76c..7cfd55324d 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/expr.ts @@ -1671,8 +1671,8 @@ export const Literal = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts index 08d43ed728..e1682df3fc 100644 --- a/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputsign/google/api/expr/v1beta1/value.ts @@ -422,8 +422,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputsign/google/api/quota.ts b/__fixtures__/v-next/outputsign/google/api/quota.ts index 8e091cd8b6..51c38c1fbf 100644 --- a/__fixtures__/v-next/outputsign/google/api/quota.ts +++ b/__fixtures__/v-next/outputsign/google/api/quota.ts @@ -645,7 +645,7 @@ export const MetricRule_MetricCostsEntry = { toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -813,7 +813,7 @@ export const QuotaLimit_ValuesEntry = { toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -995,9 +995,9 @@ export const QuotaLimit = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.description = message.description === "" ? undefined : message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit !== BigInt(0) ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier !== BigInt(0) ? message.freeTier.toString() : undefined; obj.duration = message.duration === "" ? undefined : message.duration; obj.metric = message.metric === "" ? undefined : message.metric; obj.unit = message.unit === "" ? undefined : message.unit; diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts index 80f6e09544..2d8a7edaac 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/distribution.ts @@ -464,7 +464,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.minimum = message.minimum === 0 ? undefined : message.minimum; obj.maximum = message.maximum === 0 ? undefined : message.maximum; diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts index 633dc51486..e9c41b444b 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/http_request.ts @@ -394,9 +394,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -405,7 +405,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts index b5e0b060ec..c07f14bbaf 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/log_entry.ts @@ -772,7 +772,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts index f9246ee289..5bce256110 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/metric_value.ts @@ -375,7 +375,7 @@ export const MetricValue = { obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; diff --git a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts index 5779c5de03..5eda033e76 100644 --- a/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputsign/google/api/servicecontrol/v1/service_controller.ts @@ -827,9 +827,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; + obj.project_number = message.projectNumber !== BigInt(0) ? message.projectNumber.toString() : undefined; obj.type = message.type === 0 ? undefined : message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.consumer_number = message.consumerNumber !== BigInt(0) ? message.consumerNumber.toString() : undefined; return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { diff --git a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts index bb7f696f5d..5681166434 100644 --- a/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputsign/google/api/serviceusage/v1beta1/resources.ts @@ -1874,8 +1874,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = message.effectiveLimit !== BigInt(0) ? message.effectiveLimit.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2091,7 +2091,7 @@ export const QuotaOverride = { toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.override_value = message.overrideValue !== BigInt(0) ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { @@ -2372,7 +2372,7 @@ export const AdminQuotaPolicy = { toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.policy_value = message.policyValue !== BigInt(0) ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts b/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts index 96a97c70c1..f9b2d83b8d 100644 --- a/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputsign/google/logging/type/http_request.ts @@ -398,9 +398,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -409,7 +409,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts index 36339064a0..62614e18bc 100644 --- a/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputsign/google/logging/v2/log_entry.ts @@ -1068,7 +1068,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts index 2a78b5a79e..4e4d3ae971 100644 --- a/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputsign/google/logging/v2/logging_config.ts @@ -6423,7 +6423,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = message.logEntriesCopiedCount !== BigInt(0) ? message.logEntriesCopiedCount.toString() : undefined; return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts index f2a1dffc34..5975d23774 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/descriptor.ts @@ -4730,8 +4730,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts index 4a379210db..54378694b9 100644 --- a/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputsign/google/protobuf/wrappers.ts @@ -479,7 +479,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -544,7 +544,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { diff --git a/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts index 095070f906..049f4b86ad 100644 --- a/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputsign/google/rpc/context/attribute_context.ts @@ -1345,7 +1345,7 @@ export const AttributeContext_Peer = { toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; obj.ip = message.ip === "" ? undefined : message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.port = message.port !== BigInt(0) ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -1856,7 +1856,7 @@ export const AttributeContext_Request = { obj.scheme = message.scheme === "" ? undefined : message.scheme; obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; @@ -2058,8 +2058,8 @@ export const AttributeContext_Response = { }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = message.code !== BigInt(0) ? message.code.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts index 987030508f..5b25137327 100644 --- a/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/applications/transfer/v1/tx.ts @@ -215,7 +215,7 @@ export const MsgTransfer = { obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts index ac1f6bef7a..f8ec911247 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/channel.ts @@ -904,14 +904,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1017,7 +1017,7 @@ export const PacketState = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts index c331b9f0d9..abb4d1ffe3 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/genesis.ts @@ -224,7 +224,7 @@ export const GenesisState = { } else { obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -319,7 +319,7 @@ export const PacketSequence = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts index 3df90e45dd..0b88c38a40 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/query.ts @@ -1818,8 +1818,8 @@ export const QueryChannelConsensusStateRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -2023,7 +2023,7 @@ export const QueryPacketCommitmentRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2407,7 +2407,7 @@ export const QueryPacketReceiptRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2597,7 +2597,7 @@ export const QueryPacketAcknowledgementRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -3481,7 +3481,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts index db4f6d15ef..c3a832e68f 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/channel/v1/tx.ts @@ -1855,7 +1855,7 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2046,7 +2046,7 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts index 9a3d8c0c8e..67fb71c5fe 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/client.ts @@ -825,8 +825,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts index 8e88ae8a66..0cdbb035ba 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/genesis.ts @@ -229,7 +229,7 @@ export const GenesisState = { } obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts index d1a19942ea..9bfb9c80c2 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/client/v1/query.ts @@ -940,8 +940,8 @@ export const QueryConsensusStateRequest = { toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts index 73e524d540..16484b13a6 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/connection.ts @@ -447,7 +447,7 @@ export const ConnectionEnd = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -582,7 +582,7 @@ export const IdentifiedConnection = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -985,7 +985,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts index fae342fb16..42a954642e 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/genesis.ts @@ -120,7 +120,7 @@ export const GenesisState = { } else { obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts index 455f4904da..0f55ed6ebd 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/query.ts @@ -1116,8 +1116,8 @@ export const QueryConnectionConsensusStateRequest = { toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { diff --git a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts index 61acf963ab..62eb881bf8 100644 --- a/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputsign/ibc/core/connection/v1/tx.ts @@ -406,7 +406,7 @@ export const MsgConnectionOpenInit = { obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -665,7 +665,7 @@ export const MsgConnectionOpenTry = { obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts index 5ee5c0a650..405113c9db 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v1/solomachine.ts @@ -730,8 +730,8 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence !== BigInt(0) ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; @@ -830,7 +830,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -949,8 +949,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1062,7 +1062,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1171,7 +1171,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1254,7 +1254,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1371,8 +1371,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2104,7 +2104,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts index 824daa1bd3..c59c46562f 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/solomachine/v2/solomachine.ts @@ -728,7 +728,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; @@ -828,7 +828,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -947,8 +947,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1060,7 +1060,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1169,7 +1169,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1252,7 +1252,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1369,8 +1369,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2102,7 +2102,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts index 5353130c8e..1c5e1bc05f 100644 --- a/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputsign/ibc/lightclients/tendermint/v1/tendermint.ts @@ -859,8 +859,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts index a3a724a8bf..7ba395a91a 100644 --- a/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/epochs/genesis.ts @@ -279,10 +279,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts b/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts index 9facacc51f..7ce53fb8c5 100644 --- a/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/epochs/query.ts @@ -306,7 +306,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts index 1a373c0bec..beb5dc31db 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -670,7 +670,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts index d93c651f31..7591531bcb 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -206,7 +206,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 534e78182a..6d29a57f26 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -324,7 +324,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts index 8c9e45a487..b683c67e6d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/pool-models/stableswap/tx.ts @@ -294,7 +294,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -395,7 +395,7 @@ export const MsgStableSwapAdjustScalingFactors = { toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts index 4e9a0a5352..abeda636a3 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/genesis.ts @@ -195,7 +195,7 @@ export const GenesisState = { } else { obj.pools = message.pools; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = message.nextPoolNumber !== BigInt(0) ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts index a21af8660d..002bf277ba 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/query.ts @@ -678,7 +678,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -1032,7 +1032,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1103,7 +1103,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1252,7 +1252,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1422,7 +1422,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, @@ -1565,7 +1565,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1707,7 +1707,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -1849,7 +1849,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2000,7 +2000,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2181,7 +2181,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; @@ -2537,7 +2537,7 @@ export const QuerySwapExactAmountInRequest = { toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); @@ -2715,7 +2715,7 @@ export const QuerySwapExactAmountOutRequest = { toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts index da213136ef..49af98ba37 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v1beta1/tx.ts @@ -515,7 +515,7 @@ export const MsgJoinPool = { toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); @@ -707,7 +707,7 @@ export const MsgExitPool = { toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); @@ -866,7 +866,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -1127,7 +1127,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, @@ -1413,7 +1413,7 @@ export const MsgJoinSwapExternAmountIn = { toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; @@ -1600,7 +1600,7 @@ export const MsgJoinSwapShareAmountOut = { toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; @@ -1788,7 +1788,7 @@ export const MsgExitSwapShareAmountIn = { toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; @@ -1967,7 +1967,7 @@ export const MsgExitSwapExternAmountOut = { toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts index 4e35cc4c6a..97f145cd4d 100644 --- a/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/gamm/v2/query.ts @@ -135,7 +135,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts index 2bb2650714..735dbc37b5 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/gauge.ts @@ -254,7 +254,7 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { @@ -263,8 +263,8 @@ export const Gauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; + obj.filled_epochs = message.filledEpochs !== BigInt(0) ? message.filledEpochs.toString() : undefined; if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts index f94657aa6b..5f5e303ec1 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/genesis.ts @@ -150,7 +150,7 @@ export const GenesisState = { } else { obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = message.lastGaugeId !== BigInt(0) ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts index ecedae78f4..4c80e71ac6 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/query.ts @@ -561,7 +561,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1542,7 +1542,7 @@ export const RewardsEstRequest = { } else { obj.lock_ids = message.lockIds; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = message.endEpoch !== BigInt(0) ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts index cb3bd2d362..1113410315 100644 --- a/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/incentives/tx.ts @@ -239,7 +239,7 @@ export const MsgCreateGauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -387,7 +387,7 @@ export const MsgAddToGauge = { toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts index a36aaaca3f..a032e069cf 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/genesis.ts @@ -92,7 +92,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = message.lastLockId !== BigInt(0) ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts index 8166061138..afeca4035c 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/lock.ts @@ -359,7 +359,7 @@ export const PeriodLock = { }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; @@ -580,7 +580,7 @@ export const SyntheticLock = { }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; + obj.underlying_lock_id = message.underlyingLockId !== BigInt(0) ? message.underlyingLockId.toString() : undefined; obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts index 879a82d006..f746011781 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/query.ts @@ -2091,7 +2091,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2233,7 +2233,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { diff --git a/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts index 1787859302..0a462f85e5 100644 --- a/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/lockup/tx.ts @@ -377,7 +377,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -609,7 +609,7 @@ export const MsgBeginUnlocking = { toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -779,7 +779,7 @@ export const MsgExtendLockup = { toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -941,7 +941,7 @@ export const MsgForceUnlock = { toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/genesis.ts index bc3d4b144c..2d032e30ca 100644 --- a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/genesis.ts @@ -114,7 +114,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = message.reductionStartedEpoch !== BigInt(0) ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts index ad28ae32f8..a05afe53a5 100644 --- a/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputsign/osmosis/mint/v1beta1/mint.ts @@ -608,7 +608,7 @@ export const Params = { obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs.toString() : undefined; obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { @@ -616,7 +616,7 @@ export const Params = { } else { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch !== BigInt(0) ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts index a0cd20741b..dbf38cff40 100644 --- a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/incentives.ts @@ -408,7 +408,7 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, @@ -506,8 +506,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts index 1e4a300519..161e83c797 100644 --- a/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/pool-incentives/v1beta1/query.ts @@ -270,7 +270,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -436,7 +436,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; @@ -972,9 +972,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts index 0f33e0af37..6e3f25d7c5 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/query.ts @@ -1196,7 +1196,7 @@ export const SuperfluidIntermediaryAccountInfo = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -1424,7 +1424,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts index 8441db2cea..974719b55a 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/superfluid.ts @@ -405,7 +405,7 @@ export const SuperfluidIntermediaryAccount = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -498,7 +498,7 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; return obj; @@ -691,7 +691,7 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, diff --git a/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts index c941fb2bb2..f9828750d2 100644 --- a/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputsign/osmosis/superfluid/tx.ts @@ -289,7 +289,7 @@ export const MsgSuperfluidDelegate = { toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, @@ -429,7 +429,7 @@ export const MsgSuperfluidUndelegate = { toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -568,7 +568,7 @@ export const MsgSuperfluidUnbondLock = { toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -790,7 +790,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -873,7 +873,7 @@ export const MsgUnPoolWhitelistedPool = { toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts index 7978c500f8..58438f8ef7 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/query.ts @@ -211,7 +211,7 @@ export const ArithmeticTwapRequest = { }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; @@ -388,7 +388,7 @@ export const ArithmeticTwapToNowRequest = { }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; diff --git a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts index 0eb942b320..f56f652c26 100644 --- a/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputsign/osmosis/twap/v1beta1/twap_record.ts @@ -60,7 +60,7 @@ export interface TwapRecordAmino { /** Lexicographically larger denom of the pair */ asset1_denom?: string; /** height this record corresponds to, for debugging purposes */ - height?: string; + height: string; /** * This field should only exist until we have a global registry in the state * machine, mapping prior block heights within {TIME RANGE} to times. @@ -253,7 +253,7 @@ export const TwapRecord = { }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height.toString() : "0"; diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts index 9a6782a8e7..b24814f1fd 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/feetoken.ts @@ -97,7 +97,7 @@ export const FeeToken = { toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts index 61bb72e9b9..bc10b430ad 100644 --- a/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputsign/osmosis/txfees/v1beta1/query.ts @@ -407,7 +407,7 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, @@ -548,7 +548,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { diff --git a/__fixtures__/v-next/outputsign/tendermint/abci/types.ts b/__fixtures__/v-next/outputsign/tendermint/abci/types.ts index f64d45825b..91b8a1b8e2 100644 --- a/__fixtures__/v-next/outputsign/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/abci/types.ts @@ -1831,8 +1831,8 @@ export const RequestInfo = { toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; obj.version = message.version === "" ? undefined : message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -2036,7 +2036,7 @@ export const RequestInitChain = { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -2136,7 +2136,7 @@ export const RequestQuery = { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.path = message.path === "" ? undefined : message.path; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.prove = message.prove === false ? undefined : message.prove; return obj; }, @@ -2445,7 +2445,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -2709,7 +2709,7 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; @@ -3362,8 +3362,8 @@ export const ResponseInfo = { const obj: any = {}; obj.data = message.data === "" ? undefined : message.data; obj.version = message.version === "" ? undefined : message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; return obj; }, @@ -3702,11 +3702,11 @@ export const ResponseQuery = { obj.code = message.code === 0 ? undefined : message.code; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, @@ -3918,8 +3918,8 @@ export const ResponseCheckTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4071,8 +4071,8 @@ export const ResponseDeliverTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4248,7 +4248,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -4724,8 +4724,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -5066,7 +5066,7 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; @@ -5146,7 +5146,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -5225,7 +5225,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -5417,9 +5417,9 @@ export const Evidence = { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -5528,7 +5528,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; diff --git a/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts index 3e0f7f7f4c..74328b2835 100644 --- a/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputsign/tendermint/crypto/proof.ts @@ -211,8 +211,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); diff --git a/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts index a3df52b35a..89bfb95e91 100644 --- a/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/libs/bits/types.ts @@ -85,7 +85,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts b/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts index b1287e0b6f..b663b8b6e0 100644 --- a/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/p2p/types.ts @@ -204,9 +204,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { diff --git a/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts b/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts index dfc1350bfb..7bcd8a747c 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/evidence.ts @@ -282,8 +282,8 @@ export const DuplicateVoteEvidence = { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -396,13 +396,13 @@ export const LightClientAttackEvidence = { toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputsign/tendermint/types/params.ts b/__fixtures__/v-next/outputsign/tendermint/types/params.ts index c3e3253935..581032d686 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/params.ts @@ -419,9 +419,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs !== BigInt(0) ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -512,9 +512,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -644,7 +644,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -722,8 +722,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputsign/tendermint/types/types.ts b/__fixtures__/v-next/outputsign/tendermint/types/types.ts index f3b89d682d..bf695a7392 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/types.ts @@ -946,7 +946,7 @@ export const Header = { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; @@ -1167,7 +1167,7 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -1271,7 +1271,7 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { @@ -1511,7 +1511,7 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; @@ -1779,9 +1779,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputsign/tendermint/types/validator.ts b/__fixtures__/v-next/outputsign/tendermint/types/validator.ts index c5be185f38..e860a9ddb5 100644 --- a/__fixtures__/v-next/outputsign/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputsign/tendermint/types/validator.ts @@ -145,7 +145,7 @@ export const ValidatorSet = { obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -249,8 +249,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -329,7 +329,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputsign/tendermint/version/types.ts b/__fixtures__/v-next/outputsign/tendermint/version/types.ts index e260450ea1..881ca73be2 100644 --- a/__fixtures__/v-next/outputsign/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputsign/tendermint/version/types.ts @@ -128,7 +128,7 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; obj.software = message.software === "" ? undefined : message.software; return obj; }, @@ -207,8 +207,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts index f6b1eedc31..7168cff660 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta1/audit.ts @@ -14,9 +14,9 @@ export interface ProviderProtoMsg { } /** Provider stores owner auditor and attributes details */ export interface ProviderAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface ProviderAminoMsg { type: "/akash.audit.v1beta1.Provider"; @@ -40,9 +40,9 @@ export interface AuditedAttributesProtoMsg { } /** Attributes */ export interface AuditedAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface AuditedAttributesAminoMsg { type: "/akash.audit.v1beta1.AuditedAttributes"; @@ -64,7 +64,7 @@ export interface AttributesResponseProtoMsg { } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } export interface AttributesResponseAminoMsg { type: "/akash.audit.v1beta1.AttributesResponse"; @@ -85,8 +85,8 @@ export interface AttributesFiltersProtoMsg { } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersAmino { - auditors?: string[]; - owners?: string[]; + auditors: string[]; + owners: string[]; } export interface AttributesFiltersAminoMsg { type: "/akash.audit.v1beta1.AttributesFilters"; @@ -109,9 +109,9 @@ export interface MsgSignProviderAttributesProtoMsg { } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface MsgSignProviderAttributesAminoMsg { type: "/akash.audit.v1beta1.MsgSignProviderAttributes"; @@ -149,9 +149,9 @@ export interface MsgDeleteProviderAttributesProtoMsg { } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesAmino { - owner?: string; - auditor?: string; - keys?: string[]; + owner: string; + auditor: string; + keys: string[]; } export interface MsgDeleteProviderAttributesAminoMsg { type: "/akash.audit.v1beta1.MsgDeleteProviderAttributes"; diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts index c0b24decea..4a43ed6a97 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/audit.ts @@ -14,9 +14,9 @@ export interface ProviderProtoMsg { } /** Provider stores owner auditor and attributes details */ export interface ProviderAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface ProviderAminoMsg { type: "/akash.audit.v1beta2.Provider"; @@ -40,9 +40,9 @@ export interface AuditedAttributesProtoMsg { } /** Attributes */ export interface AuditedAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface AuditedAttributesAminoMsg { type: "/akash.audit.v1beta2.AuditedAttributes"; @@ -64,7 +64,7 @@ export interface AttributesResponseProtoMsg { } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } export interface AttributesResponseAminoMsg { type: "/akash.audit.v1beta2.AttributesResponse"; @@ -85,8 +85,8 @@ export interface AttributesFiltersProtoMsg { } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersAmino { - auditors?: string[]; - owners?: string[]; + auditors: string[]; + owners: string[]; } export interface AttributesFiltersAminoMsg { type: "/akash.audit.v1beta2.AttributesFilters"; @@ -109,9 +109,9 @@ export interface MsgSignProviderAttributesProtoMsg { } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } export interface MsgSignProviderAttributesAminoMsg { type: "/akash.audit.v1beta2.MsgSignProviderAttributes"; @@ -149,9 +149,9 @@ export interface MsgDeleteProviderAttributesProtoMsg { } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesAmino { - owner?: string; - auditor?: string; - keys?: string[]; + owner: string; + auditor: string; + keys: string[]; } export interface MsgDeleteProviderAttributesAminoMsg { type: "/akash.audit.v1beta2.MsgDeleteProviderAttributes"; diff --git a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts index b806dca987..434d5e08d1 100644 --- a/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/audit/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by audit module */ export interface GenesisStateAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.audit.v1beta2.GenesisState"; diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts index 3af50b0a6c..46061cbef4 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/attribute.ts @@ -48,9 +48,9 @@ export interface SignedByProtoMsg { */ export interface SignedByAmino { /** all_of all keys in this list must have signed attributes */ - all_of?: string[]; + all_of: string[]; /** any_of at least of of the keys from the list must have signed attributes */ - any_of?: string[]; + any_of: string[]; } export interface SignedByAminoMsg { type: "/akash.base.v1beta1.SignedBy"; @@ -80,9 +80,9 @@ export interface PlacementRequirementsProtoMsg { /** PlacementRequirements */ export interface PlacementRequirementsAmino { /** SignedBy list of keys that tenants expect to have signatures from */ - signed_by?: SignedByAmino; + signed_by: SignedByAmino; /** Attribute list of attributes tenant expects from the provider */ - attributes?: AttributeAmino[]; + attributes: AttributeAmino[]; } export interface PlacementRequirementsAminoMsg { type: "/akash.base.v1beta1.PlacementRequirements"; @@ -398,7 +398,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts index 6a85b3b7f9..57152107af 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta1/resource.ts @@ -38,7 +38,7 @@ export interface MemoryProtoMsg { } /** Memory stores resource quantity and memory attributes */ export interface MemoryAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface MemoryAminoMsg { @@ -61,7 +61,7 @@ export interface StorageProtoMsg { } /** Storage stores resource quantity and storage attributes */ export interface StorageAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface StorageAminoMsg { @@ -95,7 +95,7 @@ export interface ResourceUnitsAmino { cpu?: CPUAmino; memory?: MemoryAmino; storage?: StorageAmino; - endpoints?: EndpointAmino[]; + endpoints: EndpointAmino[]; } export interface ResourceUnitsAminoMsg { type: "/akash.base.v1beta1.ResourceUnits"; @@ -309,7 +309,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -420,7 +420,7 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts index 481ddc13bb..2958f3e1bc 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/attribute.ts @@ -48,9 +48,9 @@ export interface SignedByProtoMsg { */ export interface SignedByAmino { /** all_of all keys in this list must have signed attributes */ - all_of?: string[]; + all_of: string[]; /** any_of at least of of the keys from the list must have signed attributes */ - any_of?: string[]; + any_of: string[]; } export interface SignedByAminoMsg { type: "/akash.base.v1beta2.SignedBy"; @@ -80,9 +80,9 @@ export interface PlacementRequirementsProtoMsg { /** PlacementRequirements */ export interface PlacementRequirementsAmino { /** SignedBy list of keys that tenants expect to have signatures from */ - signed_by?: SignedByAmino; + signed_by: SignedByAmino; /** Attribute list of attributes tenant expects from the provider */ - attributes?: AttributeAmino[]; + attributes: AttributeAmino[]; } export interface PlacementRequirementsAminoMsg { type: "/akash.base.v1beta2.PlacementRequirements"; @@ -398,7 +398,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts index 57b616fcbb..c48ba7610b 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/endpoint.ts @@ -55,7 +55,7 @@ export interface EndpointProtoMsg { /** Endpoint describes a publicly accessible IP service */ export interface EndpointAmino { kind?: Endpoint_Kind; - sequence_number?: number; + sequence_number: number; } export interface EndpointAminoMsg { type: "/akash.base.v1beta2.Endpoint"; diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts index 48bfe0b37f..1907da342c 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resource.ts @@ -37,7 +37,7 @@ export interface MemoryProtoMsg { } /** Memory stores resource quantity and memory attributes */ export interface MemoryAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface MemoryAminoMsg { @@ -61,8 +61,8 @@ export interface StorageProtoMsg { } /** Storage stores resource quantity and storage attributes */ export interface StorageAmino { - name?: string; - quantity?: ResourceValueAmino; + name: string; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } export interface StorageAminoMsg { @@ -273,7 +273,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -400,7 +400,7 @@ export const Storage = { toAmino(message: Storage): StorageAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts index 3897a7735d..6ebb69390f 100644 --- a/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv2/akash/base/v1beta2/resourceunits.ts @@ -25,7 +25,7 @@ export interface ResourceUnitsAmino { cpu?: CPUAmino; memory?: MemoryAmino; storage?: StorageAmino[]; - endpoints?: EndpointAmino[]; + endpoints: EndpointAmino[]; } export interface ResourceUnitsAminoMsg { type: "/akash.base.v1beta2.ResourceUnits"; diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts index 904f2dfae7..97f2d45043 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/cert.ts @@ -54,8 +54,8 @@ export interface CertificateIDProtoMsg { } /** CertificateID stores owner and sequence number */ export interface CertificateIDAmino { - owner?: string; - serial?: string; + owner: string; + serial: string; } export interface CertificateIDAminoMsg { type: "/akash.cert.v1beta2.CertificateID"; @@ -78,9 +78,9 @@ export interface CertificateProtoMsg { } /** Certificate stores state, certificate and it's public key */ export interface CertificateAmino { - state?: Certificate_State; - cert?: string; - pubkey?: string; + state: Certificate_State; + cert: string; + pubkey: string; } export interface CertificateAminoMsg { type: "/akash.cert.v1beta2.Certificate"; @@ -104,9 +104,9 @@ export interface CertificateFilterProtoMsg { } /** CertificateFilter defines filters used to filter certificates */ export interface CertificateFilterAmino { - owner?: string; - serial?: string; - state?: string; + owner: string; + serial: string; + state: string; } export interface CertificateFilterAminoMsg { type: "/akash.cert.v1beta2.CertificateFilter"; @@ -130,9 +130,9 @@ export interface MsgCreateCertificateProtoMsg { } /** MsgCreateCertificate defines an SDK message for creating certificate */ export interface MsgCreateCertificateAmino { - owner?: string; - cert?: string; - pubkey?: string; + owner: string; + cert: string; + pubkey: string; } export interface MsgCreateCertificateAminoMsg { type: "/akash.cert.v1beta2.MsgCreateCertificate"; @@ -168,7 +168,7 @@ export interface MsgRevokeCertificateProtoMsg { } /** MsgRevokeCertificate defines an SDK message for revoking certificate */ export interface MsgRevokeCertificateAmino { - id?: CertificateIDAmino; + id: CertificateIDAmino; } export interface MsgRevokeCertificateAminoMsg { type: "/akash.cert.v1beta2.MsgRevokeCertificate"; @@ -767,7 +767,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.toAmino(CertificateID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts index 0ef6e7e0d1..99bd1ca0f8 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisCertificateProtoMsg { } /** GenesisCertificate defines certificate entry at genesis */ export interface GenesisCertificateAmino { - owner?: string; - certificate?: CertificateAmino; + owner: string; + certificate: CertificateAmino; } export interface GenesisCertificateAminoMsg { type: "/akash.cert.v1beta2.GenesisCertificate"; @@ -35,7 +35,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by cert module */ export interface GenesisStateAmino { - certificates?: GenesisCertificateAmino[]; + certificates: GenesisCertificateAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.cert.v1beta2.GenesisState"; @@ -127,7 +127,7 @@ export const GenesisCertificate = { toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; obj.owner = message.owner ?? ""; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { diff --git a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts index c904a36c00..c93d50492e 100644 --- a/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/cert/v1beta2/query.ts @@ -14,8 +14,8 @@ export interface CertificateResponseProtoMsg { } /** CertificateResponse contains a single X509 certificate and its serial number */ export interface CertificateResponseAmino { - certificate?: CertificateAmino; - serial?: string; + certificate: CertificateAmino; + serial: string; } export interface CertificateResponseAminoMsg { type: "/akash.cert.v1beta2.CertificateResponse"; @@ -153,7 +153,7 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); obj.serial = message.serial ?? ""; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts index 76b2a42d40..c425838583 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/authz.ts @@ -27,7 +27,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino; + spend_limit: CoinAmino; } export interface DepositDeploymentAuthorizationAminoMsg { type: "/akash.deployment.v1beta1.DepositDeploymentAuthorization"; @@ -108,7 +108,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts index 106d6f7bc6..b079e17c9d 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/deployment.ts @@ -60,10 +60,10 @@ export interface MsgCreateDeploymentProtoMsg { } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; - deposit?: CoinAmino; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; + deposit: CoinAmino; } export interface MsgCreateDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgCreateDeployment"; @@ -101,8 +101,8 @@ export interface MsgDepositDeploymentProtoMsg { } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentAmino { - id?: DeploymentIDAmino; - amount?: CoinAmino; + id: DeploymentIDAmino; + amount: CoinAmino; } export interface MsgDepositDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgDepositDeployment"; @@ -139,9 +139,9 @@ export interface MsgUpdateDeploymentProtoMsg { } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; } export interface MsgUpdateDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgUpdateDeployment"; @@ -177,7 +177,7 @@ export interface MsgCloseDeploymentProtoMsg { } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentAmino { - id?: DeploymentIDAmino; + id: DeploymentIDAmino; } export interface MsgCloseDeploymentAminoMsg { type: "/akash.deployment.v1beta1.MsgCloseDeployment"; @@ -212,8 +212,8 @@ export interface DeploymentIDProtoMsg { } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDAmino { - owner?: string; - dseq?: string; + owner: string; + dseq: string; } export interface DeploymentIDAminoMsg { type: "/akash.deployment.v1beta1.DeploymentID"; @@ -237,9 +237,9 @@ export interface DeploymentProtoMsg { } /** Deployment stores deploymentID, state and version details */ export interface DeploymentAmino { - deployment_id?: DeploymentIDAmino; - state?: Deployment_State; - version?: string; + deployment_id: DeploymentIDAmino; + state: Deployment_State; + version: string; created_at?: string; } export interface DeploymentAminoMsg { @@ -265,9 +265,9 @@ export interface DeploymentFiltersProtoMsg { } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersAmino { - owner?: string; - dseq?: string; - state?: string; + owner: string; + dseq: string; + state: string; } export interface DeploymentFiltersAminoMsg { type: "/akash.deployment.v1beta1.DeploymentFilters"; @@ -398,14 +398,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -572,8 +572,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -759,7 +759,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { @@ -915,7 +915,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1213,10 +1213,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts index 031371ac51..323692a6e6 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/genesis.ts @@ -15,8 +15,8 @@ export interface GenesisDeploymentProtoMsg { } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; } export interface GenesisDeploymentAminoMsg { type: "/akash.deployment.v1beta1.GenesisDeployment"; @@ -38,8 +38,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - deployments?: GenesisDeploymentAmino[]; - params?: ParamsAmino; + deployments: GenesisDeploymentAmino[]; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.deployment.v1beta1.GenesisState"; @@ -137,7 +137,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts index 3ca58fd5f2..54165d7bca 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/group.ts @@ -70,7 +70,7 @@ export interface MsgCloseGroupProtoMsg { } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgCloseGroupAminoMsg { type: "/akash.deployment.v1beta1.MsgCloseGroup"; @@ -104,7 +104,7 @@ export interface MsgPauseGroupProtoMsg { } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgPauseGroupAminoMsg { type: "/akash.deployment.v1beta1.MsgPauseGroup"; @@ -138,7 +138,7 @@ export interface MsgStartGroupProtoMsg { } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgStartGroupAminoMsg { type: "/akash.deployment.v1beta1.MsgStartGroup"; @@ -174,9 +174,9 @@ export interface GroupIDProtoMsg { } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDAmino { - owner?: string; - dseq?: string; - gseq?: number; + owner: string; + dseq: string; + gseq: number; } export interface GroupIDAminoMsg { type: "/akash.deployment.v1beta1.GroupID"; @@ -200,9 +200,9 @@ export interface GroupSpecProtoMsg { } /** GroupSpec stores group specifications */ export interface GroupSpecAmino { - name?: string; - requirements?: PlacementRequirementsAmino; - resources?: ResourceAmino[]; + name: string; + requirements: PlacementRequirementsAmino; + resources: ResourceAmino[]; } export interface GroupSpecAminoMsg { type: "/akash.deployment.v1beta1.GroupSpec"; @@ -227,9 +227,9 @@ export interface GroupProtoMsg { } /** Group stores group id, state and specifications of group */ export interface GroupAmino { - group_id?: GroupIDAmino; - state?: Group_State; - group_spec?: GroupSpecAmino; + group_id: GroupIDAmino; + state: Group_State; + group_spec: GroupSpecAmino; created_at?: string; } export interface GroupAminoMsg { @@ -255,9 +255,9 @@ export interface ResourceProtoMsg { } /** Resource stores unit, total count and price of resource */ export interface ResourceAmino { - resources?: ResourceUnitsAmino; - count?: number; - price?: CoinAmino; + resources: ResourceUnitsAmino; + count: number; + price: CoinAmino; } export interface ResourceAminoMsg { type: "/akash.deployment.v1beta1.Resource"; @@ -335,7 +335,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -485,7 +485,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -635,7 +635,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -939,7 +939,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { @@ -1078,10 +1078,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1198,9 +1198,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); + obj.price = message.price ? Coin.toAmino(message.price) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts index ac8f240e3c..93e1c120c4 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/params.ts @@ -12,7 +12,7 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { - deployment_min_deposit?: CoinAmino; + deployment_min_deposit: CoinAmino; } export interface ParamsAminoMsg { type: "/akash.deployment.v1beta1.Params"; @@ -88,7 +88,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts index 78bef69d4d..eee0a36125 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta1/query.ts @@ -83,8 +83,8 @@ export interface QueryDeploymentResponseProtoMsg { } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ export interface QueryDeploymentResponseAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; escrow_account?: AccountAmino; } export interface QueryDeploymentResponseAminoMsg { @@ -540,7 +540,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts index 4416fdb3e9..0b643b17bb 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/authz.ts @@ -27,7 +27,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino; + spend_limit: CoinAmino; } export interface DepositDeploymentAuthorizationAminoMsg { type: "/akash.deployment.v1beta2.DepositDeploymentAuthorization"; @@ -108,7 +108,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts index fbe64b1778..b2cc4b9276 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deployment.ts @@ -54,8 +54,8 @@ export interface DeploymentIDProtoMsg { } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDAmino { - owner?: string; - dseq?: string; + owner: string; + dseq: string; } export interface DeploymentIDAminoMsg { type: "/akash.deployment.v1beta2.DeploymentID"; @@ -79,9 +79,9 @@ export interface DeploymentProtoMsg { } /** Deployment stores deploymentID, state and version details */ export interface DeploymentAmino { - deployment_id?: DeploymentIDAmino; - state?: Deployment_State; - version?: string; + deployment_id: DeploymentIDAmino; + state: Deployment_State; + version: string; created_at?: string; } export interface DeploymentAminoMsg { @@ -107,9 +107,9 @@ export interface DeploymentFiltersProtoMsg { } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersAmino { - owner?: string; - dseq?: string; - state?: string; + owner: string; + dseq: string; + state: string; } export interface DeploymentFiltersAminoMsg { type: "/akash.deployment.v1beta2.DeploymentFilters"; @@ -335,10 +335,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts index c83e8edf99..91cdf4f6d2 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/deploymentmsg.ts @@ -19,12 +19,12 @@ export interface MsgCreateDeploymentProtoMsg { } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; - deposit?: CoinAmino; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; + deposit: CoinAmino; /** Depositor pays for the deposit */ - depositor?: string; + depositor: string; } export interface MsgCreateDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgCreateDeployment"; @@ -65,10 +65,10 @@ export interface MsgDepositDeploymentProtoMsg { } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentAmino { - id?: DeploymentIDAmino; - amount?: CoinAmino; + id: DeploymentIDAmino; + amount: CoinAmino; /** Depositor pays for the deposit */ - depositor?: string; + depositor: string; } export interface MsgDepositDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgDepositDeployment"; @@ -105,8 +105,8 @@ export interface MsgUpdateDeploymentProtoMsg { } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentAmino { - id?: DeploymentIDAmino; - version?: string; + id: DeploymentIDAmino; + version: string; } export interface MsgUpdateDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgUpdateDeployment"; @@ -141,7 +141,7 @@ export interface MsgCloseDeploymentProtoMsg { } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentAmino { - id?: DeploymentIDAmino; + id: DeploymentIDAmino; } export interface MsgCloseDeploymentAminoMsg { type: "/akash.deployment.v1beta2.MsgCloseDeployment"; @@ -299,14 +299,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -489,8 +489,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -656,7 +656,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, @@ -807,7 +807,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts index dc1a284ce8..3cfeae88fb 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/genesis.ts @@ -15,8 +15,8 @@ export interface GenesisDeploymentProtoMsg { } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; } export interface GenesisDeploymentAminoMsg { type: "/akash.deployment.v1beta2.GenesisDeployment"; @@ -38,8 +38,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - deployments?: GenesisDeploymentAmino[]; - params?: ParamsAmino; + deployments: GenesisDeploymentAmino[]; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.deployment.v1beta2.GenesisState"; @@ -137,7 +137,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts index b9c3d5cb81..7ed00bb0ca 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/group.ts @@ -72,9 +72,9 @@ export interface GroupProtoMsg { } /** Group stores group id, state and specifications of group */ export interface GroupAmino { - group_id?: GroupIDAmino; - state?: Group_State; - group_spec?: GroupSpecAmino; + group_id: GroupIDAmino; + state: Group_State; + group_spec: GroupSpecAmino; created_at?: string; } export interface GroupAminoMsg { @@ -203,10 +203,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts index e37e23a986..4d03f559a8 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupid.ts @@ -13,9 +13,9 @@ export interface GroupIDProtoMsg { } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDAmino { - owner?: string; - dseq?: string; - gseq?: number; + owner: string; + dseq: string; + gseq: number; } export interface GroupIDAminoMsg { type: "/akash.deployment.v1beta2.GroupID"; diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts index 47efeed728..06e54f774b 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupmsg.ts @@ -12,7 +12,7 @@ export interface MsgCloseGroupProtoMsg { } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgCloseGroupAminoMsg { type: "/akash.deployment.v1beta2.MsgCloseGroup"; @@ -46,7 +46,7 @@ export interface MsgPauseGroupProtoMsg { } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgPauseGroupAminoMsg { type: "/akash.deployment.v1beta2.MsgPauseGroup"; @@ -80,7 +80,7 @@ export interface MsgStartGroupProtoMsg { } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } export interface MsgStartGroupAminoMsg { type: "/akash.deployment.v1beta2.MsgStartGroup"; @@ -170,7 +170,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -320,7 +320,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -470,7 +470,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts index c86a85af30..5b094020fc 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/groupspec.ts @@ -15,9 +15,9 @@ export interface GroupSpecProtoMsg { } /** GroupSpec stores group specifications */ export interface GroupSpecAmino { - name?: string; - requirements?: PlacementRequirementsAmino; - resources?: ResourceAmino[]; + name: string; + requirements: PlacementRequirementsAmino; + resources: ResourceAmino[]; } export interface GroupSpecAminoMsg { type: "/akash.deployment.v1beta2.GroupSpec"; @@ -132,7 +132,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts index 2c46b6fd3e..9467fe19f2 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/params.ts @@ -12,7 +12,7 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { - deployment_min_deposit?: CoinAmino; + deployment_min_deposit: CoinAmino; } export interface ParamsAminoMsg { type: "/akash.deployment.v1beta2.Params"; @@ -88,7 +88,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts index 65933475d9..65d97aaf47 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/query.ts @@ -84,8 +84,8 @@ export interface QueryDeploymentResponseProtoMsg { } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ export interface QueryDeploymentResponseAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; escrow_account?: AccountAmino; } export interface QueryDeploymentResponseAminoMsg { @@ -541,7 +541,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts index 0e80620fd0..b3b2daf22d 100644 --- a/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv2/akash/deployment/v1beta2/resource.ts @@ -15,9 +15,9 @@ export interface ResourceProtoMsg { } /** Resource stores unit, total count and price of resource */ export interface ResourceAmino { - resources?: ResourceUnitsAmino; - count?: number; - price?: DecCoinAmino; + resources: ResourceUnitsAmino; + count: number; + price: DecCoinAmino; } export interface ResourceAminoMsg { type: "/akash.deployment.v1beta2.Resource"; @@ -127,9 +127,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts index 82656d4c02..b1ceb58dd7 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateAmino { - accounts?: AccountAmino[]; - payments?: PaymentAmino[]; + accounts: AccountAmino[]; + payments: PaymentAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.escrow.v1beta1.GenesisState"; diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts index 6622871352..63eac84e4a 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta1/types.ts @@ -111,8 +111,8 @@ export interface AccountIDProtoMsg { } /** AccountID is the account identifier */ export interface AccountIDAmino { - scope?: string; - xid?: string; + scope: string; + xid: string; } export interface AccountIDAminoMsg { type: "/akash.escrow.v1beta1.AccountID"; @@ -145,17 +145,17 @@ export interface AccountProtoMsg { /** Account stores state for an escrow account */ export interface AccountAmino { /** unique identifier for this escrow account */ - id?: AccountIDAmino; + id: AccountIDAmino; /** bech32 encoded account address of the owner of this escrow account */ - owner?: string; + owner: string; /** current state of this escrow account */ - state?: Account_State; + state: Account_State; /** unspent coins received from the owner's wallet */ - balance?: CoinAmino; + balance: CoinAmino; /** total coins spent by this account */ - transferred?: CoinAmino; + transferred: CoinAmino; /** block height at which this account was last settled */ - settled_at?: string; + settled_at: string; } export interface AccountAminoMsg { type: "/akash.escrow.v1beta1.Account"; @@ -186,13 +186,13 @@ export interface PaymentProtoMsg { } /** Payment stores state for a payment */ export interface PaymentAmino { - account_id?: AccountIDAmino; - payment_id?: string; - owner?: string; - state?: Payment_State; - rate?: CoinAmino; - balance?: CoinAmino; - withdrawn?: CoinAmino; + account_id: AccountIDAmino; + payment_id: string; + owner: string; + state: Payment_State; + rate: CoinAmino; + balance: CoinAmino; + withdrawn: CoinAmino; } export interface PaymentAminoMsg { type: "/akash.escrow.v1beta1.Payment"; @@ -454,11 +454,11 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.toAmino(Coin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, @@ -640,13 +640,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.toAmino(Coin.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts index 0ac9339ec6..42f4e3dadd 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateAmino { - accounts?: AccountAmino[]; - payments?: FractionalPaymentAmino[]; + accounts: AccountAmino[]; + payments: FractionalPaymentAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.escrow.v1beta2.GenesisState"; diff --git a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts index 6f851a60be..11901920b9 100644 --- a/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv2/akash/escrow/v1beta2/types.ts @@ -111,8 +111,8 @@ export interface AccountIDProtoMsg { } /** AccountID is the account identifier */ export interface AccountIDAmino { - scope?: string; - xid?: string; + scope: string; + xid: string; } export interface AccountIDAminoMsg { type: "/akash.escrow.v1beta2.AccountID"; @@ -156,28 +156,28 @@ export interface AccountProtoMsg { /** Account stores state for an escrow account */ export interface AccountAmino { /** unique identifier for this escrow account */ - id?: AccountIDAmino; + id: AccountIDAmino; /** bech32 encoded account address of the owner of this escrow account */ - owner?: string; + owner: string; /** current state of this escrow account */ - state?: Account_State; + state: Account_State; /** unspent coins received from the owner's wallet */ - balance?: DecCoinAmino; + balance: DecCoinAmino; /** total coins spent by this account */ - transferred?: DecCoinAmino; + transferred: DecCoinAmino; /** block height at which this account was last settled */ - settled_at?: string; + settled_at: string; /** * bech32 encoded account address of the depositor. * If depositor is same as the owner, then any incoming coins are added to the Balance. * If depositor isn't same as the owner, then any incoming coins are added to the Funds. */ - depositor?: string; + depositor: string; /** * Funds are unspent coins received from the (non-Owner) Depositor's wallet. * If there are any funds, they should be spent before spending the Balance. */ - funds?: DecCoinAmino; + funds: DecCoinAmino; } export interface AccountAminoMsg { type: "/akash.escrow.v1beta2.Account"; @@ -210,13 +210,13 @@ export interface FractionalPaymentProtoMsg { } /** Payment stores state for a payment */ export interface FractionalPaymentAmino { - account_id?: AccountIDAmino; - payment_id?: string; - owner?: string; - state?: FractionalPayment_State; - rate?: DecCoinAmino; - balance?: DecCoinAmino; - withdrawn?: CoinAmino; + account_id: AccountIDAmino; + payment_id: string; + owner: string; + state: FractionalPayment_State; + rate: DecCoinAmino; + balance: DecCoinAmino; + withdrawn: CoinAmino; } export interface FractionalPaymentAminoMsg { type: "/akash.escrow.v1beta2.FractionalPayment"; @@ -510,14 +510,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.toAmino(DecCoin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; obj.depositor = message.depositor ?? ""; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -698,13 +698,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts index de9610332e..ccd98b8e55 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - params?: ParamsAmino; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.inflation.v1beta2.GenesisState"; @@ -88,7 +88,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts index bef7973e06..3ace5c63e8 100644 --- a/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/inflation/v1beta2/params.ts @@ -24,17 +24,17 @@ export interface ParamsProtoMsg { /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { /** InflationDecayFactor is the number of years it takes inflation to halve. */ - inflation_decay_factor?: string; + inflation_decay_factor: string; /** * InitialInflation is the rate at which inflation starts at genesis. * It is a decimal value in the range [0.0, 100.0]. */ - initial_inflation?: string; + initial_inflation: string; /** * Variance defines the fraction by which inflation can vary from ideal inflation in a block. * It is a decimal value in the range [0.0, 1.0]. */ - variance?: string; + variance: string; } export interface ParamsAminoMsg { type: "/akash.inflation.v1beta2.Params"; diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts index f11740c177..99afb3485a 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/bid.ts @@ -72,10 +72,10 @@ export interface MsgCreateBidProtoMsg { } /** MsgCreateBid defines an SDK message for creating Bid */ export interface MsgCreateBidAmino { - order?: OrderIDAmino; - provider?: string; - price?: DecCoinAmino; - deposit?: CoinAmino; + order: OrderIDAmino; + provider: string; + price: DecCoinAmino; + deposit: CoinAmino; } export interface MsgCreateBidAminoMsg { type: "/akash.market.v1beta2.MsgCreateBid"; @@ -112,7 +112,7 @@ export interface MsgCloseBidProtoMsg { } /** MsgCloseBid defines an SDK message for closing bid */ export interface MsgCloseBidAmino { - bid_id?: BidIDAmino; + bid_id: BidIDAmino; } export interface MsgCloseBidAminoMsg { type: "/akash.market.v1beta2.MsgCloseBid"; @@ -156,11 +156,11 @@ export interface BidIDProtoMsg { * A successful bid becomes a Lease(ID). */ export interface BidIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; } export interface BidIDAminoMsg { type: "/akash.market.v1beta2.BidID"; @@ -190,9 +190,9 @@ export interface BidProtoMsg { } /** Bid stores BidID, state of bid and price */ export interface BidAmino { - bid_id?: BidIDAmino; - state?: Bid_State; - price?: DecCoinAmino; + bid_id: BidIDAmino; + state: Bid_State; + price: DecCoinAmino; created_at?: string; } export interface BidAminoMsg { @@ -221,12 +221,12 @@ export interface BidFiltersProtoMsg { } /** BidFilters defines flags for bid list filter */ export interface BidFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; + state: string; } export interface BidFiltersAminoMsg { type: "/akash.market.v1beta2.BidFilters"; @@ -356,10 +356,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.toAmino(OrderID.fromPartial({})); obj.provider = message.provider ?? ""; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -509,7 +509,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -857,10 +857,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts index c8e064c164..c09f496048 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/genesis.ts @@ -16,9 +16,9 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by market module */ export interface GenesisStateAmino { - orders?: OrderAmino[]; - leases?: LeaseAmino[]; - params?: ParamsAmino; + orders: OrderAmino[]; + leases: LeaseAmino[]; + params: ParamsAmino; } export interface GenesisStateAminoMsg { type: "/akash.market.v1beta2.GenesisState"; @@ -148,7 +148,7 @@ export const GenesisState = { } else { obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts index 6c6bab64eb..1b68d4c9e7 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/lease.ts @@ -66,11 +66,11 @@ export interface LeaseIDProtoMsg { } /** LeaseID stores bid details of lease */ export interface LeaseIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; } export interface LeaseIDAminoMsg { type: "/akash.market.v1beta2.LeaseID"; @@ -98,9 +98,9 @@ export interface LeaseProtoMsg { } /** Lease stores LeaseID, state of lease and price */ export interface LeaseAmino { - lease_id?: LeaseIDAmino; - state?: Lease_State; - price?: DecCoinAmino; + lease_id: LeaseIDAmino; + state: Lease_State; + price: DecCoinAmino; created_at?: string; closed_on?: string; } @@ -131,12 +131,12 @@ export interface LeaseFiltersProtoMsg { } /** LeaseFilters defines flags for lease list filter */ export interface LeaseFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; + state: string; } export interface LeaseFiltersAminoMsg { type: "/akash.market.v1beta2.LeaseFilters"; @@ -161,7 +161,7 @@ export interface MsgCreateLeaseProtoMsg { } /** MsgCreateLease is sent to create a lease */ export interface MsgCreateLeaseAmino { - bid_id?: BidIDAmino; + bid_id: BidIDAmino; } export interface MsgCreateLeaseAminoMsg { type: "/akash.market.v1beta2.MsgCreateLease"; @@ -195,7 +195,7 @@ export interface MsgWithdrawLeaseProtoMsg { } /** MsgWithdrawLease defines an SDK message for closing bid */ export interface MsgWithdrawLeaseAmino { - bid_id?: LeaseIDAmino; + bid_id: LeaseIDAmino; } export interface MsgWithdrawLeaseAminoMsg { type: "/akash.market.v1beta2.MsgWithdrawLease"; @@ -229,7 +229,7 @@ export interface MsgCloseLeaseProtoMsg { } /** MsgCloseLease defines an SDK message for closing order */ export interface MsgCloseLeaseAmino { - lease_id?: LeaseIDAmino; + lease_id: LeaseIDAmino; } export interface MsgCloseLeaseAminoMsg { type: "/akash.market.v1beta2.MsgCloseLease"; @@ -534,11 +534,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn !== BigInt(0) ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -788,7 +788,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -938,7 +938,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1088,7 +1088,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts index ff83d346f5..be7b2ab39b 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/order.ts @@ -64,10 +64,10 @@ export interface OrderIDProtoMsg { } /** OrderID stores owner and all other seq numbers */ export interface OrderIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; + owner: string; + dseq: string; + gseq: number; + oseq: number; } export interface OrderIDAminoMsg { type: "/akash.market.v1beta2.OrderID"; @@ -93,9 +93,9 @@ export interface OrderProtoMsg { } /** Order stores orderID, state of order and other details */ export interface OrderAmino { - order_id?: OrderIDAmino; - state?: Order_State; - spec?: GroupSpecAmino; + order_id: OrderIDAmino; + state: Order_State; + spec: GroupSpecAmino; created_at?: string; } export interface OrderAminoMsg { @@ -123,11 +123,11 @@ export interface OrderFiltersProtoMsg { } /** OrderFilters defines flags for order list filter */ export interface OrderFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + state: string; } export interface OrderFiltersAminoMsg { type: "/akash.market.v1beta2.OrderFilters"; @@ -389,10 +389,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.toAmino(OrderID.fromPartial({})); obj.state = message.state ?? 0; - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { diff --git a/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts index 142dc403f4..662ed83bca 100644 --- a/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv2/akash/market/v1beta2/params.ts @@ -13,8 +13,8 @@ export interface ParamsProtoMsg { } /** Params is the params for the x/market module */ export interface ParamsAmino { - bid_min_deposit?: CoinAmino; - order_max_bids?: number; + bid_min_deposit: CoinAmino; + order_max_bids: number; } export interface ParamsAminoMsg { type: "/akash.market.v1beta2.Params"; @@ -106,7 +106,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.toAmino(Coin.fromPartial({})); obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts index 987fba1577..90a8f61538 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta1/provider.ts @@ -13,8 +13,8 @@ export interface ProviderInfoProtoMsg { } /** ProviderInfo */ export interface ProviderInfoAmino { - email?: string; - website?: string; + email: string; + website: string; } export interface ProviderInfoAminoMsg { type: "/akash.provider.v1beta1.ProviderInfo"; @@ -38,10 +38,10 @@ export interface MsgCreateProviderProtoMsg { } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgCreateProviderAminoMsg { type: "/akash.provider.v1beta1.MsgCreateProvider"; @@ -81,10 +81,10 @@ export interface MsgUpdateProviderProtoMsg { } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgUpdateProviderAminoMsg { type: "/akash.provider.v1beta1.MsgUpdateProvider"; @@ -121,7 +121,7 @@ export interface MsgDeleteProviderProtoMsg { } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderAmino { - owner?: string; + owner: string; } export interface MsgDeleteProviderAminoMsg { type: "/akash.provider.v1beta1.MsgDeleteProvider"; @@ -158,10 +158,10 @@ export interface ProviderProtoMsg { } /** Provider stores owner and host details */ export interface ProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface ProviderAminoMsg { type: "/akash.provider.v1beta1.Provider"; @@ -397,7 +397,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -605,7 +605,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -961,7 +961,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts index 6b6fb4bfd9..a5980b6ae9 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by provider module */ export interface GenesisStateAmino { - providers?: ProviderAmino[]; + providers: ProviderAmino[]; } export interface GenesisStateAminoMsg { type: "/akash.provider.v1beta2.GenesisState"; diff --git a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts index f7536fad95..db51e792da 100644 --- a/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv2/akash/provider/v1beta2/provider.ts @@ -13,8 +13,8 @@ export interface ProviderInfoProtoMsg { } /** ProviderInfo */ export interface ProviderInfoAmino { - email?: string; - website?: string; + email: string; + website: string; } export interface ProviderInfoAminoMsg { type: "/akash.provider.v1beta2.ProviderInfo"; @@ -38,10 +38,10 @@ export interface MsgCreateProviderProtoMsg { } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgCreateProviderAminoMsg { type: "/akash.provider.v1beta2.MsgCreateProvider"; @@ -81,10 +81,10 @@ export interface MsgUpdateProviderProtoMsg { } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface MsgUpdateProviderAminoMsg { type: "/akash.provider.v1beta2.MsgUpdateProvider"; @@ -121,7 +121,7 @@ export interface MsgDeleteProviderProtoMsg { } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderAmino { - owner?: string; + owner: string; } export interface MsgDeleteProviderAminoMsg { type: "/akash.provider.v1beta2.MsgDeleteProvider"; @@ -158,10 +158,10 @@ export interface ProviderProtoMsg { } /** Provider stores owner and host details */ export interface ProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } export interface ProviderAminoMsg { type: "/akash.provider.v1beta2.Provider"; @@ -397,7 +397,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -605,7 +605,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -961,7 +961,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts index 1355710673..a9775ece06 100644 --- a/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv2/cosmos/auth/v1beta1/auth.ts @@ -224,8 +224,8 @@ export const BaseAccount = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -520,11 +520,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts index 2c49c0d6d1..5f0e09e549 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/abci/v1beta1/abci.ts @@ -138,7 +138,7 @@ export interface ABCIMessageLogProtoMsg { } /** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ export interface ABCIMessageLogAmino { - msg_index?: number; + msg_index: number; log?: string; /** * Events contains a slice of Event objects that were emitted during some @@ -737,7 +737,7 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.txhash = message.txhash === "" ? undefined : message.txhash; obj.codespace = message.codespace === "" ? undefined : message.codespace; obj.code = message.code === 0 ? undefined : message.code; @@ -749,8 +749,8 @@ export const TxResponse = { obj.logs = message.logs; } obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { @@ -1220,8 +1220,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1902,11 +1902,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts index a5f7e2b642..3b8343ea94 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/query/v1beta1/pagination.ts @@ -302,8 +302,8 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; obj.count_total = message.countTotal === false ? undefined : message.countTotal; obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; @@ -413,7 +413,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts index 9528a9649d..3fcad902d0 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -358,7 +358,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; @@ -873,7 +873,7 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.height = message.height === 0 ? undefined : message.height; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts index a383c3a9dc..53302307f1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/store/v1beta1/commit_info.ts @@ -185,7 +185,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -405,7 +405,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts index 09fb5e3091..aabbce302b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/base/tendermint/v1beta1/query.ts @@ -448,7 +448,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -579,7 +579,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -807,7 +807,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -956,8 +956,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -1049,7 +1049,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts index 246713ac57..bb4d6d7574 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/capability.ts @@ -158,7 +158,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { diff --git a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts index 7e359de60d..503243289b 100644 --- a/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/capability/v1beta1/genesis.ts @@ -146,7 +146,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -260,7 +260,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts index de1d59a3c8..f4e28999fc 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/distribution.ts @@ -334,7 +334,7 @@ export interface DelegatorStartingInfoProtoMsg { export interface DelegatorStartingInfoAmino { previous_period?: string; stake?: string; - height?: string; + height: string; } export interface DelegatorStartingInfoAminoMsg { type: "cosmos-sdk/DelegatorStartingInfo"; @@ -773,7 +773,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = message.rewards; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -1080,7 +1080,7 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; obj.fraction = message.fraction === "" ? undefined : message.fraction; return obj; }, @@ -1553,7 +1553,7 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; obj.stake = message.stake === "" ? undefined : message.stake; obj.height = message.height ? message.height.toString() : "0"; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts index e9f64d1fed..6cda0ae837 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/genesis.ts @@ -739,7 +739,7 @@ export const ValidatorHistoricalRewardsRecord = { toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -1114,8 +1114,8 @@ export const ValidatorSlashEventRecord = { toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts index 4d216d111c..57c7fbbbaf 100644 --- a/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/distribution/v1beta1/query.ts @@ -1201,8 +1201,8 @@ export const QueryValidatorSlashesRequest = { toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts index 04441d0f5d..8b75ef8d43 100644 --- a/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv2/cosmos/evidence/v1beta1/evidence.ts @@ -154,9 +154,9 @@ export const Equivocation = { }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts index 08e077ac34..228d368faa 100644 --- a/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/genutil/v1beta1/genesis.ts @@ -13,7 +13,7 @@ export interface GenesisStateProtoMsg { /** GenesisState defines the raw genesis transaction in JSON. */ export interface GenesisStateAmino { /** gen_txs defines the genesis transactions. */ - gen_txs?: string[]; + gen_txs: string[]; } export interface GenesisStateAminoMsg { type: "cosmos-sdk/GenesisState"; diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts index 0eb4d12ad0..9af249949e 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/genesis.ts @@ -235,7 +235,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts index 799adb5d32..40b690db14 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/gov.ts @@ -633,7 +633,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -880,7 +880,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1178,7 +1178,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts index 3bf8d0694f..331e754a63 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/query.ts @@ -491,7 +491,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -948,7 +948,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1150,7 +1150,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1594,7 +1594,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1796,7 +1796,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2007,7 +2007,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts index 96731554ec..37dbeabdfa 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1/tx.ts @@ -138,7 +138,7 @@ export interface MsgVoteProtoMsg { } /** MsgVote defines a message to cast a vote. */ export interface MsgVoteAmino { - proposal_id?: string; + proposal_id: string; voter?: string; option?: VoteOption; metadata?: string; @@ -181,7 +181,7 @@ export interface MsgVoteWeightedProtoMsg { } /** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeightedAmino { - proposal_id?: string; + proposal_id: string; voter?: string; options?: WeightedVoteOptionAmino[]; metadata?: string; @@ -223,7 +223,7 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { - proposal_id?: string; + proposal_id: string; depositor?: string; amount?: CoinAmino[]; } @@ -476,7 +476,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts index c53cb304c5..d23c90d59d 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/genesis.ts @@ -235,7 +235,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts index 818793485c..74e27922a4 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/gov.ts @@ -360,7 +360,7 @@ export interface VoteProtoMsg { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface VoteAmino { - proposal_id?: string; + proposal_id: string; voter?: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries @@ -802,7 +802,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -1030,7 +1030,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any)) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts index 981d890b48..0f82a35852 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/query.ts @@ -491,7 +491,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -948,7 +948,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1150,7 +1150,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1594,7 +1594,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1796,7 +1796,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2007,7 +2007,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts index 30610c0aba..dc90529591 100644 --- a/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/gov/v1beta1/tx.ts @@ -56,7 +56,7 @@ export interface MsgSubmitProposalResponseProtoMsg { } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponseAmino { - proposal_id?: string; + proposal_id: string; } export interface MsgSubmitProposalResponseAminoMsg { type: "cosmos-sdk/MsgSubmitProposalResponse"; @@ -126,7 +126,7 @@ export interface MsgVoteWeightedProtoMsg { * Since: cosmos-sdk 0.43 */ export interface MsgVoteWeightedAmino { - proposal_id?: string; + proposal_id: string; voter?: string; options?: WeightedVoteOptionAmino[]; } @@ -182,7 +182,7 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { - proposal_id?: string; + proposal_id: string; depositor?: string; amount?: CoinAmino[]; } @@ -533,7 +533,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts index 32cafd489f..410885d358 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/events.ts @@ -277,7 +277,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -369,7 +369,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -641,7 +641,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -733,7 +733,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -825,7 +825,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -932,7 +932,7 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.result = message.result === 0 ? undefined : message.result; return obj; }, @@ -1040,7 +1040,7 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts index 4721972b81..52d6a5b96f 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/genesis.ts @@ -283,7 +283,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -294,13 +294,13 @@ export const GenesisState = { } else { obj.group_members = message.groupMembers; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = message.groupPolicies; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts index 399210d791..a799bade41 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/query.ts @@ -727,7 +727,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -1110,7 +1110,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1564,7 +1564,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -2001,7 +2001,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2426,7 +2426,7 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -2628,7 +2628,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3291,7 +3291,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts index 3c6862b796..d5abbb8fd1 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/tx.ts @@ -986,7 +986,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -1115,7 +1115,7 @@ export const MsgUpdateGroupMembers = { toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1315,7 +1315,7 @@ export const MsgUpdateGroupAdmin = { toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, @@ -1511,7 +1511,7 @@ export const MsgUpdateGroupMetadata = { toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, @@ -1724,7 +1724,7 @@ export const MsgCreateGroupPolicy = { toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; return obj; @@ -2227,7 +2227,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, @@ -2956,7 +2956,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -3063,7 +3063,7 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -3288,7 +3288,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; @@ -3471,7 +3471,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -3652,7 +3652,7 @@ export const MsgLeaveGroup = { toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts index 7252b40c50..11277cf566 100644 --- a/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmos/group/v1/types.ts @@ -1471,10 +1471,10 @@ export const GroupInfo = { }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1585,7 +1585,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1773,10 +1773,10 @@ export const GroupPolicyInfo = { toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any)) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -2068,7 +2068,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { @@ -2077,8 +2077,8 @@ export const Proposal = { obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; @@ -2378,7 +2378,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; diff --git a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts index 874e1b18a4..6cdd2ae018 100644 --- a/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/cosmos/mint/v1beta1/mint.ts @@ -329,7 +329,7 @@ export const Params = { obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts index c53827c0d7..7db0aa1f69 100644 --- a/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/nft/v1beta1/query.ts @@ -479,7 +479,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -857,7 +857,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts index 37699ead0c..6e21989663 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/genesis.ts @@ -586,7 +586,7 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.missed = message.missed === false ? undefined : message.missed; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts index 3cb713495c..c28706cc72 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/slashing.ts @@ -256,11 +256,11 @@ export const ValidatorSigningInfo = { toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.start_height = message.startHeight !== BigInt(0) ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset !== BigInt(0) ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.missed_blocks_counter = message.missedBlocksCounter !== BigInt(0) ? message.missedBlocksCounter.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -414,7 +414,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = message.signedBlocksWindow !== BigInt(0) ? message.signedBlocksWindow.toString() : undefined; obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; diff --git a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts index 5c277423db..580baacee9 100644 --- a/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/slashing/v1beta1/tx.ts @@ -11,7 +11,7 @@ export interface MsgUnjailProtoMsg { } /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjailAmino { - validator_addr?: string; + validator_addr: string; } export interface MsgUnjailAminoMsg { type: "cosmos-sdk/MsgUnjail"; diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts index 612e2fc449..6359cfc088 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/genesis.ts @@ -433,7 +433,7 @@ export const LastValidatorPower = { toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts index cd40db820c..9cf4741ad7 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/query.ts @@ -3309,7 +3309,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts index 2ee05f0c59..d99d157c00 100644 --- a/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv2/cosmos/staking/v1beta1/staking.ts @@ -815,8 +815,8 @@ export interface PoolProtoMsg { * denomination. */ export interface PoolAmino { - not_bonded_tokens?: string; - bonded_tokens?: string; + not_bonded_tokens: string; + bonded_tokens: string; } export interface PoolAminoMsg { type: "cosmos-sdk/Pool"; @@ -1562,7 +1562,7 @@ export const Validator = { obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -2484,7 +2484,7 @@ export const UnbondingDelegationEntry = { }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; @@ -2624,7 +2624,7 @@ export const RedelegationEntry = { }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts index 27059952ee..90eb296624 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/signing/v1beta1/signing.ts @@ -447,7 +447,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts index 93665043e9..7beb5470a5 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/service.ts @@ -1463,7 +1463,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts index 508c77d764..6ef830229c 100644 --- a/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/tx/v1beta1/tx.ts @@ -1141,7 +1141,7 @@ export const SignDoc = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1317,8 +1317,8 @@ export const SignDocDirectAux = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1495,7 +1495,7 @@ export const TxBody = { obj.messages = message.messages; } obj.memo = message.memo === "" ? undefined : message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1769,7 +1769,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -2235,7 +2235,7 @@ export const Fee = { } else { obj.amount = message.amount; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; obj.payer = message.payer === "" ? undefined : message.payer; obj.granter = message.granter === "" ? undefined : message.granter; return obj; diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts index 042744cebb..96421a56e3 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/query.ts @@ -653,7 +653,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -745,7 +745,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { diff --git a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts index 66b23c50cb..e1c43bb2c3 100644 --- a/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv2/cosmos/upgrade/v1beta1/upgrade.ts @@ -350,7 +350,7 @@ export const Plan = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -690,7 +690,7 @@ export const ModuleVersion = { toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts index b8f7636a3c..5dd2924605 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/tx.ts @@ -308,7 +308,7 @@ export const MsgCreateVestingAccount = { } else { obj.amount = message.amount; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, @@ -730,7 +730,7 @@ export const MsgCreatePeriodicVestingAccount = { const obj: any = {}; obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; obj.to_address = message.toAddress === "" ? undefined : message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts index 6ee2200030..5edf48a5b6 100644 --- a/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv2/cosmos/vesting/v1beta1/vesting.ts @@ -367,7 +367,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -477,7 +477,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -682,7 +682,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -818,7 +818,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts index 9ee2053442..41beb793fe 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/genesis.ts @@ -588,7 +588,7 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; obj.pinned = message.pinned === false ? undefined : message.pinned; @@ -833,7 +833,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts index 4fdabff2bc..7f18b8b41c 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/ibc.ts @@ -191,8 +191,8 @@ export const MsgIBCSend = { toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; obj.channel = message.channel === "" ? undefined : message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts index dfab50cdb1..50384fcf85 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/proposal.ts @@ -745,7 +745,7 @@ export const InstantiateContractProposal = { obj.description = message.description === "" ? undefined : message.description; obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -907,7 +907,7 @@ export const MigrateContractProposal = { obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts index e7fa7e5a3a..43bc1933e3 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/query.ts @@ -451,7 +451,7 @@ export interface CodeInfoResponseProtoMsg { } /** CodeInfoResponse contains code meta data from CodeInfo */ export interface CodeInfoResponseAmino { - code_id?: string; + code_id: string; creator?: string; data_hash?: string; } @@ -477,7 +477,7 @@ export interface QueryCodeResponseProtoMsg { /** QueryCodeResponse is the response type for the Query/Code RPC method */ export interface QueryCodeResponseAmino { code_info?: CodeInfoResponseAmino; - data?: string; + data: string; } export interface QueryCodeResponseAminoMsg { type: "wasm/QueryCodeResponse"; @@ -1108,7 +1108,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1937,7 +1937,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts index a0490fa54b..255d69aefc 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/tx.ts @@ -549,7 +549,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -724,7 +724,7 @@ export const MsgInstantiateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -1214,7 +1214,7 @@ export const MsgMigrateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts index 62ab5abed0..ad2145018d 100644 --- a/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv2/cosmwasm/wasm/v1/types.ts @@ -672,7 +672,7 @@ export const Params = { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.max_wasm_code_size = message.maxWasmCodeSize !== BigInt(0) ? message.maxWasmCodeSize.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -982,7 +982,7 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.creator = message.creator === "" ? undefined : message.creator; obj.admin = message.admin === "" ? undefined : message.admin; obj.label = message.label === "" ? undefined : message.label; @@ -1128,7 +1128,7 @@ export const ContractCodeHistoryEntry = { toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; obj.operation = message.operation === 0 ? undefined : message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1239,8 +1239,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts index 6721b8a7f2..1a891aea0f 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/genesis.ts @@ -221,10 +221,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts index 3115ba5a89..c3739ab17f 100644 --- a/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/epochs/v1/query.ts @@ -419,7 +419,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts index a5ee6380bf..66321a80d1 100644 --- a/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/fees/v1/genesis.ts @@ -330,7 +330,7 @@ export const Params = { obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate.toString() : undefined; obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; return obj; }, diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts index 59f3cad183..c60abe6554 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/incentives.ts @@ -302,7 +302,7 @@ export const Incentive = { } obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = message.totalGas !== BigInt(0) ? message.totalGas.toString() : undefined; return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -419,7 +419,7 @@ export const GasMeter = { const obj: any = {}; obj.contract = message.contract === "" ? undefined : message.contract; obj.participant = message.participant === "" ? undefined : message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.cumulative_gas = message.cumulativeGas !== BigInt(0) ? message.cumulativeGas.toString() : undefined; return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { diff --git a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts index 903fc6880f..68acf0c089 100644 --- a/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/incentives/v1/query.ts @@ -1164,7 +1164,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = message.gasMeter !== BigInt(0) ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts index 86b8d82096..dbde7cc429 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/genesis.ts @@ -214,10 +214,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.epochs_per_period = message.epochsPerPeriod !== BigInt(0) ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts index 0974d290e0..8af6baec92 100644 --- a/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv2/evmos/inflation/v1/query.ts @@ -423,7 +423,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -723,7 +723,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { diff --git a/__fixtures__/v-next/outputv2/google/api/distribution.ts b/__fixtures__/v-next/outputv2/google/api/distribution.ts index e761344e48..c6a0f58c50 100644 --- a/__fixtures__/v-next/outputv2/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/distribution.ts @@ -728,7 +728,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; diff --git a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts index df9432a437..02dacb84c5 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -1336,7 +1336,7 @@ export const IssueDetails = { const obj: any = {}; obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts index 7c22829012..855ae6ef7a 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/checked.ts @@ -980,7 +980,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -1076,7 +1076,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts index a113d90e13..bafb00f608 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/eval.ts @@ -465,8 +465,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = message.expr !== BigInt(0) ? message.expr.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts index b6c73fbc6b..f74e21a5a8 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/explain.ts @@ -290,7 +290,7 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts index f3bdff3824..52826c4b29 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/syntax.ts @@ -1185,7 +1185,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1855,7 +1855,7 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; @@ -2262,8 +2262,8 @@ export const Constant = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -2367,7 +2367,7 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value === 0 ? undefined : message.value; return obj; }, @@ -2463,7 +2463,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts index 3fdcdf8cfb..dd048bf2ae 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1alpha1/value.ts @@ -490,8 +490,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts index fe1c3f0fa2..f81d2d06a9 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/expr.ts @@ -2015,8 +2015,8 @@ export const Literal = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts index 9f85502f16..3bf3a9e655 100644 --- a/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv2/google/api/expr/v1beta1/value.ts @@ -490,8 +490,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv2/google/api/quota.ts b/__fixtures__/v-next/outputv2/google/api/quota.ts index f5a77b4453..1b475f18c8 100644 --- a/__fixtures__/v-next/outputv2/google/api/quota.ts +++ b/__fixtures__/v-next/outputv2/google/api/quota.ts @@ -709,7 +709,7 @@ export const MetricRule_MetricCostsEntry = { toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -945,7 +945,7 @@ export const QuotaLimit_ValuesEntry = { toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1203,9 +1203,9 @@ export const QuotaLimit = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.description = message.description === "" ? undefined : message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit !== BigInt(0) ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier !== BigInt(0) ? message.freeTier.toString() : undefined; obj.duration = message.duration === "" ? undefined : message.duration; obj.metric = message.metric === "" ? undefined : message.metric; obj.unit = message.unit === "" ? undefined : message.unit; diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts index 0338bcee4a..8192f0ef58 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/distribution.ts @@ -536,7 +536,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.minimum = message.minimum === 0 ? undefined : message.minimum; obj.maximum = message.maximum === 0 ? undefined : message.maximum; diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts index 63549de72e..f3f33bacd8 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/http_request.ts @@ -470,9 +470,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -481,7 +481,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts index 7b4a289acd..023e5b0223 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/log_entry.ts @@ -940,7 +940,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts index f70f423ef3..ea9653ab0e 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/metric_value.ts @@ -469,7 +469,7 @@ export const MetricValue = { obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; diff --git a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts index df510da2cf..63def361f5 100644 --- a/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv2/google/api/servicecontrol/v1/service_controller.ts @@ -959,9 +959,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; + obj.project_number = message.projectNumber !== BigInt(0) ? message.projectNumber.toString() : undefined; obj.type = message.type === 0 ? undefined : message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.consumer_number = message.consumerNumber !== BigInt(0) ? message.consumerNumber.toString() : undefined; return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { diff --git a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts index 148c3ed9e2..441210ad4a 100644 --- a/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv2/google/api/serviceusage/v1beta1/resources.ts @@ -2202,8 +2202,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = message.effectiveLimit !== BigInt(0) ? message.effectiveLimit.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2503,7 +2503,7 @@ export const QuotaOverride = { toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.override_value = message.overrideValue !== BigInt(0) ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { @@ -2896,7 +2896,7 @@ export const AdminQuotaPolicy = { toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.policy_value = message.policyValue !== BigInt(0) ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts index 02dd3c583d..b610aef4cb 100644 --- a/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv2/google/logging/type/http_request.ts @@ -474,9 +474,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -485,7 +485,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts index 45a3ebb597..d3fe621eb7 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/log_entry.ts @@ -1256,7 +1256,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts index 5a98d87d45..dd6d139cfa 100644 --- a/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv2/google/logging/v2/logging_config.ts @@ -7551,7 +7551,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = message.logEntriesCopiedCount !== BigInt(0) ? message.logEntriesCopiedCount.toString() : undefined; return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts index 1057797b32..39e1d2e5ee 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/descriptor.ts @@ -5766,8 +5766,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts index fbea471419..3556997715 100644 --- a/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv2/google/protobuf/wrappers.ts @@ -539,7 +539,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -624,7 +624,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { diff --git a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts index 1673540065..5560942348 100644 --- a/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv2/google/rpc/context/attribute_context.ts @@ -1481,7 +1481,7 @@ export const AttributeContext_Peer = { toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; obj.ip = message.ip === "" ? undefined : message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.port = message.port !== BigInt(0) ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -2184,7 +2184,7 @@ export const AttributeContext_Request = { obj.scheme = message.scheme === "" ? undefined : message.scheme; obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; @@ -2466,8 +2466,8 @@ export const AttributeContext_Response = { }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = message.code !== BigInt(0) ? message.code.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts index ffc7d3acb4..a7185130e9 100644 --- a/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/applications/transfer/v1/tx.ts @@ -260,7 +260,7 @@ export const MsgTransfer = { obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts index c6b7e21e47..ddbf07af07 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/channel.ts @@ -1076,14 +1076,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1222,7 +1222,7 @@ export const PacketState = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts index 1e20a5fe69..3c52808c62 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/genesis.ts @@ -329,7 +329,7 @@ export const GenesisState = { } else { obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -453,7 +453,7 @@ export const PacketSequence = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts index 8aad5fac7f..fa7244f228 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/query.ts @@ -2079,8 +2079,8 @@ export const QueryChannelConsensusStateRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -2346,7 +2346,7 @@ export const QueryPacketCommitmentRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2854,7 +2854,7 @@ export const QueryPacketReceiptRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -3102,7 +3102,7 @@ export const QueryPacketAcknowledgementRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -4287,7 +4287,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts index e404ebc66b..94c0099488 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/channel/v1/tx.ts @@ -2259,7 +2259,7 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2507,7 +2507,7 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts index c9aa5dd681..e5d1ddf5b6 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/client.ts @@ -1005,8 +1005,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts index 1b17e7f239..3afb72c4ca 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/genesis.ts @@ -294,7 +294,7 @@ export const GenesisState = { } obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts index e0f0c68fc1..26729eb12a 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/client/v1/query.ts @@ -1077,8 +1077,8 @@ export const QueryConsensusStateRequest = { toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts index 3167090512..25ad5a283e 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/connection.ts @@ -492,7 +492,7 @@ export const ConnectionEnd = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -676,7 +676,7 @@ export const IdentifiedConnection = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -1224,7 +1224,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts index b24ec1d1b0..d2b16082e3 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/genesis.ts @@ -169,7 +169,7 @@ export const GenesisState = { } else { obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts index 9ad5300289..e3f68e7c8b 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/query.ts @@ -1361,8 +1361,8 @@ export const QueryConnectionConsensusStateRequest = { toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { diff --git a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts index 28ce26262b..81e514fd87 100644 --- a/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv2/ibc/core/connection/v1/tx.ts @@ -443,7 +443,7 @@ export const MsgConnectionOpenInit = { obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -791,7 +791,7 @@ export const MsgConnectionOpenTry = { obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts index 55bdab7bcf..83f0070241 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v1/solomachine.ts @@ -763,8 +763,8 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence !== BigInt(0) ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; @@ -892,7 +892,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -1048,8 +1048,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1194,7 +1194,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1336,7 +1336,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1444,7 +1444,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1598,8 +1598,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2552,7 +2552,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts index 5ac62f77ae..fa52fee62d 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/solomachine/v2/solomachine.ts @@ -761,7 +761,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; @@ -890,7 +890,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -1046,8 +1046,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1192,7 +1192,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1334,7 +1334,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1442,7 +1442,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1596,8 +1596,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2550,7 +2550,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts index 80ddf5b8f6..16e285c86f 100644 --- a/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv2/ibc/lightclients/tendermint/v1/tendermint.ts @@ -1052,8 +1052,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts index a49fb005f3..03f5834f3c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/genesis.ts @@ -324,10 +324,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts index 39e5913ec7..ed5a161df9 100644 --- a/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/epochs/query.ts @@ -393,7 +393,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts index a1d167537b..2e1a4fa8e6 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -829,7 +829,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts index 99ad999173..99dccd54f3 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -268,7 +268,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 77eedd7258..630187e303 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -417,7 +417,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts index 43ba88bdfb..520703b67b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/pool-models/stableswap/tx.ts @@ -372,7 +372,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -510,7 +510,7 @@ export const MsgStableSwapAdjustScalingFactors = { toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts index ee7bdf0f34..eb1b154716 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/genesis.ts @@ -270,7 +270,7 @@ export const GenesisState = { } else { obj.pools = message.pools; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = message.nextPoolNumber !== BigInt(0) ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts index ef69dcf790..9410eb8e1c 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/query.ts @@ -714,7 +714,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -1180,7 +1180,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1272,7 +1272,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1475,7 +1475,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1703,7 +1703,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, @@ -1896,7 +1896,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -2080,7 +2080,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2272,7 +2272,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2477,7 +2477,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2720,7 +2720,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; @@ -3208,7 +3208,7 @@ export const QuerySwapExactAmountInRequest = { toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); @@ -3448,7 +3448,7 @@ export const QuerySwapExactAmountOutRequest = { toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts index 858ed5bcbc..c508331d74 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v1beta1/tx.ts @@ -556,7 +556,7 @@ export const MsgJoinPool = { toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); @@ -822,7 +822,7 @@ export const MsgExitPool = { toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); @@ -1035,7 +1035,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -1383,7 +1383,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, @@ -1764,7 +1764,7 @@ export const MsgJoinSwapExternAmountIn = { toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; @@ -2009,7 +2009,7 @@ export const MsgJoinSwapShareAmountOut = { toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; @@ -2255,7 +2255,7 @@ export const MsgExitSwapShareAmountIn = { toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; @@ -2488,7 +2488,7 @@ export const MsgExitSwapExternAmountOut = { toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; diff --git a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts index cf2c2455cb..37866f66ea 100644 --- a/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/gamm/v2/query.ts @@ -164,7 +164,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts index 90b346c20c..0150dcde09 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/gauge.ts @@ -319,7 +319,7 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { @@ -328,8 +328,8 @@ export const Gauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; + obj.filled_epochs = message.filledEpochs !== BigInt(0) ? message.filledEpochs.toString() : undefined; if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts index 40b43f5b60..1f5b8bc0d0 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/genesis.ts @@ -199,7 +199,7 @@ export const GenesisState = { } else { obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = message.lastGaugeId !== BigInt(0) ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts index 8f2777285b..6cf257623d 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/query.ts @@ -627,7 +627,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1944,7 +1944,7 @@ export const RewardsEstRequest = { } else { obj.lock_ids = message.lockIds; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = message.endEpoch !== BigInt(0) ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts index 9374e4655f..4c15055079 100644 --- a/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/incentives/tx.ts @@ -288,7 +288,7 @@ export const MsgCreateGauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -489,7 +489,7 @@ export const MsgAddToGauge = { toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts index 56728b5e02..11fbe2e2a1 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/genesis.ts @@ -137,7 +137,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = message.lastLockId !== BigInt(0) ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts index 4f38386026..63d0173b51 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/lock.ts @@ -404,7 +404,7 @@ export const PeriodLock = { }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; @@ -691,7 +691,7 @@ export const SyntheticLock = { }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; + obj.underlying_lock_id = message.underlyingLockId !== BigInt(0) ? message.underlyingLockId.toString() : undefined; obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts index 9ca90d5e36..920dde78a1 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/query.ts @@ -2618,7 +2618,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2802,7 +2802,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts index e59319c88f..89ac3d78eb 100644 --- a/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/lockup/tx.ts @@ -435,7 +435,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -754,7 +754,7 @@ export const MsgBeginUnlocking = { toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -974,7 +974,7 @@ export const MsgExtendLockup = { toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1194,7 +1194,7 @@ export const MsgForceUnlock = { toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts index b0adc047a0..2f51ee0092 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/genesis.ts @@ -143,7 +143,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = message.reductionStartedEpoch !== BigInt(0) ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts index 9404aefea3..3782a815ac 100644 --- a/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv2/osmosis/mint/v1beta1/mint.ts @@ -744,7 +744,7 @@ export const Params = { obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs.toString() : undefined; obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { @@ -752,7 +752,7 @@ export const Params = { } else { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch !== BigInt(0) ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts index 5c5c2d8345..6fd1d7f989 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/incentives.ts @@ -516,7 +516,7 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, @@ -643,8 +643,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts index 09e4e85aeb..bad79351bf 100644 --- a/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/pool-incentives/v1beta1/query.ts @@ -291,7 +291,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -515,7 +515,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; @@ -1215,9 +1215,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts index 3e6cb863aa..a5d982fd50 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/query.ts @@ -1395,7 +1395,7 @@ export const SuperfluidIntermediaryAccountInfo = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -1698,7 +1698,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts index 6c1007adc3..1aadf0fdf6 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/superfluid.ts @@ -459,7 +459,7 @@ export const SuperfluidIntermediaryAccount = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -581,7 +581,7 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; return obj; @@ -832,7 +832,7 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, diff --git a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts index 32c9643c7d..5db9cef83b 100644 --- a/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv2/osmosis/superfluid/tx.ts @@ -318,7 +318,7 @@ export const MsgSuperfluidDelegate = { toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, @@ -499,7 +499,7 @@ export const MsgSuperfluidUndelegate = { toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -679,7 +679,7 @@ export const MsgSuperfluidUnbondLock = { toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -975,7 +975,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1083,7 +1083,7 @@ export const MsgUnPoolWhitelistedPool = { toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts index 306b047111..7eb5cdbc22 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/query.ts @@ -248,7 +248,7 @@ export const ArithmeticTwapRequest = { }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; @@ -479,7 +479,7 @@ export const ArithmeticTwapToNowRequest = { }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; diff --git a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts index d2c313cbb4..e019cb5930 100644 --- a/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv2/osmosis/twap/v1beta1/twap_record.ts @@ -60,7 +60,7 @@ export interface TwapRecordAmino { /** Lexicographically larger denom of the pair */ asset1_denom?: string; /** height this record corresponds to, for debugging purposes */ - height?: string; + height: string; /** * This field should only exist until we have a global registry in the state * machine, mapping prior block heights within {TIME RANGE} to times. @@ -310,7 +310,7 @@ export const TwapRecord = { }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height.toString() : "0"; diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts index e547811457..be594d0c96 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/feetoken.ts @@ -122,7 +122,7 @@ export const FeeToken = { toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts index 09d57b4442..2ead0fbeaa 100644 --- a/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv2/osmosis/txfees/v1beta1/query.ts @@ -498,7 +498,7 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, @@ -681,7 +681,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { diff --git a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts index 28e7dc0cfb..57ad0fa219 100644 --- a/__fixtures__/v-next/outputv2/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/abci/types.ts @@ -1970,8 +1970,8 @@ export const RequestInfo = { toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; obj.version = message.version === "" ? undefined : message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -2247,7 +2247,7 @@ export const RequestInitChain = { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -2379,7 +2379,7 @@ export const RequestQuery = { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.path = message.path === "" ? undefined : message.path; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.prove = message.prove === false ? undefined : message.prove; return obj; }, @@ -2792,7 +2792,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -3138,7 +3138,7 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; @@ -3990,8 +3990,8 @@ export const ResponseInfo = { const obj: any = {}; obj.data = message.data === "" ? undefined : message.data; obj.version = message.version === "" ? undefined : message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; return obj; }, @@ -4446,11 +4446,11 @@ export const ResponseQuery = { obj.code = message.code === 0 ? undefined : message.code; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, @@ -4746,8 +4746,8 @@ export const ResponseCheckTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4955,8 +4955,8 @@ export const ResponseDeliverTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -5200,7 +5200,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -5844,8 +5844,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -6310,7 +6310,7 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; @@ -6414,7 +6414,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -6517,7 +6517,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6769,9 +6769,9 @@ export const Evidence = { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6916,7 +6916,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; diff --git a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts index a44b6fb8bd..000003ef73 100644 --- a/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv2/tendermint/crypto/proof.ts @@ -251,8 +251,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); diff --git a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts index 34b875f406..93f66d1a99 100644 --- a/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/libs/bits/types.ts @@ -117,7 +117,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts index a94a82fead..6b77e89f75 100644 --- a/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/p2p/types.ts @@ -232,9 +232,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts index 97a4e4de14..ffea338dfc 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/evidence.ts @@ -342,8 +342,8 @@ export const DuplicateVoteEvidence = { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -500,13 +500,13 @@ export const LightClientAttackEvidence = { toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv2/tendermint/types/params.ts b/__fixtures__/v-next/outputv2/tendermint/types/params.ts index 90dfebda69..e031d8a875 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/params.ts @@ -479,9 +479,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs !== BigInt(0) ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -600,9 +600,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -780,7 +780,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -882,8 +882,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/types.ts b/__fixtures__/v-next/outputv2/tendermint/types/types.ts index 932d44ed8a..f74246007e 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/types.ts @@ -1094,7 +1094,7 @@ export const Header = { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; @@ -1391,7 +1391,7 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -1535,7 +1535,7 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { @@ -1851,7 +1851,7 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; @@ -2199,9 +2199,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts index dcba6d6e5a..1eff394408 100644 --- a/__fixtures__/v-next/outputv2/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv2/tendermint/types/validator.ts @@ -181,7 +181,7 @@ export const ValidatorSet = { obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -317,8 +317,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -421,7 +421,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv2/tendermint/version/types.ts b/__fixtures__/v-next/outputv2/tendermint/version/types.ts index 9bd3530c88..78a391def9 100644 --- a/__fixtures__/v-next/outputv2/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv2/tendermint/version/types.ts @@ -152,7 +152,7 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; obj.software = message.software === "" ? undefined : message.software; return obj; }, @@ -255,8 +255,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts index 80aa6c2326..c0c2d46bbf 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta1/audit.ts @@ -14,9 +14,9 @@ export interface ProviderProtoMsg { } /** Provider stores owner auditor and attributes details */ export interface ProviderAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } /** Provider stores owner auditor and attributes details */ export interface ProviderSDKType { @@ -36,9 +36,9 @@ export interface AuditedAttributesProtoMsg { } /** Attributes */ export interface AuditedAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } /** Attributes */ export interface AuditedAttributesSDKType { @@ -56,7 +56,7 @@ export interface AttributesResponseProtoMsg { } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseSDKType { @@ -73,8 +73,8 @@ export interface AttributesFiltersProtoMsg { } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersAmino { - auditors?: string[]; - owners?: string[]; + auditors: string[]; + owners: string[]; } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersSDKType { @@ -93,9 +93,9 @@ export interface MsgSignProviderAttributesProtoMsg { } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesSDKType { @@ -125,9 +125,9 @@ export interface MsgDeleteProviderAttributesProtoMsg { } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesAmino { - owner?: string; - auditor?: string; - keys?: string[]; + owner: string; + auditor: string; + keys: string[]; } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts index 4a1f25b93d..b30458d0cd 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/audit.ts @@ -14,9 +14,9 @@ export interface ProviderProtoMsg { } /** Provider stores owner auditor and attributes details */ export interface ProviderAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } /** Provider stores owner auditor and attributes details */ export interface ProviderSDKType { @@ -36,9 +36,9 @@ export interface AuditedAttributesProtoMsg { } /** Attributes */ export interface AuditedAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } /** Attributes */ export interface AuditedAttributesSDKType { @@ -56,7 +56,7 @@ export interface AttributesResponseProtoMsg { } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } /** AttributesResponse represents details of deployment along with group details */ export interface AttributesResponseSDKType { @@ -73,8 +73,8 @@ export interface AttributesFiltersProtoMsg { } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersAmino { - auditors?: string[]; - owners?: string[]; + auditors: string[]; + owners: string[]; } /** AttributesFilters defines filters used to filter deployments */ export interface AttributesFiltersSDKType { @@ -93,9 +93,9 @@ export interface MsgSignProviderAttributesProtoMsg { } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesAmino { - owner?: string; - auditor?: string; - attributes?: AttributeAmino[]; + owner: string; + auditor: string; + attributes: AttributeAmino[]; } /** MsgSignProviderAttributes defines an SDK message for signing a provider attributes */ export interface MsgSignProviderAttributesSDKType { @@ -125,9 +125,9 @@ export interface MsgDeleteProviderAttributesProtoMsg { } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesAmino { - owner?: string; - auditor?: string; - keys?: string[]; + owner: string; + auditor: string; + keys: string[]; } /** MsgDeleteProviderAttributes defined the Msg/DeleteProviderAttributes */ export interface MsgDeleteProviderAttributesSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts index a8017aa5ad..950c0c79ad 100644 --- a/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/audit/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by audit module */ export interface GenesisStateAmino { - attributes?: AuditedAttributesAmino[]; + attributes: AuditedAttributesAmino[]; } /** GenesisState defines the basic genesis state used by audit module */ export interface GenesisStateSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts index 6cd452b816..5537d842c7 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/attribute.ts @@ -44,9 +44,9 @@ export interface SignedByProtoMsg { */ export interface SignedByAmino { /** all_of all keys in this list must have signed attributes */ - all_of?: string[]; + all_of: string[]; /** any_of at least of of the keys from the list must have signed attributes */ - any_of?: string[]; + any_of: string[]; } /** * SignedBy represents validation accounts that tenant expects signatures for provider attributes @@ -72,9 +72,9 @@ export interface PlacementRequirementsProtoMsg { /** PlacementRequirements */ export interface PlacementRequirementsAmino { /** SignedBy list of keys that tenants expect to have signatures from */ - signed_by?: SignedByAmino; + signed_by: SignedByAmino; /** Attribute list of attributes tenant expects from the provider */ - attributes?: AttributeAmino[]; + attributes: AttributeAmino[]; } /** PlacementRequirements */ export interface PlacementRequirementsSDKType { @@ -380,7 +380,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements, useInterfaces: boolean = true): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts index 792764fe39..235a55203c 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta1/resource.ts @@ -34,7 +34,7 @@ export interface MemoryProtoMsg { } /** Memory stores resource quantity and memory attributes */ export interface MemoryAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } /** Memory stores resource quantity and memory attributes */ @@ -53,7 +53,7 @@ export interface StorageProtoMsg { } /** Storage stores resource quantity and storage attributes */ export interface StorageAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } /** Storage stores resource quantity and storage attributes */ @@ -83,7 +83,7 @@ export interface ResourceUnitsAmino { cpu?: CPUAmino; memory?: MemoryAmino; storage?: StorageAmino; - endpoints?: EndpointAmino[]; + endpoints: EndpointAmino[]; } /** * ResourceUnits describes all available resources types for deployment/node etc @@ -290,7 +290,7 @@ export const Memory = { }, toAmino(message: Memory, useInterfaces: boolean = true): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { @@ -398,7 +398,7 @@ export const Storage = { }, toAmino(message: Storage, useInterfaces: boolean = true): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts index 650ca9e067..3b7aee5492 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/attribute.ts @@ -44,9 +44,9 @@ export interface SignedByProtoMsg { */ export interface SignedByAmino { /** all_of all keys in this list must have signed attributes */ - all_of?: string[]; + all_of: string[]; /** any_of at least of of the keys from the list must have signed attributes */ - any_of?: string[]; + any_of: string[]; } /** * SignedBy represents validation accounts that tenant expects signatures for provider attributes @@ -72,9 +72,9 @@ export interface PlacementRequirementsProtoMsg { /** PlacementRequirements */ export interface PlacementRequirementsAmino { /** SignedBy list of keys that tenants expect to have signatures from */ - signed_by?: SignedByAmino; + signed_by: SignedByAmino; /** Attribute list of attributes tenant expects from the provider */ - attributes?: AttributeAmino[]; + attributes: AttributeAmino[]; } /** PlacementRequirements */ export interface PlacementRequirementsSDKType { @@ -380,7 +380,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements, useInterfaces: boolean = true): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy, useInterfaces) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts index f0648e84ce..930e284e78 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/endpoint.ts @@ -55,7 +55,7 @@ export interface EndpointProtoMsg { /** Endpoint describes a publicly accessible IP service */ export interface EndpointAmino { kind?: Endpoint_Kind; - sequence_number?: number; + sequence_number: number; } /** Endpoint describes a publicly accessible IP service */ export interface EndpointSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts index 57473c28c6..030dec4011 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resource.ts @@ -33,7 +33,7 @@ export interface MemoryProtoMsg { } /** Memory stores resource quantity and memory attributes */ export interface MemoryAmino { - quantity?: ResourceValueAmino; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } /** Memory stores resource quantity and memory attributes */ @@ -53,8 +53,8 @@ export interface StorageProtoMsg { } /** Storage stores resource quantity and storage attributes */ export interface StorageAmino { - name?: string; - quantity?: ResourceValueAmino; + name: string; + quantity: ResourceValueAmino; attributes?: AttributeAmino[]; } /** Storage stores resource quantity and storage attributes */ @@ -258,7 +258,7 @@ export const Memory = { }, toAmino(message: Memory, useInterfaces: boolean = true): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { @@ -382,7 +382,7 @@ export const Storage = { toAmino(message: Storage, useInterfaces: boolean = true): StorageAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity, useInterfaces) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts index 4cf9fd95a0..d768e7cf03 100644 --- a/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts +++ b/__fixtures__/v-next/outputv3/akash/base/v1beta2/resourceunits.ts @@ -25,7 +25,7 @@ export interface ResourceUnitsAmino { cpu?: CPUAmino; memory?: MemoryAmino; storage?: StorageAmino[]; - endpoints?: EndpointAmino[]; + endpoints: EndpointAmino[]; } /** * ResourceUnits describes all available resources types for deployment/node etc diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts index c83dd11fae..411ef164e9 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/cert.ts @@ -54,8 +54,8 @@ export interface CertificateIDProtoMsg { } /** CertificateID stores owner and sequence number */ export interface CertificateIDAmino { - owner?: string; - serial?: string; + owner: string; + serial: string; } /** CertificateID stores owner and sequence number */ export interface CertificateIDSDKType { @@ -74,9 +74,9 @@ export interface CertificateProtoMsg { } /** Certificate stores state, certificate and it's public key */ export interface CertificateAmino { - state?: Certificate_State; - cert?: string; - pubkey?: string; + state: Certificate_State; + cert: string; + pubkey: string; } /** Certificate stores state, certificate and it's public key */ export interface CertificateSDKType { @@ -96,9 +96,9 @@ export interface CertificateFilterProtoMsg { } /** CertificateFilter defines filters used to filter certificates */ export interface CertificateFilterAmino { - owner?: string; - serial?: string; - state?: string; + owner: string; + serial: string; + state: string; } /** CertificateFilter defines filters used to filter certificates */ export interface CertificateFilterSDKType { @@ -118,9 +118,9 @@ export interface MsgCreateCertificateProtoMsg { } /** MsgCreateCertificate defines an SDK message for creating certificate */ export interface MsgCreateCertificateAmino { - owner?: string; - cert?: string; - pubkey?: string; + owner: string; + cert: string; + pubkey: string; } /** MsgCreateCertificate defines an SDK message for creating certificate */ export interface MsgCreateCertificateSDKType { @@ -148,7 +148,7 @@ export interface MsgRevokeCertificateProtoMsg { } /** MsgRevokeCertificate defines an SDK message for revoking certificate */ export interface MsgRevokeCertificateAmino { - id?: CertificateIDAmino; + id: CertificateIDAmino; } /** MsgRevokeCertificate defines an SDK message for revoking certificate */ export interface MsgRevokeCertificateSDKType { @@ -724,7 +724,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate, useInterfaces: boolean = true): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id, useInterfaces) : CertificateID.fromPartial({}); + obj.id = message.id ? CertificateID.toAmino(message.id, useInterfaces) : CertificateID.toAmino(CertificateID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgRevokeCertificateProtoMsg, useInterfaces: boolean = true): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts index 0dd2f4df7d..5d6688b24e 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisCertificateProtoMsg { } /** GenesisCertificate defines certificate entry at genesis */ export interface GenesisCertificateAmino { - owner?: string; - certificate?: CertificateAmino; + owner: string; + certificate: CertificateAmino; } /** GenesisCertificate defines certificate entry at genesis */ export interface GenesisCertificateSDKType { @@ -31,7 +31,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by cert module */ export interface GenesisStateAmino { - certificates?: GenesisCertificateAmino[]; + certificates: GenesisCertificateAmino[]; } /** GenesisState defines the basic genesis state used by cert module */ export interface GenesisStateSDKType { @@ -119,7 +119,7 @@ export const GenesisCertificate = { toAmino(message: GenesisCertificate, useInterfaces: boolean = true): GenesisCertificateAmino { const obj: any = {}; obj.owner = message.owner ?? ""; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : Certificate.toAmino(Certificate.fromPartial({})); return obj; }, fromProtoMsg(message: GenesisCertificateProtoMsg, useInterfaces: boolean = true): GenesisCertificate { diff --git a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts index b07fc20b96..ce2484d1e6 100644 --- a/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/cert/v1beta2/query.ts @@ -14,8 +14,8 @@ export interface CertificateResponseProtoMsg { } /** CertificateResponse contains a single X509 certificate and its serial number */ export interface CertificateResponseAmino { - certificate?: CertificateAmino; - serial?: string; + certificate: CertificateAmino; + serial: string; } /** CertificateResponse contains a single X509 certificate and its serial number */ export interface CertificateResponseSDKType { @@ -141,7 +141,7 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse, useInterfaces: boolean = true): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate, useInterfaces) : Certificate.toAmino(Certificate.fromPartial({})); obj.serial = message.serial ?? ""; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts index 672c428a45..6af87ba9c7 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/authz.ts @@ -27,7 +27,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino; + spend_limit: CoinAmino; } /** * DepositDeploymentAuthorization allows the grantee to deposit up to spend_limit coins from @@ -104,7 +104,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization, useInterfaces: boolean = true): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: DepositDeploymentAuthorizationProtoMsg, useInterfaces: boolean = true): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts index 06848123fd..a5d6ca3247 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/deployment.ts @@ -60,10 +60,10 @@ export interface MsgCreateDeploymentProtoMsg { } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; - deposit?: CoinAmino; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; + deposit: CoinAmino; } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentSDKType { @@ -93,8 +93,8 @@ export interface MsgDepositDeploymentProtoMsg { } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentAmino { - id?: DeploymentIDAmino; - amount?: CoinAmino; + id: DeploymentIDAmino; + amount: CoinAmino; } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentSDKType { @@ -123,9 +123,9 @@ export interface MsgUpdateDeploymentProtoMsg { } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentSDKType { @@ -153,7 +153,7 @@ export interface MsgCloseDeploymentProtoMsg { } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentAmino { - id?: DeploymentIDAmino; + id: DeploymentIDAmino; } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentSDKType { @@ -180,8 +180,8 @@ export interface DeploymentIDProtoMsg { } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDAmino { - owner?: string; - dseq?: string; + owner: string; + dseq: string; } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDSDKType { @@ -201,9 +201,9 @@ export interface DeploymentProtoMsg { } /** Deployment stores deploymentID, state and version details */ export interface DeploymentAmino { - deployment_id?: DeploymentIDAmino; - state?: Deployment_State; - version?: string; + deployment_id: DeploymentIDAmino; + state: Deployment_State; + version: string; created_at?: string; } /** Deployment stores deploymentID, state and version details */ @@ -225,9 +225,9 @@ export interface DeploymentFiltersProtoMsg { } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersAmino { - owner?: string; - dseq?: string; - state?: string; + owner: string; + dseq: string; + state: string; } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersSDKType { @@ -354,14 +354,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment, useInterfaces: boolean = true): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e, useInterfaces) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCreateDeploymentProtoMsg, useInterfaces: boolean = true): MsgCreateDeployment { @@ -522,8 +522,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment, useInterfaces: boolean = true): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: MsgDepositDeploymentProtoMsg, useInterfaces: boolean = true): MsgDepositDeployment { @@ -703,7 +703,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment, useInterfaces: boolean = true): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e, useInterfaces) : undefined); } else { @@ -853,7 +853,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment, useInterfaces: boolean = true): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCloseDeploymentProtoMsg, useInterfaces: boolean = true): MsgCloseDeployment { @@ -1142,10 +1142,10 @@ export const Deployment = { }, toAmino(message: Deployment, useInterfaces: boolean = true): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromProtoMsg(message: DeploymentProtoMsg, useInterfaces: boolean = true): Deployment { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts index 9734ee5751..015f96f71d 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/genesis.ts @@ -15,8 +15,8 @@ export interface GenesisDeploymentProtoMsg { } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentSDKType { @@ -34,8 +34,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - deployments?: GenesisDeploymentAmino[]; - params?: ParamsAmino; + deployments: GenesisDeploymentAmino[]; + params: ParamsAmino; } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateSDKType { @@ -129,7 +129,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment, useInterfaces: boolean = true): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { @@ -242,7 +242,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.toAmino(Params.fromPartial({})); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts index b1e71c7111..82da35b049 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/group.ts @@ -70,7 +70,7 @@ export interface MsgCloseGroupProtoMsg { } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupSDKType { @@ -96,7 +96,7 @@ export interface MsgPauseGroupProtoMsg { } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupSDKType { @@ -122,7 +122,7 @@ export interface MsgStartGroupProtoMsg { } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupSDKType { @@ -150,9 +150,9 @@ export interface GroupIDProtoMsg { } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDAmino { - owner?: string; - dseq?: string; - gseq?: number; + owner: string; + dseq: string; + gseq: number; } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDSDKType { @@ -172,9 +172,9 @@ export interface GroupSpecProtoMsg { } /** GroupSpec stores group specifications */ export interface GroupSpecAmino { - name?: string; - requirements?: PlacementRequirementsAmino; - resources?: ResourceAmino[]; + name: string; + requirements: PlacementRequirementsAmino; + resources: ResourceAmino[]; } /** GroupSpec stores group specifications */ export interface GroupSpecSDKType { @@ -195,9 +195,9 @@ export interface GroupProtoMsg { } /** Group stores group id, state and specifications of group */ export interface GroupAmino { - group_id?: GroupIDAmino; - state?: Group_State; - group_spec?: GroupSpecAmino; + group_id: GroupIDAmino; + state: Group_State; + group_spec: GroupSpecAmino; created_at?: string; } /** Group stores group id, state and specifications of group */ @@ -219,9 +219,9 @@ export interface ResourceProtoMsg { } /** Resource stores unit, total count and price of resource */ export interface ResourceAmino { - resources?: ResourceUnitsAmino; - count?: number; - price?: CoinAmino; + resources: ResourceUnitsAmino; + count: number; + price: CoinAmino; } /** Resource stores unit, total count and price of resource */ export interface ResourceSDKType { @@ -295,7 +295,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup, useInterfaces: boolean = true): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCloseGroupProtoMsg, useInterfaces: boolean = true): MsgCloseGroup { @@ -439,7 +439,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup, useInterfaces: boolean = true): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgPauseGroupProtoMsg, useInterfaces: boolean = true): MsgPauseGroup { @@ -583,7 +583,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup, useInterfaces: boolean = true): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgStartGroupProtoMsg, useInterfaces: boolean = true): MsgStartGroup { @@ -878,7 +878,7 @@ export const GroupSpec = { toAmino(message: GroupSpec, useInterfaces: boolean = true): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e, useInterfaces) : undefined); } else { @@ -1014,10 +1014,10 @@ export const Group = { }, toAmino(message: Group, useInterfaces: boolean = true): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromProtoMsg(message: GroupProtoMsg, useInterfaces: boolean = true): Group { @@ -1131,9 +1131,9 @@ export const Resource = { }, toAmino(message: Resource, useInterfaces: boolean = true): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? Coin.toAmino(message.price, useInterfaces) : Coin.fromPartial({}); + obj.price = message.price ? Coin.toAmino(message.price, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: ResourceProtoMsg, useInterfaces: boolean = true): Resource { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts index 50fc66ccae..9b7285e7f8 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/params.ts @@ -12,7 +12,7 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { - deployment_min_deposit?: CoinAmino; + deployment_min_deposit: CoinAmino; } /** Params defines the parameters for the x/deployment package */ export interface ParamsSDKType { @@ -84,7 +84,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts index 3fd9500c67..7319ad88ec 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta1/query.ts @@ -71,8 +71,8 @@ export interface QueryDeploymentResponseProtoMsg { } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ export interface QueryDeploymentResponseAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; escrow_account?: AccountAmino; } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ @@ -507,7 +507,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse, useInterfaces: boolean = true): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts index b5fd27ce83..29c6135bb0 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/authz.ts @@ -27,7 +27,7 @@ export interface DepositDeploymentAuthorizationAmino { * SpendLimit is the amount the grantee is authorized to spend from the granter's account for * the purpose of deployment. */ - spend_limit?: CoinAmino; + spend_limit: CoinAmino; } /** * DepositDeploymentAuthorization allows the grantee to deposit up to spend_limit coins from @@ -104,7 +104,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization, useInterfaces: boolean = true): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: DepositDeploymentAuthorizationProtoMsg, useInterfaces: boolean = true): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts index 052af6a274..41ea1f79cc 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deployment.ts @@ -54,8 +54,8 @@ export interface DeploymentIDProtoMsg { } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDAmino { - owner?: string; - dseq?: string; + owner: string; + dseq: string; } /** DeploymentID stores owner and sequence number */ export interface DeploymentIDSDKType { @@ -75,9 +75,9 @@ export interface DeploymentProtoMsg { } /** Deployment stores deploymentID, state and version details */ export interface DeploymentAmino { - deployment_id?: DeploymentIDAmino; - state?: Deployment_State; - version?: string; + deployment_id: DeploymentIDAmino; + state: Deployment_State; + version: string; created_at?: string; } /** Deployment stores deploymentID, state and version details */ @@ -99,9 +99,9 @@ export interface DeploymentFiltersProtoMsg { } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersAmino { - owner?: string; - dseq?: string; - state?: string; + owner: string; + dseq: string; + state: string; } /** DeploymentFilters defines filters used to filter deployments */ export interface DeploymentFiltersSDKType { @@ -320,10 +320,10 @@ export const Deployment = { }, toAmino(message: Deployment, useInterfaces: boolean = true): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromProtoMsg(message: DeploymentProtoMsg, useInterfaces: boolean = true): Deployment { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts index 8c24cf85d3..198d1b4573 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/deploymentmsg.ts @@ -19,12 +19,12 @@ export interface MsgCreateDeploymentProtoMsg { } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentAmino { - id?: DeploymentIDAmino; - groups?: GroupSpecAmino[]; - version?: string; - deposit?: CoinAmino; + id: DeploymentIDAmino; + groups: GroupSpecAmino[]; + version: string; + deposit: CoinAmino; /** Depositor pays for the deposit */ - depositor?: string; + depositor: string; } /** MsgCreateDeployment defines an SDK message for creating deployment */ export interface MsgCreateDeploymentSDKType { @@ -57,10 +57,10 @@ export interface MsgDepositDeploymentProtoMsg { } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentAmino { - id?: DeploymentIDAmino; - amount?: CoinAmino; + id: DeploymentIDAmino; + amount: CoinAmino; /** Depositor pays for the deposit */ - depositor?: string; + depositor: string; } /** MsgDepositDeployment deposits more funds into the deposit account */ export interface MsgDepositDeploymentSDKType { @@ -89,8 +89,8 @@ export interface MsgUpdateDeploymentProtoMsg { } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentAmino { - id?: DeploymentIDAmino; - version?: string; + id: DeploymentIDAmino; + version: string; } /** MsgUpdateDeployment defines an SDK message for updating deployment */ export interface MsgUpdateDeploymentSDKType { @@ -117,7 +117,7 @@ export interface MsgCloseDeploymentProtoMsg { } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentAmino { - id?: DeploymentIDAmino; + id: DeploymentIDAmino; } /** MsgCloseDeployment defines an SDK message for closing deployment */ export interface MsgCloseDeploymentSDKType { @@ -267,14 +267,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment, useInterfaces: boolean = true): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e, useInterfaces) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -451,8 +451,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment, useInterfaces: boolean = true): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -612,7 +612,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment, useInterfaces: boolean = true): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, @@ -757,7 +757,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment, useInterfaces: boolean = true): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id, useInterfaces) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCloseDeploymentProtoMsg, useInterfaces: boolean = true): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts index cc183c52a8..ed04c1e901 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/genesis.ts @@ -15,8 +15,8 @@ export interface GenesisDeploymentProtoMsg { } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; } /** GenesisDeployment defines the basic genesis state used by deployment module */ export interface GenesisDeploymentSDKType { @@ -34,8 +34,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - deployments?: GenesisDeploymentAmino[]; - params?: ParamsAmino; + deployments: GenesisDeploymentAmino[]; + params: ParamsAmino; } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateSDKType { @@ -129,7 +129,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment, useInterfaces: boolean = true): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { @@ -242,7 +242,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.toAmino(Params.fromPartial({})); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts index 03d505d0f2..f03d8837a3 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/group.ts @@ -72,9 +72,9 @@ export interface GroupProtoMsg { } /** Group stores group id, state and specifications of group */ export interface GroupAmino { - group_id?: GroupIDAmino; - state?: Group_State; - group_spec?: GroupSpecAmino; + group_id: GroupIDAmino; + state: Group_State; + group_spec: GroupSpecAmino; created_at?: string; } /** Group stores group id, state and specifications of group */ @@ -199,10 +199,10 @@ export const Group = { }, toAmino(message: Group, useInterfaces: boolean = true): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec, useInterfaces) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromProtoMsg(message: GroupProtoMsg, useInterfaces: boolean = true): Group { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts index a5d1ebc203..ee0d7bfd86 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupid.ts @@ -13,9 +13,9 @@ export interface GroupIDProtoMsg { } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDAmino { - owner?: string; - dseq?: string; - gseq?: number; + owner: string; + dseq: string; + gseq: number; } /** GroupID stores owner, deployment sequence number and group sequence number */ export interface GroupIDSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts index b8a44b6748..2a1c368baf 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupmsg.ts @@ -12,7 +12,7 @@ export interface MsgCloseGroupProtoMsg { } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } /** MsgCloseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgCloseGroupSDKType { @@ -38,7 +38,7 @@ export interface MsgPauseGroupProtoMsg { } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } /** MsgPauseGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgPauseGroupSDKType { @@ -64,7 +64,7 @@ export interface MsgStartGroupProtoMsg { } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupAmino { - id?: GroupIDAmino; + id: GroupIDAmino; } /** MsgStartGroup defines SDK message to close a single Group within a Deployment. */ export interface MsgStartGroupSDKType { @@ -146,7 +146,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup, useInterfaces: boolean = true): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCloseGroupProtoMsg, useInterfaces: boolean = true): MsgCloseGroup { @@ -290,7 +290,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup, useInterfaces: boolean = true): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgPauseGroupProtoMsg, useInterfaces: boolean = true): MsgPauseGroup { @@ -434,7 +434,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup, useInterfaces: boolean = true): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id, useInterfaces) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgStartGroupProtoMsg, useInterfaces: boolean = true): MsgStartGroup { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts index 9f20c67e4d..f83e1f3722 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/groupspec.ts @@ -15,9 +15,9 @@ export interface GroupSpecProtoMsg { } /** GroupSpec stores group specifications */ export interface GroupSpecAmino { - name?: string; - requirements?: PlacementRequirementsAmino; - resources?: ResourceAmino[]; + name: string; + requirements: PlacementRequirementsAmino; + resources: ResourceAmino[]; } /** GroupSpec stores group specifications */ export interface GroupSpecSDKType { @@ -128,7 +128,7 @@ export const GroupSpec = { toAmino(message: GroupSpec, useInterfaces: boolean = true): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements, useInterfaces) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts index 41b40b0200..9135c984f8 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/params.ts @@ -12,7 +12,7 @@ export interface ParamsProtoMsg { } /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { - deployment_min_deposit?: CoinAmino; + deployment_min_deposit: CoinAmino; } /** Params defines the parameters for the x/deployment package */ export interface ParamsSDKType { @@ -84,7 +84,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts index 8211eb5930..a85038d365 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/query.ts @@ -72,8 +72,8 @@ export interface QueryDeploymentResponseProtoMsg { } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ export interface QueryDeploymentResponseAmino { - deployment?: DeploymentAmino; - groups?: GroupAmino[]; + deployment: DeploymentAmino; + groups: GroupAmino[]; escrow_account?: AccountAmino; } /** QueryDeploymentResponse is response type for the Query/Deployment RPC method */ @@ -508,7 +508,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse, useInterfaces: boolean = true): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment, useInterfaces) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts index 89bc6194d5..a4892694e9 100644 --- a/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv3/akash/deployment/v1beta2/resource.ts @@ -15,9 +15,9 @@ export interface ResourceProtoMsg { } /** Resource stores unit, total count and price of resource */ export interface ResourceAmino { - resources?: ResourceUnitsAmino; - count?: number; - price?: DecCoinAmino; + resources: ResourceUnitsAmino; + count: number; + price: DecCoinAmino; } /** Resource stores unit, total count and price of resource */ export interface ResourceSDKType { @@ -123,9 +123,9 @@ export const Resource = { }, toAmino(message: Resource, useInterfaces: boolean = true): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources, useInterfaces) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromProtoMsg(message: ResourceProtoMsg, useInterfaces: boolean = true): Resource { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts index 1794acb7c1..63c8e90894 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateAmino { - accounts?: AccountAmino[]; - payments?: PaymentAmino[]; + accounts: AccountAmino[]; + payments: PaymentAmino[]; } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts index 392606dd89..e874222de5 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta1/types.ts @@ -111,8 +111,8 @@ export interface AccountIDProtoMsg { } /** AccountID is the account identifier */ export interface AccountIDAmino { - scope?: string; - xid?: string; + scope: string; + xid: string; } /** AccountID is the account identifier */ export interface AccountIDSDKType { @@ -141,17 +141,17 @@ export interface AccountProtoMsg { /** Account stores state for an escrow account */ export interface AccountAmino { /** unique identifier for this escrow account */ - id?: AccountIDAmino; + id: AccountIDAmino; /** bech32 encoded account address of the owner of this escrow account */ - owner?: string; + owner: string; /** current state of this escrow account */ - state?: Account_State; + state: Account_State; /** unspent coins received from the owner's wallet */ - balance?: CoinAmino; + balance: CoinAmino; /** total coins spent by this account */ - transferred?: CoinAmino; + transferred: CoinAmino; /** block height at which this account was last settled */ - settled_at?: string; + settled_at: string; } /** Account stores state for an escrow account */ export interface AccountSDKType { @@ -178,13 +178,13 @@ export interface PaymentProtoMsg { } /** Payment stores state for a payment */ export interface PaymentAmino { - account_id?: AccountIDAmino; - payment_id?: string; - owner?: string; - state?: Payment_State; - rate?: CoinAmino; - balance?: CoinAmino; - withdrawn?: CoinAmino; + account_id: AccountIDAmino; + payment_id: string; + owner: string; + state: Payment_State; + rate: CoinAmino; + balance: CoinAmino; + withdrawn: CoinAmino; } /** Payment stores state for a payment */ export interface PaymentSDKType { @@ -439,11 +439,11 @@ export const Account = { }, toAmino(message: Account, useInterfaces: boolean = true): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : Coin.fromPartial({}); - obj.transferred = message.transferred ? Coin.toAmino(message.transferred, useInterfaces) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, @@ -622,13 +622,13 @@ export const Payment = { }, toAmino(message: Payment, useInterfaces: boolean = true): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? Coin.toAmino(message.rate, useInterfaces) : Coin.fromPartial({}); - obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : Coin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : Coin.fromPartial({}); + obj.rate = message.rate ? Coin.toAmino(message.rate, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: PaymentProtoMsg, useInterfaces: boolean = true): Payment { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts index 5825874784..8e1f6e4cd1 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/genesis.ts @@ -13,8 +13,8 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateAmino { - accounts?: AccountAmino[]; - payments?: FractionalPaymentAmino[]; + accounts: AccountAmino[]; + payments: FractionalPaymentAmino[]; } /** GenesisState defines the basic genesis state used by escrow module */ export interface GenesisStateSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts index 63b03387d5..c9a7283950 100644 --- a/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv3/akash/escrow/v1beta2/types.ts @@ -111,8 +111,8 @@ export interface AccountIDProtoMsg { } /** AccountID is the account identifier */ export interface AccountIDAmino { - scope?: string; - xid?: string; + scope: string; + xid: string; } /** AccountID is the account identifier */ export interface AccountIDSDKType { @@ -152,28 +152,28 @@ export interface AccountProtoMsg { /** Account stores state for an escrow account */ export interface AccountAmino { /** unique identifier for this escrow account */ - id?: AccountIDAmino; + id: AccountIDAmino; /** bech32 encoded account address of the owner of this escrow account */ - owner?: string; + owner: string; /** current state of this escrow account */ - state?: Account_State; + state: Account_State; /** unspent coins received from the owner's wallet */ - balance?: DecCoinAmino; + balance: DecCoinAmino; /** total coins spent by this account */ - transferred?: DecCoinAmino; + transferred: DecCoinAmino; /** block height at which this account was last settled */ - settled_at?: string; + settled_at: string; /** * bech32 encoded account address of the depositor. * If depositor is same as the owner, then any incoming coins are added to the Balance. * If depositor isn't same as the owner, then any incoming coins are added to the Funds. */ - depositor?: string; + depositor: string; /** * Funds are unspent coins received from the (non-Owner) Depositor's wallet. * If there are any funds, they should be spent before spending the Balance. */ - funds?: DecCoinAmino; + funds: DecCoinAmino; } /** Account stores state for an escrow account */ export interface AccountSDKType { @@ -202,13 +202,13 @@ export interface FractionalPaymentProtoMsg { } /** Payment stores state for a payment */ export interface FractionalPaymentAmino { - account_id?: AccountIDAmino; - payment_id?: string; - owner?: string; - state?: FractionalPayment_State; - rate?: DecCoinAmino; - balance?: DecCoinAmino; - withdrawn?: CoinAmino; + account_id: AccountIDAmino; + payment_id: string; + owner: string; + state: FractionalPayment_State; + rate: DecCoinAmino; + balance: DecCoinAmino; + withdrawn: CoinAmino; } /** Payment stores state for a payment */ export interface FractionalPaymentSDKType { @@ -495,14 +495,14 @@ export const Account = { }, toAmino(message: Account, useInterfaces: boolean = true): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id, useInterfaces) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : DecCoin.fromPartial({}); - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred, useInterfaces) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; obj.depositor = message.depositor ?? ""; - obj.funds = message.funds ? DecCoin.toAmino(message.funds, useInterfaces) : DecCoin.fromPartial({}); + obj.funds = message.funds ? DecCoin.toAmino(message.funds, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromProtoMsg(message: AccountProtoMsg, useInterfaces: boolean = true): Account { @@ -680,13 +680,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment, useInterfaces: boolean = true): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId, useInterfaces) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? DecCoin.toAmino(message.rate, useInterfaces) : DecCoin.fromPartial({}); - obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : DecCoin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : Coin.fromPartial({}); + obj.rate = message.rate ? DecCoin.toAmino(message.rate, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.balance = message.balance ? DecCoin.toAmino(message.balance, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: FractionalPaymentProtoMsg, useInterfaces: boolean = true): FractionalPayment { diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts index fbfb71b669..f4dcedb829 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateAmino { - params?: ParamsAmino; + params: ParamsAmino; } /** GenesisState stores slice of genesis deployment instance */ export interface GenesisStateSDKType { @@ -84,7 +84,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.toAmino(Params.fromPartial({})); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts index cc158b8916..55898b7cf3 100644 --- a/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/inflation/v1beta2/params.ts @@ -24,17 +24,17 @@ export interface ParamsProtoMsg { /** Params defines the parameters for the x/deployment package */ export interface ParamsAmino { /** InflationDecayFactor is the number of years it takes inflation to halve. */ - inflation_decay_factor?: string; + inflation_decay_factor: string; /** * InitialInflation is the rate at which inflation starts at genesis. * It is a decimal value in the range [0.0, 100.0]. */ - initial_inflation?: string; + initial_inflation: string; /** * Variance defines the fraction by which inflation can vary from ideal inflation in a block. * It is a decimal value in the range [0.0, 1.0]. */ - variance?: string; + variance: string; } /** Params defines the parameters for the x/deployment package */ export interface ParamsSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts index 51dba1418c..7c480275b9 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/bid.ts @@ -72,10 +72,10 @@ export interface MsgCreateBidProtoMsg { } /** MsgCreateBid defines an SDK message for creating Bid */ export interface MsgCreateBidAmino { - order?: OrderIDAmino; - provider?: string; - price?: DecCoinAmino; - deposit?: CoinAmino; + order: OrderIDAmino; + provider: string; + price: DecCoinAmino; + deposit: CoinAmino; } /** MsgCreateBid defines an SDK message for creating Bid */ export interface MsgCreateBidSDKType { @@ -104,7 +104,7 @@ export interface MsgCloseBidProtoMsg { } /** MsgCloseBid defines an SDK message for closing bid */ export interface MsgCloseBidAmino { - bid_id?: BidIDAmino; + bid_id: BidIDAmino; } /** MsgCloseBid defines an SDK message for closing bid */ export interface MsgCloseBidSDKType { @@ -140,11 +140,11 @@ export interface BidIDProtoMsg { * A successful bid becomes a Lease(ID). */ export interface BidIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; } /** * BidID stores owner and all other seq numbers @@ -170,9 +170,9 @@ export interface BidProtoMsg { } /** Bid stores BidID, state of bid and price */ export interface BidAmino { - bid_id?: BidIDAmino; - state?: Bid_State; - price?: DecCoinAmino; + bid_id: BidIDAmino; + state: Bid_State; + price: DecCoinAmino; created_at?: string; } /** Bid stores BidID, state of bid and price */ @@ -197,12 +197,12 @@ export interface BidFiltersProtoMsg { } /** BidFilters defines flags for bid list filter */ export interface BidFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; + state: string; } /** BidFilters defines flags for bid list filter */ export interface BidFiltersSDKType { @@ -328,10 +328,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid, useInterfaces: boolean = true): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order, useInterfaces) : OrderID.fromPartial({}); + obj.order = message.order ? OrderID.toAmino(message.order, useInterfaces) : OrderID.toAmino(OrderID.fromPartial({})); obj.provider = message.provider ?? ""; - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); - obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCreateBidProtoMsg, useInterfaces: boolean = true): MsgCreateBid { @@ -475,7 +475,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid, useInterfaces: boolean = true): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCloseBidProtoMsg, useInterfaces: boolean = true): MsgCloseBid { @@ -814,10 +814,10 @@ export const Bid = { }, toAmino(message: Bid, useInterfaces: boolean = true): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.toAmino(BidID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromProtoMsg(message: BidProtoMsg, useInterfaces: boolean = true): Bid { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts index b6b364a90a..de613c50e2 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/genesis.ts @@ -16,9 +16,9 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by market module */ export interface GenesisStateAmino { - orders?: OrderAmino[]; - leases?: LeaseAmino[]; - params?: ParamsAmino; + orders: OrderAmino[]; + leases: LeaseAmino[]; + params: ParamsAmino; } /** GenesisState defines the basic genesis state used by market module */ export interface GenesisStateSDKType { @@ -144,7 +144,7 @@ export const GenesisState = { } else { obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : Params.toAmino(Params.fromPartial({})); return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts index abace824ee..3d419163f0 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/lease.ts @@ -66,11 +66,11 @@ export interface LeaseIDProtoMsg { } /** LeaseID stores bid details of lease */ export interface LeaseIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; } /** LeaseID stores bid details of lease */ export interface LeaseIDSDKType { @@ -94,9 +94,9 @@ export interface LeaseProtoMsg { } /** Lease stores LeaseID, state of lease and price */ export interface LeaseAmino { - lease_id?: LeaseIDAmino; - state?: Lease_State; - price?: DecCoinAmino; + lease_id: LeaseIDAmino; + state: Lease_State; + price: DecCoinAmino; created_at?: string; closed_on?: string; } @@ -123,12 +123,12 @@ export interface LeaseFiltersProtoMsg { } /** LeaseFilters defines flags for lease list filter */ export interface LeaseFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - provider?: string; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + provider: string; + state: string; } /** LeaseFilters defines flags for lease list filter */ export interface LeaseFiltersSDKType { @@ -149,7 +149,7 @@ export interface MsgCreateLeaseProtoMsg { } /** MsgCreateLease is sent to create a lease */ export interface MsgCreateLeaseAmino { - bid_id?: BidIDAmino; + bid_id: BidIDAmino; } /** MsgCreateLease is sent to create a lease */ export interface MsgCreateLeaseSDKType { @@ -175,7 +175,7 @@ export interface MsgWithdrawLeaseProtoMsg { } /** MsgWithdrawLease defines an SDK message for closing bid */ export interface MsgWithdrawLeaseAmino { - bid_id?: LeaseIDAmino; + bid_id: LeaseIDAmino; } /** MsgWithdrawLease defines an SDK message for closing bid */ export interface MsgWithdrawLeaseSDKType { @@ -201,7 +201,7 @@ export interface MsgCloseLeaseProtoMsg { } /** MsgCloseLease defines an SDK message for closing order */ export interface MsgCloseLeaseAmino { - lease_id?: LeaseIDAmino; + lease_id: LeaseIDAmino; } /** MsgCloseLease defines an SDK message for closing order */ export interface MsgCloseLeaseSDKType { @@ -495,11 +495,11 @@ export const Lease = { }, toAmino(message: Lease, useInterfaces: boolean = true): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : LeaseID.toAmino(LeaseID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price, useInterfaces) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn !== BigInt(0) ? message.closedOn.toString() : undefined; return obj; }, fromProtoMsg(message: LeaseProtoMsg, useInterfaces: boolean = true): Lease { @@ -743,7 +743,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease, useInterfaces: boolean = true): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId, useInterfaces) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCreateLeaseProtoMsg, useInterfaces: boolean = true): MsgCreateLease { @@ -887,7 +887,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease, useInterfaces: boolean = true): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId, useInterfaces) : LeaseID.fromPartial({}); + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId, useInterfaces) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgWithdrawLeaseProtoMsg, useInterfaces: boolean = true): MsgWithdrawLease { @@ -1031,7 +1031,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease, useInterfaces: boolean = true): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId, useInterfaces) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCloseLeaseProtoMsg, useInterfaces: boolean = true): MsgCloseLease { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts index 2a93a12dc2..31d6c66929 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/order.ts @@ -64,10 +64,10 @@ export interface OrderIDProtoMsg { } /** OrderID stores owner and all other seq numbers */ export interface OrderIDAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; + owner: string; + dseq: string; + gseq: number; + oseq: number; } /** OrderID stores owner and all other seq numbers */ export interface OrderIDSDKType { @@ -89,9 +89,9 @@ export interface OrderProtoMsg { } /** Order stores orderID, state of order and other details */ export interface OrderAmino { - order_id?: OrderIDAmino; - state?: Order_State; - spec?: GroupSpecAmino; + order_id: OrderIDAmino; + state: Order_State; + spec: GroupSpecAmino; created_at?: string; } /** Order stores orderID, state of order and other details */ @@ -115,11 +115,11 @@ export interface OrderFiltersProtoMsg { } /** OrderFilters defines flags for order list filter */ export interface OrderFiltersAmino { - owner?: string; - dseq?: string; - gseq?: number; - oseq?: number; - state?: string; + owner: string; + dseq: string; + gseq: number; + oseq: number; + state: string; } /** OrderFilters defines flags for order list filter */ export interface OrderFiltersSDKType { @@ -374,10 +374,10 @@ export const Order = { }, toAmino(message: Order, useInterfaces: boolean = true): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId, useInterfaces) : OrderID.fromPartial({}); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId, useInterfaces) : OrderID.toAmino(OrderID.fromPartial({})); obj.state = message.state ?? 0; - obj.spec = message.spec ? GroupSpec.toAmino(message.spec, useInterfaces) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec, useInterfaces) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromProtoMsg(message: OrderProtoMsg, useInterfaces: boolean = true): Order { diff --git a/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts index 790379625d..5908dcc74b 100644 --- a/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv3/akash/market/v1beta2/params.ts @@ -13,8 +13,8 @@ export interface ParamsProtoMsg { } /** Params is the params for the x/market module */ export interface ParamsAmino { - bid_min_deposit?: CoinAmino; - order_max_bids?: number; + bid_min_deposit: CoinAmino; + order_max_bids: number; } /** Params is the params for the x/market module */ export interface ParamsSDKType { @@ -102,7 +102,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit, useInterfaces) : Coin.fromPartial({}); + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit, useInterfaces) : Coin.toAmino(Coin.fromPartial({})); obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts index 7629164787..2cbe545c0f 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta1/provider.ts @@ -13,8 +13,8 @@ export interface ProviderInfoProtoMsg { } /** ProviderInfo */ export interface ProviderInfoAmino { - email?: string; - website?: string; + email: string; + website: string; } /** ProviderInfo */ export interface ProviderInfoSDKType { @@ -34,10 +34,10 @@ export interface MsgCreateProviderProtoMsg { } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderSDKType { @@ -69,10 +69,10 @@ export interface MsgUpdateProviderProtoMsg { } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderSDKType { @@ -101,7 +101,7 @@ export interface MsgDeleteProviderProtoMsg { } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderAmino { - owner?: string; + owner: string; } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderSDKType { @@ -130,10 +130,10 @@ export interface ProviderProtoMsg { } /** Provider stores owner and host details */ export interface ProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } /** Provider stores owner and host details */ export interface ProviderSDKType { @@ -362,7 +362,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCreateProviderProtoMsg, useInterfaces: boolean = true): MsgCreateProvider { @@ -564,7 +564,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromProtoMsg(message: MsgUpdateProviderProtoMsg, useInterfaces: boolean = true): MsgUpdateProvider { @@ -908,7 +908,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromProtoMsg(message: ProviderProtoMsg, useInterfaces: boolean = true): Provider { diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts index d4b266f51e..f8181f9e56 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/genesis.ts @@ -12,7 +12,7 @@ export interface GenesisStateProtoMsg { } /** GenesisState defines the basic genesis state used by provider module */ export interface GenesisStateAmino { - providers?: ProviderAmino[]; + providers: ProviderAmino[]; } /** GenesisState defines the basic genesis state used by provider module */ export interface GenesisStateSDKType { diff --git a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts index d20f58d5b5..e05d6c1eaa 100644 --- a/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv3/akash/provider/v1beta2/provider.ts @@ -13,8 +13,8 @@ export interface ProviderInfoProtoMsg { } /** ProviderInfo */ export interface ProviderInfoAmino { - email?: string; - website?: string; + email: string; + website: string; } /** ProviderInfo */ export interface ProviderInfoSDKType { @@ -34,10 +34,10 @@ export interface MsgCreateProviderProtoMsg { } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } /** MsgCreateProvider defines an SDK message for creating a provider */ export interface MsgCreateProviderSDKType { @@ -69,10 +69,10 @@ export interface MsgUpdateProviderProtoMsg { } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } /** MsgUpdateProvider defines an SDK message for updating a provider */ export interface MsgUpdateProviderSDKType { @@ -101,7 +101,7 @@ export interface MsgDeleteProviderProtoMsg { } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderAmino { - owner?: string; + owner: string; } /** MsgDeleteProvider defines an SDK message for deleting a provider */ export interface MsgDeleteProviderSDKType { @@ -130,10 +130,10 @@ export interface ProviderProtoMsg { } /** Provider stores owner and host details */ export interface ProviderAmino { - owner?: string; - host_uri?: string; - attributes?: AttributeAmino[]; - info?: ProviderInfoAmino; + owner: string; + host_uri: string; + attributes: AttributeAmino[]; + info: ProviderInfoAmino; } /** Provider stores owner and host details */ export interface ProviderSDKType { @@ -362,7 +362,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromProtoMsg(message: MsgCreateProviderProtoMsg, useInterfaces: boolean = true): MsgCreateProvider { @@ -564,7 +564,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromProtoMsg(message: MsgUpdateProviderProtoMsg, useInterfaces: boolean = true): MsgUpdateProvider { @@ -908,7 +908,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info, useInterfaces) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromProtoMsg(message: ProviderProtoMsg, useInterfaces: boolean = true): Provider { diff --git a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts index c29a11e980..f396528284 100644 --- a/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv3/cosmos/auth/v1beta1/auth.ts @@ -212,8 +212,8 @@ export const BaseAccount = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey, useInterfaces) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: BaseAccountProtoMsg, useInterfaces: boolean = true): BaseAccount { @@ -490,11 +490,11 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts index ea76e289c7..b6eba89d05 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/abci/v1beta1/abci.ts @@ -134,7 +134,7 @@ export interface ABCIMessageLogProtoMsg { } /** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */ export interface ABCIMessageLogAmino { - msg_index?: number; + msg_index: number; log?: string; /** * Events contains a slice of Event objects that were emitted during some @@ -697,7 +697,7 @@ export const TxResponse = { }, toAmino(message: TxResponse, useInterfaces: boolean = true): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.txhash = message.txhash === "" ? undefined : message.txhash; obj.codespace = message.codespace === "" ? undefined : message.codespace; obj.code = message.code === 0 ? undefined : message.code; @@ -709,8 +709,8 @@ export const TxResponse = { obj.logs = message.logs; } obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx, useInterfaces) : undefined; obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { @@ -1144,8 +1144,8 @@ export const GasInfo = { }, toAmino(message: GasInfo, useInterfaces: boolean = true): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; return obj; }, fromProtoMsg(message: GasInfoProtoMsg, useInterfaces: boolean = true): GasInfo { @@ -1781,11 +1781,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult, useInterfaces: boolean = true): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts index 8048a8ca23..da38d0423d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/query/v1beta1/pagination.ts @@ -294,8 +294,8 @@ export const PageRequest = { toAmino(message: PageRequest, useInterfaces: boolean = true): PageRequestAmino { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; obj.count_total = message.countTotal === false ? undefined : message.countTotal; obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; @@ -396,7 +396,7 @@ export const PageResponse = { toAmino(message: PageResponse, useInterfaces: boolean = true): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; return obj; }, fromProtoMsg(message: PageResponseProtoMsg, useInterfaces: boolean = true): PageResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts index 175cfa1893..4b79f44286 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -322,7 +322,7 @@ export const Snapshot = { }, toAmino(message: Snapshot, useInterfaces: boolean = true): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; @@ -801,7 +801,7 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.height = message.height === 0 ? undefined : message.height; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts index f0f44a1dfe..bdd0c093cc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/store/v1beta1/commit_info.ts @@ -173,7 +173,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo, useInterfaces: boolean = true): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e, useInterfaces) : undefined); } else { @@ -375,7 +375,7 @@ export const CommitID = { }, toAmino(message: CommitID, useInterfaces: boolean = true): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts index da8714c051..f808e04ea3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/base/tendermint/v1beta1/query.ts @@ -388,7 +388,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest, useInterfaces: boolean = true): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -510,7 +510,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse, useInterfaces: boolean = true): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { @@ -720,7 +720,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse, useInterfaces: boolean = true): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { @@ -860,8 +860,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey, useInterfaces) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorProtoMsg, useInterfaces: boolean = true): Validator { @@ -944,7 +944,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest, useInterfaces: boolean = true): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromProtoMsg(message: GetBlockByHeightRequestProtoMsg, useInterfaces: boolean = true): GetBlockByHeightRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts index 4503ee8378..a589279e21 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/capability.ts @@ -146,7 +146,7 @@ export const Capability = { }, toAmino(message: Capability, useInterfaces: boolean = true): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromProtoMsg(message: CapabilityProtoMsg, useInterfaces: boolean = true): Capability { diff --git a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts index a9a58d47da..c2e069c1cc 100644 --- a/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/capability/v1beta1/genesis.ts @@ -138,7 +138,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners, useInterfaces: boolean = true): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners, useInterfaces) : undefined; return obj; }, @@ -243,7 +243,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts index 62feb818a9..1213ab682c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/distribution.ts @@ -298,7 +298,7 @@ export interface DelegatorStartingInfoProtoMsg { export interface DelegatorStartingInfoAmino { previous_period?: string; stake?: string; - height?: string; + height: string; } /** * DelegatorStartingInfo represents the starting info for a delegator reward @@ -707,7 +707,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = message.rewards; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorCurrentRewardsProtoMsg, useInterfaces: boolean = true): ValidatorCurrentRewards { @@ -987,7 +987,7 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent, useInterfaces: boolean = true): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; obj.fraction = message.fraction === "" ? undefined : message.fraction; return obj; }, @@ -1424,7 +1424,7 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo, useInterfaces: boolean = true): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; obj.stake = message.stake === "" ? undefined : message.stake; obj.height = message.height ? message.height.toString() : "0"; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts index b66606be98..d52acabb4f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/genesis.ts @@ -680,7 +680,7 @@ export const ValidatorHistoricalRewardsRecord = { toAmino(message: ValidatorHistoricalRewardsRecord, useInterfaces: boolean = true): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards, useInterfaces) : undefined; return obj; }, @@ -1028,8 +1028,8 @@ export const ValidatorSlashEventRecord = { toAmino(message: ValidatorSlashEventRecord, useInterfaces: boolean = true): ValidatorSlashEventRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts index e8e7d82a62..ede248d568 100644 --- a/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/distribution/v1beta1/query.ts @@ -1075,8 +1075,8 @@ export const QueryValidatorSlashesRequest = { toAmino(message: QueryValidatorSlashesRequest, useInterfaces: boolean = true): QueryValidatorSlashesRequestAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts index 58eba949db..e93e89326f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv3/cosmos/evidence/v1beta1/evidence.ts @@ -150,9 +150,9 @@ export const Equivocation = { }, toAmino(message: Equivocation, useInterfaces: boolean = true): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts index e1c7cdfccd..22abaf1b56 100644 --- a/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/genutil/v1beta1/genesis.ts @@ -13,7 +13,7 @@ export interface GenesisStateProtoMsg { /** GenesisState defines the raw genesis transaction in JSON. */ export interface GenesisStateAmino { /** gen_txs defines the genesis transactions. */ - gen_txs?: string[]; + gen_txs: string[]; } /** GenesisState defines the raw genesis transaction in JSON. */ export interface GenesisStateSDKType { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts index 636fde61cc..cae0b5b949 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/genesis.ts @@ -231,7 +231,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts index 38713b3bdc..6e83da37d3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/gov.ts @@ -592,7 +592,7 @@ export const Deposit = { }, toAmino(message: Deposit, useInterfaces: boolean = true): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); @@ -830,7 +830,7 @@ export const Proposal = { }, toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { @@ -1110,7 +1110,7 @@ export const Vote = { }, toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e, useInterfaces) : undefined); diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts index b3a3df254b..3494f3d99c 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/query.ts @@ -427,7 +427,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest, useInterfaces: boolean = true): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryProposalRequestProtoMsg, useInterfaces: boolean = true): QueryProposalRequest { @@ -848,7 +848,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest, useInterfaces: boolean = true): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1032,7 +1032,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest, useInterfaces: boolean = true): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1440,7 +1440,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest, useInterfaces: boolean = true): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1624,7 +1624,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest, useInterfaces: boolean = true): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1817,7 +1817,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest, useInterfaces: boolean = true): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryTallyResultRequestProtoMsg, useInterfaces: boolean = true): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts index 5af89ca633..4300b59b9d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1/tx.ts @@ -123,7 +123,7 @@ export interface MsgVoteProtoMsg { } /** MsgVote defines a message to cast a vote. */ export interface MsgVoteAmino { - proposal_id?: string; + proposal_id: string; voter?: string; option?: VoteOption; metadata?: string; @@ -158,7 +158,7 @@ export interface MsgVoteWeightedProtoMsg { } /** MsgVoteWeighted defines a message to cast a vote. */ export interface MsgVoteWeightedAmino { - proposal_id?: string; + proposal_id: string; voter?: string; options?: WeightedVoteOptionAmino[]; metadata?: string; @@ -192,7 +192,7 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { - proposal_id?: string; + proposal_id: string; depositor?: string; amount?: CoinAmino[]; } @@ -428,7 +428,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse, useInterfaces: boolean = true): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg, useInterfaces: boolean = true): MsgSubmitProposalResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts index 558b1ace66..b16de625c1 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/genesis.ts @@ -231,7 +231,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts index 63808b1d74..b4009e0950 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/gov.ts @@ -341,7 +341,7 @@ export interface VoteProtoMsg { * A Vote consists of a proposal ID, the voter, and the vote option. */ export interface VoteAmino { - proposal_id?: string; + proposal_id: string; voter?: string; /** * Deprecated: Prefer to use `options` instead. This field is set in queries @@ -749,7 +749,7 @@ export const Deposit = { }, toAmino(message: Deposit, useInterfaces: boolean = true): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); @@ -968,7 +968,7 @@ export const Proposal = { }, toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.content = message.content ? ProposalContentI_ToAmino((message.content as Any), useInterfaces) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts index 8c5bdf686e..9cc0c43b47 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/query.ts @@ -427,7 +427,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest, useInterfaces: boolean = true): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryProposalRequestProtoMsg, useInterfaces: boolean = true): QueryProposalRequest { @@ -848,7 +848,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest, useInterfaces: boolean = true): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1032,7 +1032,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest, useInterfaces: boolean = true): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1440,7 +1440,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest, useInterfaces: boolean = true): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1624,7 +1624,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest, useInterfaces: boolean = true): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1817,7 +1817,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest, useInterfaces: boolean = true): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryTallyResultRequestProtoMsg, useInterfaces: boolean = true): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts index d118b2a7f2..482c332e6f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/gov/v1beta1/tx.ts @@ -53,7 +53,7 @@ export interface MsgSubmitProposalResponseProtoMsg { } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponseAmino { - proposal_id?: string; + proposal_id: string; } /** MsgSubmitProposalResponse defines the Msg/SubmitProposal response type. */ export interface MsgSubmitProposalResponseSDKType { @@ -111,7 +111,7 @@ export interface MsgVoteWeightedProtoMsg { * Since: cosmos-sdk 0.43 */ export interface MsgVoteWeightedAmino { - proposal_id?: string; + proposal_id: string; voter?: string; options?: WeightedVoteOptionAmino[]; } @@ -159,7 +159,7 @@ export interface MsgDepositProtoMsg { } /** MsgDeposit defines a message to submit a deposit to an existing proposal. */ export interface MsgDepositAmino { - proposal_id?: string; + proposal_id: string; depositor?: string; amount?: CoinAmino[]; } @@ -484,7 +484,7 @@ export const MsgVote = { }, toAmino(message: MsgVote, useInterfaces: boolean = true): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts index 1995e8bba9..da0d9a6fb7 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/events.ts @@ -241,7 +241,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup, useInterfaces: boolean = true): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromProtoMsg(message: EventCreateGroupProtoMsg, useInterfaces: boolean = true): EventCreateGroup { @@ -324,7 +324,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup, useInterfaces: boolean = true): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromProtoMsg(message: EventUpdateGroupProtoMsg, useInterfaces: boolean = true): EventUpdateGroup { @@ -569,7 +569,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal, useInterfaces: boolean = true): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: EventSubmitProposalProtoMsg, useInterfaces: boolean = true): EventSubmitProposal { @@ -652,7 +652,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal, useInterfaces: boolean = true): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: EventWithdrawProposalProtoMsg, useInterfaces: boolean = true): EventWithdrawProposal { @@ -735,7 +735,7 @@ export const EventVote = { }, toAmino(message: EventVote, useInterfaces: boolean = true): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: EventVoteProtoMsg, useInterfaces: boolean = true): EventVote { @@ -833,7 +833,7 @@ export const EventExec = { }, toAmino(message: EventExec, useInterfaces: boolean = true): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.result = message.result === 0 ? undefined : message.result; return obj; }, @@ -932,7 +932,7 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup, useInterfaces: boolean = true): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts index 94226a9855..1234902b9d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/genesis.ts @@ -279,7 +279,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e, useInterfaces) : undefined); } else { @@ -290,13 +290,13 @@ export const GenesisState = { } else { obj.group_members = message.groupMembers; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e, useInterfaces) : undefined); } else { obj.group_policies = message.groupPolicies; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts index 95d4b88745..791063eddd 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/query.ts @@ -623,7 +623,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest, useInterfaces: boolean = true): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryGroupInfoRequestProtoMsg, useInterfaces: boolean = true): QueryGroupInfoRequest { @@ -970,7 +970,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest, useInterfaces: boolean = true): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1388,7 +1388,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest, useInterfaces: boolean = true): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1789,7 +1789,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest, useInterfaces: boolean = true): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryProposalRequestProtoMsg, useInterfaces: boolean = true): QueryProposalRequest { @@ -2178,7 +2178,7 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest, useInterfaces: boolean = true): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -2362,7 +2362,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest, useInterfaces: boolean = true): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -2971,7 +2971,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest, useInterfaces: boolean = true): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryTallyResultRequestProtoMsg, useInterfaces: boolean = true): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts index 97f7ae6f85..df4b60d366 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/tx.ts @@ -865,7 +865,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse, useInterfaces: boolean = true): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgCreateGroupResponseProtoMsg, useInterfaces: boolean = true): MsgCreateGroupResponse { @@ -985,7 +985,7 @@ export const MsgUpdateGroupMembers = { toAmino(message: MsgUpdateGroupMembers, useInterfaces: boolean = true): MsgUpdateGroupMembersAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e, useInterfaces) : undefined); } else { @@ -1167,7 +1167,7 @@ export const MsgUpdateGroupAdmin = { toAmino(message: MsgUpdateGroupAdmin, useInterfaces: boolean = true): MsgUpdateGroupAdminAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, @@ -1345,7 +1345,7 @@ export const MsgUpdateGroupMetadata = { toAmino(message: MsgUpdateGroupMetadata, useInterfaces: boolean = true): MsgUpdateGroupMetadataAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, @@ -1540,7 +1540,7 @@ export const MsgCreateGroupPolicy = { toAmino(message: MsgCreateGroupPolicy, useInterfaces: boolean = true): MsgCreateGroupPolicyAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; return obj; @@ -2007,7 +2007,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse, useInterfaces: boolean = true): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, @@ -2673,7 +2673,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse, useInterfaces: boolean = true): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgSubmitProposalResponseProtoMsg, useInterfaces: boolean = true): MsgSubmitProposalResponse { @@ -2771,7 +2771,7 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal, useInterfaces: boolean = true): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -2978,7 +2978,7 @@ export const MsgVote = { }, toAmino(message: MsgVote, useInterfaces: boolean = true): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; @@ -3143,7 +3143,7 @@ export const MsgExec = { }, toAmino(message: MsgExec, useInterfaces: boolean = true): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -3306,7 +3306,7 @@ export const MsgLeaveGroup = { toAmino(message: MsgLeaveGroup, useInterfaces: boolean = true): MsgLeaveGroupAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgLeaveGroupProtoMsg, useInterfaces: boolean = true): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts index f43140dbcb..74f9bc503f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmos/group/v1/types.ts @@ -1382,10 +1382,10 @@ export const GroupInfo = { }, toAmino(message: GroupInfo, useInterfaces: boolean = true): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1487,7 +1487,7 @@ export const GroupMember = { }, toAmino(message: GroupMember, useInterfaces: boolean = true): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.member = message.member ? Member.toAmino(message.member, useInterfaces) : undefined; return obj; }, @@ -1666,10 +1666,10 @@ export const GroupPolicyInfo = { toAmino(message: GroupPolicyInfo, useInterfaces: boolean = true): GroupPolicyInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? DecisionPolicy_ToAmino((message.decisionPolicy as Any), useInterfaces) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1952,7 +1952,7 @@ export const Proposal = { }, toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { @@ -1961,8 +1961,8 @@ export const Proposal = { obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult, useInterfaces) : undefined; @@ -2244,7 +2244,7 @@ export const Vote = { }, toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; diff --git a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts index 35981fb646..f5b96b8575 100644 --- a/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/cosmos/mint/v1beta1/mint.ts @@ -312,7 +312,7 @@ export const Params = { obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts index 7d2c22f556..b6a1f804a4 100644 --- a/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/nft/v1beta1/query.ts @@ -414,7 +414,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse, useInterfaces: boolean = true): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromProtoMsg(message: QueryBalanceResponseProtoMsg, useInterfaces: boolean = true): QueryBalanceResponse { @@ -756,7 +756,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse, useInterfaces: boolean = true): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromProtoMsg(message: QuerySupplyResponseProtoMsg, useInterfaces: boolean = true): QuerySupplyResponse { diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts index e50c6442be..5f6e959ccf 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/genesis.ts @@ -543,7 +543,7 @@ export const MissedBlock = { }, toAmino(message: MissedBlock, useInterfaces: boolean = true): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.missed = message.missed === false ? undefined : message.missed; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts index 74b7183121..1d0c75055b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/slashing.ts @@ -248,11 +248,11 @@ export const ValidatorSigningInfo = { toAmino(message: ValidatorSigningInfo, useInterfaces: boolean = true): ValidatorSigningInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.start_height = message.startHeight !== BigInt(0) ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset !== BigInt(0) ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.missed_blocks_counter = message.missedBlocksCounter !== BigInt(0) ? message.missedBlocksCounter.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorSigningInfoProtoMsg, useInterfaces: boolean = true): ValidatorSigningInfo { @@ -397,7 +397,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = message.signedBlocksWindow !== BigInt(0) ? message.signedBlocksWindow.toString() : undefined; obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration, useInterfaces) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; diff --git a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts index a8855b6ecc..d2d8e6526d 100644 --- a/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/slashing/v1beta1/tx.ts @@ -11,7 +11,7 @@ export interface MsgUnjailProtoMsg { } /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjailAmino { - validator_addr?: string; + validator_addr: string; } /** MsgUnjail defines the Msg/Unjail request type */ export interface MsgUnjailSDKType { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts index 774add332b..fb5e09618f 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/genesis.ts @@ -416,7 +416,7 @@ export const LastValidatorPower = { toAmino(message: LastValidatorPower, useInterfaces: boolean = true): LastValidatorPowerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromProtoMsg(message: LastValidatorPowerProtoMsg, useInterfaces: boolean = true): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts index b738a7e046..17d039c00b 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/query.ts @@ -2999,7 +2999,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest, useInterfaces: boolean = true): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromProtoMsg(message: QueryHistoricalInfoRequestProtoMsg, useInterfaces: boolean = true): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts index 51ad33df0c..522ca7ca73 100644 --- a/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv3/cosmos/staking/v1beta1/staking.ts @@ -739,8 +739,8 @@ export interface PoolProtoMsg { * denomination. */ export interface PoolAmino { - not_bonded_tokens?: string; - bonded_tokens?: string; + not_bonded_tokens: string; + bonded_tokens: string; } /** * Pool is used for tracking bonded and not-bonded token supply of the bond @@ -1446,7 +1446,7 @@ export const Validator = { obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; obj.description = message.description ? Description.toAmino(message.description, useInterfaces) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission, useInterfaces) : undefined; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -2296,7 +2296,7 @@ export const UnbondingDelegationEntry = { }, toAmino(message: UnbondingDelegationEntry, useInterfaces: boolean = true): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; @@ -2427,7 +2427,7 @@ export const RedelegationEntry = { }, toAmino(message: RedelegationEntry, useInterfaces: boolean = true): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts index e260c9bc0e..9ffdeac2a5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/signing/v1beta1/signing.ts @@ -418,7 +418,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data, useInterfaces) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: SignatureDescriptorProtoMsg, useInterfaces: boolean = true): SignatureDescriptor { diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts index 4b8d0e41cc..c0ebe697b3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/service.ts @@ -1351,7 +1351,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest, useInterfaces: boolean = true): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts index d22f9ff8b9..607c480bd5 100644 --- a/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/tx/v1beta1/tx.ts @@ -1071,7 +1071,7 @@ export const SignDoc = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; return obj; }, fromProtoMsg(message: SignDocProtoMsg, useInterfaces: boolean = true): SignDoc { @@ -1238,8 +1238,8 @@ export const SignDocDirectAux = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip, useInterfaces) : undefined; return obj; }, @@ -1407,7 +1407,7 @@ export const TxBody = { obj.messages = message.messages; } obj.memo = message.memo === "" ? undefined : message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e, useInterfaces) : undefined); } else { @@ -1663,7 +1663,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo, useInterfaces) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: SignerInfoProtoMsg, useInterfaces: boolean = true): SignerInfo { @@ -2093,7 +2093,7 @@ export const Fee = { } else { obj.amount = message.amount; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; obj.payer = message.payer === "" ? undefined : message.payer; obj.granter = message.granter === "" ? undefined : message.granter; return obj; diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts index cd36610b63..d3766ab9c3 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/query.ts @@ -586,7 +586,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse, useInterfaces: boolean = true): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromProtoMsg(message: QueryAppliedPlanResponseProtoMsg, useInterfaces: boolean = true): QueryAppliedPlanResponse { @@ -669,7 +669,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest, useInterfaces: boolean = true): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; return obj; }, fromProtoMsg(message: QueryUpgradedConsensusStateRequestProtoMsg, useInterfaces: boolean = true): QueryUpgradedConsensusStateRequest { diff --git a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts index e110093d28..f2d114f165 100644 --- a/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv3/cosmos/upgrade/v1beta1/upgrade.ts @@ -334,7 +334,7 @@ export const Plan = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState, useInterfaces) : undefined; return obj; @@ -647,7 +647,7 @@ export const ModuleVersion = { toAmino(message: ModuleVersion, useInterfaces: boolean = true): ModuleVersionAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; return obj; }, fromProtoMsg(message: ModuleVersionProtoMsg, useInterfaces: boolean = true): ModuleVersion { diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts index 65f8b235e7..9ddb11331e 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/tx.ts @@ -284,7 +284,7 @@ export const MsgCreateVestingAccount = { } else { obj.amount = message.amount; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, @@ -670,7 +670,7 @@ export const MsgCreatePeriodicVestingAccount = { const obj: any = {}; obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; obj.to_address = message.toAddress === "" ? undefined : message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts index c16e754d1b..24ecbae9ba 100644 --- a/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv3/cosmos/vesting/v1beta1/vesting.ts @@ -343,7 +343,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; return obj; }, fromProtoMsg(message: BaseVestingAccountProtoMsg, useInterfaces: boolean = true): BaseVestingAccount { @@ -444,7 +444,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount, useInterfaces: boolean = true): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount, useInterfaces) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; return obj; }, fromProtoMsg(message: ContinuousVestingAccountProtoMsg, useInterfaces: boolean = true): ContinuousVestingAccount { @@ -631,7 +631,7 @@ export const Period = { }, toAmino(message: Period, useInterfaces: boolean = true): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { @@ -758,7 +758,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount, useInterfaces: boolean = true): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount, useInterfaces) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts index 6f74449f5d..76b7a98508 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/genesis.ts @@ -550,7 +550,7 @@ export const Code = { }, toAmino(message: Code, useInterfaces: boolean = true): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo, useInterfaces) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; obj.pinned = message.pinned === false ? undefined : message.pinned; @@ -777,7 +777,7 @@ export const Sequence = { toAmino(message: Sequence, useInterfaces: boolean = true): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: SequenceProtoMsg, useInterfaces: boolean = true): Sequence { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts index 2586adf403..556fae0105 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/ibc.ts @@ -183,8 +183,8 @@ export const MsgIBCSend = { toAmino(message: MsgIBCSend, useInterfaces: boolean = true): MsgIBCSendAmino { const obj: any = {}; obj.channel = message.channel === "" ? undefined : message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts index 8885fc1a93..489a9b9d3a 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/proposal.ts @@ -700,7 +700,7 @@ export const InstantiateContractProposal = { obj.description = message.description === "" ? undefined : message.description; obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -853,7 +853,7 @@ export const MigrateContractProposal = { obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts index 97da755bd6..b3fb76999b 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/query.ts @@ -399,7 +399,7 @@ export interface CodeInfoResponseProtoMsg { } /** CodeInfoResponse contains code meta data from CodeInfo */ export interface CodeInfoResponseAmino { - code_id?: string; + code_id: string; creator?: string; data_hash?: string; } @@ -421,7 +421,7 @@ export interface QueryCodeResponseProtoMsg { /** QueryCodeResponse is the response type for the Query/Code RPC method */ export interface QueryCodeResponseAmino { code_info?: CodeInfoResponseAmino; - data?: string; + data: string; } /** QueryCodeResponse is the response type for the Query/Code RPC method */ export interface QueryCodeResponseSDKType { @@ -996,7 +996,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest, useInterfaces: boolean = true): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination, useInterfaces) : undefined; return obj; }, @@ -1753,7 +1753,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest, useInterfaces: boolean = true): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryCodeRequestProtoMsg, useInterfaces: boolean = true): QueryCodeRequest { diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts index fe9adb204e..9281c7ae50 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/tx.ts @@ -492,7 +492,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse, useInterfaces: boolean = true): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgStoreCodeResponseProtoMsg, useInterfaces: boolean = true): MsgStoreCodeResponse { @@ -658,7 +658,7 @@ export const MsgInstantiateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -1112,7 +1112,7 @@ export const MsgMigrateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts index 895d6f8440..3fe22de0b4 100644 --- a/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv3/cosmwasm/wasm/v1/types.ts @@ -622,7 +622,7 @@ export const Params = { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess, useInterfaces) : undefined; obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.max_wasm_code_size = message.maxWasmCodeSize !== BigInt(0) ? message.maxWasmCodeSize.toString() : undefined; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { @@ -914,7 +914,7 @@ export const ContractInfo = { }, toAmino(message: ContractInfo, useInterfaces: boolean = true): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.creator = message.creator === "" ? undefined : message.creator; obj.admin = message.admin === "" ? undefined : message.admin; obj.label = message.label === "" ? undefined : message.label; @@ -1051,7 +1051,7 @@ export const ContractCodeHistoryEntry = { toAmino(message: ContractCodeHistoryEntry, useInterfaces: boolean = true): ContractCodeHistoryEntryAmino { const obj: any = {}; obj.operation = message.operation === 0 ? undefined : message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated, useInterfaces) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1153,8 +1153,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition, useInterfaces: boolean = true): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; return obj; }, fromProtoMsg(message: AbsoluteTxPositionProtoMsg, useInterfaces: boolean = true): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts index d2080b4fbf..5cb2c8af1d 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/genesis.ts @@ -213,10 +213,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromProtoMsg(message: EpochInfoProtoMsg, useInterfaces: boolean = true): EpochInfo { diff --git a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts index eac036dce0..4a4f9efbd4 100644 --- a/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/epochs/v1/query.ts @@ -394,7 +394,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse, useInterfaces: boolean = true): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: QueryCurrentEpochResponseProtoMsg, useInterfaces: boolean = true): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts index b2ff124b9b..a0fa2d1893 100644 --- a/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/fees/v1/genesis.ts @@ -319,7 +319,7 @@ export const Params = { obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate.toString() : undefined; obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; return obj; }, diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts index 300d94eb64..ca2147a116 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/incentives.ts @@ -286,7 +286,7 @@ export const Incentive = { } obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = message.totalGas !== BigInt(0) ? message.totalGas.toString() : undefined; return obj; }, fromProtoMsg(message: IncentiveProtoMsg, useInterfaces: boolean = true): Incentive { @@ -400,7 +400,7 @@ export const GasMeter = { const obj: any = {}; obj.contract = message.contract === "" ? undefined : message.contract; obj.participant = message.participant === "" ? undefined : message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.cumulative_gas = message.cumulativeGas !== BigInt(0) ? message.cumulativeGas.toString() : undefined; return obj; }, fromProtoMsg(message: GasMeterProtoMsg, useInterfaces: boolean = true): GasMeter { diff --git a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts index 9cab90bc14..d2056193d3 100644 --- a/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/incentives/v1/query.ts @@ -1087,7 +1087,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse, useInterfaces: boolean = true): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = message.gasMeter !== BigInt(0) ? message.gasMeter.toString() : undefined; return obj; }, fromProtoMsg(message: QueryGasMeterResponseProtoMsg, useInterfaces: boolean = true): QueryGasMeterResponse { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts index 67d393cb0c..8d740b52f2 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/genesis.ts @@ -206,10 +206,10 @@ export const GenesisState = { toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.epochs_per_period = message.epochsPerPeriod !== BigInt(0) ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts index 443dc5bd2a..c608c54dc8 100644 --- a/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv3/evmos/inflation/v1/query.ts @@ -372,7 +372,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse, useInterfaces: boolean = true): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPeriodResponseProtoMsg, useInterfaces: boolean = true): QueryPeriodResponse { @@ -660,7 +660,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse, useInterfaces: boolean = true): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromProtoMsg(message: QuerySkippedEpochsResponseProtoMsg, useInterfaces: boolean = true): QuerySkippedEpochsResponse { diff --git a/__fixtures__/v-next/outputv3/google/api/distribution.ts b/__fixtures__/v-next/outputv3/google/api/distribution.ts index a7ecad9db7..a58a2913dc 100644 --- a/__fixtures__/v-next/outputv3/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/distribution.ts @@ -700,7 +700,7 @@ export const Distribution = { }, toAmino(message: Distribution, useInterfaces: boolean = true): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts index 732e045696..9a62ba5458 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -1283,7 +1283,7 @@ export const IssueDetails = { const obj: any = {}; obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position, useInterfaces) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromProtoMsg(message: IssueDetailsProtoMsg, useInterfaces: boolean = true): IssueDetails { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts index 73d7e36ebd..28c5c278be 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/checked.ts @@ -928,7 +928,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry, useInterfaces: boolean = true): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Reference.toAmino(message.value, useInterfaces) : undefined; return obj; }, @@ -1021,7 +1021,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry, useInterfaces: boolean = true): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Type.toAmino(message.value, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts index ba81b86348..3364924634 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/eval.ts @@ -442,8 +442,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result, useInterfaces: boolean = true): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = message.expr !== BigInt(0) ? message.expr.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: EvalState_ResultProtoMsg, useInterfaces: boolean = true): EvalState_Result { diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts index df398e62c9..2777993ad0 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/explain.ts @@ -279,7 +279,7 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep, useInterfaces: boolean = true): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts index adf75c32ba..4dfe7fce3e 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/syntax.ts @@ -1126,7 +1126,7 @@ export const Expr = { }, toAmino(message: Expr, useInterfaces: boolean = true): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr, useInterfaces) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr, useInterfaces) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr, useInterfaces) : undefined; @@ -1778,7 +1778,7 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry, useInterfaces: boolean = true): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey, useInterfaces) : undefined; obj.value = message.value ? Expr.toAmino(message.value, useInterfaces) : undefined; @@ -2179,8 +2179,8 @@ export const Constant = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -2281,7 +2281,7 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry, useInterfaces: boolean = true): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value === 0 ? undefined : message.value; return obj; }, @@ -2374,7 +2374,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry, useInterfaces: boolean = true): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Expr.toAmino(message.value, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts index 67ad418c1f..b0515c2dd2 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1alpha1/value.ts @@ -470,8 +470,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts index b1193c7fbb..e47f33868f 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/expr.ts @@ -1948,8 +1948,8 @@ export const Literal = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts index 4c2224d297..6aad5b283f 100644 --- a/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv3/google/api/expr/v1beta1/value.ts @@ -470,8 +470,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv3/google/api/quota.ts b/__fixtures__/v-next/outputv3/google/api/quota.ts index 70c6ee22ae..d81423632a 100644 --- a/__fixtures__/v-next/outputv3/google/api/quota.ts +++ b/__fixtures__/v-next/outputv3/google/api/quota.ts @@ -686,7 +686,7 @@ export const MetricRule_MetricCostsEntry = { toAmino(message: MetricRule_MetricCostsEntry, useInterfaces: boolean = true): MetricRule_MetricCostsEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: MetricRule_MetricCostsEntryProtoMsg, useInterfaces: boolean = true): MetricRule_MetricCostsEntry { @@ -916,7 +916,7 @@ export const QuotaLimit_ValuesEntry = { toAmino(message: QuotaLimit_ValuesEntry, useInterfaces: boolean = true): QuotaLimit_ValuesEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: QuotaLimit_ValuesEntryProtoMsg, useInterfaces: boolean = true): QuotaLimit_ValuesEntry { @@ -1171,9 +1171,9 @@ export const QuotaLimit = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.description = message.description === "" ? undefined : message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit !== BigInt(0) ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier !== BigInt(0) ? message.freeTier.toString() : undefined; obj.duration = message.duration === "" ? undefined : message.duration; obj.metric = message.metric === "" ? undefined : message.metric; obj.unit = message.unit === "" ? undefined : message.unit; diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts index 99f8409cb6..12ad6eda5e 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/distribution.ts @@ -520,7 +520,7 @@ export const Distribution = { }, toAmino(message: Distribution, useInterfaces: boolean = true): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.minimum = message.minimum === 0 ? undefined : message.minimum; obj.maximum = message.maximum === 0 ? undefined : message.maximum; diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts index 35a552c622..4453b45ba9 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/http_request.ts @@ -466,9 +466,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -477,7 +477,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts index 5e17b71fcb..e172fd2eb9 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/log_entry.ts @@ -915,7 +915,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation, useInterfaces: boolean = true): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts index 4253831625..7492d7b9ce 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/metric_value.ts @@ -454,7 +454,7 @@ export const MetricValue = { obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts index bfbe8b5297..10a50c1e61 100644 --- a/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv3/google/api/servicecontrol/v1/service_controller.ts @@ -922,9 +922,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo, useInterfaces: boolean = true): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; + obj.project_number = message.projectNumber !== BigInt(0) ? message.projectNumber.toString() : undefined; obj.type = message.type === 0 ? undefined : message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.consumer_number = message.consumerNumber !== BigInt(0) ? message.consumerNumber.toString() : undefined; return obj; }, fromProtoMsg(message: CheckResponse_ConsumerInfoProtoMsg, useInterfaces: boolean = true): CheckResponse_ConsumerInfo { diff --git a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts index 2a8e2f8b2e..a55f2e5e48 100644 --- a/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv3/google/api/serviceusage/v1beta1/resources.ts @@ -2132,8 +2132,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket, useInterfaces: boolean = true): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = message.effectiveLimit !== BigInt(0) ? message.effectiveLimit.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride, useInterfaces) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride, useInterfaces) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride, useInterfaces) : undefined; @@ -2427,7 +2427,7 @@ export const QuotaOverride = { toAmino(message: QuotaOverride, useInterfaces: boolean = true): QuotaOverrideAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.override_value = message.overrideValue !== BigInt(0) ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { @@ -2811,7 +2811,7 @@ export const AdminQuotaPolicy = { toAmino(message: AdminQuotaPolicy, useInterfaces: boolean = true): AdminQuotaPolicyAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.policy_value = message.policyValue !== BigInt(0) ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts index c76d18b0d6..fba641be83 100644 --- a/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv3/google/logging/type/http_request.ts @@ -470,9 +470,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -481,7 +481,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts index bdc86da745..5aa09fde0f 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/log_entry.ts @@ -1227,7 +1227,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation, useInterfaces: boolean = true): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts index 1748f131eb..afde758dfa 100644 --- a/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv3/google/logging/v2/logging_config.ts @@ -7281,7 +7281,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse, useInterfaces: boolean = true): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = message.logEntriesCopiedCount !== BigInt(0) ? message.logEntriesCopiedCount.toString() : undefined; return obj; }, fromProtoMsg(message: CopyLogEntriesResponseProtoMsg, useInterfaces: boolean = true): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts index cafe75088f..d6b71b097b 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/descriptor.ts @@ -5595,8 +5595,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts index 03586a4e77..e679c3d51d 100644 --- a/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv3/google/protobuf/wrappers.ts @@ -497,7 +497,7 @@ export const Int64Value = { }, toAmino(message: Int64Value, useInterfaces: boolean = true): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: Int64ValueProtoMsg, useInterfaces: boolean = true): Int64Value { @@ -579,7 +579,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value, useInterfaces: boolean = true): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromProtoMsg(message: UInt64ValueProtoMsg, useInterfaces: boolean = true): UInt64Value { diff --git a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts index 17b3d6e06d..256c915d23 100644 --- a/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv3/google/rpc/context/attribute_context.ts @@ -1427,7 +1427,7 @@ export const AttributeContext_Peer = { toAmino(message: AttributeContext_Peer, useInterfaces: boolean = true): AttributeContext_PeerAmino { const obj: any = {}; obj.ip = message.ip === "" ? undefined : message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.port = message.port !== BigInt(0) ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -2118,7 +2118,7 @@ export const AttributeContext_Request = { obj.scheme = message.scheme === "" ? undefined : message.scheme; obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth, useInterfaces) : undefined; @@ -2394,8 +2394,8 @@ export const AttributeContext_Response = { }, toAmino(message: AttributeContext_Response, useInterfaces: boolean = true): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = message.code !== BigInt(0) ? message.code.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts index 6862c4d626..36601ec59e 100644 --- a/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/applications/transfer/v1/tx.ts @@ -252,7 +252,7 @@ export const MsgTransfer = { obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight, useInterfaces) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromProtoMsg(message: MsgTransferProtoMsg, useInterfaces: boolean = true): MsgTransfer { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts index d5a37ae762..2bb12547b1 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/channel.ts @@ -1025,14 +1025,14 @@ export const Packet = { }, toAmino(message: Packet, useInterfaces: boolean = true): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight, useInterfaces) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromProtoMsg(message: PacketProtoMsg, useInterfaces: boolean = true): Packet { @@ -1162,7 +1162,7 @@ export const PacketState = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts index cdd805ff9a..e6723ebcfe 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/genesis.ts @@ -321,7 +321,7 @@ export const GenesisState = { } else { obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { @@ -436,7 +436,7 @@ export const PacketSequence = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: PacketSequenceProtoMsg, useInterfaces: boolean = true): PacketSequence { diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts index 663484d983..4b5e3f60e0 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/query.ts @@ -1903,8 +1903,8 @@ export const QueryChannelConsensusStateRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromProtoMsg(message: QueryChannelConsensusStateRequestProtoMsg, useInterfaces: boolean = true): QueryChannelConsensusStateRequest { @@ -2152,7 +2152,7 @@ export const QueryPacketCommitmentRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPacketCommitmentRequestProtoMsg, useInterfaces: boolean = true): QueryPacketCommitmentRequest { @@ -2624,7 +2624,7 @@ export const QueryPacketReceiptRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPacketReceiptRequestProtoMsg, useInterfaces: boolean = true): QueryPacketReceiptRequest { @@ -2854,7 +2854,7 @@ export const QueryPacketAcknowledgementRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPacketAcknowledgementRequestProtoMsg, useInterfaces: boolean = true): QueryPacketAcknowledgementRequest { @@ -3958,7 +3958,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse, useInterfaces: boolean = true): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; return obj; diff --git a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts index 2e15a482ef..f2e8093c68 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/channel/v1/tx.ts @@ -2053,7 +2053,7 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet, useInterfaces) : undefined; obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2283,7 +2283,7 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight, useInterfaces) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts index 1b3c0da7d7..3a2feccbf3 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/client.ts @@ -932,8 +932,8 @@ export const Height = { }, toAmino(message: Height, useInterfaces: boolean = true): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromProtoMsg(message: HeightProtoMsg, useInterfaces: boolean = true): Height { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts index 227a95adae..8288d915ad 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/genesis.ts @@ -282,7 +282,7 @@ export const GenesisState = { } obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts index c78c9ced57..c838adac96 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/client/v1/query.ts @@ -977,8 +977,8 @@ export const QueryConsensusStateRequest = { toAmino(message: QueryConsensusStateRequest, useInterfaces: boolean = true): QueryConsensusStateRequestAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts index 09c44a352e..b1a2fb135f 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/connection.ts @@ -464,7 +464,7 @@ export const ConnectionEnd = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromProtoMsg(message: ConnectionEndProtoMsg, useInterfaces: boolean = true): ConnectionEnd { @@ -639,7 +639,7 @@ export const IdentifiedConnection = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromProtoMsg(message: IdentifiedConnectionProtoMsg, useInterfaces: boolean = true): IdentifiedConnection { @@ -1142,7 +1142,7 @@ export const Params = { }, toAmino(message: Params, useInterfaces: boolean = true): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts index 42933c4bd7..c506945b51 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/genesis.ts @@ -165,7 +165,7 @@ export const GenesisState = { } else { obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts index bdf94d46a5..272d158ef0 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/query.ts @@ -1249,8 +1249,8 @@ export const QueryConnectionConsensusStateRequest = { toAmino(message: QueryConnectionConsensusStateRequest, useInterfaces: boolean = true): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromProtoMsg(message: QueryConnectionConsensusStateRequestProtoMsg, useInterfaces: boolean = true): QueryConnectionConsensusStateRequest { diff --git a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts index b2c79a67e9..0601a121cc 100644 --- a/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv3/ibc/core/connection/v1/tx.ts @@ -411,7 +411,7 @@ export const MsgConnectionOpenInit = { obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; obj.version = message.version ? Version.toAmino(message.version, useInterfaces) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -741,7 +741,7 @@ export const MsgConnectionOpenTry = { obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState, useInterfaces) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty, useInterfaces) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts index cb984740f7..bc58c11336 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v1/solomachine.ts @@ -699,8 +699,8 @@ export const ClientState = { }, toAmino(message: ClientState, useInterfaces: boolean = true): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence !== BigInt(0) ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState, useInterfaces) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; @@ -819,7 +819,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromProtoMsg(message: ConsensusStateProtoMsg, useInterfaces: boolean = true): ConsensusState { @@ -966,8 +966,8 @@ export const Header = { }, toAmino(message: Header, useInterfaces: boolean = true): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey, useInterfaces) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1103,7 +1103,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour, useInterfaces: boolean = true): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne, useInterfaces) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo, useInterfaces) : undefined; return obj; @@ -1236,7 +1236,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromProtoMsg(message: SignatureAndDataProtoMsg, useInterfaces: boolean = true): SignatureAndData { @@ -1335,7 +1335,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData, useInterfaces: boolean = true): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromProtoMsg(message: TimestampedSignatureDataProtoMsg, useInterfaces: boolean = true): TimestampedSignatureData { @@ -1480,8 +1480,8 @@ export const SignBytes = { }, toAmino(message: SignBytes, useInterfaces: boolean = true): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2353,7 +2353,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData, useInterfaces: boolean = true): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromProtoMsg(message: NextSequenceRecvDataProtoMsg, useInterfaces: boolean = true): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts index 8c542aea8d..22f0553f5b 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/solomachine/v2/solomachine.ts @@ -697,7 +697,7 @@ export const ClientState = { }, toAmino(message: ClientState, useInterfaces: boolean = true): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState, useInterfaces) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; @@ -817,7 +817,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey, useInterfaces) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromProtoMsg(message: ConsensusStateProtoMsg, useInterfaces: boolean = true): ConsensusState { @@ -964,8 +964,8 @@ export const Header = { }, toAmino(message: Header, useInterfaces: boolean = true): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey, useInterfaces) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1101,7 +1101,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour, useInterfaces: boolean = true): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne, useInterfaces) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo, useInterfaces) : undefined; return obj; @@ -1234,7 +1234,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromProtoMsg(message: SignatureAndDataProtoMsg, useInterfaces: boolean = true): SignatureAndData { @@ -1333,7 +1333,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData, useInterfaces: boolean = true): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromProtoMsg(message: TimestampedSignatureDataProtoMsg, useInterfaces: boolean = true): TimestampedSignatureData { @@ -1478,8 +1478,8 @@ export const SignBytes = { }, toAmino(message: SignBytes, useInterfaces: boolean = true): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2351,7 +2351,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData, useInterfaces: boolean = true): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromProtoMsg(message: NextSequenceRecvDataProtoMsg, useInterfaces: boolean = true): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts index adcc0cffc4..bbe739e33b 100644 --- a/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv3/ibc/lightclients/tendermint/v1/tendermint.ts @@ -996,8 +996,8 @@ export const Fraction = { }, toAmino(message: Fraction, useInterfaces: boolean = true): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; return obj; }, fromProtoMsg(message: FractionProtoMsg, useInterfaces: boolean = true): Fraction { diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts index de7807d12e..0be5ac998d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/genesis.ts @@ -316,10 +316,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromProtoMsg(message: EpochInfoProtoMsg, useInterfaces: boolean = true): EpochInfo { diff --git a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts index d8d91fc5d0..d0380c17e8 100644 --- a/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/epochs/query.ts @@ -350,7 +350,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse, useInterfaces: boolean = true): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: QueryCurrentEpochResponseProtoMsg, useInterfaces: boolean = true): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts index dd6aeb489f..b05d3d5ce6 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -786,7 +786,7 @@ export const Pool = { toAmino(message: Pool, useInterfaces: boolean = true): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams, useInterfaces) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts index 086891399f..d7d491de65 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -251,7 +251,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse, useInterfaces: boolean = true): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgCreateBalancerPoolResponseProtoMsg, useInterfaces: boolean = true): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index dc067e4942..fd10e57147 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -400,7 +400,7 @@ export const Pool = { toAmino(message: Pool, useInterfaces: boolean = true): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams, useInterfaces) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts index 14f36b41c8..f20ea6bacf 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/pool-models/stableswap/tx.ts @@ -347,7 +347,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse, useInterfaces: boolean = true): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgCreateStableswapPoolResponseProtoMsg, useInterfaces: boolean = true): MsgCreateStableswapPoolResponse { @@ -476,7 +476,7 @@ export const MsgStableSwapAdjustScalingFactors = { toAmino(message: MsgStableSwapAdjustScalingFactors, useInterfaces: boolean = true): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts index 01bbc60e4f..c127633c4c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/genesis.ts @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.pools = message.pools; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = message.nextPoolNumber !== BigInt(0) ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts index 7164fe7074..136ac8c911 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/query.ts @@ -594,7 +594,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest, useInterfaces: boolean = true): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPoolRequestProtoMsg, useInterfaces: boolean = true): QueryPoolRequest { @@ -1015,7 +1015,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse, useInterfaces: boolean = true): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromProtoMsg(message: QueryNumPoolsResponseProtoMsg, useInterfaces: boolean = true): QueryNumPoolsResponse { @@ -1098,7 +1098,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest, useInterfaces: boolean = true): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPoolTypeRequestProtoMsg, useInterfaces: boolean = true): QueryPoolTypeRequest { @@ -1283,7 +1283,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest, useInterfaces: boolean = true): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { @@ -1493,7 +1493,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest, useInterfaces: boolean = true): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, @@ -1668,7 +1668,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest, useInterfaces: boolean = true): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryPoolParamsRequestProtoMsg, useInterfaces: boolean = true): QueryPoolParamsRequest { @@ -1834,7 +1834,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest, useInterfaces: boolean = true): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryTotalPoolLiquidityRequestProtoMsg, useInterfaces: boolean = true): QueryTotalPoolLiquidityRequest { @@ -2008,7 +2008,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest, useInterfaces: boolean = true): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryTotalSharesRequestProtoMsg, useInterfaces: boolean = true): QueryTotalSharesRequest { @@ -2195,7 +2195,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest, useInterfaces: boolean = true): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { @@ -2420,7 +2420,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest, useInterfaces: boolean = true): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; @@ -2872,7 +2872,7 @@ export const QuerySwapExactAmountInRequest = { toAmino(message: QuerySwapExactAmountInRequest, useInterfaces: boolean = true): QuerySwapExactAmountInRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e, useInterfaces) : undefined); @@ -3094,7 +3094,7 @@ export const QuerySwapExactAmountOutRequest = { toAmino(message: QuerySwapExactAmountOutRequest, useInterfaces: boolean = true): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts index fe79173d33..79ecb635e3 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v1beta1/tx.ts @@ -484,7 +484,7 @@ export const MsgJoinPool = { toAmino(message: MsgJoinPool, useInterfaces: boolean = true): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); @@ -732,7 +732,7 @@ export const MsgExitPool = { toAmino(message: MsgExitPool, useInterfaces: boolean = true): MsgExitPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); @@ -927,7 +927,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute, useInterfaces: boolean = true): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -1248,7 +1248,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute, useInterfaces: boolean = true): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, @@ -1602,7 +1602,7 @@ export const MsgJoinSwapExternAmountIn = { toAmino(message: MsgJoinSwapExternAmountIn, useInterfaces: boolean = true): MsgJoinSwapExternAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn, useInterfaces) : undefined; obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; @@ -1829,7 +1829,7 @@ export const MsgJoinSwapShareAmountOut = { toAmino(message: MsgJoinSwapShareAmountOut, useInterfaces: boolean = true): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; @@ -2057,7 +2057,7 @@ export const MsgExitSwapShareAmountIn = { toAmino(message: MsgExitSwapShareAmountIn, useInterfaces: boolean = true): MsgExitSwapShareAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; @@ -2272,7 +2272,7 @@ export const MsgExitSwapExternAmountOut = { toAmino(message: MsgExitSwapExternAmountOut, useInterfaces: boolean = true): MsgExitSwapExternAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut, useInterfaces) : undefined; obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts index 7391902893..cb99c63f8e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/gamm/v2/query.ts @@ -156,7 +156,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest, useInterfaces: boolean = true): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts index 8a30e03951..fe9142a197 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/gauge.ts @@ -311,7 +311,7 @@ export const Gauge = { }, toAmino(message: Gauge, useInterfaces: boolean = true): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo, useInterfaces) : undefined; if (message.coins) { @@ -320,8 +320,8 @@ export const Gauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; + obj.filled_epochs = message.filledEpochs !== BigInt(0) ? message.filledEpochs.toString() : undefined; if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts index 813466c136..81d9b1c27f 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/genesis.ts @@ -195,7 +195,7 @@ export const GenesisState = { } else { obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = message.lastGaugeId !== BigInt(0) ? message.lastGaugeId.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts index 39b3492315..9224a10def 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/query.ts @@ -537,7 +537,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest, useInterfaces: boolean = true): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromProtoMsg(message: GaugeByIDRequestProtoMsg, useInterfaces: boolean = true): GaugeByIDRequest { @@ -1746,7 +1746,7 @@ export const RewardsEstRequest = { } else { obj.lock_ids = message.lockIds; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = message.endEpoch !== BigInt(0) ? message.endEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: RewardsEstRequestProtoMsg, useInterfaces: boolean = true): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts index 58a0edb367..027f96787d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/incentives/tx.ts @@ -272,7 +272,7 @@ export const MsgCreateGauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; return obj; }, fromProtoMsg(message: MsgCreateGaugeProtoMsg, useInterfaces: boolean = true): MsgCreateGauge { @@ -455,7 +455,7 @@ export const MsgAddToGauge = { toAmino(message: MsgAddToGauge, useInterfaces: boolean = true): MsgAddToGaugeAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts index 2b66b17078..88dc36a363 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/genesis.ts @@ -133,7 +133,7 @@ export const GenesisState = { }, toAmino(message: GenesisState, useInterfaces: boolean = true): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = message.lastLockId !== BigInt(0) ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts index 727a34ee68..4c2052e96e 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/lock.ts @@ -392,7 +392,7 @@ export const PeriodLock = { }, toAmino(message: PeriodLock, useInterfaces: boolean = true): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; @@ -661,7 +661,7 @@ export const SyntheticLock = { }, toAmino(message: SyntheticLock, useInterfaces: boolean = true): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; + obj.underlying_lock_id = message.underlyingLockId !== BigInt(0) ? message.underlyingLockId.toString() : undefined; obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts index cb360554b2..810a20396c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/query.ts @@ -2302,7 +2302,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest, useInterfaces: boolean = true): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: LockedRequestProtoMsg, useInterfaces: boolean = true): LockedRequest { @@ -2468,7 +2468,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest, useInterfaces: boolean = true): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: SyntheticLockupsByLockupIDRequestProtoMsg, useInterfaces: boolean = true): SyntheticLockupsByLockupIDRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts index 5182d2383c..55daff321a 100644 --- a/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/lockup/tx.ts @@ -386,7 +386,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse, useInterfaces: boolean = true): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromProtoMsg(message: MsgLockTokensResponseProtoMsg, useInterfaces: boolean = true): MsgLockTokensResponse { @@ -678,7 +678,7 @@ export const MsgBeginUnlocking = { toAmino(message: MsgBeginUnlocking, useInterfaces: boolean = true): MsgBeginUnlockingAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { @@ -880,7 +880,7 @@ export const MsgExtendLockup = { toAmino(message: MsgExtendLockup, useInterfaces: boolean = true): MsgExtendLockupAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; }, @@ -1082,7 +1082,7 @@ export const MsgForceUnlock = { toAmino(message: MsgForceUnlock, useInterfaces: boolean = true): MsgForceUnlockAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e, useInterfaces) : undefined); } else { diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts index fcd18f180b..588e154f03 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/genesis.ts @@ -139,7 +139,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter, useInterfaces) : undefined; obj.params = message.params ? Params.toAmino(message.params, useInterfaces) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = message.reductionStartedEpoch !== BigInt(0) ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: GenesisStateProtoMsg, useInterfaces: boolean = true): GenesisState { diff --git a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts index 0cad452064..2548e217c0 100644 --- a/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv3/osmosis/mint/v1beta1/mint.ts @@ -701,7 +701,7 @@ export const Params = { obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs.toString() : undefined; obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions, useInterfaces) : undefined; if (message.weightedDeveloperRewardsReceivers) { @@ -709,7 +709,7 @@ export const Params = { } else { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch !== BigInt(0) ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromProtoMsg(message: ParamsProtoMsg, useInterfaces: boolean = true): Params { diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts index 7fdac51fe2..5383761b3c 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/incentives.ts @@ -465,7 +465,7 @@ export const DistrRecord = { }, toAmino(message: DistrRecord, useInterfaces: boolean = true): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, @@ -583,8 +583,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge, useInterfaces: boolean = true): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts index 5e55559f42..30950b1148 100644 --- a/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/pool-incentives/v1beta1/query.ts @@ -235,7 +235,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest, useInterfaces: boolean = true): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: QueryGaugeIdsRequestProtoMsg, useInterfaces: boolean = true): QueryGaugeIdsRequest { @@ -441,7 +441,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration, useInterfaces: boolean = true): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration, useInterfaces) : undefined; obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; @@ -1069,9 +1069,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool, useInterfaces: boolean = true): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration, useInterfaces) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromProtoMsg(message: IncentivizedPoolProtoMsg, useInterfaces: boolean = true): IncentivizedPool { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts index daee91dd69..fce454a655 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/query.ts @@ -1195,7 +1195,7 @@ export const SuperfluidIntermediaryAccountInfo = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -1471,7 +1471,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest, useInterfaces: boolean = true): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: ConnectedIntermediaryAccountRequestProtoMsg, useInterfaces: boolean = true): ConnectedIntermediaryAccountRequest { diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts index efc02fe9c6..0ded7c5f8d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/superfluid.ts @@ -426,7 +426,7 @@ export const SuperfluidIntermediaryAccount = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromProtoMsg(message: SuperfluidIntermediaryAccountProtoMsg, useInterfaces: boolean = true): SuperfluidIntermediaryAccount { @@ -539,7 +539,7 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord, useInterfaces: boolean = true): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; return obj; @@ -772,7 +772,7 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection, useInterfaces: boolean = true): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, diff --git a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts index 3ff85bf453..b4d58a50f1 100644 --- a/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv3/osmosis/superfluid/tx.ts @@ -278,7 +278,7 @@ export const MsgSuperfluidDelegate = { toAmino(message: MsgSuperfluidDelegate, useInterfaces: boolean = true): MsgSuperfluidDelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, @@ -441,7 +441,7 @@ export const MsgSuperfluidUndelegate = { toAmino(message: MsgSuperfluidUndelegate, useInterfaces: boolean = true): MsgSuperfluidUndelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgSuperfluidUndelegateProtoMsg, useInterfaces: boolean = true): MsgSuperfluidUndelegate { @@ -603,7 +603,7 @@ export const MsgSuperfluidUnbondLock = { toAmino(message: MsgSuperfluidUnbondLock, useInterfaces: boolean = true): MsgSuperfluidUnbondLockAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgSuperfluidUnbondLockProtoMsg, useInterfaces: boolean = true): MsgSuperfluidUnbondLock { @@ -872,7 +872,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse, useInterfaces: boolean = true): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromProtoMsg(message: MsgLockAndSuperfluidDelegateResponseProtoMsg, useInterfaces: boolean = true): MsgLockAndSuperfluidDelegateResponse { @@ -971,7 +971,7 @@ export const MsgUnPoolWhitelistedPool = { toAmino(message: MsgUnPoolWhitelistedPool, useInterfaces: boolean = true): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromProtoMsg(message: MsgUnPoolWhitelistedPoolProtoMsg, useInterfaces: boolean = true): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts index d232dc58e9..86132cda4d 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/query.ts @@ -224,7 +224,7 @@ export const ArithmeticTwapRequest = { }, toAmino(message: ArithmeticTwapRequest, useInterfaces: boolean = true): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; @@ -437,7 +437,7 @@ export const ArithmeticTwapToNowRequest = { }, toAmino(message: ArithmeticTwapToNowRequest, useInterfaces: boolean = true): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; diff --git a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts index 0a6faad15c..4117464239 100644 --- a/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv3/osmosis/twap/v1beta1/twap_record.ts @@ -60,7 +60,7 @@ export interface TwapRecordAmino { /** Lexicographically larger denom of the pair */ asset1_denom?: string; /** height this record corresponds to, for debugging purposes */ - height?: string; + height: string; /** * This field should only exist until we have a global registry in the state * machine, mapping prior block heights within {TIME RANGE} to times. @@ -306,7 +306,7 @@ export const TwapRecord = { }, toAmino(message: TwapRecord, useInterfaces: boolean = true): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height.toString() : "0"; diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts index f6d37675d9..503d8f3b98 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/feetoken.ts @@ -118,7 +118,7 @@ export const FeeToken = { toAmino(message: FeeToken, useInterfaces: boolean = true): FeeTokenAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromProtoMsg(message: FeeTokenProtoMsg, useInterfaces: boolean = true): FeeToken { diff --git a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts index d8592d18bd..27b3e0db31 100644 --- a/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv3/osmosis/txfees/v1beta1/query.ts @@ -439,7 +439,7 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse, useInterfaces: boolean = true): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, @@ -604,7 +604,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse, useInterfaces: boolean = true): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromProtoMsg(message: QueryDenomPoolIdResponseProtoMsg, useInterfaces: boolean = true): QueryDenomPoolIdResponse { diff --git a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts index a002a8427d..de96d8706a 100644 --- a/__fixtures__/v-next/outputv3/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/abci/types.ts @@ -1785,8 +1785,8 @@ export const RequestInfo = { toAmino(message: RequestInfo, useInterfaces: boolean = true): RequestInfoAmino { const obj: any = {}; obj.version = message.version === "" ? undefined : message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; return obj; }, fromProtoMsg(message: RequestInfoProtoMsg, useInterfaces: boolean = true): RequestInfo { @@ -2056,7 +2056,7 @@ export const RequestInitChain = { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; return obj; }, fromProtoMsg(message: RequestInitChainProtoMsg, useInterfaces: boolean = true): RequestInitChain { @@ -2185,7 +2185,7 @@ export const RequestQuery = { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.path = message.path === "" ? undefined : message.path; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.prove = message.prove === false ? undefined : message.prove; return obj; }, @@ -2586,7 +2586,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock, useInterfaces: boolean = true): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromProtoMsg(message: RequestEndBlockProtoMsg, useInterfaces: boolean = true): RequestEndBlock { @@ -2920,7 +2920,7 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk, useInterfaces: boolean = true): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; @@ -3754,8 +3754,8 @@ export const ResponseInfo = { const obj: any = {}; obj.data = message.data === "" ? undefined : message.data; obj.version = message.version === "" ? undefined : message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; return obj; }, @@ -4201,11 +4201,11 @@ export const ResponseQuery = { obj.code = message.code === 0 ? undefined : message.code; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps, useInterfaces) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, @@ -4495,8 +4495,8 @@ export const ResponseCheckTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { @@ -4701,8 +4701,8 @@ export const ResponseDeliverTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e, useInterfaces) : undefined); } else { @@ -4940,7 +4940,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit, useInterfaces: boolean = true): ResponseCommitAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; return obj; }, fromProtoMsg(message: ResponseCommitProtoMsg, useInterfaces: boolean = true): ResponseCommit { @@ -5566,8 +5566,8 @@ export const BlockParams = { }, toAmino(message: BlockParams, useInterfaces: boolean = true): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; return obj; }, fromProtoMsg(message: BlockParamsProtoMsg, useInterfaces: boolean = true): BlockParams { @@ -6020,7 +6020,7 @@ export const TxResult = { }, toAmino(message: TxResult, useInterfaces: boolean = true): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result, useInterfaces) : undefined; @@ -6121,7 +6121,7 @@ export const Validator = { toAmino(message: Validator, useInterfaces: boolean = true): ValidatorAmino { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorProtoMsg, useInterfaces: boolean = true): Validator { @@ -6221,7 +6221,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate, useInterfaces: boolean = true): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey, useInterfaces) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorUpdateProtoMsg, useInterfaces: boolean = true): ValidatorUpdate { @@ -6467,9 +6467,9 @@ export const Evidence = { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator, useInterfaces) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromProtoMsg(message: EvidenceProtoMsg, useInterfaces: boolean = true): Evidence { @@ -6611,7 +6611,7 @@ export const Snapshot = { }, toAmino(message: Snapshot, useInterfaces: boolean = true): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; diff --git a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts index 22eccd7223..734e6abda0 100644 --- a/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv3/tendermint/crypto/proof.ts @@ -231,8 +231,8 @@ export const Proof = { }, toAmino(message: Proof, useInterfaces: boolean = true): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); diff --git a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts index 17192591eb..f4b3e6b1ba 100644 --- a/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/libs/bits/types.ts @@ -113,7 +113,7 @@ export const BitArray = { }, toAmino(message: BitArray, useInterfaces: boolean = true): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts index 71cd9db44b..f28e55b20d 100644 --- a/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/p2p/types.ts @@ -212,9 +212,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion, useInterfaces: boolean = true): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromProtoMsg(message: ProtocolVersionProtoMsg, useInterfaces: boolean = true): ProtocolVersion { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts index 488a6d8467..5ae7131548 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/evidence.ts @@ -323,8 +323,8 @@ export const DuplicateVoteEvidence = { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA, useInterfaces) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB, useInterfaces) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -478,13 +478,13 @@ export const LightClientAttackEvidence = { toAmino(message: LightClientAttackEvidence, useInterfaces: boolean = true): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock, useInterfaces) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e, useInterfaces) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv3/tendermint/types/params.ts b/__fixtures__/v-next/outputv3/tendermint/types/params.ts index 60242b9da7..2874a134d0 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/params.ts @@ -452,9 +452,9 @@ export const BlockParams = { }, toAmino(message: BlockParams, useInterfaces: boolean = true): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs !== BigInt(0) ? message.timeIotaMs.toString() : undefined; return obj; }, fromProtoMsg(message: BlockParamsProtoMsg, useInterfaces: boolean = true): BlockParams { @@ -570,9 +570,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams, useInterfaces: boolean = true): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration, useInterfaces) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; return obj; }, fromProtoMsg(message: EvidenceParamsProtoMsg, useInterfaces: boolean = true): EvidenceParams { @@ -744,7 +744,7 @@ export const VersionParams = { }, toAmino(message: VersionParams, useInterfaces: boolean = true): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; return obj; }, fromProtoMsg(message: VersionParamsProtoMsg, useInterfaces: boolean = true): VersionParams { @@ -843,8 +843,8 @@ export const HashedParams = { }, toAmino(message: HashedParams, useInterfaces: boolean = true): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; return obj; }, fromProtoMsg(message: HashedParamsProtoMsg, useInterfaces: boolean = true): HashedParams { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/types.ts b/__fixtures__/v-next/outputv3/tendermint/types/types.ts index 75d0d8b86d..0ae6aceb8b 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/types.ts @@ -1033,7 +1033,7 @@ export const Header = { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version, useInterfaces) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId, useInterfaces) : undefined; obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; @@ -1324,7 +1324,7 @@ export const Vote = { toAmino(message: Vote, useInterfaces: boolean = true): VoteAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -1465,7 +1465,7 @@ export const Commit = { }, toAmino(message: Commit, useInterfaces: boolean = true): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; if (message.signatures) { @@ -1775,7 +1775,7 @@ export const Proposal = { toAmino(message: Proposal, useInterfaces: boolean = true): ProposalAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; @@ -2114,9 +2114,9 @@ export const BlockMeta = { toAmino(message: BlockMeta, useInterfaces: boolean = true): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId, useInterfaces) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; obj.header = message.header ? Header.toAmino(message.header, useInterfaces) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; return obj; }, fromProtoMsg(message: BlockMetaProtoMsg, useInterfaces: boolean = true): BlockMeta { diff --git a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts index d6f7616c24..8d37c26064 100644 --- a/__fixtures__/v-next/outputv3/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv3/tendermint/types/validator.ts @@ -169,7 +169,7 @@ export const ValidatorSet = { obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer, useInterfaces) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorSetProtoMsg, useInterfaces: boolean = true): ValidatorSet { @@ -302,8 +302,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey, useInterfaces) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromProtoMsg(message: ValidatorProtoMsg, useInterfaces: boolean = true): Validator { @@ -403,7 +403,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator, useInterfaces: boolean = true): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey, useInterfaces) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; return obj; }, fromProtoMsg(message: SimpleValidatorProtoMsg, useInterfaces: boolean = true): SimpleValidator { diff --git a/__fixtures__/v-next/outputv3/tendermint/version/types.ts b/__fixtures__/v-next/outputv3/tendermint/version/types.ts index e15da31139..06147fdf10 100644 --- a/__fixtures__/v-next/outputv3/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv3/tendermint/version/types.ts @@ -144,7 +144,7 @@ export const App = { }, toAmino(message: App, useInterfaces: boolean = true): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; obj.software = message.software === "" ? undefined : message.software; return obj; }, @@ -244,8 +244,8 @@ export const Consensus = { }, toAmino(message: Consensus, useInterfaces: boolean = true): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromProtoMsg(message: ConsensusProtoMsg, useInterfaces: boolean = true): Consensus { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts index 447d3f8556..c1e8cf5e25 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/attribute.ts @@ -392,7 +392,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts index 2e5716a6cb..c640281aef 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta1/resource.ts @@ -286,7 +286,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -409,7 +409,7 @@ export const Storage = { }, toAmino(message: Storage): StorageAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts index 193b3ae103..ecb63a9eb4 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/attribute.ts @@ -392,7 +392,7 @@ export const PlacementRequirements = { }, toAmino(message: PlacementRequirements): PlacementRequirementsAmino { const obj: any = {}; - obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.fromPartial({}); + obj.signed_by = message.signedBy ? SignedBy.toAmino(message.signedBy) : SignedBy.toAmino(SignedBy.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts b/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts index 19df53bad2..89353bc2fd 100644 --- a/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv4/akash/base/v1beta2/resource.ts @@ -263,7 +263,7 @@ export const Memory = { }, toAmino(message: Memory): MemoryAmino { const obj: any = {}; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { @@ -403,7 +403,7 @@ export const Storage = { toAmino(message: Storage): StorageAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.fromPartial({}); + obj.quantity = message.quantity ? ResourceValue.toAmino(message.quantity) : ResourceValue.toAmino(ResourceValue.fromPartial({})); if (message.attributes) { obj.attributes = message.attributes.map(e => e ? Attribute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts index bfb3981741..ef849758bf 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.ts @@ -772,7 +772,7 @@ export const MsgRevokeCertificate = { }, toAmino(message: MsgRevokeCertificate): MsgRevokeCertificateAmino { const obj: any = {}; - obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.fromPartial({}); + obj.id = message.id ? CertificateID.toAmino(message.id) : CertificateID.toAmino(CertificateID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgRevokeCertificateAminoMsg): MsgRevokeCertificate { diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts index 3cb6a37102..5d914a929b 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/genesis.ts @@ -116,7 +116,7 @@ export const GenesisCertificate = { toAmino(message: GenesisCertificate): GenesisCertificateAmino { const obj: any = {}; obj.owner = message.owner ?? ""; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisCertificateAminoMsg): GenesisCertificate { diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts index c3cd752c70..17d1f5c3b1 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/query.ts @@ -132,7 +132,7 @@ export const CertificateResponse = { }, toAmino(message: CertificateResponse): CertificateResponseAmino { const obj: any = {}; - obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.fromPartial({}); + obj.certificate = message.certificate ? Certificate.toAmino(message.certificate) : Certificate.toAmino(Certificate.fromPartial({})); obj.serial = message.serial ?? ""; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts index 136c503512..7c7934f29f 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts index 199a950791..bdea42b9bd 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/deployment.ts @@ -313,14 +313,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateDeploymentAminoMsg): MsgCreateDeployment { @@ -508,8 +508,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgDepositDeploymentAminoMsg): MsgDepositDeployment { @@ -717,7 +717,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { @@ -893,7 +893,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { @@ -1226,10 +1226,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts index 21ac8f466c..e4342465b7 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/genesis.ts @@ -125,7 +125,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts index 18926deffa..77bd5bab7d 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/group.ts @@ -256,7 +256,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -426,7 +426,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -596,7 +596,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { @@ -935,7 +935,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { @@ -1088,10 +1088,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { @@ -1221,9 +1221,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? Coin.toAmino(message.price) : Coin.fromPartial({}); + obj.price = message.price ? Coin.toAmino(message.price) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts index 54dd585a27..ce3bc32ff9 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts index ac09f8200c..75097f5359 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta1/query.ts @@ -531,7 +531,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts index 0174ebbd77..2fa97819d2 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/authz.ts @@ -95,7 +95,7 @@ export const DepositDeploymentAuthorization = { }, toAmino(message: DepositDeploymentAuthorization): DepositDeploymentAuthorizationAmino { const obj: any = {}; - obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.fromPartial({}); + obj.spend_limit = message.spendLimit ? Coin.toAmino(message.spendLimit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: DepositDeploymentAuthorizationAminoMsg): DepositDeploymentAuthorization { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts index ede028f38f..2a9ba1f985 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deployment.ts @@ -324,10 +324,10 @@ export const Deployment = { }, toAmino(message: Deployment): DeploymentAmino { const obj: any = {}; - obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.fromPartial({}); + obj.deployment_id = message.deploymentId ? DeploymentID.toAmino(message.deploymentId) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.state = message.state ?? 0; obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: DeploymentAminoMsg): Deployment { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts index 6f620bcc9e..c166c25279 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/deploymentmsg.ts @@ -243,14 +243,14 @@ export const MsgCreateDeployment = { }, toAmino(message: MsgCreateDeployment): MsgCreateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? GroupSpec.toAmino(e) : undefined); } else { obj.groups = message.groups; } obj.version = message.version ? base64FromBytes(message.version) : ""; - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -455,8 +455,8 @@ export const MsgDepositDeployment = { }, toAmino(message: MsgDepositDeployment): MsgDepositDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); - obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); + obj.amount = message.amount ? Coin.toAmino(message.amount) : Coin.toAmino(Coin.fromPartial({})); obj.depositor = message.depositor ?? ""; return obj; }, @@ -643,7 +643,7 @@ export const MsgUpdateDeployment = { }, toAmino(message: MsgUpdateDeployment): MsgUpdateDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); obj.version = message.version ? base64FromBytes(message.version) : ""; return obj; }, @@ -814,7 +814,7 @@ export const MsgCloseDeployment = { }, toAmino(message: MsgCloseDeployment): MsgCloseDeploymentAmino { const obj: any = {}; - obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.fromPartial({}); + obj.id = message.id ? DeploymentID.toAmino(message.id) : DeploymentID.toAmino(DeploymentID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseDeploymentAminoMsg): MsgCloseDeployment { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts index 7853419e04..5e8fb1bcff 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/genesis.ts @@ -125,7 +125,7 @@ export const GenesisDeployment = { }, toAmino(message: GenesisDeployment): GenesisDeploymentAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { @@ -253,7 +253,7 @@ export const GenesisState = { } else { obj.deployments = message.deployments; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts index 3d95c54aa7..062e1029ca 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/group.ts @@ -199,10 +199,10 @@ export const Group = { }, toAmino(message: Group): GroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.fromPartial({}); + obj.group_id = message.groupId ? GroupID.toAmino(message.groupId) : GroupID.toAmino(GroupID.fromPartial({})); obj.state = message.state ?? 0; - obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.group_spec = message.groupSpec ? GroupSpec.toAmino(message.groupSpec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: GroupAminoMsg): Group { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts index 1df98da044..cdc733348e 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupmsg.ts @@ -133,7 +133,7 @@ export const MsgCloseGroup = { }, toAmino(message: MsgCloseGroup): MsgCloseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseGroupAminoMsg): MsgCloseGroup { @@ -303,7 +303,7 @@ export const MsgPauseGroup = { }, toAmino(message: MsgPauseGroup): MsgPauseGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgPauseGroupAminoMsg): MsgPauseGroup { @@ -473,7 +473,7 @@ export const MsgStartGroup = { }, toAmino(message: MsgStartGroup): MsgStartGroupAmino { const obj: any = {}; - obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.fromPartial({}); + obj.id = message.id ? GroupID.toAmino(message.id) : GroupID.toAmino(GroupID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgStartGroupAminoMsg): MsgStartGroup { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts index 88ade8bf5a..2fa61a4718 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/groupspec.ts @@ -129,7 +129,7 @@ export const GroupSpec = { toAmino(message: GroupSpec): GroupSpecAmino { const obj: any = {}; obj.name = message.name ?? ""; - obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.fromPartial({}); + obj.requirements = message.requirements ? PlacementRequirements.toAmino(message.requirements) : PlacementRequirements.toAmino(PlacementRequirements.fromPartial({})); if (message.resources) { obj.resources = message.resources.map(e => e ? Resource.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts index 65b3ab2e8d..e8dc65f255 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/params.ts @@ -85,7 +85,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.fromPartial({}); + obj.deployment_min_deposit = message.deploymentMinDeposit ? Coin.toAmino(message.deploymentMinDeposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts index 1e1a51a14f..685288ea85 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/query.ts @@ -531,7 +531,7 @@ export const QueryDeploymentResponse = { }, toAmino(message: QueryDeploymentResponse): QueryDeploymentResponseAmino { const obj: any = {}; - obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.fromPartial({}); + obj.deployment = message.deployment ? Deployment.toAmino(message.deployment) : Deployment.toAmino(Deployment.fromPartial({})); if (message.groups) { obj.groups = message.groups.map(e => e ? Group.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts index 3ad5531a6f..a274baf4d2 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/resource.ts @@ -124,9 +124,9 @@ export const Resource = { }, toAmino(message: Resource): ResourceAmino { const obj: any = {}; - obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.fromPartial({}); + obj.resources = message.resources ? ResourceUnits.toAmino(message.resources) : ResourceUnits.toAmino(ResourceUnits.fromPartial({})); obj.count = message.count ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: ResourceAminoMsg): Resource { diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts index a6a3f865f3..9a8c14a44f 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta1/types.ts @@ -432,11 +432,11 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.fromPartial({}); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.transferred = message.transferred ? Coin.toAmino(message.transferred) : Coin.toAmino(Coin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; return obj; }, @@ -635,13 +635,13 @@ export const Payment = { }, toAmino(message: Payment): PaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.fromPartial({}); - obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? Coin.toAmino(message.rate) : Coin.toAmino(Coin.fromPartial({})); + obj.balance = message.balance ? Coin.toAmino(message.balance) : Coin.toAmino(Coin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: PaymentAminoMsg): Payment { diff --git a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts index a007accce1..060c1be323 100644 --- a/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts +++ b/__fixtures__/v-next/outputv4/akash/escrow/v1beta2/types.ts @@ -479,14 +479,14 @@ export const Account = { }, toAmino(message: Account): AccountAmino { const obj: any = {}; - obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.fromPartial({}); + obj.id = message.id ? AccountID.toAmino(message.id) : AccountID.toAmino(AccountID.fromPartial({})); obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.fromPartial({}); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.transferred = message.transferred ? DecCoin.toAmino(message.transferred) : DecCoin.toAmino(DecCoin.fromPartial({})); obj.settled_at = message.settledAt ? message.settledAt.toString() : "0"; obj.depositor = message.depositor ?? ""; - obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.fromPartial({}); + obj.funds = message.funds ? DecCoin.toAmino(message.funds) : DecCoin.toAmino(DecCoin.fromPartial({})); return obj; }, fromAminoMsg(object: AccountAminoMsg): Account { @@ -684,13 +684,13 @@ export const FractionalPayment = { }, toAmino(message: FractionalPayment): FractionalPaymentAmino { const obj: any = {}; - obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.fromPartial({}); + obj.account_id = message.accountId ? AccountID.toAmino(message.accountId) : AccountID.toAmino(AccountID.fromPartial({})); obj.payment_id = message.paymentId ?? ""; obj.owner = message.owner ?? ""; obj.state = message.state ?? 0; - obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.fromPartial({}); - obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.fromPartial({}); - obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.fromPartial({}); + obj.rate = message.rate ? DecCoin.toAmino(message.rate) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.balance = message.balance ? DecCoin.toAmino(message.balance) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.withdrawn = message.withdrawn ? Coin.toAmino(message.withdrawn) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: FractionalPaymentAminoMsg): FractionalPayment { diff --git a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts index c1830d787a..b91bdb499a 100644 --- a/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/inflation/v1beta2/genesis.ts @@ -85,7 +85,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts index 4d7f7d6e7c..167485e3e3 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/bid.ts @@ -293,10 +293,10 @@ export const MsgCreateBid = { }, toAmino(message: MsgCreateBid): MsgCreateBidAmino { const obj: any = {}; - obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.fromPartial({}); + obj.order = message.order ? OrderID.toAmino(message.order) : OrderID.toAmino(OrderID.fromPartial({})); obj.provider = message.provider ?? ""; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.fromPartial({}); + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.deposit = message.deposit ? Coin.toAmino(message.deposit) : Coin.toAmino(Coin.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateBidAminoMsg): MsgCreateBid { @@ -466,7 +466,7 @@ export const MsgCloseBid = { }, toAmino(message: MsgCloseBid): MsgCloseBidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseBidAminoMsg): MsgCloseBid { @@ -852,10 +852,10 @@ export const Bid = { }, toAmino(message: Bid): BidAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: BidAminoMsg): Bid { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts index 83cac6aee6..8e9edf33e0 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/genesis.ts @@ -145,7 +145,7 @@ export const GenesisState = { } else { obj.leases = message.leases; } - obj.params = message.params ? Params.toAmino(message.params) : Params.fromPartial({}); + obj.params = message.params ? Params.toAmino(message.params) : Params.toAmino(Params.fromPartial({})); return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts index da39230d92..88f34d516b 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/lease.ts @@ -478,11 +478,11 @@ export const Lease = { }, toAmino(message: Lease): LeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); obj.state = message.state ?? 0; - obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; - obj.closed_on = message.closedOn ? message.closedOn.toString() : undefined; + obj.price = message.price ? DecCoin.toAmino(message.price) : DecCoin.toAmino(DecCoin.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; + obj.closed_on = message.closedOn !== BigInt(0) ? message.closedOn.toString() : undefined; return obj; }, fromAminoMsg(object: LeaseAminoMsg): Lease { @@ -759,7 +759,7 @@ export const MsgCreateLease = { }, toAmino(message: MsgCreateLease): MsgCreateLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.fromPartial({}); + obj.bid_id = message.bidId ? BidID.toAmino(message.bidId) : BidID.toAmino(BidID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateLeaseAminoMsg): MsgCreateLease { @@ -929,7 +929,7 @@ export const MsgWithdrawLease = { }, toAmino(message: MsgWithdrawLease): MsgWithdrawLeaseAmino { const obj: any = {}; - obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.fromPartial({}); + obj.bid_id = message.bidId ? LeaseID.toAmino(message.bidId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgWithdrawLeaseAminoMsg): MsgWithdrawLease { @@ -1099,7 +1099,7 @@ export const MsgCloseLease = { }, toAmino(message: MsgCloseLease): MsgCloseLeaseAmino { const obj: any = {}; - obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.fromPartial({}); + obj.lease_id = message.leaseId ? LeaseID.toAmino(message.leaseId) : LeaseID.toAmino(LeaseID.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCloseLeaseAminoMsg): MsgCloseLease { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts index 9e91c39142..7ed65f9cde 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/order.ts @@ -376,10 +376,10 @@ export const Order = { }, toAmino(message: Order): OrderAmino { const obj: any = {}; - obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.fromPartial({}); + obj.order_id = message.orderId ? OrderID.toAmino(message.orderId) : OrderID.toAmino(OrderID.fromPartial({})); obj.state = message.state ?? 0; - obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.fromPartial({}); - obj.created_at = message.createdAt ? message.createdAt.toString() : undefined; + obj.spec = message.spec ? GroupSpec.toAmino(message.spec) : GroupSpec.toAmino(GroupSpec.fromPartial({})); + obj.created_at = message.createdAt !== BigInt(0) ? message.createdAt.toString() : undefined; return obj; }, fromAminoMsg(object: OrderAminoMsg): Order { diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts index eaf1756342..283be606bd 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/params.ts @@ -103,7 +103,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.fromPartial({}); + obj.bid_min_deposit = message.bidMinDeposit ? Coin.toAmino(message.bidMinDeposit) : Coin.toAmino(Coin.fromPartial({})); obj.order_max_bids = message.orderMaxBids ?? 0; return obj; }, diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts index 86ade67186..ee65d646fa 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.ts @@ -349,7 +349,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -580,7 +580,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -979,7 +979,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts index c3ebfde66f..4ecc7b636f 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.ts @@ -349,7 +349,7 @@ export const MsgCreateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgCreateProviderAminoMsg): MsgCreateProvider { @@ -580,7 +580,7 @@ export const MsgUpdateProvider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: MsgUpdateProviderAminoMsg): MsgUpdateProvider { @@ -979,7 +979,7 @@ export const Provider = { } else { obj.attributes = message.attributes; } - obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.fromPartial({}); + obj.info = message.info ? ProviderInfo.toAmino(message.info) : ProviderInfo.toAmino(ProviderInfo.fromPartial({})); return obj; }, fromAminoMsg(object: ProviderAminoMsg): Provider { diff --git a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts index a2e543f322..0c6cdcd43d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts +++ b/__fixtures__/v-next/outputv4/cosmos/auth/v1beta1/auth.ts @@ -189,8 +189,8 @@ export const BaseAccount = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: BaseAccountAminoMsg): BaseAccount { @@ -498,11 +498,11 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_memo_characters = message.maxMemoCharacters ? message.maxMemoCharacters.toString() : undefined; - obj.tx_sig_limit = message.txSigLimit ? message.txSigLimit.toString() : undefined; - obj.tx_size_cost_per_byte = message.txSizeCostPerByte ? message.txSizeCostPerByte.toString() : undefined; - obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 ? message.sigVerifyCostEd25519.toString() : undefined; - obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 ? message.sigVerifyCostSecp256k1.toString() : undefined; + obj.max_memo_characters = message.maxMemoCharacters !== BigInt(0) ? message.maxMemoCharacters.toString() : undefined; + obj.tx_sig_limit = message.txSigLimit !== BigInt(0) ? message.txSigLimit.toString() : undefined; + obj.tx_size_cost_per_byte = message.txSizeCostPerByte !== BigInt(0) ? message.txSizeCostPerByte.toString() : undefined; + obj.sig_verify_cost_ed25519 = message.sigVerifyCostEd25519 !== BigInt(0) ? message.sigVerifyCostEd25519.toString() : undefined; + obj.sig_verify_cost_secp256k1 = message.sigVerifyCostSecp256k1 !== BigInt(0) ? message.sigVerifyCostSecp256k1.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts b/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts index 17bb26fd6f..c56f04653d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/abci/v1beta1/abci.ts @@ -563,7 +563,7 @@ export const TxResponse = { }, toAmino(message: TxResponse): TxResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.txhash = message.txhash === "" ? undefined : message.txhash; obj.codespace = message.codespace === "" ? undefined : message.codespace; obj.code = message.code === 0 ? undefined : message.code; @@ -575,8 +575,8 @@ export const TxResponse = { obj.logs = message.logs; } obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; obj.tx = message.tx ? Any.toAmino(message.tx) : undefined; obj.timestamp = message.timestamp === "" ? undefined : message.timestamp; if (message.events) { @@ -1067,8 +1067,8 @@ export const GasInfo = { }, toAmino(message: GasInfo): GasInfoAmino { const obj: any = {}; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; return obj; }, fromAminoMsg(object: GasInfoAminoMsg): GasInfo { @@ -1780,11 +1780,11 @@ export const SearchTxsResult = { }, toAmino(message: SearchTxsResult): SearchTxsResultAmino { const obj: any = {}; - obj.total_count = message.totalCount ? message.totalCount.toString() : undefined; - obj.count = message.count ? message.count.toString() : undefined; - obj.page_number = message.pageNumber ? message.pageNumber.toString() : undefined; - obj.page_total = message.pageTotal ? message.pageTotal.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.total_count = message.totalCount !== BigInt(0) ? message.totalCount.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; + obj.page_number = message.pageNumber !== BigInt(0) ? message.pageNumber.toString() : undefined; + obj.page_total = message.pageTotal !== BigInt(0) ? message.pageTotal.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; if (message.txs) { obj.txs = message.txs.map(e => e ? TxResponse.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts b/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts index 7a03f47a54..c8852c94c9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/query/v1beta1/pagination.ts @@ -239,8 +239,8 @@ export const PageRequest = { toAmino(message: PageRequest): PageRequestAmino { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; - obj.offset = message.offset ? message.offset.toString() : undefined; - obj.limit = message.limit ? message.limit.toString() : undefined; + obj.offset = message.offset !== BigInt(0) ? message.offset.toString() : undefined; + obj.limit = message.limit !== BigInt(0) ? message.limit.toString() : undefined; obj.count_total = message.countTotal === false ? undefined : message.countTotal; obj.reverse = message.reverse === false ? undefined : message.reverse; return obj; @@ -355,7 +355,7 @@ export const PageResponse = { toAmino(message: PageResponse): PageResponseAmino { const obj: any = {}; obj.next_key = message.nextKey ? base64FromBytes(message.nextKey) : undefined; - obj.total = message.total ? message.total.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; return obj; }, fromAminoMsg(object: PageResponseAminoMsg): PageResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts b/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts index 6a2bfd1322..cf4ec701d6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/snapshots/v1beta1/snapshot.ts @@ -277,7 +277,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; @@ -816,7 +816,7 @@ export const SnapshotIAVLItem = { const obj: any = {}; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.height = message.height === 0 ? undefined : message.height; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts index 189b44abe3..41b0949aaa 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/store/v1beta1/commit_info.ts @@ -154,7 +154,7 @@ export const CommitInfo = { }, toAmino(message: CommitInfo): CommitInfoAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; if (message.storeInfos) { obj.store_infos = message.storeInfos.map(e => e ? StoreInfo.toAmino(e) : undefined); } else { @@ -384,7 +384,7 @@ export const CommitID = { }, toAmino(message: CommitID): CommitIDAmino { const obj: any = {}; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts index 5ce8b2c682..e27447c1b3 100644 --- a/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/base/tendermint/v1beta1/query.ts @@ -311,7 +311,7 @@ export const GetValidatorSetByHeightRequest = { }, toAmino(message: GetValidatorSetByHeightRequest): GetValidatorSetByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -448,7 +448,7 @@ export const GetValidatorSetByHeightResponse = { }, toAmino(message: GetValidatorSetByHeightResponse): GetValidatorSetByHeightResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -686,7 +686,7 @@ export const GetLatestValidatorSetResponse = { }, toAmino(message: GetLatestValidatorSetResponse): GetLatestValidatorSetResponseAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; if (message.validators) { obj.validators = message.validators.map(e => e ? Validator.toAmino(e) : undefined); } else { @@ -842,8 +842,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; obj.pub_key = message.pubKey ? Any.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -939,7 +939,7 @@ export const GetBlockByHeightRequest = { }, toAmino(message: GetBlockByHeightRequest): GetBlockByHeightRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: GetBlockByHeightRequestAminoMsg): GetBlockByHeightRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts index 560e36c210..6b7d06d10b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts +++ b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/capability.ts @@ -128,7 +128,7 @@ export const Capability = { }, toAmino(message: Capability): CapabilityAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; return obj; }, fromAminoMsg(object: CapabilityAminoMsg): Capability { diff --git a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts index babd51f927..9d53937e94 100644 --- a/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/capability/v1beta1/genesis.ts @@ -126,7 +126,7 @@ export const GenesisOwners = { }, toAmino(message: GenesisOwners): GenesisOwnersAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.index_owners = message.indexOwners ? CapabilityOwners.toAmino(message.indexOwners) : undefined; return obj; }, @@ -245,7 +245,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; if (message.owners) { obj.owners = message.owners.map(e => e ? GenesisOwners.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts index a15594fad5..5313c8c869 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/distribution.ts @@ -633,7 +633,7 @@ export const ValidatorCurrentRewards = { } else { obj.rewards = message.rewards; } - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorCurrentRewardsAminoMsg): ValidatorCurrentRewards { @@ -953,7 +953,7 @@ export const ValidatorSlashEvent = { }, toAmino(message: ValidatorSlashEvent): ValidatorSlashEventAmino { const obj: any = {}; - obj.validator_period = message.validatorPeriod ? message.validatorPeriod.toString() : undefined; + obj.validator_period = message.validatorPeriod !== BigInt(0) ? message.validatorPeriod.toString() : undefined; obj.fraction = message.fraction === "" ? undefined : message.fraction; return obj; }, @@ -1447,7 +1447,7 @@ export const DelegatorStartingInfo = { }, toAmino(message: DelegatorStartingInfo): DelegatorStartingInfoAmino { const obj: any = {}; - obj.previous_period = message.previousPeriod ? message.previousPeriod.toString() : undefined; + obj.previous_period = message.previousPeriod !== BigInt(0) ? message.previousPeriod.toString() : undefined; obj.stake = message.stake === "" ? undefined : message.stake; obj.height = message.height ? message.height.toString() : "0"; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts index 770aac4ff1..eccbb020af 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/genesis.ts @@ -638,7 +638,7 @@ export const ValidatorHistoricalRewardsRecord = { toAmino(message: ValidatorHistoricalRewardsRecord): ValidatorHistoricalRewardsRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.rewards = message.rewards ? ValidatorHistoricalRewards.toAmino(message.rewards) : undefined; return obj; }, @@ -1031,8 +1031,8 @@ export const ValidatorSlashEventRecord = { toAmino(message: ValidatorSlashEventRecord): ValidatorSlashEventRecordAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.height = message.height ? message.height.toString() : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.validator_slash_event = message.validatorSlashEvent ? ValidatorSlashEvent.toAmino(message.validatorSlashEvent) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts index 09b6b4786c..b86c0725a9 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/query.ts @@ -1015,8 +1015,8 @@ export const QueryValidatorSlashesRequest = { toAmino(message: QueryValidatorSlashesRequest): QueryValidatorSlashesRequestAmino { const obj: any = {}; obj.validator_address = message.validatorAddress === "" ? undefined : message.validatorAddress; - obj.starting_height = message.startingHeight ? message.startingHeight.toString() : undefined; - obj.ending_height = message.endingHeight ? message.endingHeight.toString() : undefined; + obj.starting_height = message.startingHeight !== BigInt(0) ? message.startingHeight.toString() : undefined; + obj.ending_height = message.endingHeight !== BigInt(0) ? message.endingHeight.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts index 177cc55a60..fd98bae28c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/evidence.ts @@ -147,9 +147,9 @@ export const Equivocation = { }, toAmino(message: Equivocation): EquivocationAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; obj.consensus_address = message.consensusAddress === "" ? undefined : message.consensusAddress; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts index ca340c46b4..0d917dde42 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/genesis.ts @@ -224,7 +224,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts index 2d1a4fad72..b308c32d54 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/gov.ts @@ -529,7 +529,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -789,7 +789,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; if (message.messages) { obj.messages = message.messages.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1101,7 +1101,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; if (message.options) { obj.options = message.options.map(e => e ? WeightedVoteOption.toAmino(e) : undefined); diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts index d62ff97658..ff094623c0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/query.ts @@ -324,7 +324,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -802,7 +802,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1013,7 +1013,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1477,7 +1477,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1688,7 +1688,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1908,7 +1908,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts index e373ff2c21..ce4992c22c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.ts @@ -383,7 +383,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts index 86d0f07abe..b3be36ca4f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/genesis.ts @@ -224,7 +224,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.starting_proposal_id = message.startingProposalId ? message.startingProposalId.toString() : undefined; + obj.starting_proposal_id = message.startingProposalId !== BigInt(0) ? message.startingProposalId.toString() : undefined; if (message.deposits) { obj.deposits = message.deposits.map(e => e ? Deposit.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts index c2ecd2a63c..8f979c59c0 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/gov.ts @@ -673,7 +673,7 @@ export const Deposit = { }, toAmino(message: Deposit): DepositAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); @@ -913,7 +913,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.content = message.content ? Any.toAmino(message.content) : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts index 9424d83417..6d6b571cb7 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/query.ts @@ -324,7 +324,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -802,7 +802,7 @@ export const QueryVoteRequest = { }, toAmino(message: QueryVoteRequest): QueryVoteRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -1013,7 +1013,7 @@ export const QueryVotesRequest = { }, toAmino(message: QueryVotesRequest): QueryVotesRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1477,7 +1477,7 @@ export const QueryDepositRequest = { }, toAmino(message: QueryDepositRequest): QueryDepositRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.depositor = message.depositor === "" ? undefined : message.depositor; return obj; }, @@ -1688,7 +1688,7 @@ export const QueryDepositsRequest = { }, toAmino(message: QueryDepositsRequest): QueryDepositsRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1908,7 +1908,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts index c51f6d9e71..9e2119fe97 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.ts @@ -465,7 +465,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts index dcea2fb135..ebcd8c38bd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/events.ts @@ -196,7 +196,7 @@ export const EventCreateGroup = { }, toAmino(message: EventCreateGroup): EventCreateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventCreateGroupAminoMsg): EventCreateGroup { @@ -292,7 +292,7 @@ export const EventUpdateGroup = { }, toAmino(message: EventUpdateGroup): EventUpdateGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: EventUpdateGroupAminoMsg): EventUpdateGroup { @@ -576,7 +576,7 @@ export const EventSubmitProposal = { }, toAmino(message: EventSubmitProposal): EventSubmitProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventSubmitProposalAminoMsg): EventSubmitProposal { @@ -672,7 +672,7 @@ export const EventWithdrawProposal = { }, toAmino(message: EventWithdrawProposal): EventWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventWithdrawProposalAminoMsg): EventWithdrawProposal { @@ -768,7 +768,7 @@ export const EventVote = { }, toAmino(message: EventVote): EventVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: EventVoteAminoMsg): EventVote { @@ -880,7 +880,7 @@ export const EventExec = { }, toAmino(message: EventExec): EventExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.result = message.result === 0 ? undefined : message.result; return obj; }, @@ -993,7 +993,7 @@ export const EventLeaveGroup = { }, toAmino(message: EventLeaveGroup): EventLeaveGroupAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts index 8f63f57201..c6880bfa8a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/genesis.ts @@ -262,7 +262,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.group_seq = message.groupSeq ? message.groupSeq.toString() : undefined; + obj.group_seq = message.groupSeq !== BigInt(0) ? message.groupSeq.toString() : undefined; if (message.groups) { obj.groups = message.groups.map(e => e ? GroupInfo.toAmino(e) : undefined); } else { @@ -273,13 +273,13 @@ export const GenesisState = { } else { obj.group_members = message.groupMembers; } - obj.group_policy_seq = message.groupPolicySeq ? message.groupPolicySeq.toString() : undefined; + obj.group_policy_seq = message.groupPolicySeq !== BigInt(0) ? message.groupPolicySeq.toString() : undefined; if (message.groupPolicies) { obj.group_policies = message.groupPolicies.map(e => e ? GroupPolicyInfo.toAmino(e) : undefined); } else { obj.group_policies = message.groupPolicies; } - obj.proposal_seq = message.proposalSeq ? message.proposalSeq.toString() : undefined; + obj.proposal_seq = message.proposalSeq !== BigInt(0) ? message.proposalSeq.toString() : undefined; if (message.proposals) { obj.proposals = message.proposals.map(e => e ? Proposal.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts index e28bd59ec0..7b2e5f6f33 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/query.ts @@ -463,7 +463,7 @@ export const QueryGroupInfoRequest = { }, toAmino(message: QueryGroupInfoRequest): QueryGroupInfoRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGroupInfoRequestAminoMsg): QueryGroupInfoRequest { @@ -863,7 +863,7 @@ export const QueryGroupMembersRequest = { }, toAmino(message: QueryGroupMembersRequest): QueryGroupMembersRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1337,7 +1337,7 @@ export const QueryGroupPoliciesByGroupRequest = { }, toAmino(message: QueryGroupPoliciesByGroupRequest): QueryGroupPoliciesByGroupRequestAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1793,7 +1793,7 @@ export const QueryProposalRequest = { }, toAmino(message: QueryProposalRequest): QueryProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryProposalRequestAminoMsg): QueryProposalRequest { @@ -2237,7 +2237,7 @@ export const QueryVoteByProposalVoterRequest = { }, toAmino(message: QueryVoteByProposalVoterRequest): QueryVoteByProposalVoterRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; return obj; }, @@ -2448,7 +2448,7 @@ export const QueryVotesByProposalRequest = { }, toAmino(message: QueryVotesByProposalRequest): QueryVotesByProposalRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -3140,7 +3140,7 @@ export const QueryTallyResultRequest = { }, toAmino(message: QueryTallyResultRequest): QueryTallyResultRequestAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTallyResultRequestAminoMsg): QueryTallyResultRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts index 9978c185d0..50c88e1588 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.ts @@ -683,7 +683,7 @@ export const MsgCreateGroupResponse = { }, toAmino(message: MsgCreateGroupResponse): MsgCreateGroupResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGroupResponseAminoMsg): MsgCreateGroupResponse { @@ -818,7 +818,7 @@ export const MsgUpdateGroupMembers = { toAmino(message: MsgUpdateGroupMembers): MsgUpdateGroupMembersAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; if (message.memberUpdates) { obj.member_updates = message.memberUpdates.map(e => e ? Member.toAmino(e) : undefined); } else { @@ -1026,7 +1026,7 @@ export const MsgUpdateGroupAdmin = { toAmino(message: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.new_admin = message.newAdmin === "" ? undefined : message.newAdmin; return obj; }, @@ -1230,7 +1230,7 @@ export const MsgUpdateGroupMetadata = { toAmino(message: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; return obj; }, @@ -1452,7 +1452,7 @@ export const MsgCreateGroupPolicy = { toAmino(message: MsgCreateGroupPolicy): MsgCreateGroupPolicyAmino { const obj: any = {}; obj.admin = message.admin === "" ? undefined : message.admin; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.metadata = message.metadata === "" ? undefined : message.metadata; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; return obj; @@ -1979,7 +1979,7 @@ export const MsgCreateGroupWithPolicyResponse = { }, toAmino(message: MsgCreateGroupWithPolicyResponse): MsgCreateGroupWithPolicyResponseAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.group_policy_address = message.groupPolicyAddress === "" ? undefined : message.groupPolicyAddress; return obj; }, @@ -2738,7 +2738,7 @@ export const MsgSubmitProposalResponse = { }, toAmino(message: MsgSubmitProposalResponse): MsgSubmitProposalResponseAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSubmitProposalResponseAminoMsg): MsgSubmitProposalResponse { @@ -2850,7 +2850,7 @@ export const MsgWithdrawProposal = { }, toAmino(message: MsgWithdrawProposal): MsgWithdrawProposalAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -3085,7 +3085,7 @@ export const MsgVote = { }, toAmino(message: MsgVote): MsgVoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; @@ -3275,7 +3275,7 @@ export const MsgExec = { }, toAmino(message: MsgExec): MsgExecAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -3463,7 +3463,7 @@ export const MsgLeaveGroup = { toAmino(message: MsgLeaveGroup): MsgLeaveGroupAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLeaveGroupAminoMsg): MsgLeaveGroup { diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts index 0f7746a3b5..276eed1f6f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/types.ts @@ -1269,10 +1269,10 @@ export const GroupInfo = { }, toAmino(message: GroupInfo): GroupInfoAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.total_weight = message.totalWeight === "" ? undefined : message.totalWeight; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1388,7 +1388,7 @@ export const GroupMember = { }, toAmino(message: GroupMember): GroupMemberAmino { const obj: any = {}; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.member = message.member ? Member.toAmino(message.member) : undefined; return obj; }, @@ -1586,10 +1586,10 @@ export const GroupPolicyInfo = { toAmino(message: GroupPolicyInfo): GroupPolicyInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.group_id = message.groupId ? message.groupId.toString() : undefined; + obj.group_id = message.groupId !== BigInt(0) ? message.groupId.toString() : undefined; obj.admin = message.admin === "" ? undefined : message.admin; obj.metadata = message.metadata === "" ? undefined : message.metadata; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; obj.decision_policy = message.decisionPolicy ? Any.toAmino(message.decisionPolicy) : undefined; obj.created_at = message.createdAt ? Timestamp.toAmino(toTimestamp(message.createdAt)) : undefined; return obj; @@ -1897,7 +1897,7 @@ export const Proposal = { }, toAmino(message: Proposal): ProposalAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; obj.metadata = message.metadata === "" ? undefined : message.metadata; if (message.proposers) { @@ -1906,8 +1906,8 @@ export const Proposal = { obj.proposers = message.proposers; } obj.submit_time = message.submitTime ? Timestamp.toAmino(toTimestamp(message.submitTime)) : undefined; - obj.group_version = message.groupVersion ? message.groupVersion.toString() : undefined; - obj.group_policy_version = message.groupPolicyVersion ? message.groupPolicyVersion.toString() : undefined; + obj.group_version = message.groupVersion !== BigInt(0) ? message.groupVersion.toString() : undefined; + obj.group_policy_version = message.groupPolicyVersion !== BigInt(0) ? message.groupPolicyVersion.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; obj.result = message.result === 0 ? undefined : message.result; obj.final_tally_result = message.finalTallyResult ? TallyResult.toAmino(message.finalTallyResult) : undefined; @@ -2222,7 +2222,7 @@ export const Vote = { }, toAmino(message: Vote): VoteAmino { const obj: any = {}; - obj.proposal_id = message.proposalId ? message.proposalId.toString() : undefined; + obj.proposal_id = message.proposalId !== BigInt(0) ? message.proposalId.toString() : undefined; obj.voter = message.voter === "" ? undefined : message.voter; obj.option = message.option === 0 ? undefined : message.option; obj.metadata = message.metadata === "" ? undefined : message.metadata; diff --git a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts index ed88b30692..369098833b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/cosmos/mint/v1beta1/mint.ts @@ -313,7 +313,7 @@ export const Params = { obj.inflation_max = message.inflationMax === "" ? undefined : message.inflationMax; obj.inflation_min = message.inflationMin === "" ? undefined : message.inflationMin; obj.goal_bonded = message.goalBonded === "" ? undefined : message.goalBonded; - obj.blocks_per_year = message.blocksPerYear ? message.blocksPerYear.toString() : undefined; + obj.blocks_per_year = message.blocksPerYear !== BigInt(0) ? message.blocksPerYear.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts index 31c7ee24a1..f871471cd2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/nft/v1beta1/query.ts @@ -368,7 +368,7 @@ export const QueryBalanceResponse = { }, toAmino(message: QueryBalanceResponse): QueryBalanceResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QueryBalanceResponseAminoMsg): QueryBalanceResponse { @@ -763,7 +763,7 @@ export const QuerySupplyResponse = { }, toAmino(message: QuerySupplyResponse): QuerySupplyResponseAmino { const obj: any = {}; - obj.amount = message.amount ? message.amount.toString() : undefined; + obj.amount = message.amount !== BigInt(0) ? message.amount.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySupplyResponseAminoMsg): QuerySupplyResponse { diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts index ade24fdab1..c5a03f1532 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/genesis.ts @@ -552,7 +552,7 @@ export const MissedBlock = { }, toAmino(message: MissedBlock): MissedBlockAmino { const obj: any = {}; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.missed = message.missed === false ? undefined : message.missed; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts index a82bd224c5..e1f9756e10 100644 --- a/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/slashing/v1beta1/slashing.ts @@ -222,11 +222,11 @@ export const ValidatorSigningInfo = { toAmino(message: ValidatorSigningInfo): ValidatorSigningInfoAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.start_height = message.startHeight ? message.startHeight.toString() : undefined; - obj.index_offset = message.indexOffset ? message.indexOffset.toString() : undefined; + obj.start_height = message.startHeight !== BigInt(0) ? message.startHeight.toString() : undefined; + obj.index_offset = message.indexOffset !== BigInt(0) ? message.indexOffset.toString() : undefined; obj.jailed_until = message.jailedUntil ? Timestamp.toAmino(toTimestamp(message.jailedUntil)) : undefined; obj.tombstoned = message.tombstoned === false ? undefined : message.tombstoned; - obj.missed_blocks_counter = message.missedBlocksCounter ? message.missedBlocksCounter.toString() : undefined; + obj.missed_blocks_counter = message.missedBlocksCounter !== BigInt(0) ? message.missedBlocksCounter.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSigningInfoAminoMsg): ValidatorSigningInfo { @@ -388,7 +388,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.signed_blocks_window = message.signedBlocksWindow ? message.signedBlocksWindow.toString() : undefined; + obj.signed_blocks_window = message.signedBlocksWindow !== BigInt(0) ? message.signedBlocksWindow.toString() : undefined; obj.min_signed_per_window = message.minSignedPerWindow ? base64FromBytes(message.minSignedPerWindow) : undefined; obj.downtime_jail_duration = message.downtimeJailDuration ? Duration.toAmino(message.downtimeJailDuration) : undefined; obj.slash_fraction_double_sign = message.slashFractionDoubleSign ? base64FromBytes(message.slashFractionDoubleSign) : undefined; diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts index 7f2b0792a3..0c34e2d307 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/genesis.ts @@ -410,7 +410,7 @@ export const LastValidatorPower = { toAmino(message: LastValidatorPower): LastValidatorPowerAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: LastValidatorPowerAminoMsg): LastValidatorPower { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts index cf5479ff8b..8949ac7d7c 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/query.ts @@ -3086,7 +3086,7 @@ export const QueryHistoricalInfoRequest = { }, toAmino(message: QueryHistoricalInfoRequest): QueryHistoricalInfoRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryHistoricalInfoRequestAminoMsg): QueryHistoricalInfoRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts index b93573ca8f..a9f39d7534 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/staking.ts @@ -1297,7 +1297,7 @@ export const Validator = { obj.tokens = message.tokens === "" ? undefined : message.tokens; obj.delegator_shares = message.delegatorShares === "" ? undefined : message.delegatorShares; obj.description = message.description ? Description.toAmino(message.description) : undefined; - obj.unbonding_height = message.unbondingHeight ? message.unbondingHeight.toString() : undefined; + obj.unbonding_height = message.unbondingHeight !== BigInt(0) ? message.unbondingHeight.toString() : undefined; obj.unbonding_time = message.unbondingTime ? Timestamp.toAmino(toTimestamp(message.unbondingTime)) : undefined; obj.commission = message.commission ? Commission.toAmino(message.commission) : undefined; obj.min_self_delegation = message.minSelfDelegation === "" ? undefined : message.minSelfDelegation; @@ -2261,7 +2261,7 @@ export const UnbondingDelegationEntry = { }, toAmino(message: UnbondingDelegationEntry): UnbondingDelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.balance = message.balance === "" ? undefined : message.balance; @@ -2408,7 +2408,7 @@ export const RedelegationEntry = { }, toAmino(message: RedelegationEntry): RedelegationEntryAmino { const obj: any = {}; - obj.creation_height = message.creationHeight ? message.creationHeight.toString() : undefined; + obj.creation_height = message.creationHeight !== BigInt(0) ? message.creationHeight.toString() : undefined; obj.completion_time = message.completionTime ? Timestamp.toAmino(toTimestamp(message.completionTime)) : undefined; obj.initial_balance = message.initialBalance === "" ? undefined : message.initialBalance; obj.shares_dst = message.sharesDst === "" ? undefined : message.sharesDst; diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts index f014120f56..d6f2bf58bb 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/signing/v1beta1/signing.ts @@ -393,7 +393,7 @@ export const SignatureDescriptor = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts index 854df5e397..4c39105a05 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/service.ts @@ -1358,7 +1358,7 @@ export const GetBlockWithTxsRequest = { }, toAmino(message: GetBlockWithTxsRequest): GetBlockWithTxsRequestAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts index b0bbbeddf4..94569400d1 100644 --- a/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/tx/v1beta1/tx.ts @@ -842,7 +842,7 @@ export const SignDoc = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.auth_info_bytes = message.authInfoBytes ? base64FromBytes(message.authInfoBytes) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; return obj; }, fromAminoMsg(object: SignDocAminoMsg): SignDoc { @@ -1027,8 +1027,8 @@ export const SignDocDirectAux = { obj.body_bytes = message.bodyBytes ? base64FromBytes(message.bodyBytes) : undefined; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.account_number = message.accountNumber ? message.accountNumber.toString() : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.account_number = message.accountNumber !== BigInt(0) ? message.accountNumber.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.tip = message.tip ? Tip.toAmino(message.tip) : undefined; return obj; }, @@ -1213,7 +1213,7 @@ export const TxBody = { obj.messages = message.messages; } obj.memo = message.memo === "" ? undefined : message.memo; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; if (message.extensionOptions) { obj.extension_options = message.extensionOptions.map(e => e ? Any.toAmino(e) : undefined); } else { @@ -1499,7 +1499,7 @@ export const SignerInfo = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.mode_info = message.modeInfo ? ModeInfo.toAmino(message.modeInfo) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignerInfoAminoMsg): SignerInfo { @@ -1986,7 +1986,7 @@ export const Fee = { } else { obj.amount = message.amount; } - obj.gas_limit = message.gasLimit ? message.gasLimit.toString() : undefined; + obj.gas_limit = message.gasLimit !== BigInt(0) ? message.gasLimit.toString() : undefined; obj.payer = message.payer === "" ? undefined : message.payer; obj.granter = message.granter === "" ? undefined : message.granter; return obj; diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts index d4742ee7d4..3802cccd71 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/query.ts @@ -539,7 +539,7 @@ export const QueryAppliedPlanResponse = { }, toAmino(message: QueryAppliedPlanResponse): QueryAppliedPlanResponseAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: QueryAppliedPlanResponseAminoMsg): QueryAppliedPlanResponse { @@ -635,7 +635,7 @@ export const QueryUpgradedConsensusStateRequest = { }, toAmino(message: QueryUpgradedConsensusStateRequest): QueryUpgradedConsensusStateRequestAmino { const obj: any = {}; - obj.last_height = message.lastHeight ? message.lastHeight.toString() : undefined; + obj.last_height = message.lastHeight !== BigInt(0) ? message.lastHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryUpgradedConsensusStateRequestAminoMsg): QueryUpgradedConsensusStateRequest { diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts index f7c0520f77..c77b4f802f 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/upgrade.ts @@ -271,7 +271,7 @@ export const Plan = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.info = message.info === "" ? undefined : message.info; obj.upgraded_client_state = message.upgradedClientState ? Any.toAmino(message.upgradedClientState) : undefined; return obj; @@ -627,7 +627,7 @@ export const ModuleVersion = { toAmino(message: ModuleVersion): ModuleVersionAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.version = message.version ? message.version.toString() : undefined; + obj.version = message.version !== BigInt(0) ? message.version.toString() : undefined; return obj; }, fromAminoMsg(object: ModuleVersionAminoMsg): ModuleVersion { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts index 23ff1b99de..5d51a93a48 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.ts @@ -253,7 +253,7 @@ export const MsgCreateVestingAccount = { } else { obj.amount = message.amount; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; obj.delayed = message.delayed === false ? undefined : message.delayed; return obj; }, @@ -692,7 +692,7 @@ export const MsgCreatePeriodicVestingAccount = { const obj: any = {}; obj.from_address = message.fromAddress === "" ? undefined : message.fromAddress; obj.to_address = message.toAddress === "" ? undefined : message.toAddress; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts index d46fa33da4..a08a48b3fd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/vesting.ts @@ -300,7 +300,7 @@ export const BaseVestingAccount = { } else { obj.delegated_vesting = message.delegatedVesting; } - obj.end_time = message.endTime ? message.endTime.toString() : undefined; + obj.end_time = message.endTime !== BigInt(0) ? message.endTime.toString() : undefined; return obj; }, fromAminoMsg(object: BaseVestingAccountAminoMsg): BaseVestingAccount { @@ -415,7 +415,7 @@ export const ContinuousVestingAccount = { toAmino(message: ContinuousVestingAccount): ContinuousVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; return obj; }, fromAminoMsg(object: ContinuousVestingAccountAminoMsg): ContinuousVestingAccount { @@ -629,7 +629,7 @@ export const Period = { }, toAmino(message: Period): PeriodAmino { const obj: any = {}; - obj.length = message.length ? message.length.toString() : undefined; + obj.length = message.length !== BigInt(0) ? message.length.toString() : undefined; if (message.amount) { obj.amount = message.amount.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -771,7 +771,7 @@ export const PeriodicVestingAccount = { toAmino(message: PeriodicVestingAccount): PeriodicVestingAccountAmino { const obj: any = {}; obj.base_vesting_account = message.baseVestingAccount ? BaseVestingAccount.toAmino(message.baseVestingAccount) : undefined; - obj.start_time = message.startTime ? message.startTime.toString() : undefined; + obj.start_time = message.startTime !== BigInt(0) ? message.startTime.toString() : undefined; if (message.vestingPeriods) { obj.vesting_periods = message.vestingPeriods.map(e => e ? Period.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts index a0cf4fa807..81f21b3f15 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/genesis.ts @@ -553,7 +553,7 @@ export const Code = { }, toAmino(message: Code): CodeAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.code_info = message.codeInfo ? CodeInfo.toAmino(message.codeInfo) : undefined; obj.code_bytes = message.codeBytes ? base64FromBytes(message.codeBytes) : undefined; obj.pinned = message.pinned === false ? undefined : message.pinned; @@ -809,7 +809,7 @@ export const Sequence = { toAmino(message: Sequence): SequenceAmino { const obj: any = {}; obj.id_key = message.idKey ? base64FromBytes(message.idKey) : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: SequenceAminoMsg): Sequence { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts index 8e7cd6c134..e9ac988fc2 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/ibc.ts @@ -166,8 +166,8 @@ export const MsgIBCSend = { toAmino(message: MsgIBCSend): MsgIBCSendAmino { const obj: any = {}; obj.channel = message.channel === "" ? undefined : message.channel; - obj.timeout_height = message.timeoutHeight ? message.timeoutHeight.toString() : undefined; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_height = message.timeoutHeight !== BigInt(0) ? message.timeoutHeight.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts index 5026591c1b..f3f216feba 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/proposal.ts @@ -604,7 +604,7 @@ export const InstantiateContractProposal = { obj.description = message.description === "" ? undefined : message.description; obj.run_as = message.runAs === "" ? undefined : message.runAs; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -774,7 +774,7 @@ export const MigrateContractProposal = { obj.title = message.title === "" ? undefined : message.title; obj.description = message.description === "" ? undefined : message.description; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts index eb38798ea0..922d121679 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/query.ts @@ -900,7 +900,7 @@ export const QueryContractsByCodeRequest = { }, toAmino(message: QueryContractsByCodeRequest): QueryContractsByCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.pagination = message.pagination ? PageRequest.toAmino(message.pagination) : undefined; return obj; }, @@ -1766,7 +1766,7 @@ export const QueryCodeRequest = { }, toAmino(message: QueryCodeRequest): QueryCodeRequestAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCodeRequestAminoMsg): QueryCodeRequest { diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts index 4659919c1e..a4fcbdb309 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.ts @@ -414,7 +414,7 @@ export const MsgStoreCodeResponse = { }, toAmino(message: MsgStoreCodeResponse): MsgStoreCodeResponseAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgStoreCodeResponseAminoMsg): MsgStoreCodeResponse { @@ -598,7 +598,7 @@ export const MsgInstantiateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.admin = message.admin === "" ? undefined : message.admin; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.label = message.label === "" ? undefined : message.label; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; if (message.funds) { @@ -1111,7 +1111,7 @@ export const MsgMigrateContract = { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; obj.contract = message.contract === "" ? undefined : message.contract; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts index 8eef86ad3d..04502688af 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/types.ts @@ -570,7 +570,7 @@ export const Params = { const obj: any = {}; obj.code_upload_access = message.codeUploadAccess ? AccessConfig.toAmino(message.codeUploadAccess) : undefined; obj.instantiate_default_permission = message.instantiateDefaultPermission === 0 ? undefined : message.instantiateDefaultPermission; - obj.max_wasm_code_size = message.maxWasmCodeSize ? message.maxWasmCodeSize.toString() : undefined; + obj.max_wasm_code_size = message.maxWasmCodeSize !== BigInt(0) ? message.maxWasmCodeSize.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { @@ -896,7 +896,7 @@ export const ContractInfo = { }, toAmino(message: ContractInfo): ContractInfoAmino { const obj: any = {}; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.creator = message.creator === "" ? undefined : message.creator; obj.admin = message.admin === "" ? undefined : message.admin; obj.label = message.label === "" ? undefined : message.label; @@ -1049,7 +1049,7 @@ export const ContractCodeHistoryEntry = { toAmino(message: ContractCodeHistoryEntry): ContractCodeHistoryEntryAmino { const obj: any = {}; obj.operation = message.operation === 0 ? undefined : message.operation; - obj.code_id = message.codeId ? message.codeId.toString() : undefined; + obj.code_id = message.codeId !== BigInt(0) ? message.codeId.toString() : undefined; obj.updated = message.updated ? AbsoluteTxPosition.toAmino(message.updated) : undefined; obj.msg = message.msg ? JSON.parse(fromUtf8(message.msg)) : undefined; return obj; @@ -1165,8 +1165,8 @@ export const AbsoluteTxPosition = { }, toAmino(message: AbsoluteTxPosition): AbsoluteTxPositionAmino { const obj: any = {}; - obj.block_height = message.blockHeight ? message.blockHeight.toString() : undefined; - obj.tx_index = message.txIndex ? message.txIndex.toString() : undefined; + obj.block_height = message.blockHeight !== BigInt(0) ? message.blockHeight.toString() : undefined; + obj.tx_index = message.txIndex !== BigInt(0) ? message.txIndex.toString() : undefined; return obj; }, fromAminoMsg(object: AbsoluteTxPositionAminoMsg): AbsoluteTxPosition { diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts index 7ce1b4da96..7266b7325e 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/genesis.ts @@ -211,10 +211,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts index 96bb2a0e58..259c230ef8 100644 --- a/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/epochs/v1/query.ts @@ -411,7 +411,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts index af6cebf85f..81003cf27c 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/genesis.ts @@ -308,7 +308,7 @@ export const Params = { obj.enable_fees = message.enableFees === false ? undefined : message.enableFees; obj.developer_shares = message.developerShares === "" ? undefined : message.developerShares; obj.validator_shares = message.validatorShares === "" ? undefined : message.validatorShares; - obj.addr_derivation_cost_create = message.addrDerivationCostCreate ? message.addrDerivationCostCreate.toString() : undefined; + obj.addr_derivation_cost_create = message.addrDerivationCostCreate !== BigInt(0) ? message.addrDerivationCostCreate.toString() : undefined; obj.min_gas_price = message.minGasPrice === "" ? undefined : message.minGasPrice; return obj; }, diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts index 397ec5baa2..7424e30ede 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/incentives.ts @@ -246,7 +246,7 @@ export const Incentive = { } obj.epochs = message.epochs === 0 ? undefined : message.epochs; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.total_gas = message.totalGas ? message.totalGas.toString() : undefined; + obj.total_gas = message.totalGas !== BigInt(0) ? message.totalGas.toString() : undefined; return obj; }, fromAminoMsg(object: IncentiveAminoMsg): Incentive { @@ -370,7 +370,7 @@ export const GasMeter = { const obj: any = {}; obj.contract = message.contract === "" ? undefined : message.contract; obj.participant = message.participant === "" ? undefined : message.participant; - obj.cumulative_gas = message.cumulativeGas ? message.cumulativeGas.toString() : undefined; + obj.cumulative_gas = message.cumulativeGas !== BigInt(0) ? message.cumulativeGas.toString() : undefined; return obj; }, fromAminoMsg(object: GasMeterAminoMsg): GasMeter { diff --git a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts index 0e03fbe393..9858d8ae82 100644 --- a/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/incentives/v1/query.ts @@ -1045,7 +1045,7 @@ export const QueryGasMeterResponse = { }, toAmino(message: QueryGasMeterResponse): QueryGasMeterResponseAmino { const obj: any = {}; - obj.gas_meter = message.gasMeter ? message.gasMeter.toString() : undefined; + obj.gas_meter = message.gasMeter !== BigInt(0) ? message.gasMeter.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGasMeterResponseAminoMsg): QueryGasMeterResponse { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts index 2390374c0a..12c5cc94f0 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/genesis.ts @@ -191,10 +191,10 @@ export const GenesisState = { toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.epochs_per_period = message.epochsPerPeriod ? message.epochsPerPeriod.toString() : undefined; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.epochs_per_period = message.epochsPerPeriod !== BigInt(0) ? message.epochsPerPeriod.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts index 1dbbea2864..9b13bfcea1 100644 --- a/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts +++ b/__fixtures__/v-next/outputv4/evmos/inflation/v1/query.ts @@ -317,7 +317,7 @@ export const QueryPeriodResponse = { }, toAmino(message: QueryPeriodResponse): QueryPeriodResponseAmino { const obj: any = {}; - obj.period = message.period ? message.period.toString() : undefined; + obj.period = message.period !== BigInt(0) ? message.period.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPeriodResponseAminoMsg): QueryPeriodResponse { @@ -633,7 +633,7 @@ export const QuerySkippedEpochsResponse = { }, toAmino(message: QuerySkippedEpochsResponse): QuerySkippedEpochsResponseAmino { const obj: any = {}; - obj.skipped_epochs = message.skippedEpochs ? message.skippedEpochs.toString() : undefined; + obj.skipped_epochs = message.skippedEpochs !== BigInt(0) ? message.skippedEpochs.toString() : undefined; return obj; }, fromAminoMsg(object: QuerySkippedEpochsResponseAminoMsg): QuerySkippedEpochsResponse { diff --git a/__fixtures__/v-next/outputv4/google/api/distribution.ts b/__fixtures__/v-next/outputv4/google/api/distribution.ts index 50c81443a3..0967ffbaaf 100644 --- a/__fixtures__/v-next/outputv4/google/api/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/distribution.ts @@ -523,7 +523,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.sum_of_squared_deviation = message.sumOfSquaredDeviation === 0 ? undefined : message.sumOfSquaredDeviation; obj.range = message.range ? Distribution_Range.toAmino(message.range) : undefined; diff --git a/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts b/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts index 6a5142fdc6..fcf3d0737c 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/conformance/v1alpha1/conformance_service.ts @@ -1271,7 +1271,7 @@ export const IssueDetails = { const obj: any = {}; obj.severity = message.severity === 0 ? undefined : message.severity; obj.position = message.position ? SourcePosition.toAmino(message.position) : undefined; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: IssueDetailsAminoMsg): IssueDetails { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts index 4a275bcb18..1bb1e2eb2d 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/checked.ts @@ -663,7 +663,7 @@ export const CheckedExpr_ReferenceMapEntry = { }, toAmino(message: CheckedExpr_ReferenceMapEntry): CheckedExpr_ReferenceMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Reference.toAmino(message.value) : undefined; return obj; }, @@ -765,7 +765,7 @@ export const CheckedExpr_TypeMapEntry = { }, toAmino(message: CheckedExpr_TypeMapEntry): CheckedExpr_TypeMapEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Type.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts index 7578b2cf10..6a6f5d581d 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/eval.ts @@ -365,8 +365,8 @@ export const EvalState_Result = { }, toAmino(message: EvalState_Result): EvalState_ResultAmino { const obj: any = {}; - obj.expr = message.expr ? message.expr.toString() : undefined; - obj.value = message.value ? message.value.toString() : undefined; + obj.expr = message.expr !== BigInt(0) ? message.expr.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: EvalState_ResultAminoMsg): EvalState_Result { diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts index fb9adcfcc5..d803047c0d 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/explain.ts @@ -265,7 +265,7 @@ export const Explain_ExprStep = { }, toAmino(message: Explain_ExprStep): Explain_ExprStepAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.value_index = message.valueIndex === 0 ? undefined : message.valueIndex; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts index 8707c2b3cd..801b92b798 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/syntax.ts @@ -842,7 +842,7 @@ export const Expr = { }, toAmino(message: Expr): ExprAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.const_expr = message.constExpr ? Constant.toAmino(message.constExpr) : undefined; obj.ident_expr = message.identExpr ? Expr_Ident.toAmino(message.identExpr) : undefined; obj.select_expr = message.selectExpr ? Expr_Select.toAmino(message.selectExpr) : undefined; @@ -1550,7 +1550,7 @@ export const Expr_CreateStruct_Entry = { }, toAmino(message: Expr_CreateStruct_Entry): Expr_CreateStruct_EntryAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.field_key = message.fieldKey === null ? undefined : message.fieldKey; obj.map_key = message.mapKey ? Expr.toAmino(message.mapKey) : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; @@ -1981,8 +1981,8 @@ export const Constant = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -2092,7 +2092,7 @@ export const SourceInfo_PositionsEntry = { }, toAmino(message: SourceInfo_PositionsEntry): SourceInfo_PositionsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value === 0 ? undefined : message.value; return obj; }, @@ -2194,7 +2194,7 @@ export const SourceInfo_MacroCallsEntry = { }, toAmino(message: SourceInfo_MacroCallsEntry): SourceInfo_MacroCallsEntryAmino { const obj: any = {}; - obj.key = message.key ? message.key.toString() : undefined; + obj.key = message.key !== BigInt(0) ? message.key.toString() : undefined; obj.value = message.value ? Expr.toAmino(message.value) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts index a2a4461fbe..f7387d7dc3 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1alpha1/value.ts @@ -410,8 +410,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts index 558ab489b3..d461fbe243 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/expr.ts @@ -1830,8 +1830,8 @@ export const Literal = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts index 9b332a9930..5de8bc247e 100644 --- a/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts +++ b/__fixtures__/v-next/outputv4/google/api/expr/v1beta1/value.ts @@ -410,8 +410,8 @@ export const Value = { const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; diff --git a/__fixtures__/v-next/outputv4/google/api/quota.ts b/__fixtures__/v-next/outputv4/google/api/quota.ts index 750cfdfbd4..62d8ed3331 100644 --- a/__fixtures__/v-next/outputv4/google/api/quota.ts +++ b/__fixtures__/v-next/outputv4/google/api/quota.ts @@ -513,7 +513,7 @@ export const MetricRule_MetricCostsEntry = { toAmino(message: MetricRule_MetricCostsEntry): MetricRule_MetricCostsEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: MetricRule_MetricCostsEntryAminoMsg): MetricRule_MetricCostsEntry { @@ -766,7 +766,7 @@ export const QuotaLimit_ValuesEntry = { toAmino(message: QuotaLimit_ValuesEntry): QuotaLimit_ValuesEntryAmino { const obj: any = {}; obj.key = message.key === "" ? undefined : message.key; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: QuotaLimit_ValuesEntryAminoMsg): QuotaLimit_ValuesEntry { @@ -1043,9 +1043,9 @@ export const QuotaLimit = { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; obj.description = message.description === "" ? undefined : message.description; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; - obj.max_limit = message.maxLimit ? message.maxLimit.toString() : undefined; - obj.free_tier = message.freeTier ? message.freeTier.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; + obj.max_limit = message.maxLimit !== BigInt(0) ? message.maxLimit.toString() : undefined; + obj.free_tier = message.freeTier !== BigInt(0) ? message.freeTier.toString() : undefined; obj.duration = message.duration === "" ? undefined : message.duration; obj.metric = message.metric === "" ? undefined : message.metric; obj.unit = message.unit === "" ? undefined : message.unit; diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts index 14f84eed08..2d585a36c2 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/distribution.ts @@ -416,7 +416,7 @@ export const Distribution = { }, toAmino(message: Distribution): DistributionAmino { const obj: any = {}; - obj.count = message.count ? message.count.toString() : undefined; + obj.count = message.count !== BigInt(0) ? message.count.toString() : undefined; obj.mean = message.mean === 0 ? undefined : message.mean; obj.minimum = message.minimum === 0 ? undefined : message.minimum; obj.maximum = message.maximum === 0 ? undefined : message.maximum; diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts index 6908f69686..62ddb90d53 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/http_request.ts @@ -408,9 +408,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -419,7 +419,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts index 4fdb683fb5..3217d86cfe 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/log_entry.ts @@ -851,7 +851,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts index 53dc5f8432..47d8c3ac9d 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/metric_value.ts @@ -429,7 +429,7 @@ export const MetricValue = { obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.distribution_value = message.distributionValue ? Distribution.toAmino(message.distributionValue) : undefined; diff --git a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts index 0b5467322d..cba968e113 100644 --- a/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts +++ b/__fixtures__/v-next/outputv4/google/api/servicecontrol/v1/service_controller.ts @@ -806,9 +806,9 @@ export const CheckResponse_ConsumerInfo = { }, toAmino(message: CheckResponse_ConsumerInfo): CheckResponse_ConsumerInfoAmino { const obj: any = {}; - obj.project_number = message.projectNumber ? message.projectNumber.toString() : undefined; + obj.project_number = message.projectNumber !== BigInt(0) ? message.projectNumber.toString() : undefined; obj.type = message.type === 0 ? undefined : message.type; - obj.consumer_number = message.consumerNumber ? message.consumerNumber.toString() : undefined; + obj.consumer_number = message.consumerNumber !== BigInt(0) ? message.consumerNumber.toString() : undefined; return obj; }, fromAminoMsg(object: CheckResponse_ConsumerInfoAminoMsg): CheckResponse_ConsumerInfo { diff --git a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts index d4583eb019..c772a7d927 100644 --- a/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts +++ b/__fixtures__/v-next/outputv4/google/api/serviceusage/v1beta1/resources.ts @@ -1860,8 +1860,8 @@ export const QuotaBucket = { }, toAmino(message: QuotaBucket): QuotaBucketAmino { const obj: any = {}; - obj.effective_limit = message.effectiveLimit ? message.effectiveLimit.toString() : undefined; - obj.default_limit = message.defaultLimit ? message.defaultLimit.toString() : undefined; + obj.effective_limit = message.effectiveLimit !== BigInt(0) ? message.effectiveLimit.toString() : undefined; + obj.default_limit = message.defaultLimit !== BigInt(0) ? message.defaultLimit.toString() : undefined; obj.producer_override = message.producerOverride ? QuotaOverride.toAmino(message.producerOverride) : undefined; obj.consumer_override = message.consumerOverride ? QuotaOverride.toAmino(message.consumerOverride) : undefined; obj.admin_override = message.adminOverride ? QuotaOverride.toAmino(message.adminOverride) : undefined; @@ -2182,7 +2182,7 @@ export const QuotaOverride = { toAmino(message: QuotaOverride): QuotaOverrideAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.override_value = message.overrideValue ? message.overrideValue.toString() : undefined; + obj.override_value = message.overrideValue !== BigInt(0) ? message.overrideValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { @@ -2601,7 +2601,7 @@ export const AdminQuotaPolicy = { toAmino(message: AdminQuotaPolicy): AdminQuotaPolicyAmino { const obj: any = {}; obj.name = message.name === "" ? undefined : message.name; - obj.policy_value = message.policyValue ? message.policyValue.toString() : undefined; + obj.policy_value = message.policyValue !== BigInt(0) ? message.policyValue.toString() : undefined; obj.dimensions = {}; if (message.dimensions) { Object.entries(message.dimensions).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts index 073190bdac..0a812f230f 100644 --- a/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts +++ b/__fixtures__/v-next/outputv4/google/logging/type/http_request.ts @@ -410,9 +410,9 @@ export const HttpRequest = { const obj: any = {}; obj.request_method = message.requestMethod === "" ? undefined : message.requestMethod; obj.request_url = message.requestUrl === "" ? undefined : message.requestUrl; - obj.request_size = message.requestSize ? message.requestSize.toString() : undefined; + obj.request_size = message.requestSize !== BigInt(0) ? message.requestSize.toString() : undefined; obj.status = message.status === 0 ? undefined : message.status; - obj.response_size = message.responseSize ? message.responseSize.toString() : undefined; + obj.response_size = message.responseSize !== BigInt(0) ? message.responseSize.toString() : undefined; obj.user_agent = message.userAgent === "" ? undefined : message.userAgent; obj.remote_ip = message.remoteIp === "" ? undefined : message.remoteIp; obj.server_ip = message.serverIp === "" ? undefined : message.serverIp; @@ -421,7 +421,7 @@ export const HttpRequest = { obj.cache_lookup = message.cacheLookup === false ? undefined : message.cacheLookup; obj.cache_hit = message.cacheHit === false ? undefined : message.cacheHit; obj.cache_validated_with_origin_server = message.cacheValidatedWithOriginServer === false ? undefined : message.cacheValidatedWithOriginServer; - obj.cache_fill_bytes = message.cacheFillBytes ? message.cacheFillBytes.toString() : undefined; + obj.cache_fill_bytes = message.cacheFillBytes !== BigInt(0) ? message.cacheFillBytes.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts index 30e86d2510..8d788c0a02 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/log_entry.ts @@ -1064,7 +1064,7 @@ export const LogEntrySourceLocation = { toAmino(message: LogEntrySourceLocation): LogEntrySourceLocationAmino { const obj: any = {}; obj.file = message.file === "" ? undefined : message.file; - obj.line = message.line ? message.line.toString() : undefined; + obj.line = message.line !== BigInt(0) ? message.line.toString() : undefined; obj.function = message.function === "" ? undefined : message.function; return obj; }, diff --git a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts index 9cb168f8c8..c69b11ff68 100644 --- a/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts +++ b/__fixtures__/v-next/outputv4/google/logging/v2/logging_config.ts @@ -6529,7 +6529,7 @@ export const CopyLogEntriesResponse = { }, toAmino(message: CopyLogEntriesResponse): CopyLogEntriesResponseAmino { const obj: any = {}; - obj.log_entries_copied_count = message.logEntriesCopiedCount ? message.logEntriesCopiedCount.toString() : undefined; + obj.log_entries_copied_count = message.logEntriesCopiedCount !== BigInt(0) ? message.logEntriesCopiedCount.toString() : undefined; return obj; }, fromAminoMsg(object: CopyLogEntriesResponseAminoMsg): CopyLogEntriesResponse { diff --git a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts index c3f1203ab9..0e1d99dacf 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/descriptor.ts @@ -5154,8 +5154,8 @@ export const UninterpretedOption = { obj.name = message.name; } obj.identifier_value = message.identifierValue === "" ? undefined : message.identifierValue; - obj.positive_int_value = message.positiveIntValue ? message.positiveIntValue.toString() : undefined; - obj.negative_int_value = message.negativeIntValue ? message.negativeIntValue.toString() : undefined; + obj.positive_int_value = message.positiveIntValue !== BigInt(0) ? message.positiveIntValue.toString() : undefined; + obj.negative_int_value = message.negativeIntValue !== BigInt(0) ? message.negativeIntValue.toString() : undefined; obj.double_value = message.doubleValue === 0 ? undefined : message.doubleValue; obj.string_value = message.stringValue ? base64FromBytes(message.stringValue) : undefined; obj.aggregate_value = message.aggregateValue === "" ? undefined : message.aggregateValue; diff --git a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts index 814ea49c4c..e22e95be06 100644 --- a/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts +++ b/__fixtures__/v-next/outputv4/google/protobuf/wrappers.ts @@ -437,7 +437,7 @@ export const Int64Value = { }, toAmino(message: Int64Value): Int64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: Int64ValueAminoMsg): Int64Value { @@ -527,7 +527,7 @@ export const UInt64Value = { }, toAmino(message: UInt64Value): UInt64ValueAmino { const obj: any = {}; - obj.value = message.value ? message.value.toString() : undefined; + obj.value = message.value !== BigInt(0) ? message.value.toString() : undefined; return obj; }, fromAminoMsg(object: UInt64ValueAminoMsg): UInt64Value { diff --git a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts index 0165405e0a..4ec47edc48 100644 --- a/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts +++ b/__fixtures__/v-next/outputv4/google/rpc/context/attribute_context.ts @@ -1085,7 +1085,7 @@ export const AttributeContext_Peer = { toAmino(message: AttributeContext_Peer): AttributeContext_PeerAmino { const obj: any = {}; obj.ip = message.ip === "" ? undefined : message.ip; - obj.port = message.port ? message.port.toString() : undefined; + obj.port = message.port !== BigInt(0) ? message.port.toString() : undefined; obj.labels = {}; if (message.labels) { Object.entries(message.labels).forEach(([k, v]) => { @@ -1832,7 +1832,7 @@ export const AttributeContext_Request = { obj.scheme = message.scheme === "" ? undefined : message.scheme; obj.query = message.query === "" ? undefined : message.query; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.protocol = message.protocol === "" ? undefined : message.protocol; obj.reason = message.reason === "" ? undefined : message.reason; obj.auth = message.auth ? AttributeContext_Auth.toAmino(message.auth) : undefined; @@ -2134,8 +2134,8 @@ export const AttributeContext_Response = { }, toAmino(message: AttributeContext_Response): AttributeContext_ResponseAmino { const obj: any = {}; - obj.code = message.code ? message.code.toString() : undefined; - obj.size = message.size ? message.size.toString() : undefined; + obj.code = message.code !== BigInt(0) ? message.code.toString() : undefined; + obj.size = message.size !== BigInt(0) ? message.size.toString() : undefined; obj.headers = {}; if (message.headers) { Object.entries(message.headers).forEach(([k, v]) => { diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts index a833616377..cef091965d 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.ts @@ -233,7 +233,7 @@ export const MsgTransfer = { obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts index 8a19cbb071..02430de508 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/channel.ts @@ -982,14 +982,14 @@ export const Packet = { }, toAmino(message: Packet): PacketAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.source_port = message.sourcePort === "" ? undefined : message.sourcePort; obj.source_channel = message.sourceChannel === "" ? undefined : message.sourceChannel; obj.destination_port = message.destinationPort === "" ? undefined : message.destinationPort; obj.destination_channel = message.destinationChannel === "" ? undefined : message.destinationChannel; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: PacketAminoMsg): Packet { @@ -1135,7 +1135,7 @@ export const PacketState = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.data = message.data ? base64FromBytes(message.data) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts index 229991d01f..c91ee16cc9 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/genesis.ts @@ -311,7 +311,7 @@ export const GenesisState = { } else { obj.ack_sequences = message.ackSequences; } - obj.next_channel_sequence = message.nextChannelSequence ? message.nextChannelSequence.toString() : undefined; + obj.next_channel_sequence = message.nextChannelSequence !== BigInt(0) ? message.nextChannelSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { @@ -441,7 +441,7 @@ export const PacketSequence = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: PacketSequenceAminoMsg): PacketSequence { diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts index 7326d28aaa..4f7af83913 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/query.ts @@ -1730,8 +1730,8 @@ export const QueryChannelConsensusStateRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryChannelConsensusStateRequestAminoMsg): QueryChannelConsensusStateRequest { @@ -2010,7 +2010,7 @@ export const QueryPacketCommitmentRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketCommitmentRequestAminoMsg): QueryPacketCommitmentRequest { @@ -2542,7 +2542,7 @@ export const QueryPacketReceiptRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketReceiptRequestAminoMsg): QueryPacketReceiptRequest { @@ -2802,7 +2802,7 @@ export const QueryPacketAcknowledgementRequest = { const obj: any = {}; obj.port_id = message.portId === "" ? undefined : message.portId; obj.channel_id = message.channelId === "" ? undefined : message.channelId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPacketAcknowledgementRequestAminoMsg): QueryPacketAcknowledgementRequest { @@ -4039,7 +4039,7 @@ export const QueryNextSequenceReceiveResponse = { }, toAmino(message: QueryNextSequenceReceiveResponse): QueryNextSequenceReceiveResponseAmino { const obj: any = {}; - obj.next_sequence_receive = message.nextSequenceReceive ? message.nextSequenceReceive.toString() : undefined; + obj.next_sequence_receive = message.nextSequenceReceive !== BigInt(0) ? message.nextSequenceReceive.toString() : undefined; obj.proof = message.proof ? base64FromBytes(message.proof) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; return obj; diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts index 78b3c99694..b9be74e602 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.ts @@ -2128,7 +2128,7 @@ export const MsgTimeout = { obj.packet = message.packet ? Packet.toAmino(message.packet) : undefined; obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -2387,7 +2387,7 @@ export const MsgTimeoutOnClose = { obj.proof_unreceived = message.proofUnreceived ? base64FromBytes(message.proofUnreceived) : undefined; obj.proof_close = message.proofClose ? base64FromBytes(message.proofClose) : undefined; obj.proof_height = message.proofHeight ? Height.toAmino(message.proofHeight) : {}; - obj.next_sequence_recv = message.nextSequenceRecv ? message.nextSequenceRecv.toString() : undefined; + obj.next_sequence_recv = message.nextSequenceRecv !== BigInt(0) ? message.nextSequenceRecv.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts index ab02de0478..a6e02d50d0 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/client.ts @@ -915,8 +915,8 @@ export const Height = { }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts index 52eff4f978..d78d54a3fd 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/genesis.ts @@ -259,7 +259,7 @@ export const GenesisState = { } obj.params = message.params ? Params.toAmino(message.params) : undefined; obj.create_localhost = message.createLocalhost === false ? undefined : message.createLocalhost; - obj.next_client_sequence = message.nextClientSequence ? message.nextClientSequence.toString() : undefined; + obj.next_client_sequence = message.nextClientSequence !== BigInt(0) ? message.nextClientSequence.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts index 753af92de0..facf10a215 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/query.ts @@ -896,8 +896,8 @@ export const QueryConsensusStateRequest = { toAmino(message: QueryConsensusStateRequest): QueryConsensusStateRequestAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; obj.latest_height = message.latestHeight === false ? undefined : message.latestHeight; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts index 965fa427e4..a0ad2cdc6e 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/connection.ts @@ -379,7 +379,7 @@ export const ConnectionEnd = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectionEndAminoMsg): ConnectionEnd { @@ -572,7 +572,7 @@ export const IdentifiedConnection = { } obj.state = message.state === 0 ? undefined : message.state; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; return obj; }, fromAminoMsg(object: IdentifiedConnectionAminoMsg): IdentifiedConnection { @@ -1144,7 +1144,7 @@ export const Params = { }, toAmino(message: Params): ParamsAmino { const obj: any = {}; - obj.max_expected_time_per_block = message.maxExpectedTimePerBlock ? message.maxExpectedTimePerBlock.toString() : undefined; + obj.max_expected_time_per_block = message.maxExpectedTimePerBlock !== BigInt(0) ? message.maxExpectedTimePerBlock.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts index 8280f6b8e5..bdc3b303c7 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/genesis.ts @@ -164,7 +164,7 @@ export const GenesisState = { } else { obj.client_connection_paths = message.clientConnectionPaths; } - obj.next_connection_sequence = message.nextConnectionSequence ? message.nextConnectionSequence.toString() : undefined; + obj.next_connection_sequence = message.nextConnectionSequence !== BigInt(0) ? message.nextConnectionSequence.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts index ec6bc9cb01..b43d22b7ae 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/query.ts @@ -1263,8 +1263,8 @@ export const QueryConnectionConsensusStateRequest = { toAmino(message: QueryConnectionConsensusStateRequest): QueryConnectionConsensusStateRequestAmino { const obj: any = {}; obj.connection_id = message.connectionId === "" ? undefined : message.connectionId; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: QueryConnectionConsensusStateRequestAminoMsg): QueryConnectionConsensusStateRequest { diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts index b327cae029..0448be92eb 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.ts @@ -333,7 +333,7 @@ export const MsgConnectionOpenInit = { obj.client_id = message.clientId === "" ? undefined : message.clientId; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; obj.version = message.version ? Version.toAmino(message.version) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; obj.signer = message.signer === "" ? undefined : message.signer; return obj; }, @@ -698,7 +698,7 @@ export const MsgConnectionOpenTry = { obj.previous_connection_id = message.previousConnectionId === "" ? undefined : message.previousConnectionId; obj.client_state = message.clientState ? Any.toAmino(message.clientState) : undefined; obj.counterparty = message.counterparty ? Counterparty.toAmino(message.counterparty) : undefined; - obj.delay_period = message.delayPeriod ? message.delayPeriod.toString() : undefined; + obj.delay_period = message.delayPeriod !== BigInt(0) ? message.delayPeriod.toString() : undefined; if (message.counterpartyVersions) { obj.counterparty_versions = message.counterpartyVersions.map(e => e ? Version.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts index eb3629e7b1..5248697115 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v1/solomachine.ts @@ -559,8 +559,8 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.frozen_sequence = message.frozenSequence ? message.frozenSequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.frozen_sequence = message.frozenSequence !== BigInt(0) ? message.frozenSequence.toString() : undefined; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; return obj; @@ -694,7 +694,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -858,8 +858,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1011,7 +1011,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1160,7 +1160,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1273,7 +1273,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1435,8 +1435,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2433,7 +2433,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts index a2b744046e..87fe47bfc0 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/solomachine/v2/solomachine.ts @@ -557,7 +557,7 @@ export const ClientState = { }, toAmino(message: ClientState): ClientStateAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.is_frozen = message.isFrozen === false ? undefined : message.isFrozen; obj.consensus_state = message.consensusState ? ConsensusState.toAmino(message.consensusState) : undefined; obj.allow_update_after_proposal = message.allowUpdateAfterProposal === false ? undefined : message.allowUpdateAfterProposal; @@ -692,7 +692,7 @@ export const ConsensusState = { const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusStateAminoMsg): ConsensusState { @@ -856,8 +856,8 @@ export const Header = { }, toAmino(message: Header): HeaderAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.new_public_key = message.newPublicKey ? Any.toAmino(message.newPublicKey) : undefined; obj.new_diversifier = message.newDiversifier === "" ? undefined : message.newDiversifier; @@ -1009,7 +1009,7 @@ export const Misbehaviour = { toAmino(message: Misbehaviour): MisbehaviourAmino { const obj: any = {}; obj.client_id = message.clientId === "" ? undefined : message.clientId; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; obj.signature_one = message.signatureOne ? SignatureAndData.toAmino(message.signatureOne) : undefined; obj.signature_two = message.signatureTwo ? SignatureAndData.toAmino(message.signatureTwo) : undefined; return obj; @@ -1158,7 +1158,7 @@ export const SignatureAndData = { obj.signature = message.signature ? base64FromBytes(message.signature) : undefined; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureAndDataAminoMsg): SignatureAndData { @@ -1271,7 +1271,7 @@ export const TimestampedSignatureData = { toAmino(message: TimestampedSignatureData): TimestampedSignatureDataAmino { const obj: any = {}; obj.signature_data = message.signatureData ? base64FromBytes(message.signatureData) : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; return obj; }, fromAminoMsg(object: TimestampedSignatureDataAminoMsg): TimestampedSignatureData { @@ -1433,8 +1433,8 @@ export const SignBytes = { }, toAmino(message: SignBytes): SignBytesAmino { const obj: any = {}; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; - obj.timestamp = message.timestamp ? message.timestamp.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; + obj.timestamp = message.timestamp !== BigInt(0) ? message.timestamp.toString() : undefined; obj.diversifier = message.diversifier === "" ? undefined : message.diversifier; obj.data_type = message.dataType === 0 ? undefined : message.dataType; obj.data = message.data ? base64FromBytes(message.data) : undefined; @@ -2431,7 +2431,7 @@ export const NextSequenceRecvData = { toAmino(message: NextSequenceRecvData): NextSequenceRecvDataAmino { const obj: any = {}; obj.path = message.path ? base64FromBytes(message.path) : undefined; - obj.next_seq_recv = message.nextSeqRecv ? message.nextSeqRecv.toString() : undefined; + obj.next_seq_recv = message.nextSeqRecv !== BigInt(0) ? message.nextSeqRecv.toString() : undefined; return obj; }, fromAminoMsg(object: NextSequenceRecvDataAminoMsg): NextSequenceRecvData { diff --git a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts index 2caa3c6e01..d6152bc9fa 100644 --- a/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts +++ b/__fixtures__/v-next/outputv4/ibc/lightclients/tendermint/v1/tendermint.ts @@ -979,8 +979,8 @@ export const Fraction = { }, toAmino(message: Fraction): FractionAmino { const obj: any = {}; - obj.numerator = message.numerator ? message.numerator.toString() : undefined; - obj.denominator = message.denominator ? message.denominator.toString() : undefined; + obj.numerator = message.numerator !== BigInt(0) ? message.numerator.toString() : undefined; + obj.denominator = message.denominator !== BigInt(0) ? message.denominator.toString() : undefined; return obj; }, fromAminoMsg(object: FractionAminoMsg): Fraction { diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts index c55d1e3936..b5a7cb4406 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/genesis.ts @@ -264,10 +264,10 @@ export const EpochInfo = { obj.identifier = message.identifier === "" ? undefined : message.identifier; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; obj.current_epoch_start_time = message.currentEpochStartTime ? Timestamp.toAmino(toTimestamp(message.currentEpochStartTime)) : undefined; obj.epoch_counting_started = message.epochCountingStarted === false ? undefined : message.epochCountingStarted; - obj.current_epoch_start_height = message.currentEpochStartHeight ? message.currentEpochStartHeight.toString() : undefined; + obj.current_epoch_start_height = message.currentEpochStartHeight !== BigInt(0) ? message.currentEpochStartHeight.toString() : undefined; return obj; }, fromAminoMsg(object: EpochInfoAminoMsg): EpochInfo { diff --git a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts index efeb5c1186..ea9d933e90 100644 --- a/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/epochs/query.ts @@ -381,7 +381,7 @@ export const QueryCurrentEpochResponse = { }, toAmino(message: QueryCurrentEpochResponse): QueryCurrentEpochResponseAmino { const obj: any = {}; - obj.current_epoch = message.currentEpoch ? message.currentEpoch.toString() : undefined; + obj.current_epoch = message.currentEpoch !== BigInt(0) ? message.currentEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: QueryCurrentEpochResponseAminoMsg): QueryCurrentEpochResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts index e99a1675d8..2343660f0f 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/balancerPool.ts @@ -748,7 +748,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts index 84eb8cdd7f..f7ac466bd8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.ts @@ -260,7 +260,7 @@ export const MsgCreateBalancerPoolResponse = { }, toAmino(message: MsgCreateBalancerPoolResponse): MsgCreateBalancerPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateBalancerPoolResponseAminoMsg): MsgCreateBalancerPoolResponse { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts index 0b89fa139e..52dd53a9d3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/stableswap_pool.ts @@ -387,7 +387,7 @@ export const Pool = { toAmino(message: Pool): PoolAmino { const obj: any = {}; obj.address = message.address === "" ? undefined : message.address; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.pool_params = message.poolParams ? PoolParams.toAmino(message.poolParams) : undefined; obj.future_pool_governor = message.futurePoolGovernor === "" ? undefined : message.futurePoolGovernor; obj.total_shares = message.totalShares ? Coin.toAmino(message.totalShares) : undefined; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts index 0fe4465e12..54cebe6395 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.ts @@ -346,7 +346,7 @@ export const MsgCreateStableswapPoolResponse = { }, toAmino(message: MsgCreateStableswapPoolResponse): MsgCreateStableswapPoolResponseAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateStableswapPoolResponseAminoMsg): MsgCreateStableswapPoolResponse { @@ -490,7 +490,7 @@ export const MsgStableSwapAdjustScalingFactors = { toAmino(message: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.scalingFactors) { obj.scaling_factors = message.scalingFactors.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts index a167293adc..bf076f10b6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/genesis.ts @@ -252,7 +252,7 @@ export const GenesisState = { } else { obj.pools = message.pools; } - obj.next_pool_number = message.nextPoolNumber ? message.nextPoolNumber.toString() : undefined; + obj.next_pool_number = message.nextPoolNumber !== BigInt(0) ? message.nextPoolNumber.toString() : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts index c6a83f0e1d..6157ab7910 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/query.ts @@ -452,7 +452,7 @@ export const QueryPoolRequest = { }, toAmino(message: QueryPoolRequest): QueryPoolRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolRequestAminoMsg): QueryPoolRequest { @@ -937,7 +937,7 @@ export const QueryNumPoolsResponse = { }, toAmino(message: QueryNumPoolsResponse): QueryNumPoolsResponseAmino { const obj: any = {}; - obj.num_pools = message.numPools ? message.numPools.toString() : undefined; + obj.num_pools = message.numPools !== BigInt(0) ? message.numPools.toString() : undefined; return obj; }, fromAminoMsg(object: QueryNumPoolsResponseAminoMsg): QueryNumPoolsResponse { @@ -1033,7 +1033,7 @@ export const QueryPoolTypeRequest = { }, toAmino(message: QueryPoolTypeRequest): QueryPoolTypeRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolTypeRequestAminoMsg): QueryPoolTypeRequest { @@ -1245,7 +1245,7 @@ export const QueryCalcJoinPoolSharesRequest = { }, toAmino(message: QueryCalcJoinPoolSharesRequest): QueryCalcJoinPoolSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -1483,7 +1483,7 @@ export const QueryCalcExitPoolCoinsFromSharesRequest = { }, toAmino(message: QueryCalcExitPoolCoinsFromSharesRequest): QueryCalcExitPoolCoinsFromSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; return obj; }, @@ -1684,7 +1684,7 @@ export const QueryPoolParamsRequest = { }, toAmino(message: QueryPoolParamsRequest): QueryPoolParamsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryPoolParamsRequestAminoMsg): QueryPoolParamsRequest { @@ -1876,7 +1876,7 @@ export const QueryTotalPoolLiquidityRequest = { }, toAmino(message: QueryTotalPoolLiquidityRequest): QueryTotalPoolLiquidityRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalPoolLiquidityRequestAminoMsg): QueryTotalPoolLiquidityRequest { @@ -2076,7 +2076,7 @@ export const QueryTotalSharesRequest = { }, toAmino(message: QueryTotalSharesRequest): QueryTotalSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryTotalSharesRequestAminoMsg): QueryTotalSharesRequest { @@ -2290,7 +2290,7 @@ export const QueryCalcJoinPoolNoSwapSharesRequest = { }, toAmino(message: QueryCalcJoinPoolNoSwapSharesRequest): QueryCalcJoinPoolNoSwapSharesRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.tokensIn) { obj.tokens_in = message.tokensIn.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -2544,7 +2544,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; @@ -3054,7 +3054,7 @@ export const QuerySwapExactAmountInRequest = { toAmino(message: QuerySwapExactAmountInRequest): QuerySwapExactAmountInRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn === "" ? undefined : message.tokenIn; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountInRoute.toAmino(e) : undefined); @@ -3305,7 +3305,7 @@ export const QuerySwapExactAmountOutRequest = { toAmino(message: QuerySwapExactAmountOutRequest): QuerySwapExactAmountOutRequestAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; if (message.routes) { obj.routes = message.routes.map(e => e ? SwapAmountOutRoute.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts index 096beac3dc..cc37726c6d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.ts @@ -394,7 +394,7 @@ export const MsgJoinPool = { toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); @@ -672,7 +672,7 @@ export const MsgExitPool = { toAmino(message: MsgExitPool): MsgExitPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; if (message.tokenOutMins) { obj.token_out_mins = message.tokenOutMins.map(e => e ? Coin.toAmino(e) : undefined); @@ -894,7 +894,7 @@ export const SwapAmountInRoute = { }, toAmino(message: SwapAmountInRoute): SwapAmountInRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; return obj; }, @@ -1258,7 +1258,7 @@ export const SwapAmountOutRoute = { }, toAmino(message: SwapAmountOutRoute): SwapAmountOutRouteAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; return obj; }, @@ -1657,7 +1657,7 @@ export const MsgJoinSwapExternAmountIn = { toAmino(message: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in = message.tokenIn ? Coin.toAmino(message.tokenIn) : undefined; obj.share_out_min_amount = message.shareOutMinAmount === "" ? undefined : message.shareOutMinAmount; return obj; @@ -1914,7 +1914,7 @@ export const MsgJoinSwapShareAmountOut = { toAmino(message: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_in_denom = message.tokenInDenom === "" ? undefined : message.tokenInDenom; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; obj.token_in_max_amount = message.tokenInMaxAmount === "" ? undefined : message.tokenInMaxAmount; @@ -2172,7 +2172,7 @@ export const MsgExitSwapShareAmountIn = { toAmino(message: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out_denom = message.tokenOutDenom === "" ? undefined : message.tokenOutDenom; obj.share_in_amount = message.shareInAmount === "" ? undefined : message.shareInAmount; obj.token_out_min_amount = message.tokenOutMinAmount === "" ? undefined : message.tokenOutMinAmount; @@ -2416,7 +2416,7 @@ export const MsgExitSwapExternAmountOut = { toAmino(message: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.token_out = message.tokenOut ? Coin.toAmino(message.tokenOut) : undefined; obj.share_in_max_amount = message.shareInMaxAmount === "" ? undefined : message.shareInMaxAmount; return obj; diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts index 0793fc0d01..69c0eb93a8 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v2/query.ts @@ -145,7 +145,7 @@ export const QuerySpotPriceRequest = { }, toAmino(message: QuerySpotPriceRequest): QuerySpotPriceRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset_denom = message.baseAssetDenom === "" ? undefined : message.baseAssetDenom; obj.quote_asset_denom = message.quoteAssetDenom === "" ? undefined : message.quoteAssetDenom; return obj; diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts index 9081c6e243..9eb54c3651 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/gauge.ts @@ -277,7 +277,7 @@ export const Gauge = { }, toAmino(message: Gauge): GaugeAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; obj.is_perpetual = message.isPerpetual === false ? undefined : message.isPerpetual; obj.distribute_to = message.distributeTo ? QueryCondition.toAmino(message.distributeTo) : undefined; if (message.coins) { @@ -286,8 +286,8 @@ export const Gauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; - obj.filled_epochs = message.filledEpochs ? message.filledEpochs.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; + obj.filled_epochs = message.filledEpochs !== BigInt(0) ? message.filledEpochs.toString() : undefined; if (message.distributedCoins) { obj.distributed_coins = message.distributedCoins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts index da04c4968a..8fca4595f6 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/genesis.ts @@ -182,7 +182,7 @@ export const GenesisState = { } else { obj.lockable_durations = message.lockableDurations; } - obj.last_gauge_id = message.lastGaugeId ? message.lastGaugeId.toString() : undefined; + obj.last_gauge_id = message.lastGaugeId !== BigInt(0) ? message.lastGaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts index f7c21c9cd7..c78c530b74 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/query.ts @@ -475,7 +475,7 @@ export const GaugeByIDRequest = { }, toAmino(message: GaugeByIDRequest): GaugeByIDRequestAmino { const obj: any = {}; - obj.id = message.id ? message.id.toString() : undefined; + obj.id = message.id !== BigInt(0) ? message.id.toString() : undefined; return obj; }, fromAminoMsg(object: GaugeByIDRequestAminoMsg): GaugeByIDRequest { @@ -1849,7 +1849,7 @@ export const RewardsEstRequest = { } else { obj.lock_ids = message.lockIds; } - obj.end_epoch = message.endEpoch ? message.endEpoch.toString() : undefined; + obj.end_epoch = message.endEpoch !== BigInt(0) ? message.endEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: RewardsEstRequestAminoMsg): RewardsEstRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts index 8bd45ca411..6fb60a8117 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.ts @@ -243,7 +243,7 @@ export const MsgCreateGauge = { obj.coins = message.coins; } obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; - obj.num_epochs_paid_over = message.numEpochsPaidOver ? message.numEpochsPaidOver.toString() : undefined; + obj.num_epochs_paid_over = message.numEpochsPaidOver !== BigInt(0) ? message.numEpochsPaidOver.toString() : undefined; return obj; }, fromAminoMsg(object: MsgCreateGaugeAminoMsg): MsgCreateGauge { @@ -452,7 +452,7 @@ export const MsgAddToGauge = { toAmino(message: MsgAddToGauge): MsgAddToGaugeAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; if (message.rewards) { obj.rewards = message.rewards.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts index 8a142aa777..fa76db0580 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/genesis.ts @@ -133,7 +133,7 @@ export const GenesisState = { }, toAmino(message: GenesisState): GenesisStateAmino { const obj: any = {}; - obj.last_lock_id = message.lastLockId ? message.lastLockId.toString() : undefined; + obj.last_lock_id = message.lastLockId !== BigInt(0) ? message.lastLockId.toString() : undefined; if (message.locks) { obj.locks = message.locks.map(e => e ? PeriodLock.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts index 893e285ca6..0b299f3be4 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/lock.ts @@ -315,7 +315,7 @@ export const PeriodLock = { }, toAmino(message: PeriodLock): PeriodLockAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.owner = message.owner === "" ? undefined : message.owner; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; @@ -616,7 +616,7 @@ export const SyntheticLock = { }, toAmino(message: SyntheticLock): SyntheticLockAmino { const obj: any = {}; - obj.underlying_lock_id = message.underlyingLockId ? message.underlyingLockId.toString() : undefined; + obj.underlying_lock_id = message.underlyingLockId !== BigInt(0) ? message.underlyingLockId.toString() : undefined; obj.synth_denom = message.synthDenom === "" ? undefined : message.synthDenom; obj.end_time = message.endTime ? Timestamp.toAmino(toTimestamp(message.endTime)) : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts index 096af91e0d..610bbb6503 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/query.ts @@ -2461,7 +2461,7 @@ export const LockedRequest = { }, toAmino(message: LockedRequest): LockedRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: LockedRequestAminoMsg): LockedRequest { @@ -2653,7 +2653,7 @@ export const SyntheticLockupsByLockupIDRequest = { }, toAmino(message: SyntheticLockupsByLockupIDRequest): SyntheticLockupsByLockupIDRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: SyntheticLockupsByLockupIDRequestAminoMsg): SyntheticLockupsByLockupIDRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts index 95df255a3b..12fe8486f3 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.ts @@ -353,7 +353,7 @@ export const MsgLockTokensResponse = { }, toAmino(message: MsgLockTokensResponse): MsgLockTokensResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockTokensResponseAminoMsg): MsgLockTokensResponse { @@ -686,7 +686,7 @@ export const MsgBeginUnlocking = { toAmino(message: MsgBeginUnlocking): MsgBeginUnlockingAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { @@ -916,7 +916,7 @@ export const MsgExtendLockup = { toAmino(message: MsgExtendLockup): MsgExtendLockupAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, @@ -1146,7 +1146,7 @@ export const MsgForceUnlock = { toAmino(message: MsgForceUnlock): MsgForceUnlockAmino { const obj: any = {}; obj.owner = message.owner === "" ? undefined : message.owner; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; if (message.coins) { obj.coins = message.coins.map(e => e ? Coin.toAmino(e) : undefined); } else { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts index e2474a70b7..366c3b7419 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/genesis.ts @@ -133,7 +133,7 @@ export const GenesisState = { const obj: any = {}; obj.minter = message.minter ? Minter.toAmino(message.minter) : undefined; obj.params = message.params ? Params.toAmino(message.params) : undefined; - obj.reduction_started_epoch = message.reductionStartedEpoch ? message.reductionStartedEpoch.toString() : undefined; + obj.reduction_started_epoch = message.reductionStartedEpoch !== BigInt(0) ? message.reductionStartedEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: GenesisStateAminoMsg): GenesisState { diff --git a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts index 6b0a5b76ec..8b83124382 100644 --- a/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts +++ b/__fixtures__/v-next/outputv4/osmosis/mint/v1beta1/mint.ts @@ -677,7 +677,7 @@ export const Params = { obj.mint_denom = message.mintDenom === "" ? undefined : message.mintDenom; obj.genesis_epoch_provisions = message.genesisEpochProvisions === "" ? undefined : message.genesisEpochProvisions; obj.epoch_identifier = message.epochIdentifier === "" ? undefined : message.epochIdentifier; - obj.reduction_period_in_epochs = message.reductionPeriodInEpochs ? message.reductionPeriodInEpochs.toString() : undefined; + obj.reduction_period_in_epochs = message.reductionPeriodInEpochs !== BigInt(0) ? message.reductionPeriodInEpochs.toString() : undefined; obj.reduction_factor = message.reductionFactor === "" ? undefined : message.reductionFactor; obj.distribution_proportions = message.distributionProportions ? DistributionProportions.toAmino(message.distributionProportions) : undefined; if (message.weightedDeveloperRewardsReceivers) { @@ -685,7 +685,7 @@ export const Params = { } else { obj.weighted_developer_rewards_receivers = message.weightedDeveloperRewardsReceivers; } - obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; + obj.minting_rewards_distribution_start_epoch = message.mintingRewardsDistributionStartEpoch !== BigInt(0) ? message.mintingRewardsDistributionStartEpoch.toString() : undefined; return obj; }, fromAminoMsg(object: ParamsAminoMsg): Params { diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts index d300003020..437da4cd52 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/incentives.ts @@ -482,7 +482,7 @@ export const DistrRecord = { }, toAmino(message: DistrRecord): DistrRecordAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.weight = message.weight === "" ? undefined : message.weight; return obj; }, @@ -615,8 +615,8 @@ export const PoolToGauge = { }, toAmino(message: PoolToGauge): PoolToGaugeAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts index 296e0a744e..87d6b46376 100644 --- a/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/pool-incentives/v1beta1/query.ts @@ -203,7 +203,7 @@ export const QueryGaugeIdsRequest = { }, toAmino(message: QueryGaugeIdsRequest): QueryGaugeIdsRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: QueryGaugeIdsRequestAminoMsg): QueryGaugeIdsRequest { @@ -437,7 +437,7 @@ export const QueryGaugeIdsResponse_GaugeIdWithDuration = { }, toAmino(message: QueryGaugeIdsResponse_GaugeIdWithDuration): QueryGaugeIdsResponse_GaugeIdWithDurationAmino { const obj: any = {}; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.duration = message.duration ? Duration.toAmino(message.duration) : undefined; obj.gauge_incentive_percentage = message.gaugeIncentivePercentage === "" ? undefined : message.gaugeIncentivePercentage; return obj; @@ -1163,9 +1163,9 @@ export const IncentivizedPool = { }, toAmino(message: IncentivizedPool): IncentivizedPoolAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.lockable_duration = message.lockableDuration ? Duration.toAmino(message.lockableDuration) : undefined; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: IncentivizedPoolAminoMsg): IncentivizedPool { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts index 023c4bb8bc..d0655c731c 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/query.ts @@ -1195,7 +1195,7 @@ export const SuperfluidIntermediaryAccountInfo = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; obj.address = message.address === "" ? undefined : message.address; return obj; }, @@ -1511,7 +1511,7 @@ export const ConnectedIntermediaryAccountRequest = { }, toAmino(message: ConnectedIntermediaryAccountRequest): ConnectedIntermediaryAccountRequestAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: ConnectedIntermediaryAccountRequestAminoMsg): ConnectedIntermediaryAccountRequest { diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts index 51eef72917..598fda8724 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/superfluid.ts @@ -387,7 +387,7 @@ export const SuperfluidIntermediaryAccount = { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; - obj.gauge_id = message.gaugeId ? message.gaugeId.toString() : undefined; + obj.gauge_id = message.gaugeId !== BigInt(0) ? message.gaugeId.toString() : undefined; return obj; }, fromAminoMsg(object: SuperfluidIntermediaryAccountAminoMsg): SuperfluidIntermediaryAccount { @@ -515,7 +515,7 @@ export const OsmoEquivalentMultiplierRecord = { }, toAmino(message: OsmoEquivalentMultiplierRecord): OsmoEquivalentMultiplierRecordAmino { const obj: any = {}; - obj.epoch_number = message.epochNumber ? message.epochNumber.toString() : undefined; + obj.epoch_number = message.epochNumber !== BigInt(0) ? message.epochNumber.toString() : undefined; obj.denom = message.denom === "" ? undefined : message.denom; obj.multiplier = message.multiplier === "" ? undefined : message.multiplier; return obj; @@ -778,7 +778,7 @@ export const LockIdIntermediaryAccountConnection = { }, toAmino(message: LockIdIntermediaryAccountConnection): LockIdIntermediaryAccountConnectionAmino { const obj: any = {}; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.intermediary_account = message.intermediaryAccount === "" ? undefined : message.intermediaryAccount; return obj; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts index 510ec0f9ff..0930d7ecab 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.ts @@ -238,7 +238,7 @@ export const MsgSuperfluidDelegate = { toAmino(message: MsgSuperfluidDelegate): MsgSuperfluidDelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; obj.val_addr = message.valAddr === "" ? undefined : message.valAddr; return obj; }, @@ -426,7 +426,7 @@ export const MsgSuperfluidUndelegate = { toAmino(message: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUndelegateAminoMsg): MsgSuperfluidUndelegate { @@ -613,7 +613,7 @@ export const MsgSuperfluidUnbondLock = { toAmino(message: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.lock_id = message.lockId ? message.lockId.toString() : undefined; + obj.lock_id = message.lockId !== BigInt(0) ? message.lockId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgSuperfluidUnbondLockAminoMsg): MsgSuperfluidUnbondLock { @@ -921,7 +921,7 @@ export const MsgLockAndSuperfluidDelegateResponse = { }, toAmino(message: MsgLockAndSuperfluidDelegateResponse): MsgLockAndSuperfluidDelegateResponseAmino { const obj: any = {}; - obj.ID = message.ID ? message.ID.toString() : undefined; + obj.ID = message.ID !== BigInt(0) ? message.ID.toString() : undefined; return obj; }, fromAminoMsg(object: MsgLockAndSuperfluidDelegateResponseAminoMsg): MsgLockAndSuperfluidDelegateResponse { @@ -1034,7 +1034,7 @@ export const MsgUnPoolWhitelistedPool = { toAmino(message: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; return obj; }, fromAminoMsg(object: MsgUnPoolWhitelistedPoolAminoMsg): MsgUnPoolWhitelistedPool { diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts index 8361f269c0..16342b7412 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/query.ts @@ -209,7 +209,7 @@ export const ArithmeticTwapRequest = { }, toAmino(message: ArithmeticTwapRequest): ArithmeticTwapRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; @@ -451,7 +451,7 @@ export const ArithmeticTwapToNowRequest = { }, toAmino(message: ArithmeticTwapToNowRequest): ArithmeticTwapToNowRequestAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.base_asset = message.baseAsset === "" ? undefined : message.baseAsset; obj.quote_asset = message.quoteAsset === "" ? undefined : message.quoteAsset; obj.start_time = message.startTime ? Timestamp.toAmino(toTimestamp(message.startTime)) : undefined; diff --git a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts index 73cb746fc5..00fa424091 100644 --- a/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts +++ b/__fixtures__/v-next/outputv4/osmosis/twap/v1beta1/twap_record.ts @@ -282,7 +282,7 @@ export const TwapRecord = { }, toAmino(message: TwapRecord): TwapRecordAmino { const obj: any = {}; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.asset0_denom = message.asset0Denom === "" ? undefined : message.asset0Denom; obj.asset1_denom = message.asset1Denom === "" ? undefined : message.asset1Denom; obj.height = message.height ? message.height.toString() : "0"; diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts index 4a8467c23d..1bdf14c875 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/feetoken.ts @@ -113,7 +113,7 @@ export const FeeToken = { toAmino(message: FeeToken): FeeTokenAmino { const obj: any = {}; obj.denom = message.denom === "" ? undefined : message.denom; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: FeeTokenAminoMsg): FeeToken { diff --git a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts index 8a90de2a62..610d234fc1 100644 --- a/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts +++ b/__fixtures__/v-next/outputv4/osmosis/txfees/v1beta1/query.ts @@ -452,7 +452,7 @@ export const QueryDenomSpotPriceResponse = { }, toAmino(message: QueryDenomSpotPriceResponse): QueryDenomSpotPriceResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; obj.spot_price = message.spotPrice === "" ? undefined : message.spotPrice; return obj; }, @@ -643,7 +643,7 @@ export const QueryDenomPoolIdResponse = { }, toAmino(message: QueryDenomPoolIdResponse): QueryDenomPoolIdResponseAmino { const obj: any = {}; - obj.poolID = message.poolID ? message.poolID.toString() : undefined; + obj.poolID = message.poolID !== BigInt(0) ? message.poolID.toString() : undefined; return obj; }, fromAminoMsg(object: QueryDenomPoolIdResponseAminoMsg): QueryDenomPoolIdResponse { diff --git a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts index 04a1eac3b4..bde3491e77 100644 --- a/__fixtures__/v-next/outputv4/tendermint/abci/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/abci/types.ts @@ -1535,8 +1535,8 @@ export const RequestInfo = { toAmino(message: RequestInfo): RequestInfoAmino { const obj: any = {}; obj.version = message.version === "" ? undefined : message.version; - obj.block_version = message.blockVersion ? message.blockVersion.toString() : undefined; - obj.p2p_version = message.p2pVersion ? message.p2pVersion.toString() : undefined; + obj.block_version = message.blockVersion !== BigInt(0) ? message.blockVersion.toString() : undefined; + obj.p2p_version = message.p2pVersion !== BigInt(0) ? message.p2pVersion.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInfoAminoMsg): RequestInfo { @@ -1828,7 +1828,7 @@ export const RequestInitChain = { obj.validators = message.validators; } obj.app_state_bytes = message.appStateBytes ? base64FromBytes(message.appStateBytes) : undefined; - obj.initial_height = message.initialHeight ? message.initialHeight.toString() : undefined; + obj.initial_height = message.initialHeight !== BigInt(0) ? message.initialHeight.toString() : undefined; return obj; }, fromAminoMsg(object: RequestInitChainAminoMsg): RequestInitChain { @@ -1968,7 +1968,7 @@ export const RequestQuery = { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.path = message.path === "" ? undefined : message.path; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.prove = message.prove === false ? undefined : message.prove; return obj; }, @@ -2405,7 +2405,7 @@ export const RequestEndBlock = { }, toAmino(message: RequestEndBlock): RequestEndBlockAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; return obj; }, fromAminoMsg(object: RequestEndBlockAminoMsg): RequestEndBlock { @@ -2770,7 +2770,7 @@ export const RequestLoadSnapshotChunk = { }, toAmino(message: RequestLoadSnapshotChunk): RequestLoadSnapshotChunkAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunk = message.chunk === 0 ? undefined : message.chunk; return obj; @@ -3671,8 +3671,8 @@ export const ResponseInfo = { const obj: any = {}; obj.data = message.data === "" ? undefined : message.data; obj.version = message.version === "" ? undefined : message.version; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; - obj.last_block_height = message.lastBlockHeight ? message.lastBlockHeight.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; + obj.last_block_height = message.lastBlockHeight !== BigInt(0) ? message.lastBlockHeight.toString() : undefined; obj.last_block_app_hash = message.lastBlockAppHash ? base64FromBytes(message.lastBlockAppHash) : undefined; return obj; }, @@ -4154,11 +4154,11 @@ export const ResponseQuery = { obj.code = message.code === 0 ? undefined : message.code; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.index = message.index ? message.index.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.key = message.key ? base64FromBytes(message.key) : undefined; obj.value = message.value ? base64FromBytes(message.value) : undefined; obj.proof_ops = message.proofOps ? ProofOps.toAmino(message.proofOps) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.codespace = message.codespace === "" ? undefined : message.codespace; return obj; }, @@ -4471,8 +4471,8 @@ export const ResponseCheckTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4692,8 +4692,8 @@ export const ResponseDeliverTx = { obj.data = message.data ? base64FromBytes(message.data) : undefined; obj.log = message.log === "" ? undefined : message.log; obj.info = message.info === "" ? undefined : message.info; - obj.gas_wanted = message.gasWanted ? message.gasWanted.toString() : undefined; - obj.gas_used = message.gasUsed ? message.gasUsed.toString() : undefined; + obj.gas_wanted = message.gasWanted !== BigInt(0) ? message.gasWanted.toString() : undefined; + obj.gas_used = message.gasUsed !== BigInt(0) ? message.gasUsed.toString() : undefined; if (message.events) { obj.events = message.events.map(e => e ? Event.toAmino(e) : undefined); } else { @@ -4950,7 +4950,7 @@ export const ResponseCommit = { toAmino(message: ResponseCommit): ResponseCommitAmino { const obj: any = {}; obj.data = message.data ? base64FromBytes(message.data) : undefined; - obj.retain_height = message.retainHeight ? message.retainHeight.toString() : undefined; + obj.retain_height = message.retainHeight !== BigInt(0) ? message.retainHeight.toString() : undefined; return obj; }, fromAminoMsg(object: ResponseCommitAminoMsg): ResponseCommit { @@ -5630,8 +5630,8 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -6123,7 +6123,7 @@ export const TxResult = { }, toAmino(message: TxResult): TxResultAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.index = message.index === 0 ? undefined : message.index; obj.tx = message.tx ? base64FromBytes(message.tx) : undefined; obj.result = message.result ? ResponseDeliverTx.toAmino(message.result) : undefined; @@ -6233,7 +6233,7 @@ export const Validator = { toAmino(message: Validator): ValidatorAmino { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -6342,7 +6342,7 @@ export const ValidatorUpdate = { toAmino(message: ValidatorUpdate): ValidatorUpdateAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.power = message.power ? message.power.toString() : undefined; + obj.power = message.power !== BigInt(0) ? message.power.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorUpdateAminoMsg): ValidatorUpdate { @@ -6609,9 +6609,9 @@ export const Evidence = { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; obj.validator = message.validator ? Validator.toAmino(message.validator) : undefined; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceAminoMsg): Evidence { @@ -6765,7 +6765,7 @@ export const Snapshot = { }, toAmino(message: Snapshot): SnapshotAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.format = message.format === 0 ? undefined : message.format; obj.chunks = message.chunks === 0 ? undefined : message.chunks; obj.hash = message.hash ? base64FromBytes(message.hash) : undefined; diff --git a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts index 6393e6860c..eb3082cbcd 100644 --- a/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts +++ b/__fixtures__/v-next/outputv4/tendermint/crypto/proof.ts @@ -208,8 +208,8 @@ export const Proof = { }, toAmino(message: Proof): ProofAmino { const obj: any = {}; - obj.total = message.total ? message.total.toString() : undefined; - obj.index = message.index ? message.index.toString() : undefined; + obj.total = message.total !== BigInt(0) ? message.total.toString() : undefined; + obj.index = message.index !== BigInt(0) ? message.index.toString() : undefined; obj.leaf_hash = message.leafHash ? base64FromBytes(message.leafHash) : undefined; if (message.aunts) { obj.aunts = message.aunts.map(e => base64FromBytes(e)); diff --git a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts index ca7ef79b7b..b824c36692 100644 --- a/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/libs/bits/types.ts @@ -115,7 +115,7 @@ export const BitArray = { }, toAmino(message: BitArray): BitArrayAmino { const obj: any = {}; - obj.bits = message.bits ? message.bits.toString() : undefined; + obj.bits = message.bits !== BigInt(0) ? message.bits.toString() : undefined; if (message.elems) { obj.elems = message.elems.map(e => e.toString()); } else { diff --git a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts index 2303697558..1c24960afa 100644 --- a/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/p2p/types.ts @@ -189,9 +189,9 @@ export const ProtocolVersion = { }, toAmino(message: ProtocolVersion): ProtocolVersionAmino { const obj: any = {}; - obj.p2p = message.p2p ? message.p2p.toString() : undefined; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.p2p = message.p2p !== BigInt(0) ? message.p2p.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ProtocolVersionAminoMsg): ProtocolVersion { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts index 5543313c32..06bf9dba0a 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/evidence.ts @@ -318,8 +318,8 @@ export const DuplicateVoteEvidence = { const obj: any = {}; obj.vote_a = message.voteA ? Vote.toAmino(message.voteA) : undefined; obj.vote_b = message.voteB ? Vote.toAmino(message.voteB) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; - obj.validator_power = message.validatorPower ? message.validatorPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; + obj.validator_power = message.validatorPower !== BigInt(0) ? message.validatorPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, @@ -485,13 +485,13 @@ export const LightClientAttackEvidence = { toAmino(message: LightClientAttackEvidence): LightClientAttackEvidenceAmino { const obj: any = {}; obj.conflicting_block = message.conflictingBlock ? LightBlock.toAmino(message.conflictingBlock) : undefined; - obj.common_height = message.commonHeight ? message.commonHeight.toString() : undefined; + obj.common_height = message.commonHeight !== BigInt(0) ? message.commonHeight.toString() : undefined; if (message.byzantineValidators) { obj.byzantine_validators = message.byzantineValidators.map(e => e ? Validator.toAmino(e) : undefined); } else { obj.byzantine_validators = message.byzantineValidators; } - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; return obj; }, diff --git a/__fixtures__/v-next/outputv4/tendermint/types/params.ts b/__fixtures__/v-next/outputv4/tendermint/types/params.ts index 7ac17d0710..5c31de35d1 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/params.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/params.ts @@ -396,9 +396,9 @@ export const BlockParams = { }, toAmino(message: BlockParams): BlockParamsAmino { const obj: any = {}; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; - obj.max_gas = message.maxGas ? message.maxGas.toString() : undefined; - obj.time_iota_ms = message.timeIotaMs ? message.timeIotaMs.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; + obj.max_gas = message.maxGas !== BigInt(0) ? message.maxGas.toString() : undefined; + obj.time_iota_ms = message.timeIotaMs !== BigInt(0) ? message.timeIotaMs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockParamsAminoMsg): BlockParams { @@ -524,9 +524,9 @@ export const EvidenceParams = { }, toAmino(message: EvidenceParams): EvidenceParamsAmino { const obj: any = {}; - obj.max_age_num_blocks = message.maxAgeNumBlocks ? message.maxAgeNumBlocks.toString() : undefined; + obj.max_age_num_blocks = message.maxAgeNumBlocks !== BigInt(0) ? message.maxAgeNumBlocks.toString() : undefined; obj.max_age_duration = message.maxAgeDuration ? Duration.toAmino(message.maxAgeDuration) : undefined; - obj.max_bytes = message.maxBytes ? message.maxBytes.toString() : undefined; + obj.max_bytes = message.maxBytes !== BigInt(0) ? message.maxBytes.toString() : undefined; return obj; }, fromAminoMsg(object: EvidenceParamsAminoMsg): EvidenceParams { @@ -714,7 +714,7 @@ export const VersionParams = { }, toAmino(message: VersionParams): VersionParamsAmino { const obj: any = {}; - obj.app_version = message.appVersion ? message.appVersion.toString() : undefined; + obj.app_version = message.appVersion !== BigInt(0) ? message.appVersion.toString() : undefined; return obj; }, fromAminoMsg(object: VersionParamsAminoMsg): VersionParams { @@ -822,8 +822,8 @@ export const HashedParams = { }, toAmino(message: HashedParams): HashedParamsAmino { const obj: any = {}; - obj.block_max_bytes = message.blockMaxBytes ? message.blockMaxBytes.toString() : undefined; - obj.block_max_gas = message.blockMaxGas ? message.blockMaxGas.toString() : undefined; + obj.block_max_bytes = message.blockMaxBytes !== BigInt(0) ? message.blockMaxBytes.toString() : undefined; + obj.block_max_gas = message.blockMaxGas !== BigInt(0) ? message.blockMaxGas.toString() : undefined; return obj; }, fromAminoMsg(object: HashedParamsAminoMsg): HashedParams { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/types.ts b/__fixtures__/v-next/outputv4/tendermint/types/types.ts index 1c6e685520..62180c51dc 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/types.ts @@ -969,7 +969,7 @@ export const Header = { const obj: any = {}; obj.version = message.version ? Consensus.toAmino(message.version) : undefined; obj.chain_id = message.chainId === "" ? undefined : message.chainId; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.time = message.time ? Timestamp.toAmino(toTimestamp(message.time)) : undefined; obj.last_block_id = message.lastBlockId ? BlockID.toAmino(message.lastBlockId) : undefined; obj.last_commit_hash = message.lastCommitHash ? base64FromBytes(message.lastCommitHash) : undefined; @@ -1283,7 +1283,7 @@ export const Vote = { toAmino(message: Vote): VoteAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; obj.timestamp = message.timestamp ? Timestamp.toAmino(toTimestamp(message.timestamp)) : undefined; @@ -1435,7 +1435,7 @@ export const Commit = { }, toAmino(message: Commit): CommitAmino { const obj: any = {}; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; if (message.signatures) { @@ -1770,7 +1770,7 @@ export const Proposal = { toAmino(message: Proposal): ProposalAmino { const obj: any = {}; obj.type = message.type === 0 ? undefined : message.type; - obj.height = message.height ? message.height.toString() : undefined; + obj.height = message.height !== BigInt(0) ? message.height.toString() : undefined; obj.round = message.round === 0 ? undefined : message.round; obj.pol_round = message.polRound === 0 ? undefined : message.polRound; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; @@ -2138,9 +2138,9 @@ export const BlockMeta = { toAmino(message: BlockMeta): BlockMetaAmino { const obj: any = {}; obj.block_id = message.blockId ? BlockID.toAmino(message.blockId) : undefined; - obj.block_size = message.blockSize ? message.blockSize.toString() : undefined; + obj.block_size = message.blockSize !== BigInt(0) ? message.blockSize.toString() : undefined; obj.header = message.header ? Header.toAmino(message.header) : undefined; - obj.num_txs = message.numTxs ? message.numTxs.toString() : undefined; + obj.num_txs = message.numTxs !== BigInt(0) ? message.numTxs.toString() : undefined; return obj; }, fromAminoMsg(object: BlockMetaAminoMsg): BlockMeta { diff --git a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts index e4dcd1df7b..cd32dbc43c 100644 --- a/__fixtures__/v-next/outputv4/tendermint/types/validator.ts +++ b/__fixtures__/v-next/outputv4/tendermint/types/validator.ts @@ -161,7 +161,7 @@ export const ValidatorSet = { obj.validators = message.validators; } obj.proposer = message.proposer ? Validator.toAmino(message.proposer) : undefined; - obj.total_voting_power = message.totalVotingPower ? message.totalVotingPower.toString() : undefined; + obj.total_voting_power = message.totalVotingPower !== BigInt(0) ? message.totalVotingPower.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorSetAminoMsg): ValidatorSet { @@ -305,8 +305,8 @@ export const Validator = { const obj: any = {}; obj.address = message.address ? base64FromBytes(message.address) : undefined; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; - obj.proposer_priority = message.proposerPriority ? message.proposerPriority.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; + obj.proposer_priority = message.proposerPriority !== BigInt(0) ? message.proposerPriority.toString() : undefined; return obj; }, fromAminoMsg(object: ValidatorAminoMsg): Validator { @@ -415,7 +415,7 @@ export const SimpleValidator = { toAmino(message: SimpleValidator): SimpleValidatorAmino { const obj: any = {}; obj.pub_key = message.pubKey ? PublicKey.toAmino(message.pubKey) : undefined; - obj.voting_power = message.votingPower ? message.votingPower.toString() : undefined; + obj.voting_power = message.votingPower !== BigInt(0) ? message.votingPower.toString() : undefined; return obj; }, fromAminoMsg(object: SimpleValidatorAminoMsg): SimpleValidator { diff --git a/__fixtures__/v-next/outputv4/tendermint/version/types.ts b/__fixtures__/v-next/outputv4/tendermint/version/types.ts index a4fa8adb2e..1f1933a734 100644 --- a/__fixtures__/v-next/outputv4/tendermint/version/types.ts +++ b/__fixtures__/v-next/outputv4/tendermint/version/types.ts @@ -132,7 +132,7 @@ export const App = { }, toAmino(message: App): AppAmino { const obj: any = {}; - obj.protocol = message.protocol ? message.protocol.toString() : undefined; + obj.protocol = message.protocol !== BigInt(0) ? message.protocol.toString() : undefined; obj.software = message.software === "" ? undefined : message.software; return obj; }, @@ -241,8 +241,8 @@ export const Consensus = { }, toAmino(message: Consensus): ConsensusAmino { const obj: any = {}; - obj.block = message.block ? message.block.toString() : undefined; - obj.app = message.app ? message.app.toString() : undefined; + obj.block = message.block !== BigInt(0) ? message.block.toString() : undefined; + obj.app = message.app !== BigInt(0) ? message.app.toString() : undefined; return obj; }, fromAminoMsg(object: ConsensusAminoMsg): Consensus { diff --git a/package.json b/package.json index bc8a41e7e9..ebe8b4e697 100644 --- a/package.json +++ b/package.json @@ -11,6 +11,7 @@ "ast:fixture": "lerna run test:ast --parallel --scope \"@cosmology/ast\"", "ast:watch": "lerna run test:watch --parallel --scope \"@cosmology/ast\"", "regen": "lerna run test --parallel --scope \"@cosmology/telescope\"", + "resnap": "lerna run test:update --parallel --scope \"@cosmology/ast\"", "buidl:clean": "lerna run buidl:clean", "buidl:ast": "lerna run buidl --parallel --scope \"@cosmology/ast\"", "buidl:parser": "lerna run buidl --parallel --scope \"@cosmology/proto-parser\"", diff --git a/packages/ast/package.json b/packages/ast/package.json index adba1c0edd..85a0f44ac6 100644 --- a/packages/ast/package.json +++ b/packages/ast/package.json @@ -32,6 +32,7 @@ "test": "jest", "test:ast": "cross-env NODE_ENV=development babel-node scripts/test-ast.js", "test:watch": "jest --watch", + "test:update": "jest --watch -u", "test:debug": "node --inspect node_modules/.bin/jest --runInBand" }, "jest": { diff --git a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap index a549615d9f..e14639e7ad 100644 --- a/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/object.spec.ts.snap @@ -324,7 +324,7 @@ exports[`cosmos/tx/signing/v1beta1/signing SignatureDescriptor 1`] = ` const obj: any = {}; obj.public_key = message.publicKey ? Any.toAmino(message.publicKey) : undefined; obj.data = message.data ? SignatureDescriptor_Data.toAmino(message.data) : undefined; - obj.sequence = message.sequence ? message.sequence.toString() : undefined; + obj.sequence = message.sequence !== BigInt(0) ? message.sequence.toString() : undefined; return obj; }, fromAminoMsg(object: SignatureDescriptorAminoMsg): SignatureDescriptor { @@ -2265,8 +2265,8 @@ exports[`google/api/expr/v1alpha1/syntax Constant 1`] = ` const obj: any = {}; obj.null_value = message.nullValue === null ? undefined : message.nullValue; obj.bool_value = message.boolValue === null ? undefined : message.boolValue; - obj.int64_value = message.int64Value ? message.int64Value.toString() : undefined; - obj.uint64_value = message.uint64Value ? message.uint64Value.toString() : undefined; + obj.int64_value = message.int64Value !== BigInt(0) ? message.int64Value.toString() : undefined; + obj.uint64_value = message.uint64Value !== BigInt(0) ? message.uint64Value.toString() : undefined; obj.double_value = message.doubleValue === null ? undefined : message.doubleValue; obj.string_value = message.stringValue === null ? undefined : message.stringValue; obj.bytes_value = message.bytesValue ? base64FromBytes(message.bytesValue) : undefined; @@ -3716,18 +3716,6 @@ exports[`ibc/core/types/v1/genesis name collisions 3`] = ` "name": "GenesisState", "type": "typeImport", }, - { - "import": "ibc/core/client/v1/genesis.proto", - "importedAs": "GenesisState1", - "name": "GenesisState", - "type": "typeImport", - }, - { - "import": "ibc/core/connection/v1/genesis.proto", - "importedAs": "GenesisState2", - "name": "GenesisState", - "type": "typeImport", - }, { "import": "ibc/core/connection/v1/genesis.proto", "importedAs": "GenesisState2", @@ -3740,12 +3728,6 @@ exports[`ibc/core/types/v1/genesis name collisions 3`] = ` "name": "GenesisState", "type": "typeImport", }, - { - "import": "ibc/core/channel/v1/genesis.proto", - "importedAs": "GenesisState3", - "name": "GenesisState", - "type": "typeImport", - }, ] `; @@ -3970,7 +3952,7 @@ exports[`osmosis/gamm/v1beta1/tx MsgJoinPool 1`] = ` toAmino(message: MsgJoinPool): MsgJoinPoolAmino { const obj: any = {}; obj.sender = message.sender === "" ? undefined : message.sender; - obj.pool_id = message.poolId ? message.poolId.toString() : undefined; + obj.pool_id = message.poolId !== BigInt(0) ? message.poolId.toString() : undefined; obj.share_out_amount = message.shareOutAmount === "" ? undefined : message.shareOutAmount; if (message.tokenInMaxs) { obj.token_in_maxs = message.tokenInMaxs.map(e => e ? Coin.toAmino(e) : undefined); diff --git a/packages/ast/src/encoding/__tests__/misc.overall.test.ts b/packages/ast/src/encoding/__tests__/misc.overall.test.ts index dc59ae6ff4..0ebe36ed68 100644 --- a/packages/ast/src/encoding/__tests__/misc.overall.test.ts +++ b/packages/ast/src/encoding/__tests__/misc.overall.test.ts @@ -29,7 +29,8 @@ cases( context.options.interfaces!.enabled = true; context.options.interfaces!.useGlobalDecoderRegistry = true; context.options.aminoEncoding = { - enabled: true + enabled: true, + omitEmptyTags: ["omitempty" , "dont_omitempty"] } expectCode( diff --git a/packages/ast/src/encoding/amino/to-amino-json/index.ts b/packages/ast/src/encoding/amino/to-amino-json/index.ts index 63eeaeea03..ad993c66c8 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/index.ts @@ -5,6 +5,7 @@ import { ProtoType, ProtoField } from '@cosmology/types'; import { protoFieldsToArray } from '../utils'; import { arrayTypes, toAmino } from './utils'; import { getFieldOptionality, getOneOfs } from '../../proto'; +import { shouldOmitEmpty } from '@cosmology/utils'; const needsImplementation = (name: string, field: ProtoField) => { throw new Error(`need to implement toAmino (${field.type} rules[${field.rule}] name[${name}])`); @@ -131,7 +132,7 @@ export const toAminoParseField = ({ } } - let omitEmpty = AminoUtils.shouldOmitEmpty(field); + let omitEmpty = shouldOmitEmpty(args.context, field); // scalar types... switch (field.type) { diff --git a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap index 8303432a82..fbdac4b5fb 100644 --- a/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap +++ b/packages/ast/src/encoding/proto/__snapshots__/interfaces-amino.test.ts.snap @@ -160,8 +160,8 @@ exports[`Height 1`] = ` }, toAmino(message: Height): HeightAmino { const obj: any = {}; - obj.revision_number = message.revisionNumber ? message.revisionNumber.toString() : undefined; - obj.revision_height = message.revisionHeight ? message.revisionHeight.toString() : undefined; + obj.revision_number = message.revisionNumber !== BigInt(0) ? message.revisionNumber.toString() : undefined; + obj.revision_height = message.revisionHeight !== BigInt(0) ? message.revisionHeight.toString() : undefined; return obj; }, fromAminoMsg(object: HeightAminoMsg): Height { @@ -759,7 +759,7 @@ exports[`MsgTransfer 1`] = ` obj.sender = message.sender === "" ? undefined : message.sender; obj.receiver = message.receiver === "" ? undefined : message.receiver; obj.timeout_height = message.timeoutHeight ? Height.toAmino(message.timeoutHeight) : {}; - obj.timeout_timestamp = message.timeoutTimestamp ? message.timeoutTimestamp.toString() : undefined; + obj.timeout_timestamp = message.timeoutTimestamp !== BigInt(0) ? message.timeoutTimestamp.toString() : undefined; return obj; }, fromAminoMsg(object: MsgTransferAminoMsg): MsgTransfer { diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 99731bb99b..737027470c 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -2,17 +2,15 @@ import * as t from '@babel/types'; import { ProtoType } from '@cosmology/types'; import { AminoUtils, BILLION, identifier, TypeLong } from '../../../utils'; import { ProtoParseContext } from '../../context'; -import { getDefaultTSTypeFromProtoType, getFieldNames } from '../../types'; +import { getDefaultTSTypeFromProtoType, getFieldNames, getDefaultTSTypeFromAminoTypeDefault } from '../../types'; import { getInterfaceToAminoName } from '../implements'; import { ToAminoJSONMethod } from './index'; +import { shouldOmitEmpty } from '@cosmology/utils'; const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - // currently the "(amino.dont_omitempty)" does not work on cosmos sdk - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const omitEmpty = AminoUtils.shouldOmitEmpty(args.field); - + const omitEmpty = shouldOmitEmpty(args.context, args.field); valExpr = valExpr ?? t.memberExpression(t.identifier("message"), t.identifier(propName)); @@ -105,39 +103,39 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { return toAminoJSON.scalar(args); }, + // obj.big = message.big ? message.big.toString() : "0"; + // obj.o_big = message.oBig !== BigInt(0) ? message.oBig.toString() : undefined; long(args: ToAminoJSONMethod) { - const { propName, origName } = getFieldNames(args.field); - - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const omitEmpty = AminoUtils.shouldOmitEmpty(args.field); + const { propName, origName } = getFieldNames(args.field); - return t.expressionStatement( - t.assignmentExpression( - '=', - t.memberExpression( - t.identifier('obj'), - t.identifier(origName) - ), - t.conditionalExpression( - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ), - t.callExpression( - t.memberExpression( - t.memberExpression( - t.identifier('message'), - t.identifier(propName) - ), - t.identifier('toString') - ), - [] - ), - omitEmpty ? t.identifier('undefined') : t.stringLiteral("0") - ) - ) - ); + const omitEmpty = shouldOmitEmpty(args.context, args.field); + const nullTest = omitEmpty + ? TypeLong.getLongNotZero(propName, args.context) + : t.memberExpression( + t.identifier("message"), + t.identifier(propName) + ); + return t.expressionStatement( + t.assignmentExpression( + "=", + t.memberExpression(t.identifier("obj"), t.identifier(origName)), + t.conditionalExpression( + nullTest, + t.callExpression( + t.memberExpression( + t.memberExpression( + t.identifier("message"), + t.identifier(propName) + ), + t.identifier("toString") + ), + [] + ), + omitEmpty ? t.identifier("undefined") : t.stringLiteral("0") + ) + ) + ); }, int64(args: ToAminoJSONMethod) { return toAminoJSON.long(args); @@ -155,17 +153,17 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { return toAminoJSON.long(args); }, + // obj.proto = message.proto ? AccessConfig.toAmino(message.proto) : AccessConfig.toAmino(AccessConfig.fromPartial({})); + // obj.o_proto = message.oProto ? AccessConfig.toAmino(message.oProto) : undefined; protoType(args: ToAminoJSONMethod) { const { propName, origName } = getFieldNames(args.field); const name = args.context.getTypeName(args.field); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); + const omitEmpty = shouldOmitEmpty(args.context, args.field); + + let defaultValue: t.Expression = omitEmpty ? t.identifier('undefined') : getDefaultTSTypeFromAminoTypeDefault(args.context, args.field); - let defaultValue = getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true); - let emptyValue: t.Expression = dontOmitempty ? defaultValue : t.identifier('undefined'); if (args.field.type === 'ibc.core.client.v1.Height') { - emptyValue = t.objectExpression([]) defaultValue = t.objectExpression([]) } @@ -196,7 +194,7 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { ] : []), ] ), - emptyValue + defaultValue ) ) ); @@ -209,11 +207,9 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { args.context.getTypeName(args.field); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - + const omitEmpty = shouldOmitEmpty(args.context, args.field); - let defaultValue: t.Expression = dontOmitempty ? t.objectExpression([ + let defaultValue: t.Expression = !omitEmpty ? t.objectExpression([ t.objectProperty(t.identifier("type"), t.stringLiteral("")), t.objectProperty(t.identifier("value"), t.objectExpression([])), ]) : t.identifier('undefined'); @@ -291,10 +287,10 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { args.context.addUtil('base64FromBytes'); const { propName, origName } = getFieldNames(args.field); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? t.stringLiteral("") : t.identifier('undefined'); + const omitEmpty = shouldOmitEmpty(args.context,args.field); + + let defaultValue: t.Expression = !omitEmpty ? t.stringLiteral("") : t.identifier('undefined'); const expr = t.callExpression( t.identifier('base64FromBytes'), @@ -346,10 +342,10 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); args.context.addUtil('toTimestamp'); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) : t.identifier('undefined'); + const omitEmpty = shouldOmitEmpty(args.context,args.field); + + let defaultValue: t.Expression = !omitEmpty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) : t.identifier('undefined'); return t.expressionStatement( t.assignmentExpression( @@ -391,10 +387,9 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); + const omitEmpty = shouldOmitEmpty(args.context,args.field); - let defaultValue: t.Expression = dontOmitempty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) : t.identifier('undefined'); + let defaultValue: t.Expression = !omitEmpty ? getDefaultTSTypeFromProtoType(args.context, args.field, args.isOneOf, true) : t.identifier('undefined'); return t.expressionStatement( t.assignmentExpression( @@ -430,10 +425,10 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? t.objectExpression([]) : t.identifier('undefined'); + const omitEmpty = shouldOmitEmpty(args.context,args.field); + + let defaultValue: t.Expression = !omitEmpty ? t.objectExpression([]) : t.identifier('undefined'); return t.expressionStatement( t.assignmentExpression( @@ -477,10 +472,10 @@ const setValue = (args: ToAminoJSONMethod, valExpr?: t.Expression) => { const { propName, origName } = getFieldNames(args.field); - // const dontOmitempty = args.field.options["(amino.dont_omitempty)"]; - const dontOmitempty = !AminoUtils.shouldOmitEmpty(args.field); - let defaultValue: t.Expression = dontOmitempty ? t.stringLiteral("") : t.identifier('undefined'); + const omitEmpty = shouldOmitEmpty(args.context,args.field); + + let defaultValue: t.Expression = !omitEmpty ? t.stringLiteral("") : t.identifier('undefined'); return t.expressionStatement( t.assignmentExpression( diff --git a/packages/ast/src/encoding/proto/types.ts b/packages/ast/src/encoding/proto/types.ts index cf6c19ab06..373abe4627 100644 --- a/packages/ast/src/encoding/proto/types.ts +++ b/packages/ast/src/encoding/proto/types.ts @@ -1,6 +1,7 @@ import { ProtoType, ProtoField } from '@cosmology/types'; import { pascal } from 'case'; import { AminoParseContext, ProtoParseContext } from '../context'; +import { shouldOmitEmpty } from '@cosmology/utils'; export const SCALAR_TYPES = [ 'string', @@ -193,9 +194,7 @@ export const getFieldOptionalityForAmino = ( return true; } - const dontOmitempty = !!field?.options?.['(amino.dont_omitempty)']; - - return !dontOmitempty; + return shouldOmitEmpty(context, field) }; export const isScalarField = ( diff --git a/packages/ast/src/encoding/types.ts b/packages/ast/src/encoding/types.ts index c52d45e907..f7294fa9d9 100644 --- a/packages/ast/src/encoding/types.ts +++ b/packages/ast/src/encoding/types.ts @@ -521,6 +521,26 @@ export const getDefaultTSTypeFromProtoType = ( }; }; +export const getDefaultTSTypeFromAminoTypeDefault = ( + context: ProtoParseContext, + field: ProtoField +) => { + const typeName = getProtoFieldTypeName(context, field); + + return t.callExpression( + t.memberExpression(t.identifier(typeName), t.identifier("toAmino")), + [ + t.callExpression( + t.memberExpression( + t.identifier(getProtoFieldTypeName(context, field)), + t.identifier("fromPartial") + ), + [t.objectExpression([])] + ), + ] + ); +}; + function getDefaultTSTypeFromProtoTypeDefault(context: ProtoParseContext,field: ProtoField) { return t.callExpression( t.memberExpression( @@ -530,3 +550,4 @@ function getDefaultTSTypeFromProtoTypeDefault(context: ProtoParseContext,field: [t.objectExpression([])] ) } + diff --git a/packages/ast/types/encoding/types.d.ts b/packages/ast/types/encoding/types.d.ts index 80377b5339..7a5a238357 100644 --- a/packages/ast/types/encoding/types.d.ts +++ b/packages/ast/types/encoding/types.d.ts @@ -28,3 +28,4 @@ export declare const getTSTypeFromGoogleType: (context: GenericParseContext, typ export declare const getTSTypeForAmino: (context: GenericParseContext, field: ProtoField) => t.TSAnyKeyword | t.TSBooleanKeyword | t.TSNumberKeyword | t.TSStringKeyword | t.TSTypeReference; export declare const getTSTypeForProto: (context: GenericParseContext, field: ProtoField) => t.TSBooleanKeyword | t.TSNumberKeyword | t.TSStringKeyword | t.TSTypeReference; export declare const getDefaultTSTypeFromProtoType: (context: ProtoParseContext, field: ProtoField, isOneOf: boolean, useNullForOptionals?: boolean) => t.Expression; +export declare const getDefaultTSTypeFromAminoTypeDefault: (context: ProtoParseContext, field: ProtoField) => t.CallExpression; diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index c6f29bad93..6d9e2fc983 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -141,7 +141,7 @@ interface TelescopeOpts { customTypes?: { useCosmosSDKDec?: boolean; }, - omitEmptyTags: ( "omitempty" | "dont_omitempty" )[]; + omitEmptyTags?: ( "omitempty" | "dont_omitempty" )[]; useProtoOptionality?: boolean; disableMsgTypes?: boolean; casingFn?: Function; diff --git a/packages/types/types/telescope.d.ts b/packages/types/types/telescope.d.ts index d26a681419..761ac2c98c 100644 --- a/packages/types/types/telescope.d.ts +++ b/packages/types/types/telescope.d.ts @@ -115,7 +115,7 @@ interface TelescopeOpts { customTypes?: { useCosmosSDKDec?: boolean; }; - omitEmptyTags: ("omitempty" | "dont_omitempty")[]; + omitEmptyTags?: ("omitempty" | "dont_omitempty")[]; useProtoOptionality?: boolean; disableMsgTypes?: boolean; casingFn?: Function; diff --git a/packages/utils/src/__tests__/amino.test.ts b/packages/utils/src/__tests__/amino.test.ts index b80522ff72..68d2ddc971 100644 --- a/packages/utils/src/__tests__/amino.test.ts +++ b/packages/utils/src/__tests__/amino.test.ts @@ -136,6 +136,16 @@ describe("shouldOmitEmpty", () => { }, result: false, }, + { + name: "omitEmptyTags: omitempty, if options is null, then true. And amino.dont_omitempty will be ignored.", + pluginValue: ["omitempty"], + options: { + "(gogoproto.jsontag)": "attributes", + "(cosmos_proto.json_tag)": "attributes", + "(amino.dont_omitempty)": false, + }, + result: false, + }, // aminoEncoding.omitEmptyTags includes "dont_omitempty" only // if amino.dont_omitempty is true, then false, otherwise true. From 5fd9703cbe33da499637d186447cb37e92168eaa Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sun, 17 Mar 2024 15:06:32 +0800 Subject: [PATCH 19/24] flag for amino legacy null handling --- .../amino-legacy/misc/tx.amino.ts | 40 +- .../akash/audit/v1beta1/audit.amino.ts | 2 +- .../akash/audit/v1beta2/audit.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 16 +- .../akash/provider/v1beta1/provider.amino.ts | 4 +- .../akash/provider/v1beta2/provider.amino.ts | 4 +- .../output1/cosmos/authz/v1beta1/tx.amino.ts | 2 +- .../output1/cosmos/bank/v1beta1/tx.amino.ts | 10 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 2 +- .../output1/cosmos/gov/v1/tx.amino.ts | 8 +- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../output1/cosmos/group/v1/tx.amino.ts | 8 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 8 +- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../output1/evmos/fees/v1/tx.amino.ts | 2 +- .../output1/evmos/vesting/v1/tx.amino.ts | 8 +- .../ibc/core/connection/v1/tx.amino.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 6 +- .../gamm/pool-models/stableswap/tx.amino.ts | 6 +- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 8 +- .../output1/osmosis/incentives/tx.amino.ts | 4 +- .../output1/osmosis/lockup/tx.amino.ts | 6 +- .../output1/osmosis/superfluid/tx.amino.ts | 2 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 2 +- .../akash/audit/v1beta1/audit.amino.ts | 2 +- .../akash/audit/v1beta2/audit.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 16 +- .../akash/provider/v1beta1/provider.amino.ts | 4 +- .../akash/provider/v1beta2/provider.amino.ts | 4 +- .../cosmos/authz/v1beta1/tx.amino.ts | 2 +- .../cosmos/bank/v1beta1/tx.amino.ts | 10 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 2 +- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 8 +- .../cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 8 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 8 +- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../outputosmojs/evmos/fees/v1/tx.amino.ts | 2 +- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 8 +- .../ibc/applications/fee/v1/tx.amino.ts | 12 +- .../ibc/core/connection/v1/tx.amino.ts | 2 +- .../concentrated-liquidity/tx.amino.ts | 6 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 6 +- .../gamm/pool-models/stableswap/tx.amino.ts | 6 +- .../osmosis/gamm/v1beta1/tx.amino.ts | 8 +- .../osmosis/incentives/tx.amino.ts | 4 +- .../outputosmojs/osmosis/lockup/tx.amino.ts | 6 +- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 4 +- .../osmosis/protorev/v1beta1/tx.amino.ts | 8 +- .../osmosis/superfluid/tx.amino.ts | 2 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 2 +- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 4 +- .../akash/audit/v1beta1/audit.amino.ts | 2 +- .../akash/audit/v1beta2/audit.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 16 +- .../akash/provider/v1beta1/provider.amino.ts | 4 +- .../akash/provider/v1beta2/provider.amino.ts | 4 +- .../outputv4/cosmos/authz/v1beta1/tx.amino.ts | 2 +- .../outputv4/cosmos/bank/v1beta1/tx.amino.ts | 10 +- .../cosmos/distribution/v1beta1/tx.amino.ts | 2 +- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 8 +- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../outputv4/cosmos/group/v1/tx.amino.ts | 8 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 8 +- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../v-next/outputv4/evmos/fees/v1/tx.amino.ts | 2 +- .../outputv4/evmos/vesting/v1/tx.amino.ts | 8 +- .../ibc/core/connection/v1/tx.amino.ts | 2 +- .../gamm/pool-models/balancer/tx/tx.amino.ts | 6 +- .../gamm/pool-models/stableswap/tx.amino.ts | 6 +- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 8 +- .../outputv4/osmosis/incentives/tx.amino.ts | 4 +- .../outputv4/osmosis/lockup/tx.amino.ts | 6 +- .../outputv4/osmosis/superfluid/tx.amino.ts | 2 +- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 2 +- .../__snapshots__/cosmwasm.test.ts.snap | 4 +- .../__snapshots__/lockup.test.ts.snap | 4 +- .../__snapshots__/tendermint.test.ts.snap | 4 +- .../amino-converter.spec.ts.snap | 10 +- .../__tests__/__snapshots__/vote.test.ts.snap | 6 +- .../encoding/amino/from-amino-json/utils.ts | 528 +++++++++++------- .../src/encoding/amino/to-amino-json/index.ts | 2 +- .../ast/src/encoding/proto/to-amino/utils.ts | 2 +- packages/ast/src/utils/amino.ts | 12 - packages/ast/src/utils/index.ts | 3 +- packages/ast/src/utils/utils.ts | 322 ++++++----- .../encoding/amino/from-amino-json/utils.d.ts | 16 +- packages/ast/types/utils/index.d.ts | 1 - packages/ast/types/utils/utils.d.ts | 2 +- .../__tests__/telescope-instant-rpc.test.ts | 3 + packages/types/src/telescope.ts | 3 + packages/types/types/telescope.d.ts | 3 + 92 files changed, 765 insertions(+), 600 deletions(-) delete mode 100644 packages/ast/src/utils/amino.ts diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts index fc7ff4bbec..9fc520edde 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -388,35 +388,35 @@ export const AminoConverter = { dOPubkey: encodePubkey(pubkey), nums: d_o_tests.nums, dONums: d_o_tests.d_o_nums, - bigs: d_o_tests.bigs.map?.(el1 => BigInt(el1)), - dOBigs: d_o_tests.d_o_bigs.map?.(el1 => BigInt(el1)), + bigs: d_o_tests.bigs.map(el1 => BigInt(el1)), + dOBigs: d_o_tests.d_o_bigs.map(el1 => BigInt(el1)), salts: d_o_tests.salts, dOSalts: d_o_tests.d_o_salts, raws: d_o_tests.raws, dORaws: d_o_tests.d_o_raws, wasms: d_o_tests.wasms, dOWasms: d_o_tests.d_o_wasms, - opts: d_o_tests.opts.map?.(el => voteOptionFromJSON(el)), - dOOpts: d_o_tests.d_o_opts.map?.(el => voteOptionFromJSON(el)), - periods: d_o_tests.periods.map?.(el1 => ({ + opts: d_o_tests.opts.map(el => voteOptionFromJSON(el)), + dOOpts: d_o_tests.d_o_opts.map(el => voteOptionFromJSON(el)), + periods: d_o_tests.periods.map(el1 => ({ seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), nanos: el1.nanos })), - dOPeriods: d_o_tests.d_o_periods.map?.(el1 => ({ + dOPeriods: d_o_tests.d_o_periods.map(el1 => ({ seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), nanos: el1.nanos })), - protos: d_o_tests.protos.map?.(el1 => ({ + protos: d_o_tests.protos.map(el1 => ({ sender: el1.sender })), - dOProtos: d_o_tests.d_o_protos.map?.(el1 => ({ + dOProtos: d_o_tests.d_o_protos.map(el1 => ({ sender: el1.sender })), - auths: d_o_tests.auths.map?.(el1 => ({ + auths: d_o_tests.auths.map(el1 => ({ typeUrl: el1.type_url, value: el1.value })), - dOAuths: d_o_tests.d_o_auths.map?.(el1 => ({ + dOAuths: d_o_tests.d_o_auths.map(el1 => ({ typeUrl: el1.type_url, value: el1.value })), @@ -470,35 +470,35 @@ export const AminoConverter = { oPubkey: encodePubkey(pubkey), nums: o_tests.nums, oNums: o_tests.o_nums, - bigs: o_tests.bigs.map?.(el1 => BigInt(el1)), - oBigs: o_tests.o_bigs.map?.(el1 => BigInt(el1)), + bigs: o_tests.bigs.map(el1 => BigInt(el1)), + oBigs: o_tests.o_bigs.map(el1 => BigInt(el1)), salts: o_tests.salts, oSalts: o_tests.o_salts, raws: o_tests.raws, oRaws: o_tests.o_raws, wasms: o_tests.wasms, oWasms: o_tests.o_wasms, - opts: o_tests.opts.map?.(el => voteOptionFromJSON(el)), - oOpts: o_tests.o_opts.map?.(el => voteOptionFromJSON(el)), - periods: o_tests.periods.map?.(el1 => ({ + opts: o_tests.opts.map(el => voteOptionFromJSON(el)), + oOpts: o_tests.o_opts.map(el => voteOptionFromJSON(el)), + periods: o_tests.periods.map(el1 => ({ seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), nanos: el1.nanos })), - oPeriods: o_tests.o_periods.map?.(el1 => ({ + oPeriods: o_tests.o_periods.map(el1 => ({ seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), nanos: el1.nanos })), - protos: o_tests.protos.map?.(el1 => ({ + protos: o_tests.protos.map(el1 => ({ sender: el1.sender })), - oProtos: o_tests.o_protos.map?.(el1 => ({ + oProtos: o_tests.o_protos.map(el1 => ({ sender: el1.sender })), - auths: o_tests.auths.map?.(el1 => ({ + auths: o_tests.auths.map(el1 => ({ typeUrl: el1.type_url, value: el1.value })), - oAuths: o_tests.o_auths.map?.(el1 => ({ + oAuths: o_tests.o_auths.map(el1 => ({ typeUrl: el1.type_url, value: el1.value })), diff --git a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts index 04457f59f0..b3c5e0e145 100644 --- a/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta1/audit.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts index 977a75b3b7..de83b12abd 100644 --- a/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/output1/akash/audit/v1beta2/audit.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index d4817891c2..182674bf72 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -234,25 +234,25 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) }, - groups: groups.map?.(el0 => ({ + groups: groups.map(el0 => ({ name: el0.name, requirements: el0.requirements == null ? el0.requirements : { signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map?.(el2 => ({ + attributes: el0.requirements.attributes.map(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map?.(el1 => ({ + resources: el0.resources.map(el1 => ({ resources: el1.resources == null ? el1.resources : { cpu: el1.resources.cpu == null ? el1.resources.cpu : { units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map?.(el4 => ({ + attributes: el1.resources.cpu.attributes.map(el4 => ({ key: el4.key, value: el4.value })) @@ -261,22 +261,22 @@ export const AminoConverter = { quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map?.(el4 => ({ + attributes: el1.resources.memory.attributes.map(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map?.(el3 => ({ + storage: el1.resources.storage.map(el3 => ({ name: el3.name, quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map?.(el4 => ({ + attributes: el3.attributes.map(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map?.(el3 => ({ + endpoints: el1.resources.endpoints.map(el3 => ({ kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) diff --git a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts index d4fdfe9032..bc115d76f9 100644 --- a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts @@ -69,7 +69,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), @@ -110,7 +110,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), diff --git a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts index 946fece8ef..a751ab4653 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts @@ -69,7 +69,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), @@ -110,7 +110,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts index 824747e564..4a9c5269c5 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts @@ -92,7 +92,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map?.(el0 => ({ + msgs: msgs.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })) diff --git a/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts index 85122e6a31..5352659e14 100644 --- a/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/bank/v1beta1/tx.amino.ts @@ -57,7 +57,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -92,16 +92,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map?.(el0 => ({ + inputs: inputs.map(el0 => ({ address: el0.address, - coins: el0.coins.map?.(el1 => ({ + coins: el0.coins.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map?.(el0 => ({ + outputs: outputs.map(el0 => ({ address: el0.address, - coins: el0.coins.map?.(el1 => ({ + coins: el0.coins.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts index a1a0dd4ca3..c7d34e047d 100644 --- a/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/distribution/v1beta1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index c2e68a4b01..2548c976d7 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -90,11 +90,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map?.(el0 => ({ + messages: messages.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -186,7 +186,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), @@ -218,7 +218,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index 416bbe811a..ad09884431 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -78,7 +78,7 @@ export const AminoConverter = { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -135,7 +135,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) @@ -166,7 +166,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index 155c6311b6..123b1c7b9c 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -173,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map?.(el0 => ({ + members: members.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -209,7 +209,7 @@ export const AminoConverter = { return { admin, groupId: group_id == null ? group_id : Long.fromString(group_id), - memberUpdates: member_updates.map?.(el0 => ({ + memberUpdates: member_updates.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -340,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map?.(el0 => ({ + members: members.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -468,7 +468,7 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map?.(el0 => ({ + messages: messages.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })), diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index 2bbf846aeb..c77acd7a38 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -106,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -144,9 +144,9 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time == null ? start_time : Long.fromString(start_time), - vestingPeriods: vesting_periods.map?.(el0 => ({ + vestingPeriods: vesting_periods.map(el0 => ({ length: el0.length == null ? el0.length : Long.fromString(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index fa256e4d76..1b2d91adbf 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -133,7 +133,7 @@ export const AminoConverter = { codeId: code_id == null ? code_id : Long.fromString(code_id), label, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -168,7 +168,7 @@ export const AminoConverter = { sender, contract, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/evmos/fees/v1/tx.amino.ts b/__fixtures__/output1/evmos/fees/v1/tx.amino.ts index 1017882b99..87695a734f 100644 --- a/__fixtures__/output1/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/fees/v1/tx.amino.ts @@ -51,7 +51,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map?.(el0 => Long.fromString(el0)) + nonces: nonces.map(el0 => Long.fromString(el0)) }; } }, diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index d09007ea64..ced9693ab4 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -79,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map?.(el0 => ({ + lockupPeriods: lockup_periods.map(el0 => ({ length: el0.length == null ? el0.length : Long.fromString(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map?.(el0 => ({ + vestingPeriods: vesting_periods.map(el0 => ({ length: el0.length == null ? el0.length : Long.fromString(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index bbc49934a4..b160359939 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -213,7 +213,7 @@ export const AminoConverter = { } }, delayPeriod: delay_period == null ? delay_period : Long.fromString(delay_period), - counterpartyVersions: counterparty_versions.map?.(el0 => ({ + counterpartyVersions: counterparty_versions.map(el0 => ({ identifier: el0.identifier, features: el0.features })), diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index d1f45e98f3..5212080da9 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -104,14 +104,14 @@ export const AminoConverter = { seconds: Long.fromNumber(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount @@ -120,7 +120,7 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map?.(el0 => ({ + poolAssets: pool_assets.map(el0 => ({ token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 08906e81a2..de366d7e5f 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -69,11 +69,11 @@ export const AminoConverter = { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map?.(el0 => Long.fromString(el0)), + scalingFactors: scaling_factors.map(el0 => Long.fromString(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -100,7 +100,7 @@ export const AminoConverter = { return { sender, poolId: pool_id == null ? pool_id : Long.fromString(pool_id), - scalingFactors: scaling_factors.map?.(el0 => Long.fromString(el0)) + scalingFactors: scaling_factors.map(el0 => Long.fromString(el0)) }; } } diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index 63c639cc5f..bea8660afb 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -130,7 +130,7 @@ export const AminoConverter = { sender, poolId: pool_id == null ? pool_id : Long.fromString(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map?.(el0 => ({ + tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -165,7 +165,7 @@ export const AminoConverter = { sender, poolId: pool_id == null ? pool_id : Long.fromString(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map?.(el0 => ({ + tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -201,7 +201,7 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : Long.fromString(el0.pool_id), tokenOutDenom: el0.token_out_denom })), @@ -242,7 +242,7 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : Long.fromString(el0.pool_id), tokenInDenom: el0.token_in_denom })), diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 9b53a2256c..13302e40dd 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -87,7 +87,7 @@ export const AminoConverter = { }, timestamp: distribute_to.timestamp }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -120,7 +120,7 @@ export const AminoConverter = { return { owner, gaugeId: gauge_id == null ? gauge_id : Long.fromString(gauge_id), - rewards: rewards.map?.(el0 => ({ + rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index 3147d04220..4b7ec5f978 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -86,7 +86,7 @@ export const AminoConverter = { seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -134,7 +134,7 @@ export const AminoConverter = { return { owner, ID: ID == null ? ID : Long.fromString(ID), - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -193,7 +193,7 @@ export const AminoConverter = { return { owner, ID: ID == null ? ID : Long.fromString(ID), - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index f1db653d28..5690ad05a0 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -134,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts index caf67c915c..1be16f5a73 100644 --- a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -192,7 +192,7 @@ export const AminoConverter = { sender, metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map?.(el1 => ({ + denomUnits: metadata.denom_units.map(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts index 04457f59f0..b3c5e0e145 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta1/audit.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts index 977a75b3b7..de83b12abd 100644 --- a/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/audit/v1beta2/audit.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index e5ef875175..112f873555 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -233,25 +233,25 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - groups: groups.map?.(el0 => ({ + groups: groups.map(el0 => ({ name: el0.name, requirements: el0.requirements == null ? el0.requirements : { signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map?.(el2 => ({ + attributes: el0.requirements.attributes.map(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map?.(el1 => ({ + resources: el0.resources.map(el1 => ({ resources: el1.resources == null ? el1.resources : { cpu: el1.resources.cpu == null ? el1.resources.cpu : { units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map?.(el4 => ({ + attributes: el1.resources.cpu.attributes.map(el4 => ({ key: el4.key, value: el4.value })) @@ -260,22 +260,22 @@ export const AminoConverter = { quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map?.(el4 => ({ + attributes: el1.resources.memory.attributes.map(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map?.(el3 => ({ + storage: el1.resources.storage.map(el3 => ({ name: el3.name, quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map?.(el4 => ({ + attributes: el3.attributes.map(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map?.(el3 => ({ + endpoints: el1.resources.endpoints.map(el3 => ({ kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts index d4fdfe9032..bc115d76f9 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts @@ -69,7 +69,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), @@ -110,7 +110,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts index 946fece8ef..a751ab4653 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts @@ -69,7 +69,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), @@ -110,7 +110,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts index 824747e564..4a9c5269c5 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts @@ -92,7 +92,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map?.(el0 => ({ + msgs: msgs.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts index 85122e6a31..5352659e14 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/bank/v1beta1/tx.amino.ts @@ -57,7 +57,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -92,16 +92,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map?.(el0 => ({ + inputs: inputs.map(el0 => ({ address: el0.address, - coins: el0.coins.map?.(el1 => ({ + coins: el0.coins.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map?.(el0 => ({ + outputs: outputs.map(el0 => ({ address: el0.address, - coins: el0.coins.map?.(el1 => ({ + coins: el0.coins.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts index a1a0dd4ca3..c7d34e047d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/distribution/v1beta1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index dcc1e90421..571eb66357 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -89,11 +89,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map?.(el0 => ({ + messages: messages.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -185,7 +185,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), @@ -217,7 +217,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index ff841eee46..1e74d4ac48 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -78,7 +78,7 @@ export const AminoConverter = { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -135,7 +135,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) @@ -166,7 +166,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index 618a0bd70a..3518cc077d 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -173,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map?.(el0 => ({ + members: members.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -209,7 +209,7 @@ export const AminoConverter = { return { admin, groupId: group_id == null ? group_id : BigInt(group_id), - memberUpdates: member_updates.map?.(el0 => ({ + memberUpdates: member_updates.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -340,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map?.(el0 => ({ + members: members.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -468,7 +468,7 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map?.(el0 => ({ + messages: messages.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })), diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index b6c3997b9b..ac022a3690 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -106,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -144,9 +144,9 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time == null ? start_time : BigInt(start_time), - vestingPeriods: vesting_periods.map?.(el0 => ({ + vestingPeriods: vesting_periods.map(el0 => ({ length: el0.length == null ? el0.length : BigInt(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index c466d644d8..037366286b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -133,7 +133,7 @@ export const AminoConverter = { codeId: code_id == null ? code_id : BigInt(code_id), label, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -168,7 +168,7 @@ export const AminoConverter = { sender, contract, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts index 48b3a5fef2..c226ee6556 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/fees/v1/tx.amino.ts @@ -50,7 +50,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map?.(el0 => BigInt(el0)) + nonces: nonces.map(el0 => BigInt(el0)) }; } }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index b37f873caf..15586a4c89 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -79,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map?.(el0 => ({ + lockupPeriods: lockup_periods.map(el0 => ({ length: el0.length == null ? el0.length : BigInt(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map?.(el0 => ({ + vestingPeriods: vesting_periods.map(el0 => ({ length: el0.length == null ? el0.length : BigInt(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts index 564e57d732..2fc542ef2c 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts @@ -164,15 +164,15 @@ export const AminoConverter = { }: MsgPayPacketFeeAminoType["value"]): MsgPayPacketFee => { return { fee: fee == null ? fee : { - recvFee: fee.recv_fee.map?.(el1 => ({ + recvFee: fee.recv_fee.map(el1 => ({ denom: el1.denom, amount: el1.amount })), - ackFee: fee.ack_fee.map?.(el1 => ({ + ackFee: fee.ack_fee.map(el1 => ({ denom: el1.denom, amount: el1.amount })), - timeoutFee: fee.timeout_fee.map?.(el1 => ({ + timeoutFee: fee.timeout_fee.map(el1 => ({ denom: el1.denom, amount: el1.amount })) @@ -216,15 +216,15 @@ export const AminoConverter = { return { packetFee: packet_fee == null ? packet_fee : { fee: packet_fee.fee == null ? packet_fee.fee : { - recvFee: packet_fee.fee.recv_fee.map?.(el2 => ({ + recvFee: packet_fee.fee.recv_fee.map(el2 => ({ denom: el2.denom, amount: el2.amount })), - ackFee: packet_fee.fee.ack_fee.map?.(el2 => ({ + ackFee: packet_fee.fee.ack_fee.map(el2 => ({ denom: el2.denom, amount: el2.amount })), - timeoutFee: packet_fee.fee.timeout_fee.map?.(el2 => ({ + timeoutFee: packet_fee.fee.timeout_fee.map(el2 => ({ denom: el2.denom, amount: el2.amount })) diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 9d90e69915..2b0def79de 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -213,7 +213,7 @@ export const AminoConverter = { } }, delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), - counterpartyVersions: counterparty_versions.map?.(el0 => ({ + counterpartyVersions: counterparty_versions.map(el0 => ({ identifier: el0.identifier, features: el0.features })), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index aae7dcda78..48206573b9 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -152,7 +152,7 @@ export const AminoConverter = { sender }: MsgCollectFeesAminoType["value"]): MsgCollectFees => { return { - positionIds: position_ids.map?.(el0 => BigInt(el0)), + positionIds: position_ids.map(el0 => BigInt(el0)), sender }; } @@ -173,7 +173,7 @@ export const AminoConverter = { sender }: MsgCollectIncentivesAminoType["value"]): MsgCollectIncentives => { return { - positionIds: position_ids.map?.(el0 => BigInt(el0)), + positionIds: position_ids.map(el0 => BigInt(el0)), sender }; } @@ -194,7 +194,7 @@ export const AminoConverter = { sender }: MsgFungifyChargedPositionsAminoType["value"]): MsgFungifyChargedPositions => { return { - positionIds: position_ids.map?.(el0 => BigInt(el0)), + positionIds: position_ids.map(el0 => BigInt(el0)), sender }; } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e028c4b738..f7dc37a131 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -103,14 +103,14 @@ export const AminoConverter = { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount @@ -119,7 +119,7 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map?.(el0 => ({ + poolAssets: pool_assets.map(el0 => ({ token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 165f81a64a..235fa81f60 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -69,11 +69,11 @@ export const AminoConverter = { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)), + scalingFactors: scaling_factors.map(el0 => BigInt(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -100,7 +100,7 @@ export const AminoConverter = { return { sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), - scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)) + scalingFactors: scaling_factors.map(el0 => BigInt(el0)) }; } } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index a511ea2294..24bf8274f7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -130,7 +130,7 @@ export const AminoConverter = { sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map?.(el0 => ({ + tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -165,7 +165,7 @@ export const AminoConverter = { sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map?.(el0 => ({ + tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -201,7 +201,7 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), @@ -242,7 +242,7 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index 8c8c011103..a1791c5798 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -87,7 +87,7 @@ export const AminoConverter = { }, timestamp: distribute_to.timestamp }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -120,7 +120,7 @@ export const AminoConverter = { return { owner, gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), - rewards: rewards.map?.(el0 => ({ + rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index 33e2ea5c7a..2e3b4c8331 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -86,7 +86,7 @@ export const AminoConverter = { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -134,7 +134,7 @@ export const AminoConverter = { return { owner, ID: ID == null ? ID : BigInt(ID), - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -193,7 +193,7 @@ export const AminoConverter = { return { owner, ID: ID == null ? ID : BigInt(ID), - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index b6d67c6630..8c2af5c0c4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), @@ -105,7 +105,7 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index d6797e44d0..d6b3baad7d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -92,9 +92,9 @@ export const AminoConverter = { }: MsgSetHotRoutesAminoType["value"]): MsgSetHotRoutes => { return { admin, - hotRoutes: hot_routes.map?.(el0 => ({ - arbRoutes: el0.arb_routes.map?.(el1 => ({ - trades: el1.trades.map?.(el2 => ({ + hotRoutes: hot_routes.map(el0 => ({ + arbRoutes: el0.arb_routes.map(el1 => ({ + trades: el1.trades.map(el2 => ({ pool: el2.pool == null ? el2.pool : BigInt(el2.pool), tokenIn: el2.token_in, tokenOut: el2.token_out @@ -219,7 +219,7 @@ export const AminoConverter = { }: MsgSetBaseDenomsAminoType["value"]): MsgSetBaseDenoms => { return { admin, - baseDenoms: base_denoms.map?.(el0 => ({ + baseDenoms: base_denoms.map(el0 => ({ denom: el0.denom, stepSize: el0.step_size })) diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index 91f77305ba..1b566dd666 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -134,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts index 0e3da3e533..faf7e687ca 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -192,7 +192,7 @@ export const AminoConverter = { sender, metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map?.(el1 => ({ + denomUnits: metadata.denom_units.map(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index 5ce47e66b7..a54e8516f0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -78,7 +78,7 @@ export const AminoConverter = { }: MsgSetValidatorSetPreferenceAminoType["value"]): MsgSetValidatorSetPreference => { return { delegator, - preferences: preferences.map?.(el0 => ({ + preferences: preferences.map(el0 => ({ valOperAddress: el0.val_oper_address, weight: el0.weight })) @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgRedelegateValidatorSetAminoType["value"]): MsgRedelegateValidatorSet => { return { delegator, - preferences: preferences.map?.(el0 => ({ + preferences: preferences.map(el0 => ({ valOperAddress: el0.val_oper_address, weight: el0.weight })) diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts index 04457f59f0..b3c5e0e145 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta1/audit.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts index 977a75b3b7..de83b12abd 100644 --- a/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/audit/v1beta2/audit.amino.ts @@ -46,7 +46,7 @@ export const AminoConverter = { return { owner, auditor, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })) diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index e5ef875175..112f873555 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -233,25 +233,25 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) }, - groups: groups.map?.(el0 => ({ + groups: groups.map(el0 => ({ name: el0.name, requirements: el0.requirements == null ? el0.requirements : { signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, - attributes: el0.requirements.attributes.map?.(el2 => ({ + attributes: el0.requirements.attributes.map(el2 => ({ key: el2.key, value: el2.value })) }, - resources: el0.resources.map?.(el1 => ({ + resources: el0.resources.map(el1 => ({ resources: el1.resources == null ? el1.resources : { cpu: el1.resources.cpu == null ? el1.resources.cpu : { units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { val: el1.resources.cpu.units.val }, - attributes: el1.resources.cpu.attributes.map?.(el4 => ({ + attributes: el1.resources.cpu.attributes.map(el4 => ({ key: el4.key, value: el4.value })) @@ -260,22 +260,22 @@ export const AminoConverter = { quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { val: el1.resources.memory.quantity.val }, - attributes: el1.resources.memory.attributes.map?.(el4 => ({ + attributes: el1.resources.memory.attributes.map(el4 => ({ key: el4.key, value: el4.value })) }, - storage: el1.resources.storage.map?.(el3 => ({ + storage: el1.resources.storage.map(el3 => ({ name: el3.name, quantity: el3.quantity == null ? el3.quantity : { val: el3.quantity.val }, - attributes: el3.attributes.map?.(el4 => ({ + attributes: el3.attributes.map(el4 => ({ key: el4.key, value: el4.value })) })), - endpoints: el1.resources.endpoints.map?.(el3 => ({ + endpoints: el1.resources.endpoints.map(el3 => ({ kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts index d4fdfe9032..bc115d76f9 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts @@ -69,7 +69,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), @@ -110,7 +110,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts index 946fece8ef..a751ab4653 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts @@ -69,7 +69,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), @@ -110,7 +110,7 @@ export const AminoConverter = { return { owner, hostUri: host_uri, - attributes: attributes.map?.(el0 => ({ + attributes: attributes.map(el0 => ({ key: el0.key, value: el0.value })), diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts index 824747e564..4a9c5269c5 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts @@ -92,7 +92,7 @@ export const AminoConverter = { }: MsgExecAminoType["value"]): MsgExec => { return { grantee, - msgs: msgs.map?.(el0 => ({ + msgs: msgs.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })) diff --git a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts index 85122e6a31..5352659e14 100644 --- a/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/bank/v1beta1/tx.amino.ts @@ -57,7 +57,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -92,16 +92,16 @@ export const AminoConverter = { outputs }: MsgMultiSendAminoType["value"]): MsgMultiSend => { return { - inputs: inputs.map?.(el0 => ({ + inputs: inputs.map(el0 => ({ address: el0.address, - coins: el0.coins.map?.(el1 => ({ + coins: el0.coins.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - outputs: outputs.map?.(el0 => ({ + outputs: outputs.map(el0 => ({ address: el0.address, - coins: el0.coins.map?.(el1 => ({ + coins: el0.coins.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts index a1a0dd4ca3..c7d34e047d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/distribution/v1beta1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { depositor }: MsgFundCommunityPoolAminoType["value"]): MsgFundCommunityPool => { return { - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index dcc1e90421..571eb66357 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -89,11 +89,11 @@ export const AminoConverter = { metadata }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - messages: messages.map?.(el0 => ({ + messages: messages.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })), - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -185,7 +185,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })), @@ -217,7 +217,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index ff841eee46..1e74d4ac48 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -78,7 +78,7 @@ export const AminoConverter = { typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -135,7 +135,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) @@ -166,7 +166,7 @@ export const AminoConverter = { return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index 618a0bd70a..3518cc077d 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -173,7 +173,7 @@ export const AminoConverter = { }: MsgCreateGroupAminoType["value"]): MsgCreateGroup => { return { admin, - members: members.map?.(el0 => ({ + members: members.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -209,7 +209,7 @@ export const AminoConverter = { return { admin, groupId: group_id == null ? group_id : BigInt(group_id), - memberUpdates: member_updates.map?.(el0 => ({ + memberUpdates: member_updates.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -340,7 +340,7 @@ export const AminoConverter = { }: MsgCreateGroupWithPolicyAminoType["value"]): MsgCreateGroupWithPolicy => { return { admin, - members: members.map?.(el0 => ({ + members: members.map(el0 => ({ address: el0.address, weight: el0.weight, metadata: el0.metadata, @@ -468,7 +468,7 @@ export const AminoConverter = { address, proposers, metadata, - messages: messages.map?.(el0 => ({ + messages: messages.map(el0 => ({ typeUrl: el0.type_url, value: el0.value })), diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index b6c3997b9b..ac022a3690 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -106,7 +106,7 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -144,9 +144,9 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time == null ? start_time : BigInt(start_time), - vestingPeriods: vesting_periods.map?.(el0 => ({ + vestingPeriods: vesting_periods.map(el0 => ({ length: el0.length == null ? el0.length : BigInt(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index c466d644d8..037366286b 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -133,7 +133,7 @@ export const AminoConverter = { codeId: code_id == null ? code_id : BigInt(code_id), label, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -168,7 +168,7 @@ export const AminoConverter = { sender, contract, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts index 48b3a5fef2..c226ee6556 100644 --- a/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/fees/v1/tx.amino.ts @@ -50,7 +50,7 @@ export const AminoConverter = { contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map?.(el0 => BigInt(el0)) + nonces: nonces.map(el0 => BigInt(el0)) }; } }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index b37f873caf..15586a4c89 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -79,16 +79,16 @@ export const AminoConverter = { fromAddress: from_address, toAddress: to_address, startTime: start_time, - lockupPeriods: lockup_periods.map?.(el0 => ({ + lockupPeriods: lockup_periods.map(el0 => ({ length: el0.length == null ? el0.length : BigInt(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - vestingPeriods: vesting_periods.map?.(el0 => ({ + vestingPeriods: vesting_periods.map(el0 => ({ length: el0.length == null ? el0.length : BigInt(el0.length), - amount: el0.amount.map?.(el1 => ({ + amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 9d90e69915..2b0def79de 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -213,7 +213,7 @@ export const AminoConverter = { } }, delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), - counterpartyVersions: counterparty_versions.map?.(el0 => ({ + counterpartyVersions: counterparty_versions.map(el0 => ({ identifier: el0.identifier, features: el0.features })), diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index e028c4b738..f7dc37a131 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -103,14 +103,14 @@ export const AminoConverter = { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, - initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map?.(el2 => ({ + initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), - targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map?.(el2 => ({ + targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ token: el2.token == null ? el2.token : { denom: el2.token.denom, amount: el2.token.amount @@ -119,7 +119,7 @@ export const AminoConverter = { })) } }, - poolAssets: pool_assets.map?.(el0 => ({ + poolAssets: pool_assets.map(el0 => ({ token: el0.token == null ? el0.token : { denom: el0.token.denom, amount: el0.token.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 165f81a64a..235fa81f60 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -69,11 +69,11 @@ export const AminoConverter = { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, - initialPoolLiquidity: initial_pool_liquidity.map?.(el0 => ({ + initialPoolLiquidity: initial_pool_liquidity.map(el0 => ({ denom: el0.denom, amount: el0.amount })), - scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)), + scalingFactors: scaling_factors.map(el0 => BigInt(el0)), futurePoolGovernor: future_pool_governor, scalingFactorController: scaling_factor_controller }; @@ -100,7 +100,7 @@ export const AminoConverter = { return { sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), - scalingFactors: scaling_factors.map?.(el0 => BigInt(el0)) + scalingFactors: scaling_factors.map(el0 => BigInt(el0)) }; } } diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index a511ea2294..24bf8274f7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -130,7 +130,7 @@ export const AminoConverter = { sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map?.(el0 => ({ + tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -165,7 +165,7 @@ export const AminoConverter = { sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map?.(el0 => ({ + tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -201,7 +201,7 @@ export const AminoConverter = { }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), @@ -242,7 +242,7 @@ export const AminoConverter = { }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index 8c8c011103..a1791c5798 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -87,7 +87,7 @@ export const AminoConverter = { }, timestamp: distribute_to.timestamp }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -120,7 +120,7 @@ export const AminoConverter = { return { owner, gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), - rewards: rewards.map?.(el0 => ({ + rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index 33e2ea5c7a..2e3b4c8331 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -86,7 +86,7 @@ export const AminoConverter = { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -134,7 +134,7 @@ export const AminoConverter = { return { owner, ID: ID == null ? ID : BigInt(ID), - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -193,7 +193,7 @@ export const AminoConverter = { return { owner, ID: ID == null ? ID : BigInt(ID), - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 91f77305ba..1b566dd666 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -134,7 +134,7 @@ export const AminoConverter = { }: MsgLockAndSuperfluidDelegateAminoType["value"]): MsgLockAndSuperfluidDelegate => { return { sender, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })), diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index 0e3da3e533..faf7e687ca 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -192,7 +192,7 @@ export const AminoConverter = { sender, metadata: metadata == null ? metadata : { description: metadata.description, - denomUnits: metadata.denom_units.map?.(el1 => ({ + denomUnits: metadata.denom_units.map(el1 => ({ denom: el1.denom, exponent: el1.exponent, aliases: el1.aliases diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap index d9889f0bf8..7c9b6f94fb 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap @@ -30,7 +30,7 @@ exports[`cosmwasm/wasm/v1/tx MsgExecuteContract 1`] = ` sender, contract, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -78,7 +78,7 @@ exports[`cosmwasm/wasm/v1/tx MsgInstantiateContract 1`] = ` codeId: code_id == null ? code_id : BigInt(code_id), label, msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), - funds: funds.map?.(el0 => ({ + funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap index 4083f2eb35..3bc59a3010 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap @@ -181,7 +181,7 @@ exports[`osmosis/lockup/tx duration 4`] = ` seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -369,7 +369,7 @@ exports[`osmosis/lockup/tx string 4`] = ` seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, - coins: coins.map?.(el0 => ({ + coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap index 8a1b1a227d..4be660b504 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap @@ -449,7 +449,7 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` revisionHeight: BigInt(latest_height.revision_height || "0"), revisionNumber: BigInt(latest_height.revision_number || "0") } : undefined, - proofSpecs: proof_specs.map?.(el0 => ({ + proofSpecs: proof_specs.map(el0 => ({ leafSpec: el0.leaf_spec == null ? el0.leaf_spec : { hash: el0.leaf_spec.hash == null ? el0.leaf_spec.hash : hashOpFromJSON(el0.leaf_spec.hash), prehashKey: el0.leaf_spec.prehash_key == null ? el0.leaf_spec.prehash_key : hashOpFromJSON(el0.leaf_spec.prehash_key), @@ -917,7 +917,7 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` revisionHeight: BigInt(latest_height.revision_height || "0"), revisionNumber: BigInt(latest_height.revision_number || "0") } : undefined, - proofSpecs: proof_specs.map?.(el0 => ({ + proofSpecs: proof_specs.map(el0 => ({ leafSpec: el0.leaf_spec == null ? el0.leaf_spec : { hash: el0.leaf_spec.hash == null ? el0.leaf_spec.hash : hashOpFromJSON(el0.leaf_spec.hash), prehashKey: el0.leaf_spec.prehash_key == null ? el0.leaf_spec.prehash_key : hashOpFromJSON(el0.leaf_spec.prehash_key), diff --git a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap index 3e45a984fb..b9ac6b7f19 100644 --- a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap @@ -447,7 +447,7 @@ exports[`evmos/fees/v1/tx AminoConverter 1`] = ` contractAddress: contract_address, deployerAddress: deployer_address, withdrawAddress: withdraw_address, - nonces: nonces.map?.(el0 => BigInt(el0)) + nonces: nonces.map(el0 => BigInt(el0)) }; } }, @@ -530,7 +530,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), shareOutAmount: share_out_amount, - tokenInMaxs: token_in_maxs.map?.(el0 => ({ + tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -565,7 +565,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` sender, poolId: pool_id == null ? pool_id : BigInt(pool_id), shareInAmount: share_in_amount, - tokenOutMins: token_out_mins.map?.(el0 => ({ + tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, amount: el0.amount })) @@ -601,7 +601,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgSwapExactAmountInAminoType["value"]): MsgSwapExactAmountIn => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), @@ -642,7 +642,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgSwapExactAmountOutAminoType["value"]): MsgSwapExactAmountOut => { return { sender, - routes: routes.map?.(el0 => ({ + routes: routes.map(el0 => ({ poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap index b524321d85..98fd826272 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap @@ -31,7 +31,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` typeUrl: content.type_url, value: content.value }, - initialDeposit: initial_deposit.map?.(el0 => ({ + initialDeposit: initial_deposit.map(el0 => ({ denom: el0.denom, amount: el0.amount })), @@ -88,7 +88,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), voter, - options: options.map?.(el0 => ({ + options: options.map(el0 => ({ option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), weight: el0.weight })) @@ -119,7 +119,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` return { proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), depositor, - amount: amount.map?.(el0 => ({ + amount: amount.map(el0 => ({ denom: el0.denom, amount: el0.amount })) diff --git a/packages/ast/src/encoding/amino/from-amino-json/utils.ts b/packages/ast/src/encoding/amino/from-amino-json/utils.ts index d148293f1c..73b8c15a6a 100644 --- a/packages/ast/src/encoding/amino/from-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/from-amino-json/utils.ts @@ -1,50 +1,78 @@ -import * as t from '@babel/types'; -import { BILLION, memberExpressionOrIdentifierAminoCaseField, shorthandProperty, TypeLong } from '../../../utils'; -import { FromAminoParseField, fromAminoParseField } from './index' -import { protoFieldsToArray } from '../utils'; -import { getFieldOptionality, getOneOfs } from '../../proto'; -import { ProtoField } from '@cosmology/types'; -import { GenericParseContext } from '../../context'; +import * as t from "@babel/types"; +import { + BILLION, + memberExpressionOrIdentifierAminoCaseField, + shorthandProperty, + TypeLong, +} from "../../../utils"; +import { FromAminoParseField, fromAminoParseField } from "./index"; +import { protoFieldsToArray } from "../utils"; +import { getFieldOptionality, getOneOfs } from "../../proto"; +import { ProtoField } from "@cosmology/types"; +import { GenericParseContext } from "../../context"; export const fromAmino = { defaultType(args: FromAminoParseField) { - if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { + if ( + args.field.name === args.context.aminoCaseField(args.field) && + args.scope.length === 1 + ) { return shorthandProperty(args.field.name); } + + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + return t.objectProperty( t.identifier(args.field.name), - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) + memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ) ); }, string(args: FromAminoParseField) { - - if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { + if ( + args.field.name === args.context.aminoCaseField(args.field) && + args.scope.length === 1 + ) { return shorthandProperty(args.field.name); } + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); return t.objectProperty( t.identifier(args.field.name), - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField) + memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ) ); }, rawBytes(args: FromAminoParseField) { - args.context.addUtil('toUtf8'); - let prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); - let value = t.callExpression( - t.identifier('toUtf8'), - [ - t.callExpression( - t.memberExpression( - t.identifier('JSON'), - t.identifier('stringify') - ), - [ - prop - ] - ) - ] + args.context.addUtil("toUtf8"); + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + let prop = memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling ); + let value = t.callExpression(t.identifier("toUtf8"), [ + t.callExpression( + t.memberExpression( + t.identifier("JSON"), + t.identifier("stringify") + ), + [prop] + ), + ]); return t.objectProperty( t.identifier(args.field.name), this.nullCheckCondition(prop, prop, value) @@ -52,14 +80,16 @@ export const fromAmino = { }, wasmByteCode(args: FromAminoParseField) { - args.context.addUtil('fromBase64'); - let prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); - let value = t.callExpression( - t.identifier('fromBase64'), - [ - prop - ] + args.context.addUtil("fromBase64"); + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + let prop = memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling ); + let value = t.callExpression(t.identifier("fromBase64"), [prop]); return t.objectProperty( t.identifier(args.field.name), this.nullCheckCondition(prop, prop, value) @@ -68,19 +98,32 @@ export const fromAmino = { long(args: FromAminoParseField) { TypeLong.addUtil(args.context); - - const prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); - return t.objectProperty(t.identifier(args.field.name), - this.nullCheckCondition(prop, prop, t.callExpression(TypeLong.getFromString(args.context), [prop])) + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + const prop = memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ); + return t.objectProperty( + t.identifier(args.field.name), + this.nullCheckCondition( + prop, + prop, + t.callExpression(TypeLong.getFromString(args.context), [prop]) + ) ); }, duration(args: FromAminoParseField) { - const durationFormat = args.context.pluginValue('prototypes.typingsFormat.duration'); + const durationFormat = args.context.pluginValue( + "prototypes.typingsFormat.duration" + ); switch (durationFormat) { - case 'duration': + case "duration": // TODO duration amino type - case 'string': + case "string": default: return fromAmino.durationString(args); } @@ -88,144 +131,203 @@ export const fromAmino = { durationString(args: FromAminoParseField) { TypeLong.addUtil(args.context); - - let property = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); - const value = t.objectExpression( - [ - t.objectProperty(t.identifier('seconds'), t.callExpression( - TypeLong.getFromNumber(args.context), [ + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + let property = memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ); + const value = t.objectExpression([ + t.objectProperty( + t.identifier("seconds"), + t.callExpression(TypeLong.getFromNumber(args.context), [ t.callExpression( t.memberExpression( - t.identifier('Math'), - t.identifier('floor') + t.identifier("Math"), + t.identifier("floor") ), [ - t.binaryExpression('/', - t.callExpression( - t.identifier('parseInt'), - [ - property - ] - ), + t.binaryExpression( + "/", + t.callExpression(t.identifier("parseInt"), [ + property, + ]), BILLION - ) + ), ] - ) - ] - )), - t.objectProperty( - t.identifier('nanos'), - t.binaryExpression('%', - t.callExpression( - t.identifier('parseInt'), - [ - property - ] - ), - BILLION - ) + ), + ]) + ), + t.objectProperty( + t.identifier("nanos"), + t.binaryExpression( + "%", + t.callExpression(t.identifier("parseInt"), [property]), + BILLION ) - ] + ), + ]); + return t.objectProperty( + t.identifier(args.field.name), + this.nullCheckCondition(property, property, value) ); - return t.objectProperty(t.identifier(args.field.name), this.nullCheckCondition(property, property, value)); }, height(args: FromAminoParseField) { TypeLong.addUtil(args.context); const longType = TypeLong.getType(args.context); + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); let revisionHeightArgs: t.Expression[] = [ t.logicalExpression( - '||', + "||", t.memberExpression( - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField), - t.identifier(args.context.aminoCasingFn('revision_height')) - , false, true + memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ), + t.identifier(args.context.aminoCasingFn("revision_height")), + false, + true ), - t.stringLiteral('0') - ) + t.stringLiteral("0") + ), ]; let revisionNumberArgs: t.Expression[] = [ t.logicalExpression( - '||', + "||", t.memberExpression( - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField), - t.identifier(args.context.aminoCasingFn('revision_number')) - , false, true + memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ), + t.identifier(args.context.aminoCasingFn("revision_number")), + false, + true ), - t.stringLiteral('0') - ) + t.stringLiteral("0") + ), ]; - if (longType == 'Long') { - revisionHeightArgs.push(t.booleanLiteral(true)) - revisionNumberArgs.push(t.booleanLiteral(true)) + if (longType == "Long") { + revisionHeightArgs.push(t.booleanLiteral(true)); + revisionNumberArgs.push(t.booleanLiteral(true)); } return t.objectProperty( t.identifier(args.field.name), t.conditionalExpression( - memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField), + memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ), t.objectExpression([ - t.objectProperty(t.identifier('revisionHeight'), + t.objectProperty( + t.identifier("revisionHeight"), t.callExpression( TypeLong.getFromString(args.context), revisionHeightArgs ) ), - t.objectProperty(t.identifier('revisionNumber'), + t.objectProperty( + t.identifier("revisionNumber"), t.callExpression( TypeLong.getFromString(args.context), revisionNumberArgs ) - ) + ), ]), - t.identifier('undefined') + t.identifier("undefined") ) - ) + ); }, - enum({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { - const enumFunction = context.lookupEnumFromJson(field, currentProtoPath); - let prop = memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField); - const value = t.callExpression( - t.identifier(enumFunction), [ - prop - ]); - return t.objectProperty(t.identifier(field.name), this.nullCheckCondition(prop, prop, value)); + enum({ + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: FromAminoParseField) { + const enumFunction = context.lookupEnumFromJson( + field, + currentProtoPath + ); + const useNullHandling = !!context.pluginValue('aminoEncoding.legacy.useNullHandling'); + let prop = memberExpressionOrIdentifierAminoCaseField( + fieldPath, + context.aminoCaseField, + useNullHandling + ); + const value = t.callExpression(t.identifier(enumFunction), [prop]); + return t.objectProperty( + t.identifier(field.name), + this.nullCheckCondition(prop, prop, value) + ); }, - enumArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { - const enumFunction = context.lookupEnumFromJson(field, currentProtoPath); - const value = t.optionalCallExpression( + enumArray({ + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: FromAminoParseField) { + const useNullHandling = !!context.pluginValue('aminoEncoding.legacy.useNullHandling'); + const enumFunction = context.lookupEnumFromJson( + field, + currentProtoPath + ); + const callExpression = useNullHandling ? t.optionalCallExpression : t.callExpression; + const value = callExpression( t.memberExpression( - memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField), - t.identifier('map'), - false, true + memberExpressionOrIdentifierAminoCaseField( + fieldPath, + context.aminoCaseField, + useNullHandling + ), + t.identifier("map"), + false, + true ), [ t.arrowFunctionExpression( - [ - t.identifier('el') - ], - t.callExpression( - t.identifier(enumFunction), - [ - t.identifier('el') - ] - ) - ) - ], true + [t.identifier("el")], + t.callExpression(t.identifier(enumFunction), [ + t.identifier("el"), + ]) + ), + ], + true ); return t.objectProperty(t.identifier(field.name), value); }, - type({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { + type({ + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: FromAminoParseField) { const parentField = field; const Type = context.getTypeFromCurrentPath(field, currentProtoPath); const oneOfs = getOneOfs(Type); - const properties = protoFieldsToArray(Type).map(field => { + const properties = protoFieldsToArray(Type).map((field) => { const isOneOf = oneOfs.includes(field.name); const isOptional = getFieldOptionality(context, field, isOneOf); @@ -237,49 +339,66 @@ export const fromAmino = { scope: [...scope], fieldPath: [...fieldPath], nested: nested + 1, - isOptional // TODO how to handle nested optionality? - }) + isOptional, // TODO how to handle nested optionality? + }); }); - let prop = memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField); + const useNullHandling = !!context.pluginValue('aminoEncoding.legacy.useNullHandling'); + let prop = memberExpressionOrIdentifierAminoCaseField( + fieldPath, + context.aminoCaseField, + useNullHandling + ); - return t.objectProperty(t.identifier(field.name), - this.nullCheckCondition(prop, prop, t.objectExpression( - properties - )) + return t.objectProperty( + t.identifier(field.name), + this.nullCheckCondition(prop, prop, t.objectExpression(properties)) ); }, arrayFrom(args: FromAminoParseField) { - let prop = memberExpressionOrIdentifierAminoCaseField(args.fieldPath, args.context.aminoCaseField); + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + let prop = memberExpressionOrIdentifierAminoCaseField( + args.fieldPath, + args.context.aminoCaseField, + useNullHandling + ); let value = t.callExpression( - t.memberExpression( - t.identifier('Array'), - t.identifier('from') - ), - [ - prop - ] + t.memberExpression(t.identifier("Array"), t.identifier("from")), + [prop] + ); + return t.objectProperty( + t.identifier(args.field.name), + this.nullCheckCondition(prop, prop, value) ); - return t.objectProperty(t.identifier(args.field.name), this.nullCheckCondition(prop, prop, value)); }, - typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField) { + typeArray({ + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: FromAminoParseField) { ////// - const variable = 'el' + nested; + const variable = "el" + nested; const f = JSON.parse(JSON.stringify(field)); // clone const varProto: ProtoField = { - ...f + ...f, }; varProto.name = variable; - varProto.options['(telescope:orig)'] = variable; - varProto.options['(telescope:name)'] = variable; - varProto.options['(telescope:camel)'] = variable; + varProto.options["(telescope:orig)"] = variable; + varProto.options["(telescope:name)"] = variable; + varProto.options["(telescope:camel)"] = variable; ////// const parentField = field; const Type = context.getTypeFromCurrentPath(field, currentProtoPath); const oneOfs = getOneOfs(Type); - const properties = protoFieldsToArray(Type).map(field => { + const properties = protoFieldsToArray(Type).map((field) => { const isOneOf = oneOfs.includes(field.name); const isOptional = getFieldOptionality(context, field, isOneOf); @@ -292,92 +411,109 @@ export const fromAmino = { scope: [variable], fieldPath: [varProto], nested: nested + 1, - isOptional // TODO how to handle nested optionality? - }) + isOptional, // TODO how to handle nested optionality? + }); }); + const useNullHandling = !!context.pluginValue('aminoEncoding.legacy.useNullHandling'); - const expr = t.optionalCallExpression( + const callExpression = useNullHandling ? t.optionalCallExpression : t.callExpression; + + const expr = callExpression( t.memberExpression( - memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField), - t.identifier('map'), false, true + memberExpressionOrIdentifierAminoCaseField( + fieldPath, + context.aminoCaseField, + useNullHandling + ), + t.identifier("map"), + false, + true ), [ t.arrowFunctionExpression( - [ - t.identifier(variable) - ], - t.objectExpression( - properties - ) - ) - ], true + [t.identifier(variable)], + t.objectExpression(properties) + ), + ], + true ); - return t.objectProperty(t.identifier(field.name), - expr - ); + return t.objectProperty(t.identifier(field.name), expr); }, - - scalarArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField, arrayTypeAstFunc: Function) { - const variable = 'el' + nested; - - const expr = t.optionalCallExpression( + scalarArray( + { + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: FromAminoParseField, + arrayTypeAstFunc: Function + ) { + const variable = "el" + nested; + const useNullHandling = !!context.pluginValue('aminoEncoding.legacy.useNullHandling'); + + const callExpression = useNullHandling ? t.optionalCallExpression : t.callExpression; + + const expr = callExpression( t.memberExpression( - memberExpressionOrIdentifierAminoCaseField(fieldPath, context.aminoCaseField), - t.identifier('map'), false, true, + memberExpressionOrIdentifierAminoCaseField( + fieldPath, + context.aminoCaseField, + useNullHandling + ), + t.identifier("map"), + false, + true ), [ t.arrowFunctionExpression( - [ - t.identifier(variable) - ], + [t.identifier(variable)], arrayTypeAstFunc(variable, context) - ) - ], true + ), + ], + true ); - return t.objectProperty(t.identifier(field.name), - expr - ); + return t.objectProperty(t.identifier(field.name), expr); }, pubkey(args: FromAminoParseField) { - args.context.addUtil('encodePubkey'); + args.context.addUtil("encodePubkey"); return t.objectProperty( t.identifier(args.field.name), - t.callExpression( - t.identifier('encodePubkey'), - [ - t.identifier('pubkey') - ] - ) - ) + t.callExpression(t.identifier("encodePubkey"), [ + t.identifier("pubkey"), + ]) + ); }, /** * value == null ? nullExpr : nonNullExpr */ - nullCheckCondition(value: t.Expression, nullExpr: t.Expression, nonNullExpr: t.Expression) - { - return t.conditionalExpression(t.binaryExpression("==", value, t.nullLiteral()), + nullCheckCondition( + value: t.Expression, + nullExpr: t.Expression, + nonNullExpr: t.Expression + ) { + return t.conditionalExpression( + t.binaryExpression("==", value, t.nullLiteral()), nullExpr, nonNullExpr ); - } + }, }; - export const arrayTypes = { long(varname: string, ctx: GenericParseContext) { TypeLong.addUtil(ctx); - return t.callExpression( - TypeLong.getFromString(ctx), - [ - t.identifier(varname) - ] - ) - } -} + return t.callExpression(TypeLong.getFromString(ctx), [ + t.identifier(varname), + ]); + }, +}; diff --git a/packages/ast/src/encoding/amino/to-amino-json/index.ts b/packages/ast/src/encoding/amino/to-amino-json/index.ts index ad993c66c8..ff0f719b9f 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/index.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/index.ts @@ -1,5 +1,5 @@ import * as t from '@babel/types'; -import { AminoUtils, arrowFunctionExpression } from '../../../utils'; +import { arrowFunctionExpression } from '../../../utils'; import { AminoParseContext } from '../../context'; import { ProtoType, ProtoField } from '@cosmology/types'; import { protoFieldsToArray } from '../utils'; diff --git a/packages/ast/src/encoding/proto/to-amino/utils.ts b/packages/ast/src/encoding/proto/to-amino/utils.ts index 737027470c..64b697bd75 100644 --- a/packages/ast/src/encoding/proto/to-amino/utils.ts +++ b/packages/ast/src/encoding/proto/to-amino/utils.ts @@ -1,6 +1,6 @@ import * as t from '@babel/types'; import { ProtoType } from '@cosmology/types'; -import { AminoUtils, BILLION, identifier, TypeLong } from '../../../utils'; +import { BILLION, identifier, TypeLong } from '../../../utils'; import { ProtoParseContext } from '../../context'; import { getDefaultTSTypeFromProtoType, getFieldNames, getDefaultTSTypeFromAminoTypeDefault } from '../../types'; import { getInterfaceToAminoName } from '../implements'; diff --git a/packages/ast/src/utils/amino.ts b/packages/ast/src/utils/amino.ts deleted file mode 100644 index 24462763bc..0000000000 --- a/packages/ast/src/utils/amino.ts +++ /dev/null @@ -1,12 +0,0 @@ -export const AminoUtils = { - shouldOmitEmpty(field: { - options: { - [p: string]: any; - }; - }): boolean - { - let jsonTag = field.options?.['(gogoproto.jsontag)'] ?? field.options?.['(cosmos_proto.json_tag)']; - return jsonTag == null || jsonTag === "" || jsonTag.includes("omitempty"); - } - -} diff --git a/packages/ast/src/utils/index.ts b/packages/ast/src/utils/index.ts index 75c37953c2..4753f3d6f0 100644 --- a/packages/ast/src/utils/index.ts +++ b/packages/ast/src/utils/index.ts @@ -1,5 +1,4 @@ export * from './babel'; export * from './utils'; export * from './scoped-bundle-builder'; -export * from './type-long-expression'; -export * from './amino'; +export * from './type-long-expression'; \ No newline at end of file diff --git a/packages/ast/src/utils/utils.ts b/packages/ast/src/utils/utils.ts index 976c76e2e6..a3574e9fe1 100644 --- a/packages/ast/src/utils/utils.ts +++ b/packages/ast/src/utils/utils.ts @@ -7,203 +7,237 @@ BILLION.extra = { raw: "1_000_000_000", rawValue: 1000000000 }; export { BILLION }; export const cleanComment = (str) => { - return str.replace(/\*\//g, "*\\/"); + return str.replace(/\*\//g, "*\\/"); }; const ensureOneSpace = (str) => { - if (/^[\s\n\t]+/.test(str)) return str; - return ` ${str}`; + if (/^[\s\n\t]+/.test(str)) return str; + return ` ${str}`; }; export const makeCommentBlock = (comment: string): t.CommentBlock => { - if (!/[\n]+/.test(comment)) { + if (!/[\n]+/.test(comment)) { + return { + type: "CommentBlock", + value: `* ${cleanComment(comment)} `, + start: null, + end: null, + loc: null, + }; + } + + let lines = comment.split("\n"); + lines = ["*", ...lines, " "]; + const comments = lines.map((line, i) => { + if (i == 0) return line; + if (i == 1) return ` *${ensureOneSpace(cleanComment(line))}`; + if (i == lines.length - 1) return cleanComment(line); + return ` *${ensureOneSpace(cleanComment(line))}`; + }); + return { - type: "CommentBlock", - value: `* ${cleanComment(comment)} `, - start: null, - end: null, - loc: null, + type: "CommentBlock", + value: comments.join("\n"), + start: null, + end: null, + loc: null, }; - } - - let lines = comment.split("\n"); - lines = ["*", ...lines, " "]; - const comments = lines.map((line, i) => { - if (i == 0) return line; - if (i == 1) return ` *${ensureOneSpace(cleanComment(line))}`; - if (i == lines.length - 1) return cleanComment(line); - return ` *${ensureOneSpace(cleanComment(line))}`; - }); - - return { - type: "CommentBlock", - value: comments.join("\n"), - start: null, - end: null, - loc: null, - }; }; export const renderNameSafely = (name) => { - return name - .split("_") - .map((str) => { - const parts = str.split("."); - str = parts[parts.length - 1]; - return str; - }) - .join("_"); + return name + .split("_") + .map((str) => { + const parts = str.split("."); + str = parts[parts.length - 1]; + return str; + }) + .join("_"); }; export const getProtoFieldTypeName = ( - context: ProtoParseContext, - field: ProtoField + context: ProtoParseContext, + field: ProtoField ) => { - let name = context.getTypeName(field); - return renderNameSafely(name); + let name = context.getTypeName(field); + return renderNameSafely(name); }; export const recursiveNamespace = (names, moduleBlockBody) => { - if (!names || !names.length) return moduleBlockBody; - const name = names.pop(); - const body = [ - t.exportNamedDeclaration( - t.tsModuleDeclaration( - t.identifier(name), - t.tsModuleBlock(recursiveNamespace(names, moduleBlockBody)) - ) - ), - ]; - return body; + if (!names || !names.length) return moduleBlockBody; + const name = names.pop(); + const body = [ + t.exportNamedDeclaration( + t.tsModuleDeclaration( + t.identifier(name), + t.tsModuleBlock(recursiveNamespace(names, moduleBlockBody)) + ) + ), + ]; + return body; }; export const bindMethod = (name: string) => { - return t.expressionStatement( - t.assignmentExpression( - "=", - t.memberExpression(t.thisExpression(), t.identifier(name)), - t.callExpression( - t.memberExpression( - t.memberExpression(t.thisExpression(), t.identifier(name)), - t.identifier("bind") - ), - [t.thisExpression()] - ) - ) - ); + return t.expressionStatement( + t.assignmentExpression( + "=", + t.memberExpression(t.thisExpression(), t.identifier(name)), + t.callExpression( + t.memberExpression( + t.memberExpression(t.thisExpression(), t.identifier(name)), + t.identifier("bind") + ), + [t.thisExpression()] + ) + ) + ); }; export const shorthandProperty = (prop: string) => { - return t.objectProperty(t.identifier(prop), t.identifier(prop), false, true); + return t.objectProperty( + t.identifier(prop), + t.identifier(prop), + false, + true + ); }; export const importStmt = (names: string[], path: string) => { - return t.importDeclaration( - names.map((name) => - t.importSpecifier(t.identifier(name), t.identifier(name)) - ), - t.stringLiteral(path) - ); + return t.importDeclaration( + names.map((name) => + t.importSpecifier(t.identifier(name), t.identifier(name)) + ), + t.stringLiteral(path) + ); }; export const memberExpressionOrIdentifier = (names) => { - if (names.length === 1) { - return t.identifier(names[0]); - } - if (names.length === 2) { - const [b, a] = names; - return t.memberExpression(t.identifier(a), t.identifier(b)); - } - const [name, ...rest] = names; + if (names.length === 1) { + return t.identifier(names[0]); + } + if (names.length === 2) { + const [b, a] = names; + return t.memberExpression(t.identifier(a), t.identifier(b)); + } + const [name, ...rest] = names; - return t.memberExpression( - memberExpressionOrIdentifier(rest), - t.identifier(name) - ); + return t.memberExpression( + memberExpressionOrIdentifier(rest), + t.identifier(name) + ); }; export const memberExpressionOrIdentifierAminoCasing = ( - names, - aminoCasingFn: Function + names, + aminoCasingFn: Function ) => { - if (names.length === 1) { - return t.identifier(aminoCasingFn(names[0])); - } - if (names.length === 2) { - const [b, a] = names; + if (names.length === 1) { + return t.identifier(aminoCasingFn(names[0])); + } + if (names.length === 2) { + const [b, a] = names; + return t.memberExpression( + t.identifier(aminoCasingFn(a)), + t.identifier(aminoCasingFn(b)) + ); + } + const [name, ...rest] = names; + return t.memberExpression( - t.identifier(aminoCasingFn(a)), - t.identifier(aminoCasingFn(b)) + memberExpressionOrIdentifierAminoCasing(rest, aminoCasingFn), + t.identifier(aminoCasingFn(name)) ); - } - const [name, ...rest] = names; - - return t.memberExpression( - memberExpressionOrIdentifierAminoCasing(rest, aminoCasingFn), - t.identifier(aminoCasingFn(name)) - ); }; export const memberExpressionOrIdentifierAminoCaseField = ( - fields: ProtoField[], - aminoCaseFunc: Function + fields: ProtoField[], + aminoCaseFunc: Function, + useNullHandling: boolean = false ) => { - if (fields.length === 1) { - return t.identifier(aminoCaseFunc(fields[0])); - } - if (fields.length === 2) { - const [b, a] = fields; - return t.memberExpression( - t.identifier(aminoCaseFunc(a)), - t.identifier(aminoCaseFunc(b)), false, true - ); - } - const [field, ...rest] = fields; - - return t.memberExpression( - memberExpressionOrIdentifierAminoCaseField(rest, aminoCaseFunc), - t.identifier(aminoCaseFunc(field)), false, true - ); + if (fields.length === 1) { + return t.identifier(aminoCaseFunc(fields[0])); + } + if (fields.length === 2) { + const [b, a] = fields; + return useNullHandling + ? t.memberExpression( + t.identifier(aminoCaseFunc(a)), + t.identifier(aminoCaseFunc(b)), + false, + true + ) + : t.memberExpression( + t.identifier(aminoCaseFunc(a)), + t.identifier(aminoCaseFunc(b)) + ); + } + const [field, ...rest] = fields; + + return useNullHandling + ? t.memberExpression( + memberExpressionOrIdentifierAminoCaseField( + rest, + aminoCaseFunc, + useNullHandling + ), + t.identifier(aminoCaseFunc(field)), + false, + true + ) + : t.memberExpression( + memberExpressionOrIdentifierAminoCaseField( + rest, + aminoCaseFunc, + useNullHandling + ), + t.identifier(aminoCaseFunc(field)) + ); }; export const promiseTypeAnnotation = (name) => { - return t.tsTypeAnnotation( - t.tsTypeReference( - t.identifier("Promise"), - t.tsTypeParameterInstantiation([t.tsTypeReference(t.identifier(name))]) - ) - ); + return t.tsTypeAnnotation( + t.tsTypeReference( + t.identifier("Promise"), + t.tsTypeParameterInstantiation([ + t.tsTypeReference(t.identifier(name)), + ]) + ) + ); }; export const getAcceptedInterfacesTypes = ( - context: ProtoParseContext, - lookupInterface: string + context: ProtoParseContext, + lookupInterface: string ) => { - return lookupInterface ? context.store._symbols.filter( - (s) => - s.implementsType === lookupInterface && s.ref === context.ref.filename - ) : []; + return lookupInterface + ? context.store._symbols.filter( + (s) => + s.implementsType === lookupInterface && + s.ref === context.ref.filename + ) + : []; }; export const getSdkFieldName = (fieldName: string, field: ProtoField) => { - return field.options?.["(telescope:orig)"] ?? fieldName; + return field.options?.["(telescope:orig)"] ?? fieldName; }; export const getAminoFieldName = ( - fieldName: string, - field: ProtoField, - interfaceName: string, - context: ProtoParseContext + fieldName: string, + field: ProtoField, + interfaceName: string, + context: ProtoParseContext ) => { - const orig = field.options?.["(telescope:orig)"] ?? fieldName; - - if ( - (interfaceName === "Any" && - context.ref.proto.package === "google.protobuf" && - ( orig === "type_url" || orig === "typeUrl" ))) { - // type_url => type for amino - return "type"; - } - - return orig; + const orig = field.options?.["(telescope:orig)"] ?? fieldName; + + if ( + interfaceName === "Any" && + context.ref.proto.package === "google.protobuf" && + (orig === "type_url" || orig === "typeUrl") + ) { + // type_url => type for amino + return "type"; + } + + return orig; }; diff --git a/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts b/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts index 0d4c541a2b..ae5bb9d6f0 100644 --- a/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts +++ b/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts @@ -1,6 +1,6 @@ -import * as t from '@babel/types'; -import { FromAminoParseField } from './index'; -import { GenericParseContext } from '../../context'; +import * as t from "@babel/types"; +import { FromAminoParseField } from "./index"; +import { GenericParseContext } from "../../context"; export declare const fromAmino: { defaultType(args: FromAminoParseField): t.ObjectProperty; string(args: FromAminoParseField): t.ObjectProperty; @@ -10,12 +10,12 @@ export declare const fromAmino: { duration(args: FromAminoParseField): t.ObjectProperty; durationString(args: FromAminoParseField): t.ObjectProperty; height(args: FromAminoParseField): t.ObjectProperty; - enum({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField): t.ObjectProperty; - enumArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField): t.ObjectProperty; - type({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField): any; + enum({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: FromAminoParseField): t.ObjectProperty; + enumArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: FromAminoParseField): t.ObjectProperty; + type({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: FromAminoParseField): any; arrayFrom(args: FromAminoParseField): t.ObjectProperty; - typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField): t.ObjectProperty; - scalarArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: FromAminoParseField, arrayTypeAstFunc: Function): t.ObjectProperty; + typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: FromAminoParseField): any; + scalarArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: FromAminoParseField, arrayTypeAstFunc: Function): t.ObjectProperty; pubkey(args: FromAminoParseField): t.ObjectProperty; /** * value == null ? nullExpr : nonNullExpr diff --git a/packages/ast/types/utils/index.d.ts b/packages/ast/types/utils/index.d.ts index 75c37953c2..ba68e90ab6 100644 --- a/packages/ast/types/utils/index.d.ts +++ b/packages/ast/types/utils/index.d.ts @@ -2,4 +2,3 @@ export * from './babel'; export * from './utils'; export * from './scoped-bundle-builder'; export * from './type-long-expression'; -export * from './amino'; diff --git a/packages/ast/types/utils/utils.d.ts b/packages/ast/types/utils/utils.d.ts index 8607340236..9cac29421d 100644 --- a/packages/ast/types/utils/utils.d.ts +++ b/packages/ast/types/utils/utils.d.ts @@ -13,7 +13,7 @@ export declare const shorthandProperty: (prop: string) => t.ObjectProperty; export declare const importStmt: (names: string[], path: string) => t.ImportDeclaration; export declare const memberExpressionOrIdentifier: (names: any) => any; export declare const memberExpressionOrIdentifierAminoCasing: (names: any, aminoCasingFn: Function) => any; -export declare const memberExpressionOrIdentifierAminoCaseField: (fields: ProtoField[], aminoCaseFunc: Function) => any; +export declare const memberExpressionOrIdentifierAminoCaseField: (fields: ProtoField[], aminoCaseFunc: Function, useNullHandling?: boolean) => any; export declare const promiseTypeAnnotation: (name: any) => t.TSTypeAnnotation; export declare const getAcceptedInterfacesTypes: (context: ProtoParseContext, lookupInterface: string) => import("@cosmology/types").TraversalSymbol[]; export declare const getSdkFieldName: (fieldName: string, field: ProtoField) => string; diff --git a/packages/telescope/__tests__/telescope-instant-rpc.test.ts b/packages/telescope/__tests__/telescope-instant-rpc.test.ts index 362779f469..b8db073123 100644 --- a/packages/telescope/__tests__/telescope-instant-rpc.test.ts +++ b/packages/telescope/__tests__/telescope-instant-rpc.test.ts @@ -234,6 +234,9 @@ const options: TelescopeOptions = { aminoEncoding: { enabled: true, + legacy: { + useNullHandling: true + }, exceptions: { "/akash.audit.v1beta2.MsgSignProviderAttributes": { aminoType: "mymessage-testonly", diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index 6d9e2fc983..44ab2b50e5 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -153,6 +153,9 @@ interface TelescopeOpts { * @deprecated The logic of useLegacyInlineEncoding will be deprecated in the future. */ useLegacyInlineEncoding?: boolean; + legacy?: { + useNullHandling: boolean; + } }; lcdClients?: { diff --git a/packages/types/types/telescope.d.ts b/packages/types/types/telescope.d.ts index 761ac2c98c..ac825228a3 100644 --- a/packages/types/types/telescope.d.ts +++ b/packages/types/types/telescope.d.ts @@ -125,6 +125,9 @@ interface TelescopeOpts { * @deprecated The logic of useLegacyInlineEncoding will be deprecated in the future. */ useLegacyInlineEncoding?: boolean; + legacy?: { + useNullHandling: boolean; + }; }; lcdClients?: { enabled: boolean; From 75db4d21d62d6d4882bdea02039975abea638a24 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sun, 17 Mar 2024 15:22:45 +0800 Subject: [PATCH 20/24] add flag for amino legacy null handling --- .../amino-legacy/misc/tx.amino.ts | 68 +++++++++---------- .../output1/akash/cert/v1beta2/cert.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 52 +++++++------- .../akash/market/v1beta2/service.amino.ts | 24 +++---- .../akash/provider/v1beta1/provider.amino.ts | 4 +- .../akash/provider/v1beta2/provider.amino.ts | 4 +- .../output1/cosmos/authz/v1beta1/tx.amino.ts | 4 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 2 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 2 +- .../output1/cosmos/gov/v1/tx.amino.ts | 12 ++-- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 12 ++-- .../output1/cosmos/group/v1/tx.amino.ts | 28 ++++---- .../cosmos/staking/v1beta1/tx.amino.ts | 14 ++-- .../cosmos/upgrade/v1beta1/tx.amino.ts | 6 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 16 ++--- .../output1/evmos/erc20/v1/tx.amino.ts | 2 +- .../output1/evmos/vesting/v1/tx.amino.ts | 4 +- .../ibc/applications/transfer/v1/tx.amino.ts | 4 +- .../output1/ibc/core/channel/v1/tx.amino.ts | 44 ++++++------ .../output1/ibc/core/client/v1/tx.amino.ts | 12 ++-- .../ibc/core/connection/v1/tx.amino.ts | 20 +++--- .../gamm/pool-models/balancer/tx/tx.amino.ts | 12 ++-- .../gamm/pool-models/stableswap/tx.amino.ts | 4 +- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 24 +++---- .../output1/osmosis/incentives/tx.amino.ts | 10 +-- .../output1/osmosis/lockup/tx.amino.ts | 10 +-- .../output1/osmosis/superfluid/tx.amino.ts | 8 +-- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 6 +- .../akash/cert/v1beta2/cert.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 52 +++++++------- .../akash/market/v1beta2/service.amino.ts | 24 +++---- .../akash/provider/v1beta1/provider.amino.ts | 4 +- .../akash/provider/v1beta2/provider.amino.ts | 4 +- .../cosmos/authz/v1beta1/tx.amino.ts | 4 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 2 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 2 +- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 12 ++-- .../cosmos/gov/v1beta1/tx.amino.ts | 12 ++-- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 28 ++++---- .../cosmos/staking/v1beta1/tx.amino.ts | 14 ++-- .../cosmos/upgrade/v1beta1/tx.amino.ts | 6 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 16 ++--- .../outputosmojs/evmos/erc20/v1/tx.amino.ts | 2 +- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 4 +- .../ibc/applications/fee/v1/tx.amino.ts | 6 +- .../controller/v1/tx.amino.ts | 6 +- .../ibc/applications/transfer/v1/tx.amino.ts | 4 +- .../ibc/core/channel/v1/tx.amino.ts | 44 ++++++------ .../ibc/core/client/v1/tx.amino.ts | 12 ++-- .../ibc/core/connection/v1/tx.amino.ts | 20 +++--- .../concentrated-liquidity/tx.amino.ts | 12 ++-- .../gamm/pool-models/balancer/tx/tx.amino.ts | 12 ++-- .../gamm/pool-models/stableswap/tx.amino.ts | 4 +- .../osmosis/gamm/v1beta1/tx.amino.ts | 24 +++---- .../osmosis/incentives/tx.amino.ts | 10 +-- .../outputosmojs/osmosis/lockup/tx.amino.ts | 10 +-- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 8 +-- .../osmosis/protorev/v1beta1/tx.amino.ts | 14 ++-- .../osmosis/superfluid/tx.amino.ts | 8 +-- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 6 +- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 6 +- .../outputv4/akash/cert/v1beta2/cert.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 52 +++++++------- .../akash/market/v1beta2/service.amino.ts | 24 +++---- .../akash/provider/v1beta1/provider.amino.ts | 4 +- .../akash/provider/v1beta2/provider.amino.ts | 4 +- .../outputv4/cosmos/authz/v1beta1/tx.amino.ts | 4 +- .../cosmos/evidence/v1beta1/tx.amino.ts | 2 +- .../cosmos/feegrant/v1beta1/tx.amino.ts | 2 +- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 12 ++-- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 12 ++-- .../outputv4/cosmos/group/v1/tx.amino.ts | 28 ++++---- .../cosmos/staking/v1beta1/tx.amino.ts | 14 ++-- .../cosmos/upgrade/v1beta1/tx.amino.ts | 6 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 16 ++--- .../outputv4/evmos/erc20/v1/tx.amino.ts | 2 +- .../outputv4/evmos/vesting/v1/tx.amino.ts | 4 +- .../ibc/applications/transfer/v1/tx.amino.ts | 4 +- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 44 ++++++------ .../outputv4/ibc/core/client/v1/tx.amino.ts | 12 ++-- .../ibc/core/connection/v1/tx.amino.ts | 20 +++--- .../gamm/pool-models/balancer/tx/tx.amino.ts | 12 ++-- .../gamm/pool-models/stableswap/tx.amino.ts | 4 +- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 24 +++---- .../outputv4/osmosis/incentives/tx.amino.ts | 10 +-- .../outputv4/osmosis/lockup/tx.amino.ts | 10 +-- .../outputv4/osmosis/superfluid/tx.amino.ts | 8 +-- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 6 +- .../__snapshots__/encode.test.ts.snap | 2 +- .../authz.timestamp.test.ts.snap | 4 +- .../__snapshots__/cosmwasm.test.ts.snap | 16 ++--- .../__snapshots__/lockup.test.ts.snap | 4 +- .../__snapshots__/tendermint.test.ts.snap | 52 +++++++------- .../amino-converter.spec.ts.snap | 52 +++++++------- .../__snapshots__/nested-enums.test.ts.snap | 4 +- .../super-nested-enums.test.ts.snap | 14 ++-- .../__tests__/__snapshots__/vote.test.ts.snap | 12 ++-- .../encoding/amino/from-amino-json/utils.ts | 22 +++--- .../encoding/amino/from-amino-json/utils.d.ts | 2 +- 102 files changed, 675 insertions(+), 673 deletions(-) diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts index 9fc520edde..1858e669dd 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -343,42 +343,42 @@ export const AminoConverter = { o_tests }: InputMsgAminoType["value"]): InputMsg => { return { - dOTests: d_o_tests == null ? d_o_tests : { + dOTests: { str: d_o_tests.str, dOStr: d_o_tests.d_o_str, b: d_o_tests.b, dOB: d_o_tests.d_o_b, num: d_o_tests.num, dONum: d_o_tests.d_o_num, - big: d_o_tests.big == null ? d_o_tests.big : BigInt(d_o_tests.big), - dOBig: d_o_tests.d_o_big == null ? d_o_tests.d_o_big : BigInt(d_o_tests.d_o_big), - proto: d_o_tests.proto == null ? d_o_tests.proto : { + big: BigInt(d_o_tests.big), + dOBig: BigInt(d_o_tests.d_o_big), + proto: { sender: d_o_tests.proto.sender }, - dOProto: d_o_tests.d_o_proto == null ? d_o_tests.d_o_proto : { + dOProto: { sender: d_o_tests.d_o_proto.sender }, - auth: d_o_tests.auth == null ? d_o_tests.auth : { + auth: { typeUrl: d_o_tests.auth.type_url, value: d_o_tests.auth.value }, - dOAuth: d_o_tests.d_o_auth == null ? d_o_tests.d_o_auth : { + dOAuth: { typeUrl: d_o_tests.d_o_auth.type_url, value: d_o_tests.d_o_auth.value }, salt: d_o_tests.salt, dOSalt: d_o_tests.d_o_salt, - raw: d_o_tests.raw == null ? d_o_tests.raw : toUtf8(JSON.stringify(d_o_tests.raw)), - dORaw: d_o_tests.d_o_raw == null ? d_o_tests.d_o_raw : toUtf8(JSON.stringify(d_o_tests.d_o_raw)), - wasm: d_o_tests.wasm == null ? d_o_tests.wasm : fromBase64(d_o_tests.wasm), - dOWasm: d_o_tests.d_o_wasm == null ? d_o_tests.d_o_wasm : fromBase64(d_o_tests.d_o_wasm), - opt: d_o_tests.opt == null ? d_o_tests.opt : voteOptionFromJSON(d_o_tests.opt), - dOOpt: d_o_tests.d_o_opt == null ? d_o_tests.d_o_opt : voteOptionFromJSON(d_o_tests.d_o_opt), - period: d_o_tests.period == null ? d_o_tests.period : { + raw: toUtf8(JSON.stringify(d_o_tests.raw)), + dORaw: toUtf8(JSON.stringify(d_o_tests.d_o_raw)), + wasm: fromBase64(d_o_tests.wasm), + dOWasm: fromBase64(d_o_tests.d_o_wasm), + opt: voteOptionFromJSON(d_o_tests.opt), + dOOpt: voteOptionFromJSON(d_o_tests.d_o_opt), + period: { seconds: BigInt(Math.floor(parseInt(d_o_tests.period) / 1_000_000_000)), nanos: parseInt(d_o_tests.period) % 1_000_000_000 }, - dOPeriod: d_o_tests.d_o_period == null ? d_o_tests.d_o_period : { + dOPeriod: { seconds: BigInt(Math.floor(parseInt(d_o_tests.d_o_period) / 1_000_000_000)), nanos: parseInt(d_o_tests.d_o_period) % 1_000_000_000 }, @@ -399,11 +399,11 @@ export const AminoConverter = { opts: d_o_tests.opts.map(el => voteOptionFromJSON(el)), dOOpts: d_o_tests.d_o_opts.map(el => voteOptionFromJSON(el)), periods: d_o_tests.periods.map(el1 => ({ - seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + seconds: BigInt(el1.seconds), nanos: el1.nanos })), dOPeriods: d_o_tests.d_o_periods.map(el1 => ({ - seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + seconds: BigInt(el1.seconds), nanos: el1.nanos })), protos: d_o_tests.protos.map(el1 => ({ @@ -425,42 +425,42 @@ export const AminoConverter = { decs: d_o_tests.decs, dODecs: d_o_tests.d_o_decs }, - oTests: o_tests == null ? o_tests : { + oTests: { str: o_tests.str, oStr: o_tests.o_str, b: o_tests.b, oB: o_tests.o_b, num: o_tests.num, oNum: o_tests.o_num, - big: o_tests.big == null ? o_tests.big : BigInt(o_tests.big), - oBig: o_tests.o_big == null ? o_tests.o_big : BigInt(o_tests.o_big), - proto: o_tests.proto == null ? o_tests.proto : { + big: BigInt(o_tests.big), + oBig: BigInt(o_tests.o_big), + proto: { sender: o_tests.proto.sender }, - oProto: o_tests.o_proto == null ? o_tests.o_proto : { + oProto: { sender: o_tests.o_proto.sender }, - auth: o_tests.auth == null ? o_tests.auth : { + auth: { typeUrl: o_tests.auth.type_url, value: o_tests.auth.value }, - oAuth: o_tests.o_auth == null ? o_tests.o_auth : { + oAuth: { typeUrl: o_tests.o_auth.type_url, value: o_tests.o_auth.value }, salt: o_tests.salt, oSalt: o_tests.o_salt, - raw: o_tests.raw == null ? o_tests.raw : toUtf8(JSON.stringify(o_tests.raw)), - oRaw: o_tests.o_raw == null ? o_tests.o_raw : toUtf8(JSON.stringify(o_tests.o_raw)), - wasm: o_tests.wasm == null ? o_tests.wasm : fromBase64(o_tests.wasm), - oWasm: o_tests.o_wasm == null ? o_tests.o_wasm : fromBase64(o_tests.o_wasm), - opt: o_tests.opt == null ? o_tests.opt : voteOptionFromJSON(o_tests.opt), - oOpt: o_tests.o_opt == null ? o_tests.o_opt : voteOptionFromJSON(o_tests.o_opt), - period: o_tests.period == null ? o_tests.period : { + raw: toUtf8(JSON.stringify(o_tests.raw)), + oRaw: toUtf8(JSON.stringify(o_tests.o_raw)), + wasm: fromBase64(o_tests.wasm), + oWasm: fromBase64(o_tests.o_wasm), + opt: voteOptionFromJSON(o_tests.opt), + oOpt: voteOptionFromJSON(o_tests.o_opt), + period: { seconds: BigInt(Math.floor(parseInt(o_tests.period) / 1_000_000_000)), nanos: parseInt(o_tests.period) % 1_000_000_000 }, - oPeriod: o_tests.o_period == null ? o_tests.o_period : { + oPeriod: { seconds: BigInt(Math.floor(parseInt(o_tests.o_period) / 1_000_000_000)), nanos: parseInt(o_tests.o_period) % 1_000_000_000 }, @@ -481,11 +481,11 @@ export const AminoConverter = { opts: o_tests.opts.map(el => voteOptionFromJSON(el)), oOpts: o_tests.o_opts.map(el => voteOptionFromJSON(el)), periods: o_tests.periods.map(el1 => ({ - seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + seconds: BigInt(el1.seconds), nanos: el1.nanos })), oPeriods: o_tests.o_periods.map(el1 => ({ - seconds: el1.seconds == null ? el1.seconds : BigInt(el1.seconds), + seconds: BigInt(el1.seconds), nanos: el1.nanos })), protos: o_tests.protos.map(el1 => ({ diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts index 8463bc6481..b49504893c 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: id == null ? id : { + id: { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index 182674bf72..745349374f 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -230,14 +230,14 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) + dseq: Long.fromString(id.dseq) }, groups: groups.map(el0 => ({ name: el0.name, - requirements: el0.requirements == null ? el0.requirements : { - signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { + requirements: { + signedBy: { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, @@ -247,9 +247,9 @@ export const AminoConverter = { })) }, resources: el0.resources.map(el1 => ({ - resources: el1.resources == null ? el1.resources : { - cpu: el1.resources.cpu == null ? el1.resources.cpu : { - units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { + resources: { + cpu: { + units: { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el4 => ({ @@ -257,8 +257,8 @@ export const AminoConverter = { value: el4.value })) }, - memory: el1.resources.memory == null ? el1.resources.memory : { - quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { + memory: { + quantity: { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el4 => ({ @@ -268,7 +268,7 @@ export const AminoConverter = { }, storage: el1.resources.storage.map(el3 => ({ name: el3.name, - quantity: el3.quantity == null ? el3.quantity : { + quantity: { val: el3.quantity.val }, attributes: el3.attributes.map(el4 => ({ @@ -277,19 +277,19 @@ export const AminoConverter = { })) })), endpoints: el1.resources.endpoints.map(el3 => ({ - kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), + kind: endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: el1.price == null ? el1.price : { + price: { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: deposit == null ? deposit : { + deposit: { denom: deposit.denom, amount: deposit.amount }, @@ -322,11 +322,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) + dseq: Long.fromString(id.dseq) }, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount }, @@ -353,9 +353,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) + dseq: Long.fromString(id.dseq) }, version }; @@ -377,9 +377,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq) + dseq: Long.fromString(id.dseq) } }; } @@ -401,9 +401,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq), + dseq: Long.fromString(id.dseq), gseq: id.gseq } }; @@ -426,9 +426,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq), + dseq: Long.fromString(id.dseq), gseq: id.gseq } }; @@ -451,9 +451,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : Long.fromString(id.dseq), + dseq: Long.fromString(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts index 135fb712af..5bd0ddf403 100644 --- a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts @@ -107,18 +107,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: order == null ? order : { + order: { owner: order.owner, - dseq: order.dseq == null ? order.dseq : Long.fromString(order.dseq), + dseq: Long.fromString(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: price == null ? price : { + price: { denom: price.denom, amount: price.amount }, - deposit: deposit == null ? deposit : { + deposit: { denom: deposit.denom, amount: deposit.amount } @@ -144,9 +144,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : Long.fromString(bid_id.dseq), + dseq: Long.fromString(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -173,9 +173,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : Long.fromString(bid_id.dseq), + dseq: Long.fromString(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -202,9 +202,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : Long.fromString(bid_id.dseq), + dseq: Long.fromString(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -231,9 +231,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: lease_id == null ? lease_id : { + leaseId: { owner: lease_id.owner, - dseq: lease_id.dseq == null ? lease_id.dseq : Long.fromString(lease_id.dseq), + dseq: Long.fromString(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts index bc115d76f9..09f69f6e0b 100644 --- a/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta1/provider.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } @@ -114,7 +114,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } diff --git a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts index a751ab4653..de1a53399d 100644 --- a/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/output1/akash/provider/v1beta2/provider.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } @@ -114,7 +114,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } diff --git a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts index 4a9c5269c5..b035d8f4ff 100644 --- a/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/authz/v1beta1/tx.amino.ts @@ -62,8 +62,8 @@ export const AminoConverter = { return { granter, grantee, - grant: grant == null ? grant : { - authorization: grant.authorization == null ? grant.authorization : { + grant: { + authorization: { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, diff --git a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts index fb52bfc0c1..8cf0ca70d6 100644 --- a/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/evidence/v1beta1/tx.amino.ts @@ -32,7 +32,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: evidence == null ? evidence : { + evidence: { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts index 0b4271eece..c376a3917b 100644 --- a/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/feegrant/v1beta1/tx.amino.ts @@ -44,7 +44,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: allowance == null ? allowance : { + allowance: { typeUrl: allowance.type_url, value: allowance.value } diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index 2548c976d7..9d8e33ead3 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -122,7 +122,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -152,9 +152,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option), + option: voteOptionFromJSON(option), metadata }; } @@ -184,10 +184,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -216,7 +216,7 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index ad09884431..8e7a47cffd 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -74,7 +74,7 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -105,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option) + option: voteOptionFromJSON(option) }; } }, @@ -133,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -164,7 +164,7 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index 123b1c7b9c..b495ad6e1f 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -208,7 +208,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: group_id == null ? group_id : Long.fromString(group_id), + groupId: Long.fromString(group_id), memberUpdates: member_updates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -238,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: group_id == null ? group_id : Long.fromString(group_id), + groupId: Long.fromString(group_id), newAdmin: new_admin }; } @@ -263,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: group_id == null ? group_id : Long.fromString(group_id), + groupId: Long.fromString(group_id), metadata }; } @@ -294,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: group_id == null ? group_id : Long.fromString(group_id), + groupId: Long.fromString(group_id), metadata, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -349,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -405,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -472,7 +472,7 @@ export const AminoConverter = { typeUrl: el0.type_url, value: el0.value })), - exec: exec == null ? exec : execFromJSON(exec) + exec: execFromJSON(exec) }; } }, @@ -492,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), address }; } @@ -522,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option), + option: voteOptionFromJSON(option), metadata, - exec: exec == null ? exec : execFromJSON(exec) + exec: execFromJSON(exec) }; } }, @@ -546,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: proposal_id == null ? proposal_id : Long.fromString(proposal_id), + proposalId: Long.fromString(proposal_id), signer }; } @@ -568,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: group_id == null ? group_id : Long.fromString(group_id) + groupId: Long.fromString(group_id) }; } } diff --git a/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts index c603ea653e..6591c296d4 100644 --- a/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/staking/v1beta1/tx.amino.ts @@ -125,14 +125,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: commission == null ? commission : { + commission: { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -141,7 +141,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: value == null ? value : { + value: { denom: value.denom, amount: value.amount } @@ -176,7 +176,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, @@ -213,7 +213,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -248,7 +248,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -279,7 +279,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts index 2a17a36729..f482eccc9d 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts @@ -52,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: plan == null ? plan : { + plan: { name: plan.name, time: plan.time, - height: plan.height == null ? plan.height : Long.fromString(plan.height), + height: Long.fromString(plan.height), info: plan.info, - upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { + upgradedClientState: { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index c77acd7a38..292736835d 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -77,7 +77,7 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - endTime: end_time == null ? end_time : Long.fromString(end_time), + endTime: Long.fromString(end_time), delayed }; } @@ -143,9 +143,9 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: start_time == null ? start_time : Long.fromString(start_time), + startTime: Long.fromString(start_time), vestingPeriods: vesting_periods.map(el0 => ({ - length: el0.length == null ? el0.length : Long.fromString(el0.length), + length: Long.fromString(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index 1b2d91adbf..e5547717dc 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -89,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), - instantiatePermission: instantiate_permission == null ? instantiate_permission : { - permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: fromBase64(wasm_byte_code), + instantiatePermission: { + permission: accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -130,9 +130,9 @@ export const AminoConverter = { return { sender, admin, - codeId: code_id == null ? code_id : Long.fromString(code_id), + codeId: Long.fromString(code_id), label, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -167,7 +167,7 @@ export const AminoConverter = { return { sender, contract, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -199,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: code_id == null ? code_id : Long.fromString(code_id), - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) + codeId: Long.fromString(code_id), + msg: toUtf8(JSON.stringify(msg)) }; } }, diff --git a/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts b/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts index 412b69ba78..caa1bd4fbd 100644 --- a/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/erc20/v1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: coin == null ? coin : { + coin: { denom: coin.denom, amount: coin.amount }, diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index ced9693ab4..2b81c001df 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -80,14 +80,14 @@ export const AminoConverter = { toAddress: to_address, startTime: start_time, lockupPeriods: lockup_periods.map(el0 => ({ - length: el0.length == null ? el0.length : Long.fromString(el0.length), + length: Long.fromString(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vestingPeriods: vesting_periods.map(el0 => ({ - length: el0.length == null ? el0.length : Long.fromString(el0.length), + length: Long.fromString(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts index ca04501369..bfa43b9545 100644 --- a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: token == null ? token : { + token: { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : Long.fromString(timeout_timestamp) + timeoutTimestamp: Long.fromString(timeout_timestamp) }; } } diff --git a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts index 683d2019bb..0430c183e1 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: channel == null ? channel : { - state: channel.state == null ? channel.state : stateFromJSON(channel.state), - ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), - counterparty: channel.counterparty == null ? channel.counterparty : { + channel: { + state: stateFromJSON(channel.state), + ordering: orderFromJSON(channel.ordering), + counterparty: { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: channel == null ? channel : { - state: channel.state == null ? channel.state : stateFromJSON(channel.state), - ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), - counterparty: channel.counterparty == null ? channel.counterparty : { + channel: { + state: stateFromJSON(channel.state), + ordering: orderFromJSON(channel.ordering), + counterparty: { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), + packet: { + sequence: Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: Long.fromString(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), + packet: { + sequence: Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: Long.fromString(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: Long.fromString(proof_height.revision_height || "0", true), revisionNumber: Long.fromString(proof_height.revision_number || "0", true) } : undefined, - nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : Long.fromString(next_sequence_recv), + nextSequenceRecv: Long.fromString(next_sequence_recv), signer }; } @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), + packet: { + sequence: Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: Long.fromString(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(proof_height.revision_height || "0", true), revisionNumber: Long.fromString(proof_height.revision_number || "0", true) } : undefined, - nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : Long.fromString(next_sequence_recv), + nextSequenceRecv: Long.fromString(next_sequence_recv), signer }; } @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : Long.fromString(packet.sequence), + packet: { + sequence: Long.fromString(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: Long.fromString(packet.timeout_height.revision_height || "0", true), revisionNumber: Long.fromString(packet.timeout_height.revision_number || "0", true) } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : Long.fromString(packet.timeout_timestamp) + timeoutTimestamp: Long.fromString(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts index d4798ea877..727e135426 100644 --- a/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/client/v1/tx.amino.ts @@ -80,11 +80,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: consensus_state == null ? consensus_state : { + consensusState: { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -115,7 +115,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: header == null ? header : { + header: { typeUrl: header.type_url, value: header.value }, @@ -158,11 +158,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: consensus_state == null ? consensus_state : { + consensusState: { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -195,7 +195,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: misbehaviour == null ? misbehaviour : { + misbehaviour: { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index b160359939..70f6da5eb8 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: counterparty == null ? counterparty : { + counterparty: { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: counterparty.prefix == null ? counterparty.prefix : { + prefix: { keyPrefix: counterparty.prefix.key_prefix } }, - version: version == null ? version : { + version: { identifier: version.identifier, features: version.features }, - delayPeriod: delay_period == null ? delay_period : Long.fromString(delay_period), + delayPeriod: Long.fromString(delay_period), signer }; } @@ -201,18 +201,18 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: counterparty == null ? counterparty : { + counterparty: { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: counterparty.prefix == null ? counterparty.prefix : { + prefix: { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: delay_period == null ? delay_period : Long.fromString(delay_period), + delayPeriod: Long.fromString(delay_period), counterpartyVersions: counterparty_versions.map(el0 => ({ identifier: el0.identifier, features: el0.features @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: version == null ? version : { + version: { identifier: version.identifier, features: version.features }, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index 5212080da9..5cf1ac60c7 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -95,24 +95,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: pool_params == null ? pool_params : { + poolParams: { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { + smoothWeightChangeParams: { startTime: pool_params.smooth_weight_change_params.start_time, - duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { + duration: { seconds: Long.fromNumber(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: el2.token == null ? el2.token : { + token: { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: el2.token == null ? el2.token : { + token: { denom: el2.token.denom, amount: el2.token.amount }, @@ -121,7 +121,7 @@ export const AminoConverter = { } }, poolAssets: pool_assets.map(el0 => ({ - token: el0.token == null ? el0.token : { + token: { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index de366d7e5f..a1c071c54d 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -65,7 +65,7 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: pool_params == null ? pool_params : { + poolParams: { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, @@ -99,7 +99,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + poolId: Long.fromString(pool_id), scalingFactors: scaling_factors.map(el0 => Long.fromString(el0)) }; } diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index bea8660afb..06959b118f 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + poolId: Long.fromString(pool_id), shareOutAmount: share_out_amount, tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, @@ -163,7 +163,7 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + poolId: Long.fromString(pool_id), shareInAmount: share_in_amount, tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, @@ -202,10 +202,10 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : Long.fromString(el0.pool_id), + poolId: Long.fromString(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: token_in == null ? token_in : { + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -243,11 +243,11 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : Long.fromString(el0.pool_id), + poolId: Long.fromString(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: token_out == null ? token_out : { + tokenOut: { denom: token_out.denom, amount: token_out.amount } @@ -280,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), - tokenIn: token_in == null ? token_in : { + poolId: Long.fromString(pool_id), + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -315,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + poolId: Long.fromString(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -348,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), - tokenOut: token_out == null ? token_out : { + poolId: Long.fromString(pool_id), + tokenOut: { denom: token_out.denom, amount: token_out.amount }, @@ -383,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id), + poolId: Long.fromString(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 13302e40dd..932fa6c7d5 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -78,10 +78,10 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: distribute_to == null ? distribute_to : { - lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: { + lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: distribute_to.duration == null ? distribute_to.duration : { + duration: { seconds: Long.fromNumber(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, @@ -92,7 +92,7 @@ export const AminoConverter = { amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : Long.fromString(num_epochs_paid_over) + numEpochsPaidOver: Long.fromString(num_epochs_paid_over) }; } }, @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: gauge_id == null ? gauge_id : Long.fromString(gauge_id), + gaugeId: Long.fromString(gauge_id), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index 4b7ec5f978..7fc22f9239 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -82,7 +82,7 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: duration == null ? duration : { + duration: { seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, @@ -133,7 +133,7 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: ID == null ? ID : Long.fromString(ID), + ID: Long.fromString(ID), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -161,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: ID == null ? ID : Long.fromString(ID), - duration: duration == null ? duration : { + ID: Long.fromString(ID), + duration: { seconds: Long.fromNumber(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -192,7 +192,7 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: ID == null ? ID : Long.fromString(ID), + ID: Long.fromString(ID), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index 5690ad05a0..e2d7965baf 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: lock_id == null ? lock_id : Long.fromString(lock_id), + lockId: Long.fromString(lock_id), valAddr: val_addr }; } @@ -86,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: lock_id == null ? lock_id : Long.fromString(lock_id) + lockId: Long.fromString(lock_id) }; } }, @@ -107,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: lock_id == null ? lock_id : Long.fromString(lock_id) + lockId: Long.fromString(lock_id) }; } }, @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: pool_id == null ? pool_id : Long.fromString(pool_id) + poolId: Long.fromString(pool_id) }; } } diff --git a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts index 1be16f5a73..d94f41b2f4 100644 --- a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -101,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -190,7 +190,7 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: metadata == null ? metadata : { + metadata: { description: metadata.description, denomUnits: metadata.denom_units.map(el1 => ({ denom: el1.denom, diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts index 8463bc6481..b49504893c 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: id == null ? id : { + id: { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index 112f873555..0ec4b67712 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -229,14 +229,14 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) }, groups: groups.map(el0 => ({ name: el0.name, - requirements: el0.requirements == null ? el0.requirements : { - signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { + requirements: { + signedBy: { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, @@ -246,9 +246,9 @@ export const AminoConverter = { })) }, resources: el0.resources.map(el1 => ({ - resources: el1.resources == null ? el1.resources : { - cpu: el1.resources.cpu == null ? el1.resources.cpu : { - units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { + resources: { + cpu: { + units: { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el4 => ({ @@ -256,8 +256,8 @@ export const AminoConverter = { value: el4.value })) }, - memory: el1.resources.memory == null ? el1.resources.memory : { - quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { + memory: { + quantity: { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el4 => ({ @@ -267,7 +267,7 @@ export const AminoConverter = { }, storage: el1.resources.storage.map(el3 => ({ name: el3.name, - quantity: el3.quantity == null ? el3.quantity : { + quantity: { val: el3.quantity.val }, attributes: el3.attributes.map(el4 => ({ @@ -276,19 +276,19 @@ export const AminoConverter = { })) })), endpoints: el1.resources.endpoints.map(el3 => ({ - kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), + kind: endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: el1.price == null ? el1.price : { + price: { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: deposit == null ? deposit : { + deposit: { denom: deposit.denom, amount: deposit.amount }, @@ -321,11 +321,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) }, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount }, @@ -352,9 +352,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) }, version }; @@ -376,9 +376,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) } }; } @@ -400,9 +400,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), + dseq: BigInt(id.dseq), gseq: id.gseq } }; @@ -425,9 +425,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), + dseq: BigInt(id.dseq), gseq: id.gseq } }; @@ -450,9 +450,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), + dseq: BigInt(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts index 7e1c6812ae..9b6c061288 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts @@ -106,18 +106,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: order == null ? order : { + order: { owner: order.owner, - dseq: order.dseq == null ? order.dseq : BigInt(order.dseq), + dseq: BigInt(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: price == null ? price : { + price: { denom: price.denom, amount: price.amount }, - deposit: deposit == null ? deposit : { + deposit: { denom: deposit.denom, amount: deposit.amount } @@ -143,9 +143,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), + dseq: BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -172,9 +172,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), + dseq: BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -201,9 +201,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), + dseq: BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -230,9 +230,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: lease_id == null ? lease_id : { + leaseId: { owner: lease_id.owner, - dseq: lease_id.dseq == null ? lease_id.dseq : BigInt(lease_id.dseq), + dseq: BigInt(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts index bc115d76f9..09f69f6e0b 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta1/provider.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } @@ -114,7 +114,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts index a751ab4653..de1a53399d 100644 --- a/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/provider/v1beta2/provider.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } @@ -114,7 +114,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts index 4a9c5269c5..b035d8f4ff 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/authz/v1beta1/tx.amino.ts @@ -62,8 +62,8 @@ export const AminoConverter = { return { granter, grantee, - grant: grant == null ? grant : { - authorization: grant.authorization == null ? grant.authorization : { + grant: { + authorization: { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts index fb52bfc0c1..8cf0ca70d6 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/evidence/v1beta1/tx.amino.ts @@ -32,7 +32,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: evidence == null ? evidence : { + evidence: { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts index 0b4271eece..c376a3917b 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/feegrant/v1beta1/tx.amino.ts @@ -44,7 +44,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: allowance == null ? allowance : { + allowance: { typeUrl: allowance.type_url, value: allowance.value } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index 571eb66357..67ab16a988 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -121,7 +121,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -151,9 +151,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option), + option: voteOptionFromJSON(option), metadata }; } @@ -183,10 +183,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -215,7 +215,7 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index 1e74d4ac48..1c57926a38 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -74,7 +74,7 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -105,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option) + option: voteOptionFromJSON(option) }; } }, @@ -133,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -164,7 +164,7 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index 3518cc077d..8d53274d40 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -208,7 +208,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), memberUpdates: member_updates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -238,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), newAdmin: new_admin }; } @@ -263,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), metadata }; } @@ -294,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), metadata, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -349,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -405,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -472,7 +472,7 @@ export const AminoConverter = { typeUrl: el0.type_url, value: el0.value })), - exec: exec == null ? exec : execFromJSON(exec) + exec: execFromJSON(exec) }; } }, @@ -492,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), address }; } @@ -522,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option), + option: voteOptionFromJSON(option), metadata, - exec: exec == null ? exec : execFromJSON(exec) + exec: execFromJSON(exec) }; } }, @@ -546,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), signer }; } @@ -568,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: group_id == null ? group_id : BigInt(group_id) + groupId: BigInt(group_id) }; } } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts index ba1c07aecb..86e67cabcd 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/staking/v1beta1/tx.amino.ts @@ -124,14 +124,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: commission == null ? commission : { + commission: { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -140,7 +140,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: value == null ? value : { + value: { denom: value.denom, amount: value.amount } @@ -175,7 +175,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, @@ -212,7 +212,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -247,7 +247,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -278,7 +278,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts index 1207564430..859b46b571 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts @@ -52,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: plan == null ? plan : { + plan: { name: plan.name, time: plan.time, - height: plan.height == null ? plan.height : BigInt(plan.height), + height: BigInt(plan.height), info: plan.info, - upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { + upgradedClientState: { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index ac022a3690..c9100067c2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -77,7 +77,7 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - endTime: end_time == null ? end_time : BigInt(end_time), + endTime: BigInt(end_time), delayed }; } @@ -143,9 +143,9 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: start_time == null ? start_time : BigInt(start_time), + startTime: BigInt(start_time), vestingPeriods: vesting_periods.map(el0 => ({ - length: el0.length == null ? el0.length : BigInt(el0.length), + length: BigInt(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index 037366286b..d9fd821339 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -89,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), - instantiatePermission: instantiate_permission == null ? instantiate_permission : { - permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: fromBase64(wasm_byte_code), + instantiatePermission: { + permission: accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -130,9 +130,9 @@ export const AminoConverter = { return { sender, admin, - codeId: code_id == null ? code_id : BigInt(code_id), + codeId: BigInt(code_id), label, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -167,7 +167,7 @@ export const AminoConverter = { return { sender, contract, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -199,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: code_id == null ? code_id : BigInt(code_id), - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) + codeId: BigInt(code_id), + msg: toUtf8(JSON.stringify(msg)) }; } }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts index 66ca632c61..0be2123e86 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/erc20/v1/tx.amino.ts @@ -44,7 +44,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: coin == null ? coin : { + coin: { denom: coin.denom, amount: coin.amount }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index 15586a4c89..3bd96d6c01 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -80,14 +80,14 @@ export const AminoConverter = { toAddress: to_address, startTime: start_time, lockupPeriods: lockup_periods.map(el0 => ({ - length: el0.length == null ? el0.length : BigInt(el0.length), + length: BigInt(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vestingPeriods: vesting_periods.map(el0 => ({ - length: el0.length == null ? el0.length : BigInt(el0.length), + length: BigInt(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts index 2fc542ef2c..b0688ec501 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/fee/v1/tx.amino.ts @@ -163,7 +163,7 @@ export const AminoConverter = { relayers }: MsgPayPacketFeeAminoType["value"]): MsgPayPacketFee => { return { - fee: fee == null ? fee : { + fee: { recvFee: fee.recv_fee.map(el1 => ({ denom: el1.denom, amount: el1.amount @@ -214,8 +214,8 @@ export const AminoConverter = { packet_fee }: MsgPayPacketFeeAsyncAminoType["value"]): MsgPayPacketFeeAsync => { return { - packetFee: packet_fee == null ? packet_fee : { - fee: packet_fee.fee == null ? packet_fee.fee : { + packetFee: { + fee: { recvFee: packet_fee.fee.recv_fee.map(el2 => ({ denom: el2.denom, amount: el2.amount diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index 7e9fe0941c..d8b8afbd5e 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -77,12 +77,12 @@ export const AminoConverter = { return { owner, connectionId: connection_id, - packetData: packet_data == null ? packet_data : { - type: packet_data.type == null ? packet_data.type : typeFromJSON(packet_data.type), + packetData: { + type: typeFromJSON(packet_data.type), data: packet_data.data, memo: packet_data.memo }, - relativeTimeout: relative_timeout == null ? relative_timeout : BigInt(relative_timeout) + relativeTimeout: BigInt(relative_timeout) }; } } diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts index af0d8699c0..854424544c 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: token == null ? token : { + token: { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: BigInt(timeout_height.revision_height || "0"), revisionNumber: BigInt(timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : BigInt(timeout_timestamp) + timeoutTimestamp: BigInt(timeout_timestamp) }; } } diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts index b2cd93ebf7..e781e4c600 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: channel == null ? channel : { - state: channel.state == null ? channel.state : stateFromJSON(channel.state), - ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), - counterparty: channel.counterparty == null ? channel.counterparty : { + channel: { + state: stateFromJSON(channel.state), + ordering: orderFromJSON(channel.ordering), + counterparty: { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: channel == null ? channel : { - state: channel.state == null ? channel.state : stateFromJSON(channel.state), - ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), - counterparty: channel.counterparty == null ? channel.counterparty : { + channel: { + state: stateFromJSON(channel.state), + ordering: orderFromJSON(channel.ordering), + counterparty: { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), + nextSequenceRecv: BigInt(next_sequence_recv), signer }; } @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), + nextSequenceRecv: BigInt(next_sequence_recv), signer }; } @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts index d4798ea877..727e135426 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/client/v1/tx.amino.ts @@ -80,11 +80,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: consensus_state == null ? consensus_state : { + consensusState: { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -115,7 +115,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: header == null ? header : { + header: { typeUrl: header.type_url, value: header.value }, @@ -158,11 +158,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: consensus_state == null ? consensus_state : { + consensusState: { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -195,7 +195,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: misbehaviour == null ? misbehaviour : { + misbehaviour: { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 2b0def79de..9d7a779dd2 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: counterparty == null ? counterparty : { + counterparty: { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: counterparty.prefix == null ? counterparty.prefix : { + prefix: { keyPrefix: counterparty.prefix.key_prefix } }, - version: version == null ? version : { + version: { identifier: version.identifier, features: version.features }, - delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + delayPeriod: BigInt(delay_period), signer }; } @@ -201,18 +201,18 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: counterparty == null ? counterparty : { + counterparty: { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: counterparty.prefix == null ? counterparty.prefix : { + prefix: { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + delayPeriod: BigInt(delay_period), counterpartyVersions: counterparty_versions.map(el0 => ({ identifier: el0.identifier, features: el0.features @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: version == null ? version : { + version: { identifier: version.identifier, features: version.features }, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index 48206573b9..6062a6910a 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -94,15 +94,15 @@ export const AminoConverter = { token_min_amount1 }: MsgCreatePositionAminoType["value"]): MsgCreatePosition => { return { - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), sender, - lowerTick: lower_tick == null ? lower_tick : BigInt(lower_tick), - upperTick: upper_tick == null ? upper_tick : BigInt(upper_tick), - tokenDesired0: token_desired0 == null ? token_desired0 : { + lowerTick: BigInt(lower_tick), + upperTick: BigInt(upper_tick), + tokenDesired0: { denom: token_desired0.denom, amount: token_desired0.amount }, - tokenDesired1: token_desired1 == null ? token_desired1 : { + tokenDesired1: { denom: token_desired1.denom, amount: token_desired1.amount }, @@ -130,7 +130,7 @@ export const AminoConverter = { liquidity_amount }: MsgWithdrawPositionAminoType["value"]): MsgWithdrawPosition => { return { - positionId: position_id == null ? position_id : BigInt(position_id), + positionId: BigInt(position_id), sender, liquidityAmount: liquidity_amount }; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index f7dc37a131..e481a8e582 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -94,24 +94,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: pool_params == null ? pool_params : { + poolParams: { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { + smoothWeightChangeParams: { startTime: pool_params.smooth_weight_change_params.start_time, - duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { + duration: { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: el2.token == null ? el2.token : { + token: { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: el2.token == null ? el2.token : { + token: { denom: el2.token.denom, amount: el2.token.amount }, @@ -120,7 +120,7 @@ export const AminoConverter = { } }, poolAssets: pool_assets.map(el0 => ({ - token: el0.token == null ? el0.token : { + token: { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 235fa81f60..8638459881 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -65,7 +65,7 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: pool_params == null ? pool_params : { + poolParams: { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, @@ -99,7 +99,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), scalingFactors: scaling_factors.map(el0 => BigInt(el0)) }; } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index 24bf8274f7..49a21b2fcc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), shareOutAmount: share_out_amount, tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, @@ -163,7 +163,7 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), shareInAmount: share_in_amount, tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, @@ -202,10 +202,10 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: token_in == null ? token_in : { + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -243,11 +243,11 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: token_out == null ? token_out : { + tokenOut: { denom: token_out.denom, amount: token_out.amount } @@ -280,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), - tokenIn: token_in == null ? token_in : { + poolId: BigInt(pool_id), + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -315,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -348,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), - tokenOut: token_out == null ? token_out : { + poolId: BigInt(pool_id), + tokenOut: { denom: token_out.denom, amount: token_out.amount }, @@ -383,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index a1791c5798..4f28766a14 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -78,10 +78,10 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: distribute_to == null ? distribute_to : { - lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: { + lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: distribute_to.duration == null ? distribute_to.duration : { + duration: { seconds: BigInt(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, @@ -92,7 +92,7 @@ export const AminoConverter = { amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : BigInt(num_epochs_paid_over) + numEpochsPaidOver: BigInt(num_epochs_paid_over) }; } }, @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), + gaugeId: BigInt(gauge_id), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index 2e3b4c8331..a5ddf6e1a1 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -82,7 +82,7 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: duration == null ? duration : { + duration: { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, @@ -133,7 +133,7 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: ID == null ? ID : BigInt(ID), + ID: BigInt(ID), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -161,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: ID == null ? ID : BigInt(ID), - duration: duration == null ? duration : { + ID: BigInt(ID), + duration: { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -192,7 +192,7 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: ID == null ? ID : BigInt(ID), + ID: BigInt(ID), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index 8c2af5c0c4..a9db12f5b4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -65,10 +65,10 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: token_in == null ? token_in : { + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -106,11 +106,11 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: token_out == null ? token_out : { + tokenOut: { denom: token_out.denom, amount: token_out.amount } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index d6b3baad7d..0ca0511aa4 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -95,7 +95,7 @@ export const AminoConverter = { hotRoutes: hot_routes.map(el0 => ({ arbRoutes: el0.arb_routes.map(el1 => ({ trades: el1.trades.map(el2 => ({ - pool: el2.pool == null ? el2.pool : BigInt(el2.pool), + pool: BigInt(el2.pool), tokenIn: el2.token_in, tokenOut: el2.token_out })), @@ -145,7 +145,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerTxAminoType["value"]): MsgSetMaxPoolPointsPerTx => { return { admin, - maxPoolPointsPerTx: max_pool_points_per_tx == null ? max_pool_points_per_tx : BigInt(max_pool_points_per_tx) + maxPoolPointsPerTx: BigInt(max_pool_points_per_tx) }; } }, @@ -166,7 +166,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerBlockAminoType["value"]): MsgSetMaxPoolPointsPerBlock => { return { admin, - maxPoolPointsPerBlock: max_pool_points_per_block == null ? max_pool_points_per_block : BigInt(max_pool_points_per_block) + maxPoolPointsPerBlock: BigInt(max_pool_points_per_block) }; } }, @@ -191,10 +191,10 @@ export const AminoConverter = { }: MsgSetPoolWeightsAminoType["value"]): MsgSetPoolWeights => { return { admin, - poolWeights: pool_weights == null ? pool_weights : { - stableWeight: pool_weights.stable_weight == null ? pool_weights.stable_weight : BigInt(pool_weights.stable_weight), - balancerWeight: pool_weights.balancer_weight == null ? pool_weights.balancer_weight : BigInt(pool_weights.balancer_weight), - concentratedWeight: pool_weights.concentrated_weight == null ? pool_weights.concentrated_weight : BigInt(pool_weights.concentrated_weight) + poolWeights: { + stableWeight: BigInt(pool_weights.stable_weight), + balancerWeight: BigInt(pool_weights.balancer_weight), + concentratedWeight: BigInt(pool_weights.concentrated_weight) } }; } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index 1b566dd666..626fa90454 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: lock_id == null ? lock_id : BigInt(lock_id), + lockId: BigInt(lock_id), valAddr: val_addr }; } @@ -86,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: lock_id == null ? lock_id : BigInt(lock_id) + lockId: BigInt(lock_id) }; } }, @@ -107,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: lock_id == null ? lock_id : BigInt(lock_id) + lockId: BigInt(lock_id) }; } }, @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id) + poolId: BigInt(pool_id) }; } } diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts index faf7e687ca..0d9cf2dde2 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -101,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -190,7 +190,7 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: metadata == null ? metadata : { + metadata: { description: metadata.description, denomUnits: metadata.denom_units.map(el1 => ({ denom: el1.denom, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index a54e8516f0..62ca2333aa 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -105,7 +105,7 @@ export const AminoConverter = { }: MsgDelegateToValidatorSetAminoType["value"]): MsgDelegateToValidatorSet => { return { delegator, - coin: coin == null ? coin : { + coin: { denom: coin.denom, amount: coin.amount } @@ -132,7 +132,7 @@ export const AminoConverter = { }: MsgUndelegateFromValidatorSetAminoType["value"]): MsgUndelegateFromValidatorSet => { return { delegator, - coin: coin == null ? coin : { + coin: { denom: coin.denom, amount: coin.amount } @@ -200,7 +200,7 @@ export const AminoConverter = { }: MsgDelegateBondedTokensAminoType["value"]): MsgDelegateBondedTokens => { return { delegator, - lockID: lockID == null ? lockID : BigInt(lockID) + lockID: BigInt(lockID) }; } } diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts index 8463bc6481..b49504893c 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts @@ -60,7 +60,7 @@ export const AminoConverter = { id }: MsgRevokeCertificateAminoType["value"]): MsgRevokeCertificate => { return { - id: id == null ? id : { + id: { owner: id.owner, serial: id.serial } diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index 112f873555..0ec4b67712 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -229,14 +229,14 @@ export const AminoConverter = { depositor }: MsgCreateDeploymentAminoType["value"]): MsgCreateDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) }, groups: groups.map(el0 => ({ name: el0.name, - requirements: el0.requirements == null ? el0.requirements : { - signedBy: el0.requirements.signed_by == null ? el0.requirements.signed_by : { + requirements: { + signedBy: { allOf: el0.requirements.signed_by.all_of, anyOf: el0.requirements.signed_by.any_of }, @@ -246,9 +246,9 @@ export const AminoConverter = { })) }, resources: el0.resources.map(el1 => ({ - resources: el1.resources == null ? el1.resources : { - cpu: el1.resources.cpu == null ? el1.resources.cpu : { - units: el1.resources.cpu.units == null ? el1.resources.cpu.units : { + resources: { + cpu: { + units: { val: el1.resources.cpu.units.val }, attributes: el1.resources.cpu.attributes.map(el4 => ({ @@ -256,8 +256,8 @@ export const AminoConverter = { value: el4.value })) }, - memory: el1.resources.memory == null ? el1.resources.memory : { - quantity: el1.resources.memory.quantity == null ? el1.resources.memory.quantity : { + memory: { + quantity: { val: el1.resources.memory.quantity.val }, attributes: el1.resources.memory.attributes.map(el4 => ({ @@ -267,7 +267,7 @@ export const AminoConverter = { }, storage: el1.resources.storage.map(el3 => ({ name: el3.name, - quantity: el3.quantity == null ? el3.quantity : { + quantity: { val: el3.quantity.val }, attributes: el3.attributes.map(el4 => ({ @@ -276,19 +276,19 @@ export const AminoConverter = { })) })), endpoints: el1.resources.endpoints.map(el3 => ({ - kind: el3.kind == null ? el3.kind : endpoint_KindFromJSON(el3.kind), + kind: endpoint_KindFromJSON(el3.kind), sequenceNumber: el3.sequence_number })) }, count: el1.count, - price: el1.price == null ? el1.price : { + price: { denom: el1.price.denom, amount: el1.price.amount } })) })), version, - deposit: deposit == null ? deposit : { + deposit: { denom: deposit.denom, amount: deposit.amount }, @@ -321,11 +321,11 @@ export const AminoConverter = { depositor }: MsgDepositDeploymentAminoType["value"]): MsgDepositDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) }, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount }, @@ -352,9 +352,9 @@ export const AminoConverter = { version }: MsgUpdateDeploymentAminoType["value"]): MsgUpdateDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) }, version }; @@ -376,9 +376,9 @@ export const AminoConverter = { id }: MsgCloseDeploymentAminoType["value"]): MsgCloseDeployment => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq) + dseq: BigInt(id.dseq) } }; } @@ -400,9 +400,9 @@ export const AminoConverter = { id }: MsgCloseGroupAminoType["value"]): MsgCloseGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), + dseq: BigInt(id.dseq), gseq: id.gseq } }; @@ -425,9 +425,9 @@ export const AminoConverter = { id }: MsgPauseGroupAminoType["value"]): MsgPauseGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), + dseq: BigInt(id.dseq), gseq: id.gseq } }; @@ -450,9 +450,9 @@ export const AminoConverter = { id }: MsgStartGroupAminoType["value"]): MsgStartGroup => { return { - id: id == null ? id : { + id: { owner: id.owner, - dseq: id.dseq == null ? id.dseq : BigInt(id.dseq), + dseq: BigInt(id.dseq), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts index 7e1c6812ae..9b6c061288 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts @@ -106,18 +106,18 @@ export const AminoConverter = { deposit }: MsgCreateBidAminoType["value"]): MsgCreateBid => { return { - order: order == null ? order : { + order: { owner: order.owner, - dseq: order.dseq == null ? order.dseq : BigInt(order.dseq), + dseq: BigInt(order.dseq), gseq: order.gseq, oseq: order.oseq }, provider, - price: price == null ? price : { + price: { denom: price.denom, amount: price.amount }, - deposit: deposit == null ? deposit : { + deposit: { denom: deposit.denom, amount: deposit.amount } @@ -143,9 +143,9 @@ export const AminoConverter = { bid_id }: MsgCloseBidAminoType["value"]): MsgCloseBid => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), + dseq: BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -172,9 +172,9 @@ export const AminoConverter = { bid_id }: MsgWithdrawLeaseAminoType["value"]): MsgWithdrawLease => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), + dseq: BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -201,9 +201,9 @@ export const AminoConverter = { bid_id }: MsgCreateLeaseAminoType["value"]): MsgCreateLease => { return { - bidId: bid_id == null ? bid_id : { + bidId: { owner: bid_id.owner, - dseq: bid_id.dseq == null ? bid_id.dseq : BigInt(bid_id.dseq), + dseq: BigInt(bid_id.dseq), gseq: bid_id.gseq, oseq: bid_id.oseq, provider: bid_id.provider @@ -230,9 +230,9 @@ export const AminoConverter = { lease_id }: MsgCloseLeaseAminoType["value"]): MsgCloseLease => { return { - leaseId: lease_id == null ? lease_id : { + leaseId: { owner: lease_id.owner, - dseq: lease_id.dseq == null ? lease_id.dseq : BigInt(lease_id.dseq), + dseq: BigInt(lease_id.dseq), gseq: lease_id.gseq, oseq: lease_id.oseq, provider: lease_id.provider diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts index bc115d76f9..09f69f6e0b 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta1/provider.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } @@ -114,7 +114,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts index a751ab4653..de1a53399d 100644 --- a/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/provider/v1beta2/provider.amino.ts @@ -73,7 +73,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } @@ -114,7 +114,7 @@ export const AminoConverter = { key: el0.key, value: el0.value })), - info: info == null ? info : { + info: { email: info.email, website: info.website } diff --git a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts index 4a9c5269c5..b035d8f4ff 100644 --- a/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/authz/v1beta1/tx.amino.ts @@ -62,8 +62,8 @@ export const AminoConverter = { return { granter, grantee, - grant: grant == null ? grant : { - authorization: grant.authorization == null ? grant.authorization : { + grant: { + authorization: { typeUrl: grant.authorization.type_url, value: grant.authorization.value }, diff --git a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts index fb52bfc0c1..8cf0ca70d6 100644 --- a/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/evidence/v1beta1/tx.amino.ts @@ -32,7 +32,7 @@ export const AminoConverter = { }: MsgSubmitEvidenceAminoType["value"]): MsgSubmitEvidence => { return { submitter, - evidence: evidence == null ? evidence : { + evidence: { typeUrl: evidence.type_url, value: evidence.value } diff --git a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts index 0b4271eece..c376a3917b 100644 --- a/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/feegrant/v1beta1/tx.amino.ts @@ -44,7 +44,7 @@ export const AminoConverter = { return { granter, grantee, - allowance: allowance == null ? allowance : { + allowance: { typeUrl: allowance.type_url, value: allowance.value } diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index 571eb66357..67ab16a988 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -121,7 +121,7 @@ export const AminoConverter = { authority }: MsgExecLegacyContentAminoType["value"]): MsgExecLegacyContent => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -151,9 +151,9 @@ export const AminoConverter = { metadata }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option), + option: voteOptionFromJSON(option), metadata }; } @@ -183,10 +183,10 @@ export const AminoConverter = { metadata }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })), metadata @@ -215,7 +215,7 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index 1e74d4ac48..1c57926a38 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -74,7 +74,7 @@ export const AminoConverter = { proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -105,9 +105,9 @@ export const AminoConverter = { option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option) + option: voteOptionFromJSON(option) }; } }, @@ -133,10 +133,10 @@ export const AminoConverter = { options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -164,7 +164,7 @@ export const AminoConverter = { amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index 3518cc077d..8d53274d40 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -208,7 +208,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembersAminoType["value"]): MsgUpdateGroupMembers => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), memberUpdates: member_updates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -238,7 +238,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdminAminoType["value"]): MsgUpdateGroupAdmin => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), newAdmin: new_admin }; } @@ -263,7 +263,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadataAminoType["value"]): MsgUpdateGroupMetadata => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), metadata }; } @@ -294,9 +294,9 @@ export const AminoConverter = { }: MsgCreateGroupPolicyAminoType["value"]): MsgCreateGroupPolicy => { return { admin, - groupId: group_id == null ? group_id : BigInt(group_id), + groupId: BigInt(group_id), metadata, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -349,7 +349,7 @@ export const AminoConverter = { groupMetadata: group_metadata, groupPolicyMetadata: group_policy_metadata, groupPolicyAsAdmin: group_policy_as_admin, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -405,7 +405,7 @@ export const AminoConverter = { return { admin, address, - decisionPolicy: decision_policy == null ? decision_policy : { + decisionPolicy: { typeUrl: decision_policy.type_url, value: decision_policy.value } @@ -472,7 +472,7 @@ export const AminoConverter = { typeUrl: el0.type_url, value: el0.value })), - exec: exec == null ? exec : execFromJSON(exec) + exec: execFromJSON(exec) }; } }, @@ -492,7 +492,7 @@ export const AminoConverter = { address }: MsgWithdrawProposalAminoType["value"]): MsgWithdrawProposal => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), address }; } @@ -522,11 +522,11 @@ export const AminoConverter = { exec }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option), + option: voteOptionFromJSON(option), metadata, - exec: exec == null ? exec : execFromJSON(exec) + exec: execFromJSON(exec) }; } }, @@ -546,7 +546,7 @@ export const AminoConverter = { signer }: MsgExecAminoType["value"]): MsgExec => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), signer }; } @@ -568,7 +568,7 @@ export const AminoConverter = { }: MsgLeaveGroupAminoType["value"]): MsgLeaveGroup => { return { address, - groupId: group_id == null ? group_id : BigInt(group_id) + groupId: BigInt(group_id) }; } } diff --git a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts index ba1c07aecb..86e67cabcd 100644 --- a/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/staking/v1beta1/tx.amino.ts @@ -124,14 +124,14 @@ export const AminoConverter = { value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: commission == null ? commission : { + commission: { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -140,7 +140,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: value == null ? value : { + value: { denom: value.denom, amount: value.amount } @@ -175,7 +175,7 @@ export const AminoConverter = { min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, @@ -212,7 +212,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -247,7 +247,7 @@ export const AminoConverter = { delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -278,7 +278,7 @@ export const AminoConverter = { return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts index 1207564430..859b46b571 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -52,12 +52,12 @@ export const AminoConverter = { }: MsgSoftwareUpgradeAminoType["value"]): MsgSoftwareUpgrade => { return { authority, - plan: plan == null ? plan : { + plan: { name: plan.name, time: plan.time, - height: plan.height == null ? plan.height : BigInt(plan.height), + height: BigInt(plan.height), info: plan.info, - upgradedClientState: plan.upgraded_client_state == null ? plan.upgraded_client_state : { + upgradedClientState: { typeUrl: plan.upgraded_client_state.type_url, value: plan.upgraded_client_state.value } diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index ac022a3690..c9100067c2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -77,7 +77,7 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - endTime: end_time == null ? end_time : BigInt(end_time), + endTime: BigInt(end_time), delayed }; } @@ -143,9 +143,9 @@ export const AminoConverter = { return { fromAddress: from_address, toAddress: to_address, - startTime: start_time == null ? start_time : BigInt(start_time), + startTime: BigInt(start_time), vestingPeriods: vesting_periods.map(el0 => ({ - length: el0.length == null ? el0.length : BigInt(el0.length), + length: BigInt(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index 037366286b..d9fd821339 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -89,9 +89,9 @@ export const AminoConverter = { }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), - instantiatePermission: instantiate_permission == null ? instantiate_permission : { - permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: fromBase64(wasm_byte_code), + instantiatePermission: { + permission: accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; @@ -130,9 +130,9 @@ export const AminoConverter = { return { sender, admin, - codeId: code_id == null ? code_id : BigInt(code_id), + codeId: BigInt(code_id), label, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -167,7 +167,7 @@ export const AminoConverter = { return { sender, contract, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -199,8 +199,8 @@ export const AminoConverter = { return { sender, contract, - codeId: code_id == null ? code_id : BigInt(code_id), - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) + codeId: BigInt(code_id), + msg: toUtf8(JSON.stringify(msg)) }; } }, diff --git a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts index 66ca632c61..0be2123e86 100644 --- a/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/erc20/v1/tx.amino.ts @@ -44,7 +44,7 @@ export const AminoConverter = { sender }: MsgConvertCoinAminoType["value"]): MsgConvertCoin => { return { - coin: coin == null ? coin : { + coin: { denom: coin.denom, amount: coin.amount }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index 15586a4c89..3bd96d6c01 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -80,14 +80,14 @@ export const AminoConverter = { toAddress: to_address, startTime: start_time, lockupPeriods: lockup_periods.map(el0 => ({ - length: el0.length == null ? el0.length : BigInt(el0.length), + length: BigInt(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vestingPeriods: vesting_periods.map(el0 => ({ - length: el0.length == null ? el0.length : BigInt(el0.length), + length: BigInt(el0.length), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index af0d8699c0..854424544c 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { return { sourcePort: source_port, sourceChannel: source_channel, - token: token == null ? token : { + token: { denom: token.denom, amount: token.amount }, @@ -68,7 +68,7 @@ export const AminoConverter = { revisionHeight: BigInt(timeout_height.revision_height || "0"), revisionNumber: BigInt(timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: timeout_timestamp == null ? timeout_timestamp : BigInt(timeout_timestamp) + timeoutTimestamp: BigInt(timeout_timestamp) }; } } diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index b2cd93ebf7..e781e4c600 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -187,10 +187,10 @@ export const AminoConverter = { }: MsgChannelOpenInitAminoType["value"]): MsgChannelOpenInit => { return { portId: port_id, - channel: channel == null ? channel : { - state: channel.state == null ? channel.state : stateFromJSON(channel.state), - ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), - counterparty: channel.counterparty == null ? channel.counterparty : { + channel: { + state: stateFromJSON(channel.state), + ordering: orderFromJSON(channel.ordering), + counterparty: { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -246,10 +246,10 @@ export const AminoConverter = { return { portId: port_id, previousChannelId: previous_channel_id, - channel: channel == null ? channel : { - state: channel.state == null ? channel.state : stateFromJSON(channel.state), - ordering: channel.ordering == null ? channel.ordering : orderFromJSON(channel.ordering), - counterparty: channel.counterparty == null ? channel.counterparty : { + channel: { + state: stateFromJSON(channel.state), + ordering: orderFromJSON(channel.ordering), + counterparty: { portId: channel.counterparty.port_id, channelId: channel.counterparty.channel_id }, @@ -453,8 +453,8 @@ export const AminoConverter = { signer }: MsgRecvPacketAminoType["value"]): MsgRecvPacket => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -464,7 +464,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, proofCommitment: proof_commitment, proofHeight: proof_height ? { @@ -515,8 +515,8 @@ export const AminoConverter = { signer }: MsgTimeoutAminoType["value"]): MsgTimeout => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -526,14 +526,14 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofHeight: proof_height ? { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), + nextSequenceRecv: BigInt(next_sequence_recv), signer }; } @@ -581,8 +581,8 @@ export const AminoConverter = { signer }: MsgTimeoutOnCloseAminoType["value"]): MsgTimeoutOnClose => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -592,7 +592,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, proofUnreceived: proof_unreceived, proofClose: proof_close, @@ -600,7 +600,7 @@ export const AminoConverter = { revisionHeight: BigInt(proof_height.revision_height || "0"), revisionNumber: BigInt(proof_height.revision_number || "0") } : undefined, - nextSequenceRecv: next_sequence_recv == null ? next_sequence_recv : BigInt(next_sequence_recv), + nextSequenceRecv: BigInt(next_sequence_recv), signer }; } @@ -645,8 +645,8 @@ export const AminoConverter = { signer }: MsgAcknowledgementAminoType["value"]): MsgAcknowledgement => { return { - packet: packet == null ? packet : { - sequence: packet.sequence == null ? packet.sequence : BigInt(packet.sequence), + packet: { + sequence: BigInt(packet.sequence), sourcePort: packet.source_port, sourceChannel: packet.source_channel, destinationPort: packet.destination_port, @@ -656,7 +656,7 @@ export const AminoConverter = { revisionHeight: BigInt(packet.timeout_height.revision_height || "0"), revisionNumber: BigInt(packet.timeout_height.revision_number || "0") } : undefined, - timeoutTimestamp: packet.timeout_timestamp == null ? packet.timeout_timestamp : BigInt(packet.timeout_timestamp) + timeoutTimestamp: BigInt(packet.timeout_timestamp) }, acknowledgement, proofAcked: proof_acked, diff --git a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts index d4798ea877..727e135426 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/client/v1/tx.amino.ts @@ -80,11 +80,11 @@ export const AminoConverter = { signer }: MsgCreateClientAminoType["value"]): MsgCreateClient => { return { - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: consensus_state == null ? consensus_state : { + consensusState: { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -115,7 +115,7 @@ export const AminoConverter = { }: MsgUpdateClientAminoType["value"]): MsgUpdateClient => { return { clientId: client_id, - header: header == null ? header : { + header: { typeUrl: header.type_url, value: header.value }, @@ -158,11 +158,11 @@ export const AminoConverter = { }: MsgUpgradeClientAminoType["value"]): MsgUpgradeClient => { return { clientId: client_id, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - consensusState: consensus_state == null ? consensus_state : { + consensusState: { typeUrl: consensus_state.type_url, value: consensus_state.value }, @@ -195,7 +195,7 @@ export const AminoConverter = { }: MsgSubmitMisbehaviourAminoType["value"]): MsgSubmitMisbehaviour => { return { clientId: client_id, - misbehaviour: misbehaviour == null ? misbehaviour : { + misbehaviour: { typeUrl: misbehaviour.type_url, value: misbehaviour.value }, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 2b0def79de..9d7a779dd2 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -119,18 +119,18 @@ export const AminoConverter = { }: MsgConnectionOpenInitAminoType["value"]): MsgConnectionOpenInit => { return { clientId: client_id, - counterparty: counterparty == null ? counterparty : { + counterparty: { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: counterparty.prefix == null ? counterparty.prefix : { + prefix: { keyPrefix: counterparty.prefix.key_prefix } }, - version: version == null ? version : { + version: { identifier: version.identifier, features: version.features }, - delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + delayPeriod: BigInt(delay_period), signer }; } @@ -201,18 +201,18 @@ export const AminoConverter = { return { clientId: client_id, previousConnectionId: previous_connection_id, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, - counterparty: counterparty == null ? counterparty : { + counterparty: { clientId: counterparty.client_id, connectionId: counterparty.connection_id, - prefix: counterparty.prefix == null ? counterparty.prefix : { + prefix: { keyPrefix: counterparty.prefix.key_prefix } }, - delayPeriod: delay_period == null ? delay_period : BigInt(delay_period), + delayPeriod: BigInt(delay_period), counterpartyVersions: counterparty_versions.map(el0 => ({ identifier: el0.identifier, features: el0.features @@ -286,11 +286,11 @@ export const AminoConverter = { return { connectionId: connection_id, counterpartyConnectionId: counterparty_connection_id, - version: version == null ? version : { + version: { identifier: version.identifier, features: version.features }, - clientState: client_state == null ? client_state : { + clientState: { typeUrl: client_state.type_url, value: client_state.value }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts index f7dc37a131..e481a8e582 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/balancer/tx/tx.amino.ts @@ -94,24 +94,24 @@ export const AminoConverter = { }: MsgCreateBalancerPoolAminoType["value"]): MsgCreateBalancerPool => { return { sender, - poolParams: pool_params == null ? pool_params : { + poolParams: { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee, - smoothWeightChangeParams: pool_params.smooth_weight_change_params == null ? pool_params.smooth_weight_change_params : { + smoothWeightChangeParams: { startTime: pool_params.smooth_weight_change_params.start_time, - duration: pool_params.smooth_weight_change_params.duration == null ? pool_params.smooth_weight_change_params.duration : { + duration: { seconds: BigInt(Math.floor(parseInt(pool_params.smooth_weight_change_params.duration) / 1_000_000_000)), nanos: parseInt(pool_params.smooth_weight_change_params.duration) % 1_000_000_000 }, initialPoolWeights: pool_params.smooth_weight_change_params.initial_pool_weights.map(el2 => ({ - token: el2.token == null ? el2.token : { + token: { denom: el2.token.denom, amount: el2.token.amount }, weight: el2.weight })), targetPoolWeights: pool_params.smooth_weight_change_params.target_pool_weights.map(el2 => ({ - token: el2.token == null ? el2.token : { + token: { denom: el2.token.denom, amount: el2.token.amount }, @@ -120,7 +120,7 @@ export const AminoConverter = { } }, poolAssets: pool_assets.map(el0 => ({ - token: el0.token == null ? el0.token : { + token: { denom: el0.token.denom, amount: el0.token.amount }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 235fa81f60..8638459881 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -65,7 +65,7 @@ export const AminoConverter = { }: MsgCreateStableswapPoolAminoType["value"]): MsgCreateStableswapPool => { return { sender, - poolParams: pool_params == null ? pool_params : { + poolParams: { swapFee: pool_params.swap_fee, exitFee: pool_params.exit_fee }, @@ -99,7 +99,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactorsAminoType["value"]): MsgStableSwapAdjustScalingFactors => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), scalingFactors: scaling_factors.map(el0 => BigInt(el0)) }; } diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index 24bf8274f7..49a21b2fcc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), shareOutAmount: share_out_amount, tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, @@ -163,7 +163,7 @@ export const AminoConverter = { }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), shareInAmount: share_in_amount, tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, @@ -202,10 +202,10 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: token_in == null ? token_in : { + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -243,11 +243,11 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: token_out == null ? token_out : { + tokenOut: { denom: token_out.denom, amount: token_out.amount } @@ -280,8 +280,8 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), - tokenIn: token_in == null ? token_in : { + poolId: BigInt(pool_id), + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -315,7 +315,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -348,8 +348,8 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), - tokenOut: token_out == null ? token_out : { + poolId: BigInt(pool_id), + tokenOut: { denom: token_out.denom, amount: token_out.amount }, @@ -383,7 +383,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index a1791c5798..4f28766a14 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -78,10 +78,10 @@ export const AminoConverter = { return { isPerpetual: is_perpetual, owner, - distributeTo: distribute_to == null ? distribute_to : { - lockQueryType: distribute_to.lock_query_type == null ? distribute_to.lock_query_type : lockQueryTypeFromJSON(distribute_to.lock_query_type), + distributeTo: { + lockQueryType: lockQueryTypeFromJSON(distribute_to.lock_query_type), denom: distribute_to.denom, - duration: distribute_to.duration == null ? distribute_to.duration : { + duration: { seconds: BigInt(Math.floor(parseInt(distribute_to.duration) / 1_000_000_000)), nanos: parseInt(distribute_to.duration) % 1_000_000_000 }, @@ -92,7 +92,7 @@ export const AminoConverter = { amount: el0.amount })), startTime: start_time, - numEpochsPaidOver: num_epochs_paid_over == null ? num_epochs_paid_over : BigInt(num_epochs_paid_over) + numEpochsPaidOver: BigInt(num_epochs_paid_over) }; } }, @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgAddToGaugeAminoType["value"]): MsgAddToGauge => { return { owner, - gaugeId: gauge_id == null ? gauge_id : BigInt(gauge_id), + gaugeId: BigInt(gauge_id), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index 2e3b4c8331..a5ddf6e1a1 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -82,7 +82,7 @@ export const AminoConverter = { }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: duration == null ? duration : { + duration: { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, @@ -133,7 +133,7 @@ export const AminoConverter = { }: MsgBeginUnlockingAminoType["value"]): MsgBeginUnlocking => { return { owner, - ID: ID == null ? ID : BigInt(ID), + ID: BigInt(ID), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -161,8 +161,8 @@ export const AminoConverter = { }: MsgExtendLockupAminoType["value"]): MsgExtendLockup => { return { owner, - ID: ID == null ? ID : BigInt(ID), - duration: duration == null ? duration : { + ID: BigInt(ID), + duration: { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 } @@ -192,7 +192,7 @@ export const AminoConverter = { }: MsgForceUnlockAminoType["value"]): MsgForceUnlock => { return { owner, - ID: ID == null ? ID : BigInt(ID), + ID: BigInt(ID), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 1b566dd666..626fa90454 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegateAminoType["value"]): MsgSuperfluidDelegate => { return { sender, - lockId: lock_id == null ? lock_id : BigInt(lock_id), + lockId: BigInt(lock_id), valAddr: val_addr }; } @@ -86,7 +86,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegateAminoType["value"]): MsgSuperfluidUndelegate => { return { sender, - lockId: lock_id == null ? lock_id : BigInt(lock_id) + lockId: BigInt(lock_id) }; } }, @@ -107,7 +107,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLockAminoType["value"]): MsgSuperfluidUnbondLock => { return { sender, - lockId: lock_id == null ? lock_id : BigInt(lock_id) + lockId: BigInt(lock_id) }; } }, @@ -159,7 +159,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPoolAminoType["value"]): MsgUnPoolWhitelistedPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id) + poolId: BigInt(pool_id) }; } } diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index faf7e687ca..0d9cf2dde2 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -101,7 +101,7 @@ export const AminoConverter = { }: MsgMintAminoType["value"]): MsgMint => { return { sender, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -128,7 +128,7 @@ export const AminoConverter = { }: MsgBurnAminoType["value"]): MsgBurn => { return { sender, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -190,7 +190,7 @@ export const AminoConverter = { }: MsgSetDenomMetadataAminoType["value"]): MsgSetDenomMetadata => { return { sender, - metadata: metadata == null ? metadata : { + metadata: { description: metadata.description, denomUnits: metadata.denom_units.map(el1 => ({ denom: el1.denom, diff --git a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap index 768f4512ec..ce0fa39054 100644 --- a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap @@ -19,7 +19,7 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` }: MsgDoFunThingAminoType["value"]): MsgDoFunThing => { return { address, - myEnumField: myEnumField == null ? myEnumField : fancyEnumTypeFromJSON(myEnumField) + myEnumField: fancyEnumTypeFromJSON(myEnumField) }; } } diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap index fd7911256d..dc1f895470 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap @@ -152,7 +152,7 @@ exports[`cosmos/authz/v1beta1/authz date 4`] = ` expiration }: GrantAminoType["value"]): Grant => { return { - authorization: authorization == null ? authorization : { + authorization: { typeUrl: authorization.type_url, value: authorization.value }, @@ -315,7 +315,7 @@ exports[`cosmos/authz/v1beta1/authz timestamp 4`] = ` expiration }: GrantAminoType["value"]): Grant => { return { - authorization: authorization == null ? authorization : { + authorization: { typeUrl: authorization.type_url, value: authorization.value }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap index 7c9b6f94fb..a49373ad79 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap @@ -29,7 +29,7 @@ exports[`cosmwasm/wasm/v1/tx MsgExecuteContract 1`] = ` return { sender, contract, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -75,9 +75,9 @@ exports[`cosmwasm/wasm/v1/tx MsgInstantiateContract 1`] = ` return { sender, admin, - codeId: code_id == null ? code_id : BigInt(code_id), + codeId: BigInt(code_id), label, - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)), + msg: toUtf8(JSON.stringify(msg)), funds: funds.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -114,8 +114,8 @@ exports[`cosmwasm/wasm/v1/tx MsgMigrateContract 1`] = ` return { sender, contract, - codeId: code_id == null ? code_id : BigInt(code_id), - msg: msg == null ? msg : toUtf8(JSON.stringify(msg)) + codeId: BigInt(code_id), + msg: toUtf8(JSON.stringify(msg)) }; } } @@ -147,9 +147,9 @@ exports[`cosmwasm/wasm/v1/tx MsgStoreCode 1`] = ` }: MsgStoreCodeAminoType["value"]): MsgStoreCode => { return { sender, - wasmByteCode: wasm_byte_code == null ? wasm_byte_code : fromBase64(wasm_byte_code), - instantiatePermission: instantiate_permission == null ? instantiate_permission : { - permission: instantiate_permission.permission == null ? instantiate_permission.permission : accessTypeFromJSON(instantiate_permission.permission), + wasmByteCode: fromBase64(wasm_byte_code), + instantiatePermission: { + permission: accessTypeFromJSON(instantiate_permission.permission), address: instantiate_permission.address } }; diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap index 3bc59a3010..f21c812b35 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/lockup.test.ts.snap @@ -177,7 +177,7 @@ exports[`osmosis/lockup/tx duration 4`] = ` }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: duration == null ? duration : { + duration: { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, @@ -365,7 +365,7 @@ exports[`osmosis/lockup/tx string 4`] = ` }: MsgLockTokensAminoType["value"]): MsgLockTokens => { return { owner, - duration: duration == null ? duration : { + duration: { seconds: BigInt(Math.floor(parseInt(duration) / 1_000_000_000)), nanos: parseInt(duration) % 1_000_000_000 }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap index 4be660b504..96760da820 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap @@ -425,19 +425,19 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` }: ClientStateAminoType["value"]): ClientState => { return { chainId: chain_id, - trustLevel: trust_level == null ? trust_level : { - numerator: trust_level.numerator == null ? trust_level.numerator : BigInt(trust_level.numerator), - denominator: trust_level.denominator == null ? trust_level.denominator : BigInt(trust_level.denominator) + trustLevel: { + numerator: BigInt(trust_level.numerator), + denominator: BigInt(trust_level.denominator) }, - trustingPeriod: trusting_period == null ? trusting_period : { + trustingPeriod: { seconds: BigInt(Math.floor(parseInt(trusting_period) / 1_000_000_000)), nanos: parseInt(trusting_period) % 1_000_000_000 }, - unbondingPeriod: unbonding_period == null ? unbonding_period : { + unbondingPeriod: { seconds: BigInt(Math.floor(parseInt(unbonding_period) / 1_000_000_000)), nanos: parseInt(unbonding_period) % 1_000_000_000 }, - maxClockDrift: max_clock_drift == null ? max_clock_drift : { + maxClockDrift: { seconds: BigInt(Math.floor(parseInt(max_clock_drift) / 1_000_000_000)), nanos: parseInt(max_clock_drift) % 1_000_000_000 }, @@ -450,20 +450,20 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` revisionNumber: BigInt(latest_height.revision_number || "0") } : undefined, proofSpecs: proof_specs.map(el0 => ({ - leafSpec: el0.leaf_spec == null ? el0.leaf_spec : { - hash: el0.leaf_spec.hash == null ? el0.leaf_spec.hash : hashOpFromJSON(el0.leaf_spec.hash), - prehashKey: el0.leaf_spec.prehash_key == null ? el0.leaf_spec.prehash_key : hashOpFromJSON(el0.leaf_spec.prehash_key), - prehashValue: el0.leaf_spec.prehash_value == null ? el0.leaf_spec.prehash_value : hashOpFromJSON(el0.leaf_spec.prehash_value), - length: el0.leaf_spec.length == null ? el0.leaf_spec.length : lengthOpFromJSON(el0.leaf_spec.length), + leafSpec: { + hash: hashOpFromJSON(el0.leaf_spec.hash), + prehashKey: hashOpFromJSON(el0.leaf_spec.prehash_key), + prehashValue: hashOpFromJSON(el0.leaf_spec.prehash_value), + length: lengthOpFromJSON(el0.leaf_spec.length), prefix: el0.leaf_spec.prefix }, - innerSpec: el0.inner_spec == null ? el0.inner_spec : { + innerSpec: { childOrder: el0.inner_spec.child_order, childSize: el0.inner_spec.child_size, minPrefixLength: el0.inner_spec.min_prefix_length, maxPrefixLength: el0.inner_spec.max_prefix_length, emptyChild: el0.inner_spec.empty_child, - hash: el0.inner_spec.hash == null ? el0.inner_spec.hash : hashOpFromJSON(el0.inner_spec.hash) + hash: hashOpFromJSON(el0.inner_spec.hash) }, maxDepth: el0.max_depth, minDepth: el0.min_depth @@ -893,19 +893,19 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` }: ClientStateAminoType["value"]): ClientState => { return { chainId: chain_id, - trustLevel: trust_level == null ? trust_level : { - numerator: trust_level.numerator == null ? trust_level.numerator : BigInt(trust_level.numerator), - denominator: trust_level.denominator == null ? trust_level.denominator : BigInt(trust_level.denominator) + trustLevel: { + numerator: BigInt(trust_level.numerator), + denominator: BigInt(trust_level.denominator) }, - trustingPeriod: trusting_period == null ? trusting_period : { + trustingPeriod: { seconds: BigInt(Math.floor(parseInt(trusting_period) / 1_000_000_000)), nanos: parseInt(trusting_period) % 1_000_000_000 }, - unbondingPeriod: unbonding_period == null ? unbonding_period : { + unbondingPeriod: { seconds: BigInt(Math.floor(parseInt(unbonding_period) / 1_000_000_000)), nanos: parseInt(unbonding_period) % 1_000_000_000 }, - maxClockDrift: max_clock_drift == null ? max_clock_drift : { + maxClockDrift: { seconds: BigInt(Math.floor(parseInt(max_clock_drift) / 1_000_000_000)), nanos: parseInt(max_clock_drift) % 1_000_000_000 }, @@ -918,20 +918,20 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` revisionNumber: BigInt(latest_height.revision_number || "0") } : undefined, proofSpecs: proof_specs.map(el0 => ({ - leafSpec: el0.leaf_spec == null ? el0.leaf_spec : { - hash: el0.leaf_spec.hash == null ? el0.leaf_spec.hash : hashOpFromJSON(el0.leaf_spec.hash), - prehashKey: el0.leaf_spec.prehash_key == null ? el0.leaf_spec.prehash_key : hashOpFromJSON(el0.leaf_spec.prehash_key), - prehashValue: el0.leaf_spec.prehash_value == null ? el0.leaf_spec.prehash_value : hashOpFromJSON(el0.leaf_spec.prehash_value), - length: el0.leaf_spec.length == null ? el0.leaf_spec.length : lengthOpFromJSON(el0.leaf_spec.length), + leafSpec: { + hash: hashOpFromJSON(el0.leaf_spec.hash), + prehashKey: hashOpFromJSON(el0.leaf_spec.prehash_key), + prehashValue: hashOpFromJSON(el0.leaf_spec.prehash_value), + length: lengthOpFromJSON(el0.leaf_spec.length), prefix: el0.leaf_spec.prefix }, - innerSpec: el0.inner_spec == null ? el0.inner_spec : { + innerSpec: { childOrder: el0.inner_spec.child_order, childSize: el0.inner_spec.child_size, minPrefixLength: el0.inner_spec.min_prefix_length, maxPrefixLength: el0.inner_spec.max_prefix_length, emptyChild: el0.inner_spec.empty_child, - hash: el0.inner_spec.hash == null ? el0.inner_spec.hash : hashOpFromJSON(el0.inner_spec.hash) + hash: hashOpFromJSON(el0.inner_spec.hash) }, maxDepth: el0.max_depth, minDepth: el0.min_depth diff --git a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap index b9ac6b7f19..880edeb553 100644 --- a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap @@ -46,14 +46,14 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: commission == null ? commission : { + commission: { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -62,7 +62,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: value == null ? value : { + value: { denom: value.denom, amount: value.amount } @@ -97,7 +97,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, @@ -134,7 +134,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -169,7 +169,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -200,7 +200,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter 1`] = ` return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -256,14 +256,14 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter useCosmosSDKDec 1`] = ` value }: MsgCreateValidatorAminoType["value"]): MsgCreateValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, securityContact: description.security_contact, details: description.details }, - commission: commission == null ? commission : { + commission: { rate: commission.rate, maxRate: commission.max_rate, maxChangeRate: commission.max_change_rate @@ -272,7 +272,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter useCosmosSDKDec 1`] = ` delegatorAddress: delegator_address, validatorAddress: validator_address, pubkey: encodePubkey(pubkey), - value: value == null ? value : { + value: { denom: value.denom, amount: value.amount } @@ -307,7 +307,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter useCosmosSDKDec 1`] = ` min_self_delegation }: MsgEditValidatorAminoType["value"]): MsgEditValidator => { return { - description: description == null ? description : { + description: { moniker: description.moniker, identity: description.identity, website: description.website, @@ -344,7 +344,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter useCosmosSDKDec 1`] = ` return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -379,7 +379,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter useCosmosSDKDec 1`] = ` delegatorAddress: delegator_address, validatorSrcAddress: validator_src_address, validatorDstAddress: validator_dst_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -410,7 +410,7 @@ exports[`cosmos/staking/v1beta1/tx AminoConverter useCosmosSDKDec 1`] = ` return { delegatorAddress: delegator_address, validatorAddress: validator_address, - amount: amount == null ? amount : { + amount: { denom: amount.denom, amount: amount.amount } @@ -528,7 +528,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinPoolAminoType["value"]): MsgJoinPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), shareOutAmount: share_out_amount, tokenInMaxs: token_in_maxs.map(el0 => ({ denom: el0.denom, @@ -563,7 +563,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitPoolAminoType["value"]): MsgExitPool => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), shareInAmount: share_in_amount, tokenOutMins: token_out_mins.map(el0 => ({ denom: el0.denom, @@ -602,10 +602,10 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenOutDenom: el0.token_out_denom })), - tokenIn: token_in == null ? token_in : { + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -643,11 +643,11 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` return { sender, routes: routes.map(el0 => ({ - poolId: el0.pool_id == null ? el0.pool_id : BigInt(el0.pool_id), + poolId: BigInt(el0.pool_id), tokenInDenom: el0.token_in_denom })), tokenInMaxAmount: token_in_max_amount, - tokenOut: token_out == null ? token_out : { + tokenOut: { denom: token_out.denom, amount: token_out.amount } @@ -680,8 +680,8 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinSwapExternAmountInAminoType["value"]): MsgJoinSwapExternAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), - tokenIn: token_in == null ? token_in : { + poolId: BigInt(pool_id), + tokenIn: { denom: token_in.denom, amount: token_in.amount }, @@ -715,7 +715,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinSwapShareAmountOutAminoType["value"]): MsgJoinSwapShareAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), tokenInDenom: token_in_denom, shareOutAmount: share_out_amount, tokenInMaxAmount: token_in_max_amount @@ -748,7 +748,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitSwapShareAmountInAminoType["value"]): MsgExitSwapShareAmountIn => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), + poolId: BigInt(pool_id), tokenOutDenom: token_out_denom, shareInAmount: share_in_amount, tokenOutMinAmount: token_out_min_amount @@ -781,8 +781,8 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitSwapExternAmountOutAminoType["value"]): MsgExitSwapExternAmountOut => { return { sender, - poolId: pool_id == null ? pool_id : BigInt(pool_id), - tokenOut: token_out == null ? token_out : { + poolId: BigInt(pool_id), + tokenOut: { denom: token_out.denom, amount: token_out.amount }, diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap index e6959d6591..4a2c326bce 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/nested-enums.test.ts.snap @@ -22,9 +22,9 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` }: MsgDoFunThingAminoType["value"]): MsgDoFunThing => { return { address, - awesome: awesome == null ? awesome : { + awesome: { address: awesome.address, - myYolo0: awesome.myYolo0 == null ? awesome.myYolo0 : myAwesomeType_FancyEnumTypeFromJSON(awesome.myYolo0) + myYolo0: myAwesomeType_FancyEnumTypeFromJSON(awesome.myYolo0) } }; } diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap index fffee842a0..dac76dfecc 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/super-nested-enums.test.ts.snap @@ -30,17 +30,17 @@ exports[`cosmology/example/c AminoConverter 1`] = ` }: MsgTypePackageCAminoType["value"]): MsgTypePackageC => { return { address, - awesome: awesome == null ? awesome : { + awesome: { address: awesome.address, - myYolo0: awesome.myYolo0 == null ? awesome.myYolo0 : msgTypePackageB_EnumTypePackageBFromJSON(awesome.myYolo0), - anotherField: awesome.anotherField == null ? awesome.anotherField : { - myType: awesome.anotherField.myType == null ? awesome.anotherField.myType : { + myYolo0: msgTypePackageB_EnumTypePackageBFromJSON(awesome.myYolo0), + anotherField: { + myType: { address: awesome.anotherField.myType.address, - someCoolField: awesome.anotherField.myType.someCoolField == null ? awesome.anotherField.myType.someCoolField : msgTypePackageA_EnumPackageAFromJSON(awesome.anotherField.myType.someCoolField), - otherField: awesome.anotherField.myType.otherField == null ? awesome.anotherField.myType.otherField : msgTypePackageA_EnumDuplicateNameFromJSON(awesome.anotherField.myType.otherField) + someCoolField: msgTypePackageA_EnumPackageAFromJSON(awesome.anotherField.myType.someCoolField), + otherField: msgTypePackageA_EnumDuplicateNameFromJSON(awesome.anotherField.myType.otherField) } }, - otherField: awesome.otherField == null ? awesome.otherField : msgTypePackageB_EnumDuplicateNameFromJSON(awesome.otherField) + otherField: msgTypePackageB_EnumDuplicateNameFromJSON(awesome.otherField) } }; } diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap index 98fd826272..31fab0b293 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap @@ -27,7 +27,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` proposer }: MsgSubmitProposalAminoType["value"]): MsgSubmitProposal => { return { - content: content == null ? content : { + content: { typeUrl: content.type_url, value: content.value }, @@ -58,9 +58,9 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` option }: MsgVoteAminoType["value"]): MsgVote => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, - option: option == null ? option : voteOptionFromJSON(option) + option: voteOptionFromJSON(option) }; } }, @@ -86,10 +86,10 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` options }: MsgVoteWeightedAminoType["value"]): MsgVoteWeighted => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), voter, options: options.map(el0 => ({ - option: el0.option == null ? el0.option : voteOptionFromJSON(el0.option), + option: voteOptionFromJSON(el0.option), weight: el0.weight })) }; @@ -117,7 +117,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` amount }: MsgDepositAminoType["value"]): MsgDeposit => { return { - proposalId: proposal_id == null ? proposal_id : BigInt(proposal_id), + proposalId: BigInt(proposal_id), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/packages/ast/src/encoding/amino/from-amino-json/utils.ts b/packages/ast/src/encoding/amino/from-amino-json/utils.ts index 73b8c15a6a..b57952e14a 100644 --- a/packages/ast/src/encoding/amino/from-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/from-amino-json/utils.ts @@ -75,7 +75,7 @@ export const fromAmino = { ]); return t.objectProperty( t.identifier(args.field.name), - this.nullCheckCondition(prop, prop, value) + this.nullCheckCondition(prop, prop, value, useNullHandling) ); }, @@ -92,7 +92,7 @@ export const fromAmino = { let value = t.callExpression(t.identifier("fromBase64"), [prop]); return t.objectProperty( t.identifier(args.field.name), - this.nullCheckCondition(prop, prop, value) + this.nullCheckCondition(prop, prop, value, useNullHandling) ); }, @@ -111,7 +111,8 @@ export const fromAmino = { this.nullCheckCondition( prop, prop, - t.callExpression(TypeLong.getFromString(args.context), [prop]) + t.callExpression(TypeLong.getFromString(args.context), [prop]), + useNullHandling ) ); }, @@ -171,7 +172,7 @@ export const fromAmino = { ]); return t.objectProperty( t.identifier(args.field.name), - this.nullCheckCondition(property, property, value) + this.nullCheckCondition(property, property, value, useNullHandling) ); }, @@ -272,7 +273,7 @@ export const fromAmino = { const value = t.callExpression(t.identifier(enumFunction), [prop]); return t.objectProperty( t.identifier(field.name), - this.nullCheckCondition(prop, prop, value) + this.nullCheckCondition(prop, prop, value, useNullHandling) ); }, @@ -351,7 +352,7 @@ export const fromAmino = { return t.objectProperty( t.identifier(field.name), - this.nullCheckCondition(prop, prop, t.objectExpression(properties)) + this.nullCheckCondition(prop, prop, t.objectExpression(properties), useNullHandling) ); }, @@ -370,7 +371,7 @@ export const fromAmino = { ); return t.objectProperty( t.identifier(args.field.name), - this.nullCheckCondition(prop, prop, value) + this.nullCheckCondition(prop, prop, value, useNullHandling) ); }, @@ -498,13 +499,14 @@ export const fromAmino = { nullCheckCondition( value: t.Expression, nullExpr: t.Expression, - nonNullExpr: t.Expression + nonNullExpr: t.Expression, + useNullHandling: boolean = false ) { - return t.conditionalExpression( + return useNullHandling ? t.conditionalExpression( t.binaryExpression("==", value, t.nullLiteral()), nullExpr, nonNullExpr - ); + ) : nonNullExpr; }, }; diff --git a/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts b/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts index ae5bb9d6f0..510c46092f 100644 --- a/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts +++ b/packages/ast/types/encoding/amino/from-amino-json/utils.d.ts @@ -20,7 +20,7 @@ export declare const fromAmino: { /** * value == null ? nullExpr : nonNullExpr */ - nullCheckCondition(value: t.Expression, nullExpr: t.Expression, nonNullExpr: t.Expression): t.ConditionalExpression; + nullCheckCondition(value: t.Expression, nullExpr: t.Expression, nonNullExpr: t.Expression, useNullHandling?: boolean): t.Expression; }; export declare const arrayTypes: { long(varname: string, ctx: GenericParseContext): t.CallExpression; From 87ace40bc4f20f7652c1f9cbf6e8a139d4b62c76 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sun, 17 Mar 2024 16:02:31 +0800 Subject: [PATCH 21/24] flags for amino legacy omitempty and handling null --- .../amino-legacy/misc/tx.amino.ts | 30 +++++++++---------- .../output1/akash/cert/v1beta2/cert.amino.ts | 4 +-- .../akash/deployment/v1beta2/service.amino.ts | 4 +-- .../output1/cosmos/gov/v1/tx.amino.ts | 2 +- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 6 ++-- .../output1/cosmos/group/v1/tx.amino.ts | 26 ++++++++-------- .../cosmos/upgrade/v1beta1/tx.amino.ts | 4 +-- .../cosmos/vesting/v1beta1/tx.amino.ts | 10 +++---- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 6 ++-- .../output1/evmos/vesting/v1/tx.amino.ts | 8 ++--- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../output1/ibc/core/channel/v1/tx.amino.ts | 22 +++++++------- .../ibc/core/connection/v1/tx.amino.ts | 6 ++-- .../gamm/pool-models/stableswap/tx.amino.ts | 4 +-- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 18 +++++------ .../output1/osmosis/incentives/tx.amino.ts | 8 ++--- .../output1/osmosis/lockup/tx.amino.ts | 8 ++--- .../output1/osmosis/superfluid/tx.amino.ts | 10 +++---- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 4 +-- .../akash/cert/v1beta2/cert.amino.ts | 4 +-- .../akash/deployment/v1beta2/service.amino.ts | 4 +-- .../cosmos/gov/v1/tx.amino.ts | 2 +- .../cosmos/gov/v1beta1/tx.amino.ts | 2 +- .../cosmos/group/v1/tx.amino.ts | 6 ++-- .../ibc/core/channel/v1/tx.amino.ts | 2 +- .../akash/cert/v1beta2/cert.amino.ts | 4 +-- .../akash/deployment/v1beta2/service.amino.ts | 4 +-- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 2 +- .../cosmos/gov/v1beta1/tx.amino.ts | 5 ++-- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 25 ++++++++-------- .../cosmos/upgrade/v1beta1/tx.amino.ts | 3 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 9 +++--- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 5 ++-- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 7 ++--- .../controller/v1/tx.amino.ts | 3 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../ibc/core/channel/v1/tx.amino.ts | 22 +++++++------- .../ibc/core/connection/v1/tx.amino.ts | 4 +-- .../concentrated-liquidity/tx.amino.ts | 9 +++--- .../gamm/pool-models/stableswap/tx.amino.ts | 3 +- .../osmosis/gamm/v1beta1/tx.amino.ts | 17 +++++------ .../osmosis/incentives/tx.amino.ts | 7 ++--- .../outputosmojs/osmosis/lockup/tx.amino.ts | 7 ++--- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 5 ++-- .../osmosis/protorev/v1beta1/tx.amino.ts | 13 ++++---- .../osmosis/superfluid/tx.amino.ts | 9 +++--- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 3 +- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 3 +- .../outputv4/akash/cert/v1beta2/cert.amino.ts | 4 +-- .../akash/deployment/v1beta2/service.amino.ts | 4 +-- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 2 +- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 5 ++-- .../outputv4/cosmos/group/v1/tx.amino.ts | 25 ++++++++-------- .../cosmos/upgrade/v1beta1/tx.amino.ts | 3 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 9 +++--- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 5 ++-- .../outputv4/evmos/vesting/v1/tx.amino.ts | 7 ++--- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 22 +++++++------- .../ibc/core/connection/v1/tx.amino.ts | 4 +-- .../gamm/pool-models/stableswap/tx.amino.ts | 3 +- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 17 +++++------ .../outputv4/osmosis/incentives/tx.amino.ts | 7 ++--- .../outputv4/osmosis/lockup/tx.amino.ts | 7 ++--- .../outputv4/osmosis/superfluid/tx.amino.ts | 9 +++--- .../osmosis/tokenfactory/v1beta1/tx.amino.ts | 3 +- .../src/encoding/amino/to-amino-json/utils.ts | 14 +++++---- .../__tests__/telescope-instant-rpc.test.ts | 3 +- packages/telescope/package.json | 6 ++-- packages/types/src/telescope.ts | 3 +- packages/types/types/telescope.d.ts | 3 +- 71 files changed, 259 insertions(+), 281 deletions(-) diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts index 1858e669dd..c540b17d93 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -1,8 +1,8 @@ import { EncodingTestForDontOmit, EncodingTestForDontOmitSDKType, EncodingTestForOmit, EncodingTestForOmitSDKType } from "./all_fields"; import { AminoMsg, Pubkey } from "@cosmjs/amino"; -import { omitDefault, padDecimal } from "../helpers"; import { fromUtf8, toBase64, toUtf8, fromBase64 } from "@cosmjs/encoding"; import { decodePubkey, encodePubkey } from "@cosmjs/proto-signing"; +import { padDecimal } from "../helpers"; import { AccessConfig, AccessConfigSDKType, voteOptionFromJSON } from "./eval_request"; import { Any, AnySDKType } from "../google/protobuf/any"; import { Duration, DurationSDKType } from "../google/protobuf/duration"; @@ -187,11 +187,11 @@ export const AminoConverter = { d_o_tests: { str: dOTests.str, d_o_str: dOTests.dOStr, - b: omitDefault(dOTests.b), + b: dOTests.b, d_o_b: dOTests.dOB, - num: omitDefault(dOTests.num), + num: dOTests.num, d_o_num: dOTests.dONum, - big: omitDefault(dOTests.big)?.toString?.(), + big: dOTests.big?.toString?.(), d_o_big: dOTests.dOBig?.toString?.(), proto: { sender: dOTests.proto.sender @@ -234,12 +234,12 @@ export const AminoConverter = { opts: dOTests.opts, d_o_opts: dOTests.dOOpts, periods: dOTests.periods.map(el0 => ({ - seconds: omitDefault(el0.seconds)?.toString?.(), - nanos: omitDefault(el0.nanos) + seconds: el0.seconds?.toString?.(), + nanos: el0.nanos })), d_o_periods: dOTests.dOPeriods.map(el0 => ({ - seconds: omitDefault(el0.seconds)?.toString?.(), - nanos: omitDefault(el0.nanos) + seconds: el0.seconds?.toString?.(), + nanos: el0.nanos })), protos: dOTests.protos.map(el0 => ({ sender: el0.sender @@ -264,11 +264,11 @@ export const AminoConverter = { str: oTests.str, o_str: oTests.oStr, b: oTests.b, - o_b: omitDefault(oTests.oB), + o_b: oTests.oB, num: oTests.num, - o_num: omitDefault(oTests.oNum), + o_num: oTests.oNum, big: oTests.big?.toString?.(), - o_big: omitDefault(oTests.oBig)?.toString?.(), + o_big: oTests.oBig?.toString?.(), proto: { sender: oTests.proto.sender }, @@ -310,12 +310,12 @@ export const AminoConverter = { opts: oTests.opts, o_opts: oTests.oOpts, periods: oTests.periods.map(el0 => ({ - seconds: omitDefault(el0.seconds)?.toString?.(), - nanos: omitDefault(el0.nanos) + seconds: el0.seconds?.toString?.(), + nanos: el0.nanos })), o_periods: oTests.oPeriods.map(el0 => ({ - seconds: omitDefault(el0.seconds)?.toString?.(), - nanos: omitDefault(el0.nanos) + seconds: el0.seconds?.toString?.(), + nanos: el0.nanos })), protos: oTests.protos.map(el0 => ({ sender: el0.sender diff --git a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts index b49504893c..97e535cbe2 100644 --- a/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/output1/akash/cert/v1beta2/cert.amino.ts @@ -28,8 +28,8 @@ export const AminoConverter = { }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { owner, - cert: cert, - pubkey: pubkey + cert, + pubkey }; }, fromAmino: ({ diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index 745349374f..d7da2f375c 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -214,7 +214,7 @@ export const AminoConverter = { } })) })), - version: version, + version, deposit: { denom: deposit.denom, amount: Long.fromValue(deposit.amount).toString() @@ -345,7 +345,7 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq?.toString?.() }, - version: version + version }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index 9d8e33ead3..eb379bb522 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -141,7 +141,7 @@ export const AminoConverter = { return { proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata }; }, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index 8e7a47cffd..c002f76cf1 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -2,7 +2,7 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -94,9 +94,9 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), voter, - option: option + option }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index b495ad6e1f..89d09c5dc4 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -192,7 +192,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), member_updates: memberUpdates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -227,7 +227,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), new_admin: newAdmin }; }, @@ -252,7 +252,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), metadata }; }, @@ -278,7 +278,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), metadata, decision_policy: { type_url: decisionPolicy.typeUrl, @@ -323,7 +323,7 @@ export const AminoConverter = { })), group_metadata: groupMetadata, group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: omitDefault(groupPolicyAsAdmin), + group_policy_as_admin: groupPolicyAsAdmin, decision_policy: { type_url: decisionPolicy.typeUrl, value: decisionPolicy.value @@ -454,7 +454,7 @@ export const AminoConverter = { type_url: el0.typeUrl, value: el0.value })), - exec: exec + exec }; }, fromAmino: ({ @@ -483,7 +483,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), address }; }, @@ -507,11 +507,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata, - exec: exec + exec }; }, fromAmino: ({ @@ -537,7 +537,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), signer }; }, @@ -559,7 +559,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address, - group_id: omitDefault(groupId)?.toString?.() + group_id: groupId?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts index f482eccc9d..4ee068fd12 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,6 +1,6 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -37,7 +37,7 @@ export const AminoConverter = { plan: { name: plan.name, time: plan.time, - height: omitDefault(plan.height)?.toString?.(), + height: plan.height?.toString?.(), info: plan.info, upgraded_client_state: { type_url: plan.upgradedClientState.typeUrl, diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index 292736835d..6942a78fc2 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -59,8 +59,8 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - end_time: omitDefault(endTime)?.toString?.(), - delayed: omitDefault(delayed) + end_time: endTime?.toString?.(), + delayed }; }, fromAmino: ({ @@ -124,9 +124,9 @@ export const AminoConverter = { return { from_address: fromAddress, to_address: toAddress, - start_time: omitDefault(startTime)?.toString?.(), + start_time: startTime?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index e5547717dc..22ddbbbb63 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -2,7 +2,7 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; @@ -110,7 +110,7 @@ export const AminoConverter = { return { sender, admin, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId?.toString?.(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +186,7 @@ export const AminoConverter = { return { sender, contract, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index 2b81c001df..d6b2c79879 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -1,7 +1,7 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -51,20 +51,20 @@ export const AminoConverter = { to_address: toAddress, start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - merge: omitDefault(merge) + merge }; }, fromAmino: ({ diff --git a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts index bfa43b9545..069b84c8ff 100644 --- a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() + timeout_timestamp: timeoutTimestamp?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts index 0430c183e1..c5dbe0858f 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + next_sequence_recv: nextSequenceRecv?.toString?.(), signer }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + next_sequence_recv: nextSequenceRecv?.toString?.(), signer }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -626,9 +626,9 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, - acknowledgement: acknowledgement, + acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index 70f6da5eb8..9ab9753ac8 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -2,7 +2,7 @@ import { Counterparty, CounterpartySDKType, Version, VersionSDKType } from "./co import { Any, AnySDKType } from "../../../../google/protobuf/any"; import { Height, HeightSDKType } from "../../client/v1/client"; import { AminoMsg } from "@cosmjs/amino"; -import { AminoHeight, omitDefault, Long } from "../../../../helpers"; +import { AminoHeight, Long, omitDefault } from "../../../../helpers"; import { MerklePrefix, MerklePrefixSDKType } from "../../commitment/v1/commitment"; import { MsgConnectionOpenInit, MsgConnectionOpenInitSDKType, MsgConnectionOpenTry, MsgConnectionOpenTrySDKType, MsgConnectionOpenAck, MsgConnectionOpenAckSDKType, MsgConnectionOpenConfirm, MsgConnectionOpenConfirmSDKType } from "./tx"; export interface MsgConnectionOpenInitAminoType extends AminoMsg { @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: version.identifier, features: version.features }, - delay_period: omitDefault(delayPeriod)?.toString?.(), + delay_period: delayPeriod?.toString?.(), signer }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: omitDefault(delayPeriod)?.toString?.(), + delay_period: delayPeriod?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: el0.identifier, features: el0.features diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index a1c071c54d..48e8fa1337 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,7 +2,7 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { Long, omitDefault } from "../../../../helpers"; +import { Long } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -88,7 +88,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index 06959b118f..1fa6d64bc1 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../../helpers"; +import { Long } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -112,7 +112,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -147,7 +147,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -183,7 +183,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -224,7 +224,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -264,7 +264,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_in: { denom: tokenIn.denom, amount: Long.fromValue(tokenIn.amount).toString() @@ -300,7 +300,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -332,7 +332,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_out: { denom: tokenOut.denom, amount: Long.fromValue(tokenOut.amount).toString() @@ -368,7 +368,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 932fa6c7d5..4969c5a70b 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -3,7 +3,7 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../helpers"; +import { Long } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -51,7 +51,7 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: omitDefault(isPerpetual), + is_perpetual: isPerpetual, owner, distribute_to: { lock_query_type: distributeTo.lockQueryType, @@ -64,7 +64,7 @@ export const AminoConverter = { amount: el0.amount })), start_time: startTime, - num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() + num_epochs_paid_over: numEpochsPaidOver?.toString?.() }; }, fromAmino: ({ @@ -105,7 +105,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner, - gauge_id: omitDefault(gaugeId)?.toString?.(), + gauge_id: gaugeId?.toString?.(), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index 7fc22f9239..a9200a4154 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -3,7 +3,7 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; -import { Long, omitDefault } from "../../helpers"; +import { Long } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +178,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index e2d7965baf..0f47a3aa51 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -1,7 +1,7 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault, Long } from "../../helpers"; +import { Long } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -53,7 +53,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.(), + lock_id: lockId?.toString?.(), val_addr: valAddr }; }, @@ -77,7 +77,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.() + lock_id: lockId?.toString?.() }; }, fromAmino: ({ @@ -98,7 +98,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.() + lock_id: lockId?.toString?.() }; }, fromAmino: ({ @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.() + pool_id: poolId?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts index d94f41b2f4..037e4cfeeb 100644 --- a/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,7 +2,7 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; -import { Long, omitDefault } from "../../../helpers"; +import { Long } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -172,7 +172,7 @@ export const AminoConverter = { description: metadata.description, denom_units: metadata.denomUnits.map(el0 => ({ denom: el0.denom, - exponent: omitDefault(el0.exponent), + exponent: el0.exponent, aliases: el0.aliases })), base: metadata.base, diff --git a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts index 8463bc6481..fb6eae41d9 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/cert/v1beta2/cert.amino.ts @@ -28,8 +28,8 @@ export const AminoConverter = { }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { owner, - cert: cert, - pubkey: pubkey + cert, + pubkey }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts index e5ef875175..12043be59d 100644 --- a/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/akash/deployment/v1beta2/service.amino.ts @@ -213,7 +213,7 @@ export const AminoConverter = { } })) })), - version: version, + version, deposit: { denom: deposit.denom, amount: deposit.amount @@ -344,7 +344,7 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq?.toString?.() }, - version: version + version }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts index dcc1e90421..d58fc08fa7 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1/tx.amino.ts @@ -140,7 +140,7 @@ export const AminoConverter = { return { proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata }; }, diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts index ff841eee46..18cd029953 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/gov/v1beta1/tx.amino.ts @@ -96,7 +96,7 @@ export const AminoConverter = { return { proposal_id: omitDefault(proposalId)?.toString?.(), voter, - option: option + option }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts index 618a0bd70a..d7b6ae4079 100644 --- a/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/cosmos/group/v1/tx.amino.ts @@ -454,7 +454,7 @@ export const AminoConverter = { type_url: el0.typeUrl, value: el0.value })), - exec: exec + exec }; }, fromAmino: ({ @@ -509,9 +509,9 @@ export const AminoConverter = { return { proposal_id: omitDefault(proposalId)?.toString?.(), voter, - option: option, + option, metadata, - exec: exec + exec }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts index b2cd93ebf7..5f0c565293 100644 --- a/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputinstantrpc/ibc/core/channel/v1/tx.amino.ts @@ -628,7 +628,7 @@ export const AminoConverter = { } : {}, timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() }, - acknowledgement: acknowledgement, + acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), diff --git a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts index b49504893c..97e535cbe2 100644 --- a/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/cert/v1beta2/cert.amino.ts @@ -28,8 +28,8 @@ export const AminoConverter = { }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { owner, - cert: cert, - pubkey: pubkey + cert, + pubkey }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index 0ec4b67712..ee5cad7df4 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -213,7 +213,7 @@ export const AminoConverter = { } })) })), - version: version, + version, deposit: { denom: deposit.denom, amount: deposit.amount @@ -344,7 +344,7 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq?.toString?.() }, - version: version + version }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index 67ab16a988..61ed1b3e47 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -140,7 +140,7 @@ export const AminoConverter = { return { proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata }; }, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index 1c57926a38..6344efde28 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -2,7 +2,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -94,9 +93,9 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), voter, - option: option + option }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index 8d53274d40..e7057df453 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -1,7 +1,6 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -192,7 +191,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), member_updates: memberUpdates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -227,7 +226,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), new_admin: newAdmin }; }, @@ -252,7 +251,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), metadata }; }, @@ -278,7 +277,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), metadata, decision_policy: { type_url: decisionPolicy.typeUrl, @@ -323,7 +322,7 @@ export const AminoConverter = { })), group_metadata: groupMetadata, group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: omitDefault(groupPolicyAsAdmin), + group_policy_as_admin: groupPolicyAsAdmin, decision_policy: { type_url: decisionPolicy.typeUrl, value: decisionPolicy.value @@ -454,7 +453,7 @@ export const AminoConverter = { type_url: el0.typeUrl, value: el0.value })), - exec: exec + exec }; }, fromAmino: ({ @@ -483,7 +482,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), address }; }, @@ -507,11 +506,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata, - exec: exec + exec }; }, fromAmino: ({ @@ -537,7 +536,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), signer }; }, @@ -559,7 +558,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address, - group_id: omitDefault(groupId)?.toString?.() + group_id: groupId?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts index 859b46b571..15dc179fbe 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,6 +1,5 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -37,7 +36,7 @@ export const AminoConverter = { plan: { name: plan.name, time: plan.time, - height: omitDefault(plan.height)?.toString?.(), + height: plan.height?.toString?.(), info: plan.info, upgraded_client_state: { type_url: plan.upgradedClientState.typeUrl, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index c9100067c2..0f8b41b9f2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,7 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -59,8 +58,8 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - end_time: omitDefault(endTime)?.toString?.(), - delayed: omitDefault(delayed) + end_time: endTime?.toString?.(), + delayed }; }, fromAmino: ({ @@ -124,9 +123,9 @@ export const AminoConverter = { return { from_address: fromAddress, to_address: toAddress, - start_time: omitDefault(startTime)?.toString?.(), + start_time: startTime?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index d9fd821339..74b49cd515 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -2,7 +2,6 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; -import { omitDefault } from "../../../helpers"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; @@ -110,7 +109,7 @@ export const AminoConverter = { return { sender, admin, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId?.toString?.(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +185,7 @@ export const AminoConverter = { return { sender, contract, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index 3bd96d6c01..944de68549 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -1,7 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -51,20 +50,20 @@ export const AminoConverter = { to_address: toAddress, start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - merge: omitDefault(merge) + merge }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index d8b8afbd5e..6780c3b5a9 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -1,6 +1,5 @@ import { InterchainAccountPacketData, InterchainAccountPacketDataSDKType, typeFromJSON } from "../../v1/packet"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../../../helpers"; import { MsgRegisterInterchainAccount, MsgRegisterInterchainAccountSDKType, MsgSendTx, MsgSendTxSDKType } from "./tx"; export interface MsgRegisterInterchainAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgRegisterInterchainAccount"; @@ -65,7 +64,7 @@ export const AminoConverter = { data: packetData.data, memo: packetData.memo }, - relative_timeout: omitDefault(relativeTimeout)?.toString?.() + relative_timeout: relativeTimeout?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts index 854424544c..c66bbe0368 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() + timeout_timestamp: timeoutTimestamp?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts index e781e4c600..f54b980d41 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + next_sequence_recv: nextSequenceRecv?.toString?.(), signer }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + next_sequence_recv: nextSequenceRecv?.toString?.(), signer }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -626,9 +626,9 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, - acknowledgement: acknowledgement, + acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 9d7a779dd2..646667fed4 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: version.identifier, features: version.features }, - delay_period: omitDefault(delayPeriod)?.toString?.(), + delay_period: delayPeriod?.toString?.(), signer }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: omitDefault(delayPeriod)?.toString?.(), + delay_period: delayPeriod?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: el0.identifier, features: el0.features diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index 6062a6910a..5dbbfc1e7c 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -3,7 +3,6 @@ import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { MsgCreatePosition, MsgCreatePositionSDKType, MsgWithdrawPosition, MsgWithdrawPositionSDKType, MsgCollectFees, MsgCollectFeesSDKType, MsgCollectIncentives, MsgCollectIncentivesSDKType, MsgFungifyChargedPositions, MsgFungifyChargedPositionsSDKType } from "./tx"; export interface MsgCreatePositionAminoType extends AminoMsg { type: "osmosis/concentratedliquidity/create-position"; @@ -67,10 +66,10 @@ export const AminoConverter = { tokenMinAmount1 }: MsgCreatePosition): MsgCreatePositionAminoType["value"] => { return { - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), sender, - lower_tick: omitDefault(lowerTick)?.toString?.(), - upper_tick: omitDefault(upperTick)?.toString?.(), + lower_tick: lowerTick?.toString?.(), + upper_tick: upperTick?.toString?.(), token_desired0: { denom: tokenDesired0.denom, amount: tokenDesired0.amount @@ -119,7 +118,7 @@ export const AminoConverter = { liquidityAmount }: MsgWithdrawPosition): MsgWithdrawPositionAminoType["value"] => { return { - position_id: omitDefault(positionId)?.toString?.(), + position_id: positionId?.toString?.(), sender, liquidity_amount: liquidityAmount }; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 8638459881..7ba7026ad7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,7 +2,6 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -88,7 +87,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index 49a21b2fcc..0ad588e0bc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,7 +1,6 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -112,7 +111,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -147,7 +146,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -183,7 +182,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -224,7 +223,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -264,7 +263,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -300,7 +299,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -332,7 +331,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -368,7 +367,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index 4f28766a14..f2a6614ebc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -3,7 +3,6 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -51,7 +50,7 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: omitDefault(isPerpetual), + is_perpetual: isPerpetual, owner, distribute_to: { lock_query_type: distributeTo.lockQueryType, @@ -64,7 +63,7 @@ export const AminoConverter = { amount: el0.amount })), start_time: startTime, - num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() + num_epochs_paid_over: numEpochsPaidOver?.toString?.() }; }, fromAmino: ({ @@ -105,7 +104,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner, - gauge_id: omitDefault(gaugeId)?.toString?.(), + gauge_id: gaugeId?.toString?.(), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index a5ddf6e1a1..3b05d63d61 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -3,7 +3,6 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -119,7 +118,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -150,7 +149,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +177,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index a9db12f5b4..97017e8e3b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -2,7 +2,6 @@ import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType } from "./swap_route"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType } from "./tx"; export interface MsgSwapExactAmountInAminoType extends AminoMsg { type: "osmosis/poolmanager/swap-exact-amount-in"; @@ -46,7 +45,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -87,7 +86,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index 0ca0511aa4..6f173ad96f 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -1,7 +1,6 @@ //@ts-nocheck import { TokenPairArbRoutes, TokenPairArbRoutesSDKType, PoolWeights, PoolWeightsSDKType, BaseDenom, BaseDenomSDKType, Route, RouteSDKType, Trade, TradeSDKType } from "./protorev"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgSetHotRoutes, MsgSetHotRoutesSDKType, MsgSetDeveloperAccount, MsgSetDeveloperAccountSDKType, MsgSetMaxPoolPointsPerTx, MsgSetMaxPoolPointsPerTxSDKType, MsgSetMaxPoolPointsPerBlock, MsgSetMaxPoolPointsPerBlockSDKType, MsgSetPoolWeights, MsgSetPoolWeightsSDKType, MsgSetBaseDenoms, MsgSetBaseDenomsSDKType } from "./tx"; export interface MsgSetHotRoutesAminoType extends AminoMsg { type: "osmosis/MsgSetHotRoutes"; @@ -75,7 +74,7 @@ export const AminoConverter = { hot_routes: hotRoutes.map(el0 => ({ arb_routes: el0.arbRoutes.map(el1 => ({ trades: el1.trades.map(el2 => ({ - pool: omitDefault(el2.pool)?.toString?.(), + pool: el2.pool?.toString?.(), token_in: el2.tokenIn, token_out: el2.tokenOut })), @@ -136,7 +135,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAminoType["value"] => { return { admin, - max_pool_points_per_tx: omitDefault(maxPoolPointsPerTx)?.toString?.() + max_pool_points_per_tx: maxPoolPointsPerTx?.toString?.() }; }, fromAmino: ({ @@ -157,7 +156,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAminoType["value"] => { return { admin, - max_pool_points_per_block: omitDefault(maxPoolPointsPerBlock)?.toString?.() + max_pool_points_per_block: maxPoolPointsPerBlock?.toString?.() }; }, fromAmino: ({ @@ -179,9 +178,9 @@ export const AminoConverter = { return { admin, pool_weights: { - stable_weight: omitDefault(poolWeights.stableWeight)?.toString?.(), - balancer_weight: omitDefault(poolWeights.balancerWeight)?.toString?.(), - concentrated_weight: omitDefault(poolWeights.concentratedWeight)?.toString?.() + stable_weight: poolWeights.stableWeight?.toString?.(), + balancer_weight: poolWeights.balancerWeight?.toString?.(), + concentrated_weight: poolWeights.concentratedWeight?.toString?.() } }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index 626fa90454..74ed8f6813 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -1,7 +1,6 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -53,7 +52,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.(), + lock_id: lockId?.toString?.(), val_addr: valAddr }; }, @@ -77,7 +76,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.() + lock_id: lockId?.toString?.() }; }, fromAmino: ({ @@ -98,7 +97,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.() + lock_id: lockId?.toString?.() }; }, fromAmino: ({ @@ -150,7 +149,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.() + pool_id: poolId?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts index 0d9cf2dde2..6ac7848d13 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,7 +2,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -172,7 +171,7 @@ export const AminoConverter = { description: metadata.description, denom_units: metadata.denomUnits.map(el0 => ({ denom: el0.denom, - exponent: omitDefault(el0.exponent), + exponent: el0.exponent, aliases: el0.aliases })), base: metadata.base, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index 62ca2333aa..7abb420f50 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -2,7 +2,6 @@ import { ValidatorPreference, ValidatorPreferenceSDKType } from "./state"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgSetValidatorSetPreference, MsgSetValidatorSetPreferenceSDKType, MsgDelegateToValidatorSet, MsgDelegateToValidatorSetSDKType, MsgUndelegateFromValidatorSet, MsgUndelegateFromValidatorSetSDKType, MsgRedelegateValidatorSet, MsgRedelegateValidatorSetSDKType, MsgWithdrawDelegationRewards, MsgWithdrawDelegationRewardsSDKType, MsgDelegateBondedTokens, MsgDelegateBondedTokensSDKType } from "./tx"; export interface MsgSetValidatorSetPreferenceAminoType extends AminoMsg { type: "osmosis/valset-pref/MsgSetValidatorSetPreference"; @@ -191,7 +190,7 @@ export const AminoConverter = { }: MsgDelegateBondedTokens): MsgDelegateBondedTokensAminoType["value"] => { return { delegator, - lockID: omitDefault(lockID)?.toString?.() + lockID: lockID?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts index b49504893c..97e535cbe2 100644 --- a/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/cert/v1beta2/cert.amino.ts @@ -28,8 +28,8 @@ export const AminoConverter = { }: MsgCreateCertificate): MsgCreateCertificateAminoType["value"] => { return { owner, - cert: cert, - pubkey: pubkey + cert, + pubkey }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index 0ec4b67712..ee5cad7df4 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -213,7 +213,7 @@ export const AminoConverter = { } })) })), - version: version, + version, deposit: { denom: deposit.denom, amount: deposit.amount @@ -344,7 +344,7 @@ export const AminoConverter = { owner: id.owner, dseq: id.dseq?.toString?.() }, - version: version + version }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index 67ab16a988..61ed1b3e47 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -140,7 +140,7 @@ export const AminoConverter = { return { proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata }; }, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index 1c57926a38..6344efde28 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -2,7 +2,6 @@ import { Any, AnySDKType } from "../../../google/protobuf/any"; import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { VoteOption, VoteOptionSDKType, WeightedVoteOption, WeightedVoteOptionSDKType, voteOptionFromJSON } from "./gov"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgSubmitProposal, MsgSubmitProposalSDKType, MsgVote, MsgVoteSDKType, MsgVoteWeighted, MsgVoteWeightedSDKType, MsgDeposit, MsgDepositSDKType } from "./tx"; export interface MsgSubmitProposalAminoType extends AminoMsg { type: "cosmos-sdk/MsgSubmitProposal"; @@ -94,9 +93,9 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), voter, - option: option + option }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index 8d53274d40..e7057df453 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -1,7 +1,6 @@ import { Member, MemberSDKType, VoteOption, VoteOptionSDKType, voteOptionFromJSON } from "./types"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { execFromJSON, MsgCreateGroup, MsgCreateGroupSDKType, MsgUpdateGroupMembers, MsgUpdateGroupMembersSDKType, MsgUpdateGroupAdmin, MsgUpdateGroupAdminSDKType, MsgUpdateGroupMetadata, MsgUpdateGroupMetadataSDKType, MsgCreateGroupPolicy, MsgCreateGroupPolicySDKType, MsgCreateGroupWithPolicy, MsgCreateGroupWithPolicySDKType, MsgUpdateGroupPolicyAdmin, MsgUpdateGroupPolicyAdminSDKType, MsgUpdateGroupPolicyDecisionPolicy, MsgUpdateGroupPolicyDecisionPolicySDKType, MsgUpdateGroupPolicyMetadata, MsgUpdateGroupPolicyMetadataSDKType, MsgSubmitProposal, MsgSubmitProposalSDKType, MsgWithdrawProposal, MsgWithdrawProposalSDKType, MsgVote, MsgVoteSDKType, MsgExec, MsgExecSDKType, MsgLeaveGroup, MsgLeaveGroupSDKType } from "./tx"; export interface MsgCreateGroupAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateGroup"; @@ -192,7 +191,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), member_updates: memberUpdates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -227,7 +226,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), new_admin: newAdmin }; }, @@ -252,7 +251,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), metadata }; }, @@ -278,7 +277,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin, - group_id: omitDefault(groupId)?.toString?.(), + group_id: groupId?.toString?.(), metadata, decision_policy: { type_url: decisionPolicy.typeUrl, @@ -323,7 +322,7 @@ export const AminoConverter = { })), group_metadata: groupMetadata, group_policy_metadata: groupPolicyMetadata, - group_policy_as_admin: omitDefault(groupPolicyAsAdmin), + group_policy_as_admin: groupPolicyAsAdmin, decision_policy: { type_url: decisionPolicy.typeUrl, value: decisionPolicy.value @@ -454,7 +453,7 @@ export const AminoConverter = { type_url: el0.typeUrl, value: el0.value })), - exec: exec + exec }; }, fromAmino: ({ @@ -483,7 +482,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), address }; }, @@ -507,11 +506,11 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), voter, - option: option, + option, metadata, - exec: exec + exec }; }, fromAmino: ({ @@ -537,7 +536,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId?.toString?.(), signer }; }, @@ -559,7 +558,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address, - group_id: omitDefault(groupId)?.toString?.() + group_id: groupId?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts index 859b46b571..15dc179fbe 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -1,6 +1,5 @@ import { Plan, PlanSDKType } from "./upgrade"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { Any, AnySDKType } from "../../../google/protobuf/any"; import { MsgSoftwareUpgrade, MsgSoftwareUpgradeSDKType, MsgCancelUpgrade, MsgCancelUpgradeSDKType } from "./tx"; export interface MsgSoftwareUpgradeAminoType extends AminoMsg { @@ -37,7 +36,7 @@ export const AminoConverter = { plan: { name: plan.name, time: plan.time, - height: omitDefault(plan.height)?.toString?.(), + height: plan.height?.toString?.(), info: plan.info, upgraded_client_state: { type_url: plan.upgradedClientState.typeUrl, diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index c9100067c2..0f8b41b9f2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -1,7 +1,6 @@ import { Coin, CoinSDKType } from "../../base/v1beta1/coin"; import { Period, PeriodSDKType } from "./vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgCreateVestingAccount, MsgCreateVestingAccountSDKType, MsgCreatePermanentLockedAccount, MsgCreatePermanentLockedAccountSDKType, MsgCreatePeriodicVestingAccount, MsgCreatePeriodicVestingAccountSDKType } from "./tx"; export interface MsgCreateVestingAccountAminoType extends AminoMsg { type: "cosmos-sdk/MsgCreateVestingAccount"; @@ -59,8 +58,8 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - end_time: omitDefault(endTime)?.toString?.(), - delayed: omitDefault(delayed) + end_time: endTime?.toString?.(), + delayed }; }, fromAmino: ({ @@ -124,9 +123,9 @@ export const AminoConverter = { return { from_address: fromAddress, to_address: toAddress, - start_time: omitDefault(startTime)?.toString?.(), + start_time: startTime?.toString?.(), vesting_periods: vestingPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index d9fd821339..74b49cd515 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -2,7 +2,6 @@ import { AccessConfig, AccessConfigSDKType, accessTypeFromJSON } from "./types"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; import { toBase64, fromBase64, fromUtf8, toUtf8 } from "@cosmjs/encoding"; -import { omitDefault } from "../../../helpers"; import { MsgStoreCode, MsgStoreCodeSDKType, MsgInstantiateContract, MsgInstantiateContractSDKType, MsgExecuteContract, MsgExecuteContractSDKType, MsgMigrateContract, MsgMigrateContractSDKType, MsgUpdateAdmin, MsgUpdateAdminSDKType, MsgClearAdmin, MsgClearAdminSDKType } from "./tx"; export interface MsgStoreCodeAminoType extends AminoMsg { type: "wasm/MsgStoreCode"; @@ -110,7 +109,7 @@ export const AminoConverter = { return { sender, admin, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId?.toString?.(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +185,7 @@ export const AminoConverter = { return { sender, contract, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId?.toString?.(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index 3bd96d6c01..944de68549 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -1,7 +1,6 @@ import { Timestamp, TimestampSDKType } from "../../../google/protobuf/timestamp"; import { Period, PeriodSDKType } from "../../../cosmos/vesting/v1beta1/vesting"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { MsgCreateClawbackVestingAccount, MsgCreateClawbackVestingAccountSDKType, MsgClawback, MsgClawbackSDKType } from "./tx"; export interface MsgCreateClawbackVestingAccountAminoType extends AminoMsg { @@ -51,20 +50,20 @@ export const AminoConverter = { to_address: toAddress, start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: omitDefault(el0.length)?.toString?.(), + length: el0.length?.toString?.(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), - merge: omitDefault(merge) + merge }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index 854424544c..c66bbe0368 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(timeoutTimestamp)?.toString?.() + timeout_timestamp: timeoutTimestamp?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index e781e4c600..f54b980d41 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + next_sequence_recv: nextSequenceRecv?.toString?.(), signer }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: omitDefault(nextSequenceRecv)?.toString?.(), + next_sequence_recv: nextSequenceRecv?.toString?.(), signer }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: omitDefault(packet.sequence)?.toString?.(), + sequence: packet.sequence?.toString?.(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -626,9 +626,9 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: omitDefault(packet.timeoutTimestamp)?.toString?.() + timeout_timestamp: packet.timeoutTimestamp?.toString?.() }, - acknowledgement: acknowledgement, + acknowledgement, proof_acked: proofAcked, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 9d7a779dd2..646667fed4 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: version.identifier, features: version.features }, - delay_period: omitDefault(delayPeriod)?.toString?.(), + delay_period: delayPeriod?.toString?.(), signer }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: omitDefault(delayPeriod)?.toString?.(), + delay_period: delayPeriod?.toString?.(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: el0.identifier, features: el0.features diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 8638459881..7ba7026ad7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -2,7 +2,6 @@ import { PoolParams, PoolParamsSDKType } from "./stableswap_pool"; import { Coin, CoinSDKType } from "../../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../../helpers"; import { MsgCreateStableswapPool, MsgCreateStableswapPoolSDKType, MsgStableSwapAdjustScalingFactors, MsgStableSwapAdjustScalingFactorsSDKType } from "./tx"; export interface MsgCreateStableswapPoolAminoType extends AminoMsg { type: "osmosis/gamm/create-stableswap-pool"; @@ -88,7 +87,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index 49a21b2fcc..0ad588e0bc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -1,7 +1,6 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { SwapAmountInRoute, SwapAmountInRouteSDKType, SwapAmountOutRoute, SwapAmountOutRouteSDKType, MsgJoinPool, MsgJoinPoolSDKType, MsgExitPool, MsgExitPoolSDKType, MsgSwapExactAmountIn, MsgSwapExactAmountInSDKType, MsgSwapExactAmountOut, MsgSwapExactAmountOutSDKType, MsgJoinSwapExternAmountIn, MsgJoinSwapExternAmountInSDKType, MsgJoinSwapShareAmountOut, MsgJoinSwapShareAmountOutSDKType, MsgExitSwapExternAmountOut, MsgExitSwapExternAmountOutSDKType, MsgExitSwapShareAmountIn, MsgExitSwapShareAmountInSDKType } from "./tx"; export interface MsgJoinPoolAminoType extends AminoMsg { type: "osmosis/gamm/join-pool"; @@ -112,7 +111,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -147,7 +146,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -183,7 +182,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -224,7 +223,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId?.toString?.(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -264,7 +263,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -300,7 +299,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -332,7 +331,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -368,7 +367,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId?.toString?.(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index 4f28766a14..f2a6614ebc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -3,7 +3,6 @@ import { QueryCondition, QueryConditionSDKType, lockQueryTypeFromJSON } from ".. import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { Timestamp, TimestampSDKType } from "../../google/protobuf/timestamp"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { MsgCreateGauge, MsgCreateGaugeSDKType, MsgAddToGauge, MsgAddToGaugeSDKType } from "./tx"; export interface MsgCreateGaugeAminoType extends AminoMsg { @@ -51,7 +50,7 @@ export const AminoConverter = { numEpochsPaidOver }: MsgCreateGauge): MsgCreateGaugeAminoType["value"] => { return { - is_perpetual: omitDefault(isPerpetual), + is_perpetual: isPerpetual, owner, distribute_to: { lock_query_type: distributeTo.lockQueryType, @@ -64,7 +63,7 @@ export const AminoConverter = { amount: el0.amount })), start_time: startTime, - num_epochs_paid_over: omitDefault(numEpochsPaidOver)?.toString?.() + num_epochs_paid_over: numEpochsPaidOver?.toString?.() }; }, fromAmino: ({ @@ -105,7 +104,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner, - gauge_id: omitDefault(gaugeId)?.toString?.(), + gauge_id: gaugeId?.toString?.(), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index a5ddf6e1a1..3b05d63d61 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -3,7 +3,6 @@ import { Duration, DurationSDKType } from "../../google/protobuf/duration"; import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { PeriodLock, PeriodLockSDKType } from "./lock"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { MsgLockTokens, MsgLockTokensSDKType, MsgBeginUnlockingAll, MsgBeginUnlockingAllSDKType, MsgBeginUnlocking, MsgBeginUnlockingSDKType, MsgExtendLockup, MsgExtendLockupSDKType, MsgForceUnlock, MsgForceUnlockSDKType } from "./tx"; export interface MsgLockTokensAminoType extends AminoMsg { type: "osmosis/lockup/lock-tokens"; @@ -119,7 +118,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -150,7 +149,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +177,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner, - ID: omitDefault(ID)?.toString?.(), + ID: ID?.toString?.(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 626fa90454..74ed8f6813 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -1,7 +1,6 @@ //@ts-nocheck import { Coin, CoinSDKType } from "../../cosmos/base/v1beta1/coin"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../helpers"; import { MsgSuperfluidDelegate, MsgSuperfluidDelegateSDKType, MsgSuperfluidUndelegate, MsgSuperfluidUndelegateSDKType, MsgSuperfluidUnbondLock, MsgSuperfluidUnbondLockSDKType, MsgLockAndSuperfluidDelegate, MsgLockAndSuperfluidDelegateSDKType, MsgUnPoolWhitelistedPool, MsgUnPoolWhitelistedPoolSDKType } from "./tx"; export interface MsgSuperfluidDelegateAminoType extends AminoMsg { type: "osmosis/superfluid-delegate"; @@ -53,7 +52,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.(), + lock_id: lockId?.toString?.(), val_addr: valAddr }; }, @@ -77,7 +76,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.() + lock_id: lockId?.toString?.() }; }, fromAmino: ({ @@ -98,7 +97,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender, - lock_id: omitDefault(lockId)?.toString?.() + lock_id: lockId?.toString?.() }; }, fromAmino: ({ @@ -150,7 +149,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.() + pool_id: poolId?.toString?.() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts index 0d9cf2dde2..6ac7848d13 100644 --- a/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/tokenfactory/v1beta1/tx.amino.ts @@ -2,7 +2,6 @@ import { Coin, CoinSDKType } from "../../../cosmos/base/v1beta1/coin"; import { Metadata, MetadataSDKType, DenomUnit, DenomUnitSDKType } from "../../../cosmos/bank/v1beta1/bank"; import { AminoMsg } from "@cosmjs/amino"; -import { omitDefault } from "../../../helpers"; import { MsgCreateDenom, MsgCreateDenomSDKType, MsgMint, MsgMintSDKType, MsgBurn, MsgBurnSDKType, MsgChangeAdmin, MsgChangeAdminSDKType, MsgSetDenomMetadata, MsgSetDenomMetadataSDKType } from "./tx"; export interface MsgCreateDenomAminoType extends AminoMsg { type: "osmosis/tokenfactory/create-denom"; @@ -172,7 +171,7 @@ export const AminoConverter = { description: metadata.description, denom_units: metadata.denomUnits.map(el0 => ({ denom: el0.denom, - exponent: omitDefault(el0.exponent), + exponent: el0.exponent, aliases: el0.aliases })), base: metadata.base, diff --git a/packages/ast/src/encoding/amino/to-amino-json/utils.ts b/packages/ast/src/encoding/amino/to-amino-json/utils.ts index 014e3f9afc..2f91ed425f 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/utils.ts @@ -7,10 +7,13 @@ import { ProtoField } from '@cosmology/types'; export const toAmino = { defaultType(args: ToAminoParseField, omitEmpty?: boolean) { - // if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { - // return shorthandProperty(args.field.name); - // } - let valueExpr = omitEmpty ? + const useOmitEmpty = !!args.context.pluginValue('aminoEncoding.legacy.useOmitEmpty'); + + if (!(useOmitEmpty && omitEmpty) && args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { + return shorthandProperty(args.field.name); + } + + let valueExpr = useOmitEmpty && omitEmpty ? this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : memberExpressionOrIdentifier(args.scope); @@ -18,7 +21,8 @@ export const toAmino = { }, long(args: ToAminoParseField, omitEmpty?: boolean) { - let valueExpr = omitEmpty ? + const useOmitEmpty = !!args.context.pluginValue('aminoEncoding.legacy.useOmitEmpty'); + let valueExpr = useOmitEmpty && omitEmpty ? this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : memberExpressionOrIdentifier(args.scope); diff --git a/packages/telescope/__tests__/telescope-instant-rpc.test.ts b/packages/telescope/__tests__/telescope-instant-rpc.test.ts index b8db073123..d70ff69578 100644 --- a/packages/telescope/__tests__/telescope-instant-rpc.test.ts +++ b/packages/telescope/__tests__/telescope-instant-rpc.test.ts @@ -235,7 +235,8 @@ const options: TelescopeOptions = { aminoEncoding: { enabled: true, legacy: { - useNullHandling: true + useNullHandling: true, + useOmitEmpty: true }, exceptions: { "/akash.audit.v1beta2.MsgSignProviderAttributes": { diff --git a/packages/telescope/package.json b/packages/telescope/package.json index 431fd867cd..49b96808dd 100644 --- a/packages/telescope/package.json +++ b/packages/telescope/package.json @@ -78,7 +78,8 @@ "ts-jest": "^29.1.0", "ts-node": "10.9.1", "ts-node-dev": "2.0.0", - "typescript": "^5.0.4" + "typescript": "^5.0.4", + "@keplr-wallet/unit": "^0.12.53" }, "dependencies": { "@babel/generator": "^7.23.6", @@ -103,7 +104,6 @@ "minimist": "1.2.8", "mkdirp": "3.0.0", "parse-package-name": "1.0.0", - "rimraf": "5.0.0", - "@keplr-wallet/unit": "^0.12.53" + "rimraf": "5.0.0" } } diff --git a/packages/types/src/telescope.ts b/packages/types/src/telescope.ts index 44ab2b50e5..0e9d8fcb51 100644 --- a/packages/types/src/telescope.ts +++ b/packages/types/src/telescope.ts @@ -154,7 +154,8 @@ interface TelescopeOpts { */ useLegacyInlineEncoding?: boolean; legacy?: { - useNullHandling: boolean; + useNullHandling?: boolean; + useOmitEmpty?: boolean; } }; diff --git a/packages/types/types/telescope.d.ts b/packages/types/types/telescope.d.ts index ac825228a3..363b3325fd 100644 --- a/packages/types/types/telescope.d.ts +++ b/packages/types/types/telescope.d.ts @@ -126,7 +126,8 @@ interface TelescopeOpts { */ useLegacyInlineEncoding?: boolean; legacy?: { - useNullHandling: boolean; + useNullHandling?: boolean; + useOmitEmpty?: boolean; }; }; lcdClients?: { From 6fb77a38bfd5a8af7f9381516f3bb2a468c230da Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Sun, 17 Mar 2024 16:14:26 +0800 Subject: [PATCH 22/24] add amino legacy flag for null handling --- .../amino-legacy/misc/tx.amino.ts | 16 +- .../akash/deployment/v1beta2/service.amino.ts | 14 +- .../akash/market/v1beta2/service.amino.ts | 10 +- .../output1/cosmos/gov/v1/tx.amino.ts | 6 +- .../output1/cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../output1/cosmos/group/v1/tx.amino.ts | 16 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 2 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../output1/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../output1/evmos/vesting/v1/tx.amino.ts | 4 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../output1/ibc/core/channel/v1/tx.amino.ts | 20 +- .../ibc/core/connection/v1/tx.amino.ts | 4 +- .../gamm/pool-models/stableswap/tx.amino.ts | 2 +- .../output1/osmosis/gamm/v1beta1/tx.amino.ts | 16 +- .../output1/osmosis/incentives/tx.amino.ts | 4 +- .../output1/osmosis/lockup/tx.amino.ts | 6 +- .../output1/osmosis/superfluid/tx.amino.ts | 8 +- .../akash/deployment/v1beta2/service.amino.ts | 14 +- .../akash/market/v1beta2/service.amino.ts | 10 +- .../outputosmojs/cosmos/gov/v1/tx.amino.ts | 6 +- .../cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../outputosmojs/cosmos/group/v1/tx.amino.ts | 16 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 2 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../outputosmojs/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../outputosmojs/evmos/vesting/v1/tx.amino.ts | 4 +- .../controller/v1/tx.amino.ts | 2 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../ibc/core/channel/v1/tx.amino.ts | 20 +- .../ibc/core/connection/v1/tx.amino.ts | 4 +- .../concentrated-liquidity/tx.amino.ts | 8 +- .../gamm/pool-models/stableswap/tx.amino.ts | 2 +- .../osmosis/gamm/v1beta1/tx.amino.ts | 16 +- .../osmosis/incentives/tx.amino.ts | 4 +- .../outputosmojs/osmosis/lockup/tx.amino.ts | 6 +- .../osmosis/poolmanager/v1beta1/tx.amino.ts | 4 +- .../osmosis/protorev/v1beta1/tx.amino.ts | 12 +- .../osmosis/superfluid/tx.amino.ts | 8 +- .../osmosis/valset-pref/v1beta1/tx.amino.ts | 2 +- .../akash/deployment/v1beta2/service.amino.ts | 14 +- .../akash/market/v1beta2/service.amino.ts | 10 +- .../v-next/outputv4/cosmos/gov/v1/tx.amino.ts | 6 +- .../outputv4/cosmos/gov/v1beta1/tx.amino.ts | 6 +- .../outputv4/cosmos/group/v1/tx.amino.ts | 16 +- .../cosmos/upgrade/v1beta1/tx.amino.ts | 2 +- .../cosmos/vesting/v1beta1/tx.amino.ts | 6 +- .../outputv4/cosmwasm/wasm/v1/tx.amino.ts | 4 +- .../outputv4/evmos/vesting/v1/tx.amino.ts | 4 +- .../ibc/applications/transfer/v1/tx.amino.ts | 2 +- .../outputv4/ibc/core/channel/v1/tx.amino.ts | 20 +- .../ibc/core/connection/v1/tx.amino.ts | 4 +- .../gamm/pool-models/stableswap/tx.amino.ts | 2 +- .../outputv4/osmosis/gamm/v1beta1/tx.amino.ts | 16 +- .../outputv4/osmosis/incentives/tx.amino.ts | 4 +- .../outputv4/osmosis/lockup/tx.amino.ts | 6 +- .../outputv4/osmosis/superfluid/tx.amino.ts | 8 +- .../src/encoding/amino/to-amino-json/utils.ts | 522 ++++++++++-------- .../encoding/amino/to-amino-json/utils.d.ts | 10 +- 59 files changed, 509 insertions(+), 457 deletions(-) diff --git a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts index c540b17d93..4f1a4b8aea 100644 --- a/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts +++ b/__fixtures__/misc/output-proto-amino/amino-legacy/misc/tx.amino.ts @@ -191,8 +191,8 @@ export const AminoConverter = { d_o_b: dOTests.dOB, num: dOTests.num, d_o_num: dOTests.dONum, - big: dOTests.big?.toString?.(), - d_o_big: dOTests.dOBig?.toString?.(), + big: dOTests.big.toString(), + d_o_big: dOTests.dOBig.toString(), proto: { sender: dOTests.proto.sender }, @@ -234,11 +234,11 @@ export const AminoConverter = { opts: dOTests.opts, d_o_opts: dOTests.dOOpts, periods: dOTests.periods.map(el0 => ({ - seconds: el0.seconds?.toString?.(), + seconds: el0.seconds.toString(), nanos: el0.nanos })), d_o_periods: dOTests.dOPeriods.map(el0 => ({ - seconds: el0.seconds?.toString?.(), + seconds: el0.seconds.toString(), nanos: el0.nanos })), protos: dOTests.protos.map(el0 => ({ @@ -267,8 +267,8 @@ export const AminoConverter = { o_b: oTests.oB, num: oTests.num, o_num: oTests.oNum, - big: oTests.big?.toString?.(), - o_big: oTests.oBig?.toString?.(), + big: oTests.big.toString(), + o_big: oTests.oBig.toString(), proto: { sender: oTests.proto.sender }, @@ -310,11 +310,11 @@ export const AminoConverter = { opts: oTests.opts, o_opts: oTests.oOpts, periods: oTests.periods.map(el0 => ({ - seconds: el0.seconds?.toString?.(), + seconds: el0.seconds.toString(), nanos: el0.nanos })), o_periods: oTests.oPeriods.map(el0 => ({ - seconds: el0.seconds?.toString?.(), + seconds: el0.seconds.toString(), nanos: el0.nanos })), protos: oTests.protos.map(el0 => ({ diff --git a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts index d7da2f375c..bed5b9394a 100644 --- a/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/deployment/v1beta2/service.amino.ts @@ -158,7 +158,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, groups: groups.map(el0 => ({ name: el0.name, @@ -307,7 +307,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, amount: { denom: amount.denom, @@ -343,7 +343,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, version }; @@ -369,7 +369,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() } }; }, @@ -392,7 +392,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; @@ -417,7 +417,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; @@ -442,7 +442,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; diff --git a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts index 5bd0ddf403..acfe362680 100644 --- a/__fixtures__/output1/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/output1/akash/market/v1beta2/service.amino.ts @@ -85,7 +85,7 @@ export const AminoConverter = { return { order: { owner: order.owner, - dseq: order.dseq?.toString?.(), + dseq: order.dseq.toString(), gseq: order.gseq, oseq: order.oseq }, @@ -133,7 +133,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -162,7 +162,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -191,7 +191,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -220,7 +220,7 @@ export const AminoConverter = { return { lease_id: { owner: leaseId.owner, - dseq: leaseId.dseq?.toString?.(), + dseq: leaseId.dseq.toString(), gseq: leaseId.gseq, oseq: leaseId.oseq, provider: leaseId.provider diff --git a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts index eb379bb522..d97e98504a 100644 --- a/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1/tx.amino.ts @@ -139,7 +139,7 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option, metadata @@ -168,7 +168,7 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -202,7 +202,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts index c002f76cf1..e9ba4f76f0 100644 --- a/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/gov/v1beta1/tx.amino.ts @@ -94,7 +94,7 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option }; @@ -119,7 +119,7 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -150,7 +150,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts index 89d09c5dc4..7bdef57235 100644 --- a/__fixtures__/output1/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/group/v1/tx.amino.ts @@ -192,7 +192,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), member_updates: memberUpdates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -227,7 +227,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), new_admin: newAdmin }; }, @@ -252,7 +252,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), metadata }; }, @@ -278,7 +278,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), metadata, decision_policy: { type_url: decisionPolicy.typeUrl, @@ -483,7 +483,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), address }; }, @@ -507,7 +507,7 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option, metadata, @@ -537,7 +537,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), signer }; }, @@ -559,7 +559,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address, - group_id: groupId?.toString?.() + group_id: groupId.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts index 4ee068fd12..9363380b44 100644 --- a/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/upgrade/v1beta1/tx.amino.ts @@ -37,7 +37,7 @@ export const AminoConverter = { plan: { name: plan.name, time: plan.time, - height: plan.height?.toString?.(), + height: plan.height.toString(), info: plan.info, upgraded_client_state: { type_url: plan.upgradedClientState.typeUrl, diff --git a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts index 6942a78fc2..eada26bd87 100644 --- a/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/cosmos/vesting/v1beta1/tx.amino.ts @@ -59,7 +59,7 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - end_time: endTime?.toString?.(), + end_time: endTime.toString(), delayed }; }, @@ -124,9 +124,9 @@ export const AminoConverter = { return { from_address: fromAddress, to_address: toAddress, - start_time: startTime?.toString?.(), + start_time: startTime.toString(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts index 22ddbbbb63..94a5bc95fa 100644 --- a/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/output1/cosmwasm/wasm/v1/tx.amino.ts @@ -110,7 +110,7 @@ export const AminoConverter = { return { sender, admin, - code_id: codeId?.toString?.(), + code_id: codeId.toString(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -186,7 +186,7 @@ export const AminoConverter = { return { sender, contract, - code_id: codeId?.toString?.(), + code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts index d6b2c79879..d9826dab6d 100644 --- a/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/output1/evmos/vesting/v1/tx.amino.ts @@ -51,14 +51,14 @@ export const AminoConverter = { to_address: toAddress, start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts index 069b84c8ff..d0699be66f 100644 --- a/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp?.toString?.() + timeout_timestamp: timeoutTimestamp.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts index c5dbe0858f..e45b2d998c 100644 --- a/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv?.toString?.(), + next_sequence_recv: nextSequenceRecv.toString(), signer }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv?.toString?.(), + next_sequence_recv: nextSequenceRecv.toString(), signer }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -626,7 +626,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, acknowledgement, proof_acked: proofAcked, diff --git a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts index 9ab9753ac8..540541f124 100644 --- a/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/output1/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: version.identifier, features: version.features }, - delay_period: delayPeriod?.toString?.(), + delay_period: delayPeriod.toString(), signer }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod?.toString?.(), + delay_period: delayPeriod.toString(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: el0.identifier, features: el0.features diff --git a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 48e8fa1337..ace726116c 100644 --- a/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -88,7 +88,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts index 1fa6d64bc1..b3a3f6f1f1 100644 --- a/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/output1/osmosis/gamm/v1beta1/tx.amino.ts @@ -112,7 +112,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -147,7 +147,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -183,7 +183,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -224,7 +224,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -264,7 +264,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: Long.fromValue(tokenIn.amount).toString() @@ -300,7 +300,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -332,7 +332,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: Long.fromValue(tokenOut.amount).toString() @@ -368,7 +368,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount diff --git a/__fixtures__/output1/osmosis/incentives/tx.amino.ts b/__fixtures__/output1/osmosis/incentives/tx.amino.ts index 4969c5a70b..e37a087742 100644 --- a/__fixtures__/output1/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/output1/osmosis/incentives/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { amount: el0.amount })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver?.toString?.() + num_epochs_paid_over: numEpochsPaidOver.toString() }; }, fromAmino: ({ @@ -105,7 +105,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner, - gauge_id: gaugeId?.toString?.(), + gauge_id: gaugeId.toString(), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/output1/osmosis/lockup/tx.amino.ts b/__fixtures__/output1/osmosis/lockup/tx.amino.ts index a9200a4154..0bb3390ab8 100644 --- a/__fixtures__/output1/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/output1/osmosis/lockup/tx.amino.ts @@ -119,7 +119,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), duration: (duration * 1_000_000_000).toString() }; }, @@ -178,7 +178,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts index 0f47a3aa51..719496a013 100644 --- a/__fixtures__/output1/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/output1/osmosis/superfluid/tx.amino.ts @@ -53,7 +53,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.(), + lock_id: lockId.toString(), val_addr: valAddr }; }, @@ -77,7 +77,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.() + lock_id: lockId.toString() }; }, fromAmino: ({ @@ -98,7 +98,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.() + lock_id: lockId.toString() }; }, fromAmino: ({ @@ -150,7 +150,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.() + pool_id: poolId.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts index ee5cad7df4..29301829da 100644 --- a/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/deployment/v1beta2/service.amino.ts @@ -157,7 +157,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, groups: groups.map(el0 => ({ name: el0.name, @@ -306,7 +306,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, amount: { denom: amount.denom, @@ -342,7 +342,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, version }; @@ -368,7 +368,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() } }; }, @@ -391,7 +391,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; @@ -416,7 +416,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; @@ -441,7 +441,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts index 9b6c061288..0e47f2ffe8 100644 --- a/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputosmojs/akash/market/v1beta2/service.amino.ts @@ -84,7 +84,7 @@ export const AminoConverter = { return { order: { owner: order.owner, - dseq: order.dseq?.toString?.(), + dseq: order.dseq.toString(), gseq: order.gseq, oseq: order.oseq }, @@ -132,7 +132,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -161,7 +161,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -190,7 +190,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -219,7 +219,7 @@ export const AminoConverter = { return { lease_id: { owner: leaseId.owner, - dseq: leaseId.dseq?.toString?.(), + dseq: leaseId.dseq.toString(), gseq: leaseId.gseq, oseq: leaseId.oseq, provider: leaseId.provider diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts index 61ed1b3e47..7c0115740a 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1/tx.amino.ts @@ -138,7 +138,7 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option, metadata @@ -167,7 +167,7 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -201,7 +201,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts index 6344efde28..fad45eaf42 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/gov/v1beta1/tx.amino.ts @@ -93,7 +93,7 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option }; @@ -118,7 +118,7 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -149,7 +149,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts index e7057df453..e44a0f0c10 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/group/v1/tx.amino.ts @@ -191,7 +191,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), member_updates: memberUpdates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -226,7 +226,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), new_admin: newAdmin }; }, @@ -251,7 +251,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), metadata }; }, @@ -277,7 +277,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), metadata, decision_policy: { type_url: decisionPolicy.typeUrl, @@ -482,7 +482,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), address }; }, @@ -506,7 +506,7 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option, metadata, @@ -536,7 +536,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), signer }; }, @@ -558,7 +558,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address, - group_id: groupId?.toString?.() + group_id: groupId.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts index 15dc179fbe..92673592c2 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/upgrade/v1beta1/tx.amino.ts @@ -36,7 +36,7 @@ export const AminoConverter = { plan: { name: plan.name, time: plan.time, - height: plan.height?.toString?.(), + height: plan.height.toString(), info: plan.info, upgraded_client_state: { type_url: plan.upgradedClientState.typeUrl, diff --git a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts index 0f8b41b9f2..b1829bb2bc 100644 --- a/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmos/vesting/v1beta1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - end_time: endTime?.toString?.(), + end_time: endTime.toString(), delayed }; }, @@ -123,9 +123,9 @@ export const AminoConverter = { return { from_address: fromAddress, to_address: toAddress, - start_time: startTime?.toString?.(), + start_time: startTime.toString(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts index 74b49cd515..db3abbec45 100644 --- a/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/cosmwasm/wasm/v1/tx.amino.ts @@ -109,7 +109,7 @@ export const AminoConverter = { return { sender, admin, - code_id: codeId?.toString?.(), + code_id: codeId.toString(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -185,7 +185,7 @@ export const AminoConverter = { return { sender, contract, - code_id: codeId?.toString?.(), + code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts index 944de68549..ef55f48dca 100644 --- a/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/evmos/vesting/v1/tx.amino.ts @@ -50,14 +50,14 @@ export const AminoConverter = { to_address: toAddress, start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts index 6780c3b5a9..41d9968082 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/interchain_accounts/controller/v1/tx.amino.ts @@ -64,7 +64,7 @@ export const AminoConverter = { data: packetData.data, memo: packetData.memo }, - relative_timeout: relativeTimeout?.toString?.() + relative_timeout: relativeTimeout.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts index c66bbe0368..a03ccde6de 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp?.toString?.() + timeout_timestamp: timeoutTimestamp.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts index f54b980d41..a2055c9569 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv?.toString?.(), + next_sequence_recv: nextSequenceRecv.toString(), signer }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv?.toString?.(), + next_sequence_recv: nextSequenceRecv.toString(), signer }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -626,7 +626,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, acknowledgement, proof_acked: proofAcked, diff --git a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts index 646667fed4..53e0a3765c 100644 --- a/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: version.identifier, features: version.features }, - delay_period: delayPeriod?.toString?.(), + delay_period: delayPeriod.toString(), signer }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod?.toString?.(), + delay_period: delayPeriod.toString(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: el0.identifier, features: el0.features diff --git a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts index 5dbbfc1e7c..1632416bcc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/concentrated-liquidity/tx.amino.ts @@ -66,10 +66,10 @@ export const AminoConverter = { tokenMinAmount1 }: MsgCreatePosition): MsgCreatePositionAminoType["value"] => { return { - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), sender, - lower_tick: lowerTick?.toString?.(), - upper_tick: upperTick?.toString?.(), + lower_tick: lowerTick.toString(), + upper_tick: upperTick.toString(), token_desired0: { denom: tokenDesired0.denom, amount: tokenDesired0.amount @@ -118,7 +118,7 @@ export const AminoConverter = { liquidityAmount }: MsgWithdrawPosition): MsgWithdrawPositionAminoType["value"] => { return { - position_id: positionId?.toString?.(), + position_id: positionId.toString(), sender, liquidity_amount: liquidityAmount }; diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 7ba7026ad7..7811c40f43 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -87,7 +87,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts index 0ad588e0bc..e82624ab3d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/gamm/v1beta1/tx.amino.ts @@ -111,7 +111,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -146,7 +146,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -182,7 +182,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -223,7 +223,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -263,7 +263,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -299,7 +299,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -331,7 +331,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -367,7 +367,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts index f2a6614ebc..fc284ed915 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/incentives/tx.amino.ts @@ -63,7 +63,7 @@ export const AminoConverter = { amount: el0.amount })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver?.toString?.() + num_epochs_paid_over: numEpochsPaidOver.toString() }; }, fromAmino: ({ @@ -104,7 +104,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner, - gauge_id: gaugeId?.toString?.(), + gauge_id: gaugeId.toString(), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts index 3b05d63d61..5a645daaa7 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/lockup/tx.amino.ts @@ -118,7 +118,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -149,7 +149,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), duration: (duration * 1_000_000_000).toString() }; }, @@ -177,7 +177,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts index 97017e8e3b..deb7cbf04b 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/poolmanager/v1beta1/tx.amino.ts @@ -45,7 +45,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -86,7 +86,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts index 6f173ad96f..a7969d86b0 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/protorev/v1beta1/tx.amino.ts @@ -74,7 +74,7 @@ export const AminoConverter = { hot_routes: hotRoutes.map(el0 => ({ arb_routes: el0.arbRoutes.map(el1 => ({ trades: el1.trades.map(el2 => ({ - pool: el2.pool?.toString?.(), + pool: el2.pool.toString(), token_in: el2.tokenIn, token_out: el2.tokenOut })), @@ -135,7 +135,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerTx): MsgSetMaxPoolPointsPerTxAminoType["value"] => { return { admin, - max_pool_points_per_tx: maxPoolPointsPerTx?.toString?.() + max_pool_points_per_tx: maxPoolPointsPerTx.toString() }; }, fromAmino: ({ @@ -156,7 +156,7 @@ export const AminoConverter = { }: MsgSetMaxPoolPointsPerBlock): MsgSetMaxPoolPointsPerBlockAminoType["value"] => { return { admin, - max_pool_points_per_block: maxPoolPointsPerBlock?.toString?.() + max_pool_points_per_block: maxPoolPointsPerBlock.toString() }; }, fromAmino: ({ @@ -178,9 +178,9 @@ export const AminoConverter = { return { admin, pool_weights: { - stable_weight: poolWeights.stableWeight?.toString?.(), - balancer_weight: poolWeights.balancerWeight?.toString?.(), - concentrated_weight: poolWeights.concentratedWeight?.toString?.() + stable_weight: poolWeights.stableWeight.toString(), + balancer_weight: poolWeights.balancerWeight.toString(), + concentrated_weight: poolWeights.concentratedWeight.toString() } }; }, diff --git a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts index 74ed8f6813..ab182966bc 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/superfluid/tx.amino.ts @@ -52,7 +52,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.(), + lock_id: lockId.toString(), val_addr: valAddr }; }, @@ -76,7 +76,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.() + lock_id: lockId.toString() }; }, fromAmino: ({ @@ -97,7 +97,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.() + lock_id: lockId.toString() }; }, fromAmino: ({ @@ -149,7 +149,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.() + pool_id: poolId.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts index 7abb420f50..4cb0b8802d 100644 --- a/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputosmojs/osmosis/valset-pref/v1beta1/tx.amino.ts @@ -190,7 +190,7 @@ export const AminoConverter = { }: MsgDelegateBondedTokens): MsgDelegateBondedTokensAminoType["value"] => { return { delegator, - lockID: lockID?.toString?.() + lockID: lockID.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts index ee5cad7df4..29301829da 100644 --- a/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/deployment/v1beta2/service.amino.ts @@ -157,7 +157,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, groups: groups.map(el0 => ({ name: el0.name, @@ -306,7 +306,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, amount: { denom: amount.denom, @@ -342,7 +342,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() }, version }; @@ -368,7 +368,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.() + dseq: id.dseq.toString() } }; }, @@ -391,7 +391,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; @@ -416,7 +416,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; @@ -441,7 +441,7 @@ export const AminoConverter = { return { id: { owner: id.owner, - dseq: id.dseq?.toString?.(), + dseq: id.dseq.toString(), gseq: id.gseq } }; diff --git a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts index 9b6c061288..0e47f2ffe8 100644 --- a/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts +++ b/__fixtures__/v-next/outputv4/akash/market/v1beta2/service.amino.ts @@ -84,7 +84,7 @@ export const AminoConverter = { return { order: { owner: order.owner, - dseq: order.dseq?.toString?.(), + dseq: order.dseq.toString(), gseq: order.gseq, oseq: order.oseq }, @@ -132,7 +132,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -161,7 +161,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -190,7 +190,7 @@ export const AminoConverter = { return { bid_id: { owner: bidId.owner, - dseq: bidId.dseq?.toString?.(), + dseq: bidId.dseq.toString(), gseq: bidId.gseq, oseq: bidId.oseq, provider: bidId.provider @@ -219,7 +219,7 @@ export const AminoConverter = { return { lease_id: { owner: leaseId.owner, - dseq: leaseId.dseq?.toString?.(), + dseq: leaseId.dseq.toString(), gseq: leaseId.gseq, oseq: leaseId.oseq, provider: leaseId.provider diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts index 61ed1b3e47..7c0115740a 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1/tx.amino.ts @@ -138,7 +138,7 @@ export const AminoConverter = { metadata }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option, metadata @@ -167,7 +167,7 @@ export const AminoConverter = { metadata }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -201,7 +201,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts index 6344efde28..fad45eaf42 100644 --- a/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/gov/v1beta1/tx.amino.ts @@ -93,7 +93,7 @@ export const AminoConverter = { option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option }; @@ -118,7 +118,7 @@ export const AminoConverter = { options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -149,7 +149,7 @@ export const AminoConverter = { amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom, diff --git a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts index e7057df453..e44a0f0c10 100644 --- a/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/group/v1/tx.amino.ts @@ -191,7 +191,7 @@ export const AminoConverter = { }: MsgUpdateGroupMembers): MsgUpdateGroupMembersAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), member_updates: memberUpdates.map(el0 => ({ address: el0.address, weight: el0.weight, @@ -226,7 +226,7 @@ export const AminoConverter = { }: MsgUpdateGroupAdmin): MsgUpdateGroupAdminAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), new_admin: newAdmin }; }, @@ -251,7 +251,7 @@ export const AminoConverter = { }: MsgUpdateGroupMetadata): MsgUpdateGroupMetadataAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), metadata }; }, @@ -277,7 +277,7 @@ export const AminoConverter = { }: MsgCreateGroupPolicy): MsgCreateGroupPolicyAminoType["value"] => { return { admin, - group_id: groupId?.toString?.(), + group_id: groupId.toString(), metadata, decision_policy: { type_url: decisionPolicy.typeUrl, @@ -482,7 +482,7 @@ export const AminoConverter = { address }: MsgWithdrawProposal): MsgWithdrawProposalAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), address }; }, @@ -506,7 +506,7 @@ export const AminoConverter = { exec }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, option, metadata, @@ -536,7 +536,7 @@ export const AminoConverter = { signer }: MsgExec): MsgExecAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), signer }; }, @@ -558,7 +558,7 @@ export const AminoConverter = { }: MsgLeaveGroup): MsgLeaveGroupAminoType["value"] => { return { address, - group_id: groupId?.toString?.() + group_id: groupId.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts index 15dc179fbe..92673592c2 100644 --- a/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/upgrade/v1beta1/tx.amino.ts @@ -36,7 +36,7 @@ export const AminoConverter = { plan: { name: plan.name, time: plan.time, - height: plan.height?.toString?.(), + height: plan.height.toString(), info: plan.info, upgraded_client_state: { type_url: plan.upgradedClientState.typeUrl, diff --git a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts index 0f8b41b9f2..b1829bb2bc 100644 --- a/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmos/vesting/v1beta1/tx.amino.ts @@ -58,7 +58,7 @@ export const AminoConverter = { denom: el0.denom, amount: el0.amount })), - end_time: endTime?.toString?.(), + end_time: endTime.toString(), delayed }; }, @@ -123,9 +123,9 @@ export const AminoConverter = { return { from_address: fromAddress, to_address: toAddress, - start_time: startTime?.toString?.(), + start_time: startTime.toString(), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts index 74b49cd515..db3abbec45 100644 --- a/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/cosmwasm/wasm/v1/tx.amino.ts @@ -109,7 +109,7 @@ export const AminoConverter = { return { sender, admin, - code_id: codeId?.toString?.(), + code_id: codeId.toString(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -185,7 +185,7 @@ export const AminoConverter = { return { sender, contract, - code_id: codeId?.toString?.(), + code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts index 944de68549..ef55f48dca 100644 --- a/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/evmos/vesting/v1/tx.amino.ts @@ -50,14 +50,14 @@ export const AminoConverter = { to_address: toAddress, start_time: startTime, lockup_periods: lockupPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount })) })), vesting_periods: vestingPeriods.map(el0 => ({ - length: el0.length?.toString?.(), + length: el0.length.toString(), amount: el0.amount.map(el1 => ({ denom: el1.denom, amount: el1.amount diff --git a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts index c66bbe0368..a03ccde6de 100644 --- a/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/applications/transfer/v1/tx.amino.ts @@ -43,7 +43,7 @@ export const AminoConverter = { revision_height: omitDefault(timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: timeoutTimestamp?.toString?.() + timeout_timestamp: timeoutTimestamp.toString() }; }, fromAmino: ({ diff --git a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts index f54b980d41..a2055c9569 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/channel/v1/tx.amino.ts @@ -426,7 +426,7 @@ export const AminoConverter = { }: MsgRecvPacket): MsgRecvPacketAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -436,7 +436,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_commitment: proofCommitment, proof_height: proofHeight ? { @@ -486,7 +486,7 @@ export const AminoConverter = { }: MsgTimeout): MsgTimeoutAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -496,14 +496,14 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_unreceived: proofUnreceived, proof_height: proofHeight ? { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv?.toString?.(), + next_sequence_recv: nextSequenceRecv.toString(), signer }; }, @@ -550,7 +550,7 @@ export const AminoConverter = { }: MsgTimeoutOnClose): MsgTimeoutOnCloseAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -560,7 +560,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, proof_unreceived: proofUnreceived, proof_close: proofClose, @@ -568,7 +568,7 @@ export const AminoConverter = { revision_height: omitDefault(proofHeight.revisionHeight)?.toString(), revision_number: omitDefault(proofHeight.revisionNumber)?.toString() } : {}, - next_sequence_recv: nextSequenceRecv?.toString?.(), + next_sequence_recv: nextSequenceRecv.toString(), signer }; }, @@ -616,7 +616,7 @@ export const AminoConverter = { }: MsgAcknowledgement): MsgAcknowledgementAminoType["value"] => { return { packet: { - sequence: packet.sequence?.toString?.(), + sequence: packet.sequence.toString(), source_port: packet.sourcePort, source_channel: packet.sourceChannel, destination_port: packet.destinationPort, @@ -626,7 +626,7 @@ export const AminoConverter = { revision_height: omitDefault(packet.timeoutHeight.revisionHeight)?.toString(), revision_number: omitDefault(packet.timeoutHeight.revisionNumber)?.toString() } : {}, - timeout_timestamp: packet.timeoutTimestamp?.toString?.() + timeout_timestamp: packet.timeoutTimestamp.toString() }, acknowledgement, proof_acked: proofAcked, diff --git a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts index 646667fed4..53e0a3765c 100644 --- a/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/ibc/core/connection/v1/tx.amino.ts @@ -106,7 +106,7 @@ export const AminoConverter = { identifier: version.identifier, features: version.features }, - delay_period: delayPeriod?.toString?.(), + delay_period: delayPeriod.toString(), signer }; }, @@ -165,7 +165,7 @@ export const AminoConverter = { key_prefix: counterparty.prefix.keyPrefix } }, - delay_period: delayPeriod?.toString?.(), + delay_period: delayPeriod.toString(), counterparty_versions: counterpartyVersions.map(el0 => ({ identifier: el0.identifier, features: el0.features diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts index 7ba7026ad7..7811c40f43 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/pool-models/stableswap/tx.amino.ts @@ -87,7 +87,7 @@ export const AminoConverter = { }: MsgStableSwapAdjustScalingFactors): MsgStableSwapAdjustScalingFactorsAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), scaling_factors: scalingFactors.map(el0 => el0.toString()) }; }, diff --git a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts index 0ad588e0bc..e82624ab3d 100644 --- a/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/gamm/v1beta1/tx.amino.ts @@ -111,7 +111,7 @@ export const AminoConverter = { }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -146,7 +146,7 @@ export const AminoConverter = { }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -182,7 +182,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -223,7 +223,7 @@ export const AminoConverter = { return { sender, routes: routes.map(el0 => ({ - pool_id: el0.poolId?.toString?.(), + pool_id: el0.poolId.toString(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -263,7 +263,7 @@ export const AminoConverter = { }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -299,7 +299,7 @@ export const AminoConverter = { }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -331,7 +331,7 @@ export const AminoConverter = { }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount @@ -367,7 +367,7 @@ export const AminoConverter = { }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.(), + pool_id: poolId.toString(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount diff --git a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts index f2a6614ebc..fc284ed915 100644 --- a/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/incentives/tx.amino.ts @@ -63,7 +63,7 @@ export const AminoConverter = { amount: el0.amount })), start_time: startTime, - num_epochs_paid_over: numEpochsPaidOver?.toString?.() + num_epochs_paid_over: numEpochsPaidOver.toString() }; }, fromAmino: ({ @@ -104,7 +104,7 @@ export const AminoConverter = { }: MsgAddToGauge): MsgAddToGaugeAminoType["value"] => { return { owner, - gauge_id: gaugeId?.toString?.(), + gauge_id: gaugeId.toString(), rewards: rewards.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts index 3b05d63d61..5a645daaa7 100644 --- a/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/lockup/tx.amino.ts @@ -118,7 +118,7 @@ export const AminoConverter = { }: MsgBeginUnlocking): MsgBeginUnlockingAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount @@ -149,7 +149,7 @@ export const AminoConverter = { }: MsgExtendLockup): MsgExtendLockupAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), duration: (duration * 1_000_000_000).toString() }; }, @@ -177,7 +177,7 @@ export const AminoConverter = { }: MsgForceUnlock): MsgForceUnlockAminoType["value"] => { return { owner, - ID: ID?.toString?.(), + ID: ID.toString(), coins: coins.map(el0 => ({ denom: el0.denom, amount: el0.amount diff --git a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts index 74ed8f6813..ab182966bc 100644 --- a/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts +++ b/__fixtures__/v-next/outputv4/osmosis/superfluid/tx.amino.ts @@ -52,7 +52,7 @@ export const AminoConverter = { }: MsgSuperfluidDelegate): MsgSuperfluidDelegateAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.(), + lock_id: lockId.toString(), val_addr: valAddr }; }, @@ -76,7 +76,7 @@ export const AminoConverter = { }: MsgSuperfluidUndelegate): MsgSuperfluidUndelegateAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.() + lock_id: lockId.toString() }; }, fromAmino: ({ @@ -97,7 +97,7 @@ export const AminoConverter = { }: MsgSuperfluidUnbondLock): MsgSuperfluidUnbondLockAminoType["value"] => { return { sender, - lock_id: lockId?.toString?.() + lock_id: lockId.toString() }; }, fromAmino: ({ @@ -149,7 +149,7 @@ export const AminoConverter = { }: MsgUnPoolWhitelistedPool): MsgUnPoolWhitelistedPoolAminoType["value"] => { return { sender, - pool_id: poolId?.toString?.() + pool_id: poolId.toString() }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/amino/to-amino-json/utils.ts b/packages/ast/src/encoding/amino/to-amino-json/utils.ts index 2f91ed425f..9baf1663aa 100644 --- a/packages/ast/src/encoding/amino/to-amino-json/utils.ts +++ b/packages/ast/src/encoding/amino/to-amino-json/utils.ts @@ -1,135 +1,177 @@ -import * as t from '@babel/types'; -import { BILLION, memberExpressionOrIdentifier, shorthandProperty, TypeLong } from "../../../utils"; -import { protoFieldsToArray } from '../utils'; -import { ToAminoParseField, toAminoParseField } from './index' -import { getFieldOptionality, getOneOfs } from '../../proto'; -import { ProtoField } from '@cosmology/types'; +import * as t from "@babel/types"; +import { + BILLION, + memberExpressionOrIdentifier, + shorthandProperty, + TypeLong, +} from "../../../utils"; +import { protoFieldsToArray } from "../utils"; +import { ToAminoParseField, toAminoParseField } from "./index"; +import { getFieldOptionality, getOneOfs } from "../../proto"; +import { ProtoField } from "@cosmology/types"; export const toAmino = { defaultType(args: ToAminoParseField, omitEmpty?: boolean) { - const useOmitEmpty = !!args.context.pluginValue('aminoEncoding.legacy.useOmitEmpty'); + const useOmitEmpty = !!args.context.pluginValue( + "aminoEncoding.legacy.useOmitEmpty" + ); - if (!(useOmitEmpty && omitEmpty) && args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { + if ( + !(useOmitEmpty && omitEmpty) && + args.field.name === args.context.aminoCaseField(args.field) && + args.scope.length === 1 + ) { return shorthandProperty(args.field.name); } - let valueExpr = useOmitEmpty && omitEmpty ? - this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : - memberExpressionOrIdentifier(args.scope); + let valueExpr = + useOmitEmpty && omitEmpty + ? this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) + : memberExpressionOrIdentifier(args.scope); - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), valueExpr) + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + valueExpr + ); }, long(args: ToAminoParseField, omitEmpty?: boolean) { - const useOmitEmpty = !!args.context.pluginValue('aminoEncoding.legacy.useOmitEmpty'); - let valueExpr = useOmitEmpty && omitEmpty ? - this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) : - memberExpressionOrIdentifier(args.scope); - - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), - t.optionalCallExpression( - t.optionalMemberExpression(valueExpr, t.identifier('toString'), false, true), - [], true) - ) + const useOmitEmpty = !!args.context.pluginValue( + "aminoEncoding.legacy.useOmitEmpty" + ); + const useNullHandling = !!args.context.pluginValue( + "aminoEncoding.legacy.useNullHandling" + ); + let valueExpr = + useOmitEmpty && omitEmpty + ? this.omitDefaultMemberExpressionOrIdentifier(args, args.scope) + : memberExpressionOrIdentifier(args.scope); + + const callExpression = useNullHandling + ? t.optionalCallExpression + : t.callExpression; + + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + callExpression( + useNullHandling + ? t.optionalMemberExpression( + valueExpr, + t.identifier("toString"), + false, + true + ) + : t.memberExpression(valueExpr, t.identifier("toString")), + [], + true + ) + ); }, string(args: ToAminoParseField, omitEmpty?: boolean) { - const useCosmosSDKDec = args.context.pluginValue('aminoEncoding.customTypes.useCosmosSDKDec'); - - if(useCosmosSDKDec){ - const isCosmosSDKDec = - (args.field.options?.['(gogoproto.customtype)'] == - 'github.com/cosmos/cosmos-sdk/types.Dec') || - (args.field.options?.['(gogoproto.customtype)'] == - 'cosmossdk.io/math.LegacyDec'); - - if (isCosmosSDKDec) { - args.context.addUtil('padDecimal'); - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), - t.callExpression( - t.identifier('padDecimal'), - [ - memberExpressionOrIdentifier(args.scope) - ] - ) - ) - } + const useCosmosSDKDec = args.context.pluginValue( + "aminoEncoding.customTypes.useCosmosSDKDec" + ); + + if (useCosmosSDKDec) { + const isCosmosSDKDec = + args.field.options?.["(gogoproto.customtype)"] == + "github.com/cosmos/cosmos-sdk/types.Dec" || + args.field.options?.["(gogoproto.customtype)"] == + "cosmossdk.io/math.LegacyDec"; + + if (isCosmosSDKDec) { + args.context.addUtil("padDecimal"); + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + t.callExpression(t.identifier("padDecimal"), [ + memberExpressionOrIdentifier(args.scope), + ]) + ); + } } - if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { - return shorthandProperty(args.field.name); + if ( + args.field.name === args.context.aminoCaseField(args.field) && + args.scope.length === 1 + ) { + return shorthandProperty(args.field.name); } - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), memberExpressionOrIdentifier(args.scope)) + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + memberExpressionOrIdentifier(args.scope) + ); }, stringArray(args: ToAminoParseField) { - const useCosmosSDKDec = args.context.pluginValue('aminoEncoding.customTypes.useCosmosSDKDec'); + const useCosmosSDKDec = args.context.pluginValue( + "aminoEncoding.customTypes.useCosmosSDKDec" + ); - if(useCosmosSDKDec){ - const isCosmosSDKDec = - (args.field.options?.['(gogoproto.customtype)'] == - 'github.com/cosmos/cosmos-sdk/types.Dec') || - (args.field.options?.['(gogoproto.customtype)'] == - 'cosmossdk.io/math.LegacyDec'); + if (useCosmosSDKDec) { + const isCosmosSDKDec = + args.field.options?.["(gogoproto.customtype)"] == + "github.com/cosmos/cosmos-sdk/types.Dec" || + args.field.options?.["(gogoproto.customtype)"] == + "cosmossdk.io/math.LegacyDec"; - if (isCosmosSDKDec) { - return toAmino.scalarArray(args, arrayTypes.stringDec) + if (isCosmosSDKDec) { + return toAmino.scalarArray(args, arrayTypes.stringDec); + } } - } - if (args.field.name === args.context.aminoCaseField(args.field) && args.scope.length === 1) { - return shorthandProperty(args.field.name); - } + if ( + args.field.name === args.context.aminoCaseField(args.field) && + args.scope.length === 1 + ) { + return shorthandProperty(args.field.name); + } - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), memberExpressionOrIdentifier(args.scope)) + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + memberExpressionOrIdentifier(args.scope) + ); }, rawBytes(args: ToAminoParseField) { - args.context.addUtil('fromUtf8'); + args.context.addUtil("fromUtf8"); return t.objectProperty( t.identifier(args.context.aminoCaseField(args.field)), t.callExpression( - t.memberExpression( - t.identifier('JSON'), - t.identifier('parse') - ), + t.memberExpression(t.identifier("JSON"), t.identifier("parse")), [ - t.callExpression( - t.identifier('fromUtf8'), - [ - memberExpressionOrIdentifier(args.scope) - ] - ) + t.callExpression(t.identifier("fromUtf8"), [ + memberExpressionOrIdentifier(args.scope), + ]), ] ) - ); }, wasmByteCode(args: ToAminoParseField) { - args.context.addUtil('toBase64'); + args.context.addUtil("toBase64"); return t.objectProperty( t.identifier(args.context.aminoCaseField(args.field)), - t.callExpression( - t.identifier('toBase64'), - [ - memberExpressionOrIdentifier(args.scope) - ] - ) - + t.callExpression(t.identifier("toBase64"), [ + memberExpressionOrIdentifier(args.scope), + ]) ); }, duration(args: ToAminoParseField) { - const durationFormat = args.context.pluginValue('prototypes.typingsFormat.duration'); - const updatedDuration = args.context.pluginValue('prototypes.typingsFormat.updatedDuration'); + const durationFormat = args.context.pluginValue( + "prototypes.typingsFormat.duration" + ); + const updatedDuration = args.context.pluginValue( + "prototypes.typingsFormat.updatedDuration" + ); switch (durationFormat) { - case 'duration': + case "duration": if (updatedDuration) { return toAmino.durationType(args); } - case 'string': + case "string": default: return toAmino.durationString(args); } @@ -138,33 +180,33 @@ export const toAmino = { // (duration * 1_000_000_000).toString(), durationString(args: ToAminoParseField) { const exp = t.binaryExpression( - '*', + "*", memberExpressionOrIdentifier(args.scope), BILLION ); exp.extra = { parenthesized: true }; const value = t.callExpression( - t.memberExpression( - exp, - t.identifier('toString') - ), + t.memberExpression(exp, t.identifier("toString")), [] - ) - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), value); + ); + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + value + ); }, // (duration.seconds.toInt() * 1_000_000_000).toString(), // what about nanos? durationType(args: ToAminoParseField) { const exp = t.binaryExpression( - '*', + "*", t.callExpression( t.memberExpression( t.memberExpression( memberExpressionOrIdentifier(args.scope), - t.identifier('seconds') + t.identifier("seconds") ), - t.identifier('toInt') + t.identifier("toInt") ), [] ), @@ -172,70 +214,57 @@ export const toAmino = { ); exp.extra = { parenthesized: true }; const value = t.callExpression( - t.memberExpression( - exp, - t.identifier('toString') - ), + t.memberExpression(exp, t.identifier("toString")), [] - ) + ); return t.objectProperty( - t.identifier( - args.context.aminoCaseField(args.field) - ), + t.identifier(args.context.aminoCaseField(args.field)), value ); }, height(args: ToAminoParseField) { - args.context.addUtil('omitDefault'); + args.context.addUtil("omitDefault"); - const value = t.objectExpression( - [ - t.objectProperty( - t.identifier(args.context.aminoCasingFn('revision_height')), - t.optionalCallExpression( - t.optionalMemberExpression( - t.callExpression( - t.identifier('omitDefault'), - [ - t.memberExpression( - memberExpressionOrIdentifier(args.scope), - t.identifier('revisionHeight') - ) - ] + const value = t.objectExpression([ + t.objectProperty( + t.identifier(args.context.aminoCasingFn("revision_height")), + t.optionalCallExpression( + t.optionalMemberExpression( + t.callExpression(t.identifier("omitDefault"), [ + t.memberExpression( + memberExpressionOrIdentifier(args.scope), + t.identifier("revisionHeight") ), - t.identifier('toString'), - false, - true - ), - [], - false - ) - ), - // - t.objectProperty( - t.identifier(args.context.aminoCasingFn('revision_number')), - t.optionalCallExpression( - t.optionalMemberExpression( - t.callExpression( - t.identifier('omitDefault'), - [ - t.memberExpression( - memberExpressionOrIdentifier(args.scope), - t.identifier('revisionNumber') - ) - ] + ]), + t.identifier("toString"), + false, + true + ), + [], + false + ) + ), + // + t.objectProperty( + t.identifier(args.context.aminoCasingFn("revision_number")), + t.optionalCallExpression( + t.optionalMemberExpression( + t.callExpression(t.identifier("omitDefault"), [ + t.memberExpression( + memberExpressionOrIdentifier(args.scope), + t.identifier("revisionNumber") ), - t.identifier('toString'), - false, - true - ), - [], - false - ) + ]), + t.identifier("toString"), + false, + true + ), + [], + false ) - ] - ); + ), + ]); const cond = t.conditionalExpression( memberExpressionOrIdentifier(args.scope), @@ -243,61 +272,72 @@ export const toAmino = { t.objectExpression([]) ); - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), cond); + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + cond + ); }, coinAmount(args: ToAminoParseField) { const longType = TypeLong.getType(args.context); switch (longType) { - case 'BigInt': + case "BigInt": return t.memberExpression( memberExpressionOrIdentifier(args.scope), - t.identifier('amount') - ) - case 'Long': + t.identifier("amount") + ); + case "Long": default: TypeLong.addUtil(args.context); return t.callExpression( t.memberExpression( - t.callExpression( - TypeLong.getFromValue(args.context), - [ - t.memberExpression( - memberExpressionOrIdentifier(args.scope), - t.identifier('amount') - ) - ] - ), - t.identifier('toString') + t.callExpression(TypeLong.getFromValue(args.context), [ + t.memberExpression( + memberExpressionOrIdentifier(args.scope), + t.identifier("amount") + ), + ]), + t.identifier("toString") ), [] - ) + ); } }, coin(args: ToAminoParseField) { const value = t.objectExpression([ - t.objectProperty(t.identifier('denom'), t.memberExpression( - memberExpressionOrIdentifier(args.scope), - t.identifier('denom'), - )), t.objectProperty( - t.identifier('amount'), - toAmino.coinAmount(args) - ) + t.identifier("denom"), + t.memberExpression( + memberExpressionOrIdentifier(args.scope), + t.identifier("denom") + ) + ), + t.objectProperty(t.identifier("amount"), toAmino.coinAmount(args)), ]); - return t.objectProperty(t.identifier(args.context.aminoCaseField(args.field)), value); + return t.objectProperty( + t.identifier(args.context.aminoCaseField(args.field)), + value + ); }, - type({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: ToAminoParseField) { + type({ + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: ToAminoParseField) { /// TODO (can this be refactored out? e.g. no recursive calls in this file?) /// BEGIN const Type = context.getTypeFromCurrentPath(field, currentProtoPath); const parentField = field; const oneOfs = getOneOfs(Type); - const properties = protoFieldsToArray(Type).map(field => { + const properties = protoFieldsToArray(Type).map((field) => { const isOneOf = oneOfs.includes(field.name); const isOptional = getFieldOptionality(context, field, isOneOf); @@ -309,39 +349,46 @@ export const toAmino = { scope: [...scope], fieldPath: [...fieldPath], nested, - isOptional // TODO how to handle nested optionality - }) + isOptional, // TODO how to handle nested optionality + }); }); /// END - return t.objectProperty(t.identifier(context.aminoCaseField(field)), - t.objectExpression( - properties - ) + return t.objectProperty( + t.identifier(context.aminoCaseField(field)), + t.objectExpression(properties) ); }, - typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: ToAminoParseField) { + typeArray({ + context, + field, + currentProtoPath, + scope, + fieldPath, + nested, + isOptional, + }: ToAminoParseField) { ////// - const variable = 'el' + nested; + const variable = "el" + nested; const f = JSON.parse(JSON.stringify(field)); // clone const varProto: ProtoField = { - ...f + ...f, }; varProto.name = variable; - varProto.options['(telescope:orig)'] = variable; - varProto.options['(telescope:name)'] = variable; - varProto.options['(telescope:camel)'] = variable; + varProto.options["(telescope:orig)"] = variable; + varProto.options["(telescope:name)"] = variable; + varProto.options["(telescope:camel)"] = variable; ////// - if (field.parsedType.type !== 'Type') { - throw new Error('Arrays only support types[Type] right now.'); + if (field.parsedType.type !== "Type") { + throw new Error("Arrays only support types[Type] right now."); } const Type = context.getTypeFromCurrentPath(field, currentProtoPath); const parentField = field; const oneOfs = getOneOfs(Type); - const properties = protoFieldsToArray(Type).map(field => { + const properties = protoFieldsToArray(Type).map((field) => { const isOneOf = oneOfs.includes(field.name); const isOptional = getFieldOptionality(context, field, isOneOf); @@ -354,98 +401,103 @@ export const toAmino = { scope: [variable], fieldPath: [varProto], nested: nested + 1, - isOptional // TODO how to handle nested optionality + isOptional, // TODO how to handle nested optionality }); }); - const expr = t.callExpression( t.memberExpression( memberExpressionOrIdentifier(scope), - t.identifier('map') + t.identifier("map") ), [ t.arrowFunctionExpression( - [ - t.identifier(variable) - ], - t.objectExpression( - properties - ) - ) + [t.identifier(variable)], + t.objectExpression(properties) + ), ] ); - return t.objectProperty(t.identifier(context.aminoCaseField(field)), + return t.objectProperty( + t.identifier(context.aminoCaseField(field)), expr ); }, - scalarArray({ context, field, currentProtoPath, scope, nested, isOptional }: ToAminoParseField, arrayTypeAstFunc: Function) { - const variable = 'el' + nested; + scalarArray( + { + context, + field, + currentProtoPath, + scope, + nested, + isOptional, + }: ToAminoParseField, + arrayTypeAstFunc: Function + ) { + const variable = "el" + nested; const expr = t.callExpression( t.memberExpression( memberExpressionOrIdentifier(scope), - t.identifier('map') + t.identifier("map") ), [ t.arrowFunctionExpression( - [ - t.identifier(variable) - ], - arrayTypeAstFunc(variable, { context, field, currentProtoPath, scope, nested, isOptional }) - ) + [t.identifier(variable)], + arrayTypeAstFunc(variable, { + context, + field, + currentProtoPath, + scope, + nested, + isOptional, + }) + ), ] ); - return t.objectProperty(t.identifier(context.aminoCaseField(field)), + return t.objectProperty( + t.identifier(context.aminoCaseField(field)), expr ); }, pubkey(args: ToAminoParseField) { - args.context.addUtil('decodePubkey'); + args.context.addUtil("decodePubkey"); return t.objectProperty( t.identifier(args.field.name), t.tsNonNullExpression( - t.callExpression( - t.identifier('decodePubkey'), - [ - t.identifier(args.field.name) - ] - ) - ), - ) - + t.callExpression(t.identifier("decodePubkey"), [ + t.identifier(args.field.name), + ]) + ) + ); }, omitDefaultMemberExpressionOrIdentifier(args: ToAminoParseField, names) { - args.context.addUtil('omitDefault'); - return t.callExpression( - t.identifier('omitDefault'), - [ - memberExpressionOrIdentifier(names) - ] - ); + args.context.addUtil("omitDefault"); + return t.callExpression(t.identifier("omitDefault"), [ + memberExpressionOrIdentifier(names), + ]); }, }; export const arrayTypes = { long(varname: string) { return t.callExpression( - t.memberExpression(memberExpressionOrIdentifier([varname]), t.identifier('toString')), + t.memberExpression( + memberExpressionOrIdentifier([varname]), + t.identifier("toString") + ), [] - ) + ); }, stringDec(varname: string, args: ToAminoParseField) { - args.context.addUtil('padDecimal'); - return t.callExpression( - t.identifier('padDecimal'), - [ - memberExpressionOrIdentifier([varname]) - ] - ) - } -} + args.context.addUtil("padDecimal"); + return t.callExpression(t.identifier("padDecimal"), [ + memberExpressionOrIdentifier([varname]), + ]); + }, +}; diff --git a/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts b/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts index 680d7c2645..0d254f13b7 100644 --- a/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts +++ b/packages/ast/types/encoding/amino/to-amino-json/utils.d.ts @@ -1,5 +1,5 @@ -import * as t from '@babel/types'; -import { ToAminoParseField } from './index'; +import * as t from "@babel/types"; +import { ToAminoParseField } from "./index"; export declare const toAmino: { defaultType(args: ToAminoParseField, omitEmpty?: boolean): t.ObjectProperty; long(args: ToAminoParseField, omitEmpty?: boolean): t.ObjectProperty; @@ -13,9 +13,9 @@ export declare const toAmino: { height(args: ToAminoParseField): t.ObjectProperty; coinAmount(args: ToAminoParseField): t.CallExpression | t.MemberExpression; coin(args: ToAminoParseField): t.ObjectProperty; - type({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: ToAminoParseField): any; - typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional }: ToAminoParseField): t.ObjectProperty; - scalarArray({ context, field, currentProtoPath, scope, nested, isOptional }: ToAminoParseField, arrayTypeAstFunc: Function): t.ObjectProperty; + type({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: ToAminoParseField): any; + typeArray({ context, field, currentProtoPath, scope, fieldPath, nested, isOptional, }: ToAminoParseField): t.ObjectProperty; + scalarArray({ context, field, currentProtoPath, scope, nested, isOptional, }: ToAminoParseField, arrayTypeAstFunc: Function): t.ObjectProperty; pubkey(args: ToAminoParseField): t.ObjectProperty; omitDefaultMemberExpressionOrIdentifier(args: ToAminoParseField, names: any): t.CallExpression; }; From 00079bb25de726165dc280cd4547896e7677f12c Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 18 Mar 2024 22:47:08 +0800 Subject: [PATCH 23/24] README --- README.md | 3 +++ packages/telescope/README.md | 3 +++ 2 files changed, 6 insertions(+) diff --git a/README.md b/README.md index 9c681236dc..29e155cbfe 100644 --- a/README.md +++ b/README.md @@ -262,12 +262,15 @@ telescope({ | option | description | defaults | | ------------------------------ | -------------------------------------------------------------- | ---------- | | `aminoEncoding.enabled` | generate amino types and amino converters | `true` | +| `aminoEncoding.omitEmptyTags` | An array of strings that determines whether a field should be omitted when serialized to JSON. If the array includes "omitempty", any field with the "omitempty" option in either gogoproto.jsontag or cosmos_proto.json_tag will be omitted. If the array includes "dont_omitempty", the field will be omitted or not based on the value of "(amino.dont_omitempty)": if it's null or false, the field will be omitted; if it's true, the field will not be omitted. | `["omitempty", "dont_omitempty"]` | | `aminoEncoding.disableMsgTypes` | disable generating AminoMsg types | `false` | | `aminoEncoding.casingFn` | set the amino-casing function for a project | `snake()` | | `aminoEncoding.exceptions` | set specific aminoType name exceptions | see code | | `aminoEncoding.typeUrlToAmino` | create functions for aminoType name exceptions | `undefined`| | `aminoEncoding.useLegacyInlineEncoding` | @deprecated. To use legacy inline encoding instead of using v2 recursive encoding | `false`| | `aminoEncoding.useRecursiveV2encoding` | this's been removed. See useLegacyInlineEncoding instead. | | +| `aminoEncoding.legacy.useNullHandling` | handle null case when generating legacy amino converters(those in tx.amino.ts) | | +| `aminoEncoding.legacy.useOmitEmpty` | handle omit empty or not when generating legacy amino converters(those in tx.amino.ts) | | ### Implemented Interface Options diff --git a/packages/telescope/README.md b/packages/telescope/README.md index 9c681236dc..29e155cbfe 100644 --- a/packages/telescope/README.md +++ b/packages/telescope/README.md @@ -262,12 +262,15 @@ telescope({ | option | description | defaults | | ------------------------------ | -------------------------------------------------------------- | ---------- | | `aminoEncoding.enabled` | generate amino types and amino converters | `true` | +| `aminoEncoding.omitEmptyTags` | An array of strings that determines whether a field should be omitted when serialized to JSON. If the array includes "omitempty", any field with the "omitempty" option in either gogoproto.jsontag or cosmos_proto.json_tag will be omitted. If the array includes "dont_omitempty", the field will be omitted or not based on the value of "(amino.dont_omitempty)": if it's null or false, the field will be omitted; if it's true, the field will not be omitted. | `["omitempty", "dont_omitempty"]` | | `aminoEncoding.disableMsgTypes` | disable generating AminoMsg types | `false` | | `aminoEncoding.casingFn` | set the amino-casing function for a project | `snake()` | | `aminoEncoding.exceptions` | set specific aminoType name exceptions | see code | | `aminoEncoding.typeUrlToAmino` | create functions for aminoType name exceptions | `undefined`| | `aminoEncoding.useLegacyInlineEncoding` | @deprecated. To use legacy inline encoding instead of using v2 recursive encoding | `false`| | `aminoEncoding.useRecursiveV2encoding` | this's been removed. See useLegacyInlineEncoding instead. | | +| `aminoEncoding.legacy.useNullHandling` | handle null case when generating legacy amino converters(those in tx.amino.ts) | | +| `aminoEncoding.legacy.useOmitEmpty` | handle omit empty or not when generating legacy amino converters(those in tx.amino.ts) | | ### Implemented Interface Options From 8cc9e2062d2f3227a9247cb26257c54e039d7047 Mon Sep 17 00:00:00 2001 From: Zetazzz Date: Mon, 18 Mar 2024 22:58:38 +0800 Subject: [PATCH 24/24] update snap --- .../__snapshots__/encode.test.ts.snap | 2 +- .../authz.timestamp.test.ts.snap | 4 +-- .../__snapshots__/cosmwasm.test.ts.snap | 4 +-- .../__snapshots__/tendermint.test.ts.snap | 36 +++++++++---------- .../amino-converter.spec.ts.snap | 16 ++++----- .../__tests__/__snapshots__/vote.test.ts.snap | 8 ++--- 6 files changed, 35 insertions(+), 35 deletions(-) diff --git a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap index ce0fa39054..d86103adce 100644 --- a/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap +++ b/packages/ast/src/encoding/__snapshots__/encode.test.ts.snap @@ -10,7 +10,7 @@ exports[`cosmology/example/msg AminoConverter 1`] = ` }: MsgDoFunThing): MsgDoFunThingAminoType["value"] => { return { address, - myEnumField: myEnumField + myEnumField }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap index dc1f895470..4d7e8f1642 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/authz.timestamp.test.ts.snap @@ -144,7 +144,7 @@ exports[`cosmos/authz/v1beta1/authz date 4`] = ` type_url: authorization.typeUrl, value: authorization.value }, - expiration: expiration + expiration }; }, fromAmino: ({ @@ -307,7 +307,7 @@ exports[`cosmos/authz/v1beta1/authz timestamp 4`] = ` type_url: authorization.typeUrl, value: authorization.value }, - expiration: expiration + expiration }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap index a49373ad79..4e411bd7a1 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/cosmwasm.test.ts.snap @@ -55,7 +55,7 @@ exports[`cosmwasm/wasm/v1/tx MsgInstantiateContract 1`] = ` return { sender, admin, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId.toString(), label, msg: JSON.parse(fromUtf8(msg)), funds: funds.map(el0 => ({ @@ -101,7 +101,7 @@ exports[`cosmwasm/wasm/v1/tx MsgMigrateContract 1`] = ` return { sender, contract, - code_id: omitDefault(codeId)?.toString?.(), + code_id: codeId.toString(), msg: JSON.parse(fromUtf8(msg)) }; }, diff --git a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap index 96760da820..63192d76a7 100644 --- a/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap +++ b/packages/ast/src/encoding/__tests__/__snapshots__/tendermint.test.ts.snap @@ -372,8 +372,8 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` return { chain_id: chainId, trust_level: { - numerator: omitDefault(trustLevel.numerator)?.toString?.(), - denominator: omitDefault(trustLevel.denominator)?.toString?.() + numerator: trustLevel.numerator.toString(), + denominator: trustLevel.denominator.toString() }, trusting_period: (trustingPeriod * 1_000_000_000).toString(), unbonding_period: (unbondingPeriod * 1_000_000_000).toString(), @@ -396,18 +396,18 @@ exports[`ibc/lightclients/tendermint/v1/tendermint duration 4`] = ` }, inner_spec: { child_order: el0.innerSpec.childOrder, - child_size: omitDefault(el0.innerSpec.childSize), - min_prefix_length: omitDefault(el0.innerSpec.minPrefixLength), - max_prefix_length: omitDefault(el0.innerSpec.maxPrefixLength), + child_size: el0.innerSpec.childSize, + min_prefix_length: el0.innerSpec.minPrefixLength, + max_prefix_length: el0.innerSpec.maxPrefixLength, empty_child: el0.innerSpec.emptyChild, hash: el0.innerSpec.hash }, - max_depth: omitDefault(el0.maxDepth), - min_depth: omitDefault(el0.minDepth) + max_depth: el0.maxDepth, + min_depth: el0.minDepth })), upgrade_path: upgradePath, - allow_update_after_expiry: omitDefault(allowUpdateAfterExpiry), - allow_update_after_misbehaviour: omitDefault(allowUpdateAfterMisbehaviour) + allow_update_after_expiry: allowUpdateAfterExpiry, + allow_update_after_misbehaviour: allowUpdateAfterMisbehaviour }; }, fromAmino: ({ @@ -840,8 +840,8 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` return { chain_id: chainId, trust_level: { - numerator: omitDefault(trustLevel.numerator)?.toString?.(), - denominator: omitDefault(trustLevel.denominator)?.toString?.() + numerator: trustLevel.numerator.toString(), + denominator: trustLevel.denominator.toString() }, trusting_period: (trustingPeriod * 1_000_000_000).toString(), unbonding_period: (unbondingPeriod * 1_000_000_000).toString(), @@ -864,18 +864,18 @@ exports[`ibc/lightclients/tendermint/v1/tendermint string 4`] = ` }, inner_spec: { child_order: el0.innerSpec.childOrder, - child_size: omitDefault(el0.innerSpec.childSize), - min_prefix_length: omitDefault(el0.innerSpec.minPrefixLength), - max_prefix_length: omitDefault(el0.innerSpec.maxPrefixLength), + child_size: el0.innerSpec.childSize, + min_prefix_length: el0.innerSpec.minPrefixLength, + max_prefix_length: el0.innerSpec.maxPrefixLength, empty_child: el0.innerSpec.emptyChild, hash: el0.innerSpec.hash }, - max_depth: omitDefault(el0.maxDepth), - min_depth: omitDefault(el0.minDepth) + max_depth: el0.maxDepth, + min_depth: el0.minDepth })), upgrade_path: upgradePath, - allow_update_after_expiry: omitDefault(allowUpdateAfterExpiry), - allow_update_after_misbehaviour: omitDefault(allowUpdateAfterMisbehaviour) + allow_update_after_expiry: allowUpdateAfterExpiry, + allow_update_after_misbehaviour: allowUpdateAfterMisbehaviour }; }, fromAmino: ({ diff --git a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap index 880edeb553..adbf9754be 100644 --- a/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__snapshots__/amino-converter.spec.ts.snap @@ -512,7 +512,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinPool): MsgJoinPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId.toString(), share_out_amount: shareOutAmount, token_in_maxs: tokenInMaxs.map(el0 => ({ denom: el0.denom, @@ -547,7 +547,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitPool): MsgExitPoolAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId.toString(), share_in_amount: shareInAmount, token_out_mins: tokenOutMins.map(el0 => ({ denom: el0.denom, @@ -583,7 +583,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId.toString(), token_out_denom: el0.tokenOutDenom })), token_in: { @@ -624,7 +624,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` return { sender, routes: routes.map(el0 => ({ - pool_id: omitDefault(el0.poolId)?.toString?.(), + pool_id: el0.poolId.toString(), token_in_denom: el0.tokenInDenom })), token_in_max_amount: tokenInMaxAmount, @@ -664,7 +664,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinSwapExternAmountIn): MsgJoinSwapExternAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId.toString(), token_in: { denom: tokenIn.denom, amount: tokenIn.amount @@ -700,7 +700,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgJoinSwapShareAmountOut): MsgJoinSwapShareAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId.toString(), token_in_denom: tokenInDenom, share_out_amount: shareOutAmount, token_in_max_amount: tokenInMaxAmount @@ -733,7 +733,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitSwapShareAmountIn): MsgExitSwapShareAmountInAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId.toString(), token_out_denom: tokenOutDenom, share_in_amount: shareInAmount, token_out_min_amount: tokenOutMinAmount @@ -765,7 +765,7 @@ exports[`osmosis/gamm/v1beta1/tx AminoConverter 1`] = ` }: MsgExitSwapExternAmountOut): MsgExitSwapExternAmountOutAminoType["value"] => { return { sender, - pool_id: omitDefault(poolId)?.toString?.(), + pool_id: poolId.toString(), token_out: { denom: tokenOut.denom, amount: tokenOut.amount diff --git a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap index 31fab0b293..6f7e5ae6b7 100644 --- a/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap +++ b/packages/ast/src/encoding/amino/converter/__tests__/__snapshots__/vote.test.ts.snap @@ -47,9 +47,9 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` option }: MsgVote): MsgVoteAminoType["value"] => { return { - proposal_id: omitDefault(proposalId)?.toString?.(), + proposal_id: proposalId.toString(), voter, - option: option + option }; }, fromAmino: ({ @@ -72,7 +72,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` options }: MsgVoteWeighted): MsgVoteWeightedAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), voter, options: options.map(el0 => ({ option: el0.option, @@ -103,7 +103,7 @@ exports[`cosmos/gov/v1beta1/tx AminoConverter 1`] = ` amount }: MsgDeposit): MsgDepositAminoType["value"] => { return { - proposal_id: proposalId?.toString?.(), + proposal_id: proposalId.toString(), depositor, amount: amount.map(el0 => ({ denom: el0.denom,